Start of major lore library rewrite. This will take a long time, so have patience.

Additional fixups and changes to the Demolitionist Menu:
 - Fixed incorrectly scaled scrollbar click/drag on the lore library.
 - Hide mp-only tabs during singleplayer.
 - Don't list the "SWWMGesture" weapon in the inventory.
 - If the current active tab is the library, the secondary tab will also be remembered after closing and reopening.
This commit is contained in:
Mari the Deer 2020-04-30 01:42:43 +02:00
commit a720af969f
28 changed files with 535 additions and 231 deletions

View file

@ -42,6 +42,7 @@ Class Wallbuster : SWWMWeapon
Weapon.SlotNumber 4;
Weapon.SelectionOrder 2200;
Stamina 35000;
+WEAPON.NO_AUTO_SWITCH;
}
States
{

View file

@ -375,18 +375,34 @@ Class SWWMLoreLibrary : Thinker
bool DirectAdd( String ref )
{
// restrictions
if ( !(gameinfo.gametype&GAME_Hexen) )
if ( !(gameinfo.gametype&(GAME_Raven|GAME_Strife)) )
{
if ( ref ~== "Parthoris" ) return true;
if ( ref ~== "Sidhe" ) return true;
if ( ref ~== "SerpentRiders" ) return true;
}
if ( !(gameinfo.gametype&(GAME_Hexen|GAME_Strife)) )
{
if ( ref ~== "Cronos" ) return true;
if ( ref ~== "Kirin" ) return true; // not met
}
if ( !(gameinfo.gametype&GAME_Strife) )
{
if ( ref ~== "TheOrder" ) return true;
if ( ref ~== "TheFront" ) return true;
}
ref = ref.MakeUpper();
String tag = String.Format("SWWM_LORETAG_%s",ref);
String tab = String.Format("SWWM_LORETAB_%s",ref);
String text = String.Format("SWWM_LORETXT_%s",ref);
String assoc = String.Format("SWWM_LOREREL_%s",ref);
// redirects
if ( gameinfo.gametype&GAME_Raven )
if ( gameinfo.gametype&(GAME_Raven|GAME_Strife) )
{
if ( text ~== "SWWM_LORETXT_AKARILABS" )
text = "SWWM_LORETXT_AKARILABS2"; // demo won, akari project announced
if ( text ~== "SWWM_LORETXT_DEMOLITIONIST" )
text = "SWWM_LORETXT_DEMOLITIONIST2"; // demo rewarded with maidbot frame
if ( text ~== "SWWM_LORETXT_UAC" )
text = "SWWM_LORETXT_UAC2"; // uac "reformed"
else if ( text ~== "SWWM_LORETXT_HELL" )
@ -395,14 +411,21 @@ Class SWWMLoreLibrary : Thinker
text = "SWWM_LORETXT_NANA2"; // demo met nana
else if ( text ~== "SWWM_LORETXT_ZANAVETH3" )
text = "SWWM_LORETXT_ZANAVETH32"; // iagb happened
if ( text ~== "SWWM_LORETXT_BIGSHOT" )
text = "SWWM_LORETXT_BIGSHOT2"; // predictions about crimes_m
}
if ( gameinfo.gametype&GAME_Hexen )
if ( gameinfo.gametype&(GAME_Hexen|GAME_Strife) )
{
if ( text ~== "SWWM_LORETXT_SAYA" )
text = "SWWM_LORETXT_SAYA2"; // married kirin
else if ( text ~== "SWWM_LORETXT_ANARUKON" )
text = "SWWM_LORETXT_ANARUKON2"; // comments from miyamoto-xanai wedding
}
if ( gameinfo.gametype&GAME_Strife )
{
if ( text ~== "SWWM_LORETXT_BIGSHOT2" )
text = "SWWM_LORETXT_BIGSHOT3"; // crimes_m happened
}
// check that it's valid
if ( StringTable.Localize(tag,false) == tag ) return false;
if ( StringTable.Localize(tab,false) == tab ) return false;
@ -1669,7 +1692,7 @@ Class SWWMHandler : EventHandler
int lastitemcount[MAXPLAYERS];
bool allkills, allitems, allsecrets;
// for money cheat
transient ui int kcode;
transient ui int kcode, lcode;
// heal/armor flashes need to be handled here so they don't stack
transient int hflash[MAXPLAYERS], aflash[MAXPLAYERS];
@ -1932,14 +1955,19 @@ Class SWWMHandler : EventHandler
l.DirectAdd("KnowledgeBase");
l.DirectAdd("Saya");
l.DirectAdd("UAC");
if ( gameinfo.gametype&GAME_Raven )
if ( gameinfo.gametype&(GAME_Raven|GAME_Strife) )
{
l.DirectAdd("Parthoris");
l.DirectAdd("SerpentRiders");
l.DirectAdd("Sidhe");
}
if ( gameinfo.gametype&GAME_Hexen )
if ( gameinfo.gametype&(GAME_Hexen|GAME_Strife) )
l.DirectAdd("Cronos");
if ( gameinfo.gametype&GAME_Strife )
{
l.DirectAdd("TheOrder");
l.DirectAdd("TheFront");
}
SWWMStats s = SWWMStats.Find(p);
if ( !s )
{
@ -2357,7 +2385,7 @@ Class SWWMHandler : EventHandler
override bool InputProcess( InputEvent e )
{
if ( e.Type == InputEvent.TYPE_KeyDown ) // assuming that's the F key on all keyboards (hopefully)
if ( e.Type == InputEvent.TYPE_KeyDown )
{
static const int lods[] = {38,24,32,31,24,33,18,50,24,49,18};
// what's that spell?
@ -2372,7 +2400,19 @@ Class SWWMHandler : EventHandler
}
}
else kcode = 0;
if ( e.KeyScan == 33 )
static const int deep[] = {32,18,18,25,38,24,19,18};
// the deepest lore
if ( e.KeyScan == deep[lcode] )
{
lcode++;
if ( lcode >= 8 )
{
SendNetworkEvent("swwmlorecheat",consoleplayer);
lcode = 0;
}
}
else lcode = 0;
if ( e.KeyScan == 33 ) // assuming that's the F key on all keyboards (hopefully)
{
let demo = Demolitionist(players[consoleplayer].mo);
if ( demo && (demo.Health <= 0) && (demo.deadtimer > 40) )
@ -2795,6 +2835,18 @@ Class SWWMHandler : EventHandler
SWWMCredits.Give(players[e.Args[0]],999999999);
SWWMScoreObj.Spawn(999999999,players[e.Args[0]].mo.Vec3Offset(0,0,players[e.Args[0]].mo.Height/2));
}
else if ( e.Name ~== "swwmlorecheat" )
{
// look up all lore files
for ( int l=0; l<Wads.GetNumLumps(); l++ )
{
String fn = Wads.GetLumpFullName(l);
if ( fn.Left(13) != "lore/default/" ) continue;
int ext = fn.IndexOf(".txt");
if ( ext != fn.Length()-4 ) continue;
SWWMLoreLibrary.Add(players[e.Args[0]],fn.Mid(13,ext-13));
}
}
}
// stuff for hud
@ -3016,6 +3068,7 @@ Class SWWMBrutalHandler : StaticEventHandler
detected = true;
break;
}
SetRandomSeed[bdscreen](Random[bdscreen]()+consoleplayer+MSTime());
}
override void UiTick()
@ -3075,6 +3128,7 @@ Class SWWMHDoomHandler : StaticEventHandler
detected = true;
break;
}
SetRandomSeed[hdscreen](Random[hdscreen]()+consoleplayer+MSTime());
}
override void UiTick()

View file

@ -35,6 +35,7 @@ Class Ynykron : SWWMWeapon
Weapon.AmmoGive1 1;
+SWWMWEAPON.NOFIRSTGIVE;
Ynykron.ClipCount 1;
+WEAPON.NO_AUTO_SWITCH;
}
States
{

View file

@ -91,7 +91,9 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
LoreSeparator = TexMan.CheckForTexture("graphics/KBase/LibraryTabSeparator.png",TexMan.Type_MiscPatch);
LoreSeparatorW = TexMan.CheckForTexture("graphics/KBase/LibraryTabSeparatorJP.png",TexMan.Type_MiscPatch);
curtab = CVar.GetCVar('swwm_lasttab',players[consoleplayer]).GetInt();
if ( (curtab < 0) || (curtab > 7) ) curtab = 0;
int maxtab = multiplayer?TAB_CHAT:TAB_STORE;
if ( (curtab < TAB_MISSION) || (curtab > maxtab) ) curtab = TAB_MISSION;
if ( curtab == TAB_LIBRARY ) sel1 = CVar.GetCVar('swwm_lastloretab',players[consoleplayer]).GetInt();
MenuSound("menu/demoopen");
[ikey[0], ikey[1]] = Bindings.GetKeysForCommand("openmenu SWWMKnowledgeBaseMenu");
mkey[0] = Bindings.NameKeys(ikey[0],0);
@ -253,6 +255,7 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
kcode = 0;
break;
}
int maxtab = multiplayer?TAB_CHAT:TAB_STORE;
switch ( mkey )
{
case MKEY_BACK:
@ -261,7 +264,7 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
return true;
case MKEY_PAGEUP:
MenuSound("menu/demotab");
if ( (curtab <= 0) || (curtab > 7) ) curtab = 7;
if ( (curtab <= TAB_MISSION) || (curtab > maxtab) ) curtab = maxtab;
else curtab--;
CVar.GetCVar('swwm_lasttab',players[consoleplayer]).SetInt(curtab);
sel0 = sel1 = sel2 = 0;
@ -275,8 +278,8 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
return true;
case MKEY_PAGEDOWN:
MenuSound("menu/demotab");
if ( curtab < 7 ) curtab++;
else curtab = 0;
if ( curtab < maxtab ) curtab++;
else curtab = TAB_MISSION;
CVar.GetCVar('swwm_lasttab',players[consoleplayer]).SetInt(curtab);
sel0 = sel1 = sel2 = 0;
ofs0 = ofs1 = ofs2 = 0;
@ -291,6 +294,7 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
if ( curtab == TAB_HELP )
{
String str = StringTable.Localize("$SWWM_HELPTXT");
if ( multiplayer ) str = str..StringTable.Localize("$SWWM_HELPTXT_MP");
BrokenLines l = fnt.BreakLines(str,629);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,620);
if ( (l.Count() > 28) && (sel0 < l.Count()-28) )
@ -467,6 +471,7 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
sub = false;
ofs1 = ++sel1;
if ( sel1 > LORE_LORE ) ofs1 = sel1 = LORE_ITEM;
CVar.GetCVar('swwm_lastloretab',players[consoleplayer]).SetInt(sel1);
}
else if ( (curtab == TAB_TRADING) && !sub && (playerlist.Size() > 21) ) // lol is this ever going to happen
{
@ -494,6 +499,7 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
sub = false;
ofs1 = --sel1;
if ( sel1 < LORE_ITEM ) ofs1 = sel1 = LORE_LORE;
CVar.GetCVar('swwm_lastloretab',players[consoleplayer]).SetInt(sel1);
}
else if ( (curtab == TAB_TRADING) && !sub && (playerlist.Size() > 21) && (sel0-22 >= 0) ) // lol is this ever going to happen
{
@ -646,11 +652,11 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
static const string tabnames[] =
{
"$SWWM_MISSTAB", "$SWWM_STATTAB", "$SWWM_INVTAB", "$SWWM_KEYTAB",
"$SWWM_KBASETAB", "$SWWM_STORETAB", "$SWWM_TRADETAB", "$SWWM_CHATTAB",
"$SWWM_SECRETTAB", "$SWWM_HELPTAB"
"$SWWM_KBASETAB", "$SWWM_STORETAB", "$SWWM_TRADETAB", "$SWWM_CHATTAB"
};
xx = 0;
for ( int i=0; i<8; i++ )
int maxtab = multiplayer?TAB_CHAT:TAB_STORE;
for ( int i=TAB_MISSION; i<=maxtab; i++ )
{
len = fnt.StringWidth(tabnames[i])+6;
if ( (mpos.x >= xx) && (mpos.x < xx+len) )
@ -1029,8 +1035,10 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
{
// check that scrollbar is present
str = StringTable.Localize(lorelist[sel0].text);
BrokenLines l = fnt.BreakLines(str,int(635-xx));
if ( l.Count() > 28 ) l = fnt.BreakLines(str,int(626-xx));
int ofs = fnt.StringWidth("MMMMMMMMMMMMMMMMMMMM")+12;
if ( lorelist.Size() > 26 ) ofs += 8;
BrokenLines l = fnt.BreakLines(str,635-ofs);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,626-ofs);
else return res; // no scrollbar
// calculate offset
int szr = l.Count()-28;
@ -1265,8 +1273,10 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
{
// check that scrollbar is present
str = StringTable.Localize(lorelist[sel0].text);
BrokenLines l = fnt.BreakLines(str,int(635-xx));
if ( l.Count() > 28 ) l = fnt.BreakLines(str,int(626-xx));
int ofs = fnt.StringWidth("MMMMMMMMMMMMMMMMMMMM")+12;
if ( lorelist.Size() > 26 ) ofs += 8;
BrokenLines l = fnt.BreakLines(str,635-ofs);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,626-ofs);
else return res; // no scrollbar
// calculate offset
int szr = l.Count()-28;
@ -1444,13 +1454,27 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
Close();
return;
}
if ( !multiplayer && ((curtab == TAB_TRADING) || (curtab == TAB_CHAT)) )
{
MenuSound("menu/demotab");
curtab = TAB_MISSION;
CVar.GetCVar('swwm_lasttab',players[consoleplayer]).SetInt(curtab);
sel0 = sel1 = sel2 = 0;
ofs0 = ofs1 = ofs2 = 0;
sub = false;
invlist.Clear();
lorelist.Clear();
storelist.Clear();
storeunits.Clear();
playerlist.Clear();
}
if ( curtab == TAB_INVENTORY )
{
invlist.Clear();
// alphabetically sorted inventory
for ( Inventory inv=players[consoleplayer].mo.Inv; inv; inv=inv.Inv )
{
if ( (inv.Amount <= 0) || !inv.SpawnState.ValidateSpriteFrame() || (inv is 'Key') || (inv is 'BasicArmor') || (inv is 'HexenArmor') || (inv is 'Powerup') || (inv is 'SWWMArmor') || (!(inv is 'Ammo') && !(inv is 'Weapon') && !inv.bINVBAR) && !(inv is 'HammerspaceEmbiggener') && !(inv is 'SWWMCollectable') ) continue;
if ( (inv.Amount <= 0) || !inv.SpawnState.ValidateSpriteFrame() || (inv is 'Key') || (inv is 'BasicArmor') || (inv is 'HexenArmor') || (inv is 'Powerup') || (inv is 'SWWMArmor') || (inv is 'SWWMGesture') || (!(inv is 'Ammo') && !(inv is 'Weapon') && !inv.bINVBAR) && !(inv is 'HammerspaceEmbiggener') && !(inv is 'SWWMCollectable') ) continue;
String tag = inv.GetTag();
bool greater = false;
for ( int i=0; i<invlist.Size(); i++ )
@ -1610,7 +1634,7 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
// alphabetically sorted inventory
for ( Inventory inv=players[consoleplayer].mo.Inv; inv; inv=inv.Inv )
{
if ( (inv.Amount <= 0) || !inv.SpawnState.ValidateSpriteFrame() || (inv is 'Key') || (inv is 'BasicArmor') || (inv is 'HexenArmor') || (inv is 'Powerup') || (inv is 'SWWMArmor') || (!(inv is 'Ammo') && !(inv is 'Weapon') && !inv.bINVBAR) && !(inv is 'HammerspaceEmbiggener') && !(inv is 'SWWMCollectable') ) continue;
if ( (inv.Amount <= 0) || !inv.SpawnState.ValidateSpriteFrame() || (inv is 'Key') || (inv is 'BasicArmor') || (inv is 'HexenArmor') || (inv is 'Powerup') || (inv is 'SWWMArmor') || (inv is 'SWWMGesture') || (!(inv is 'Ammo') && !(inv is 'Weapon') && !inv.bINVBAR) && !(inv is 'HammerspaceEmbiggener') && !(inv is 'SWWMCollectable') ) continue;
String tag = inv.GetTag();
bool greater = false;
for ( int i=0; i<invlist.Size(); i++ )
@ -1816,11 +1840,13 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
{
"$SWWM_LORETAB0", "$SWWM_LORETAB1", "$SWWM_LORETAB2"
};
int mx = (curtab>7)?9:8;
for ( int i=0; i<mx; i++ )
int maxtab = multiplayer?TAB_CHAT:TAB_STORE;
int mx = maxtab;
if ( (curtab > TAB_CHAT) ) mx++;
for ( int i=0; i<=mx; i++ )
{
str = StringTable.Localize(tabnames[(i>7)?curtab:i]);
Screen.DrawText(fnt,((i>7)||(curtab==i))?Font.CR_FIRE:Font.CR_DARKGRAY,origin.x+xx,origin.y+yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
str = StringTable.Localize(tabnames[(i>maxtab)?curtab:i]);
Screen.DrawText(fnt,((i>maxtab)||(curtab==i))?Font.CR_FIRE:Font.CR_DARKGRAY,origin.x+xx,origin.y+yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
xx += fnt.StringWidth(str)+2;
Screen.DrawTexture(TabSeparator,false,origin.x+xx,origin.y+yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
xx += 4;
@ -1853,7 +1879,7 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
for ( int i=ofs; i<l.Count(); i++ )
{
if ( yy >= 370 ) break;
Screen.DrawText(fnt,Font.CR_GREEN,origin.x+xx,origin.y+yy,l.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(fnt,Font.CR_WHITE,origin.x+xx,origin.y+yy,l.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += 13;
}
// scrollbar
@ -2108,7 +2134,7 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
for ( int i=ofs; i<l.Count(); i++ )
{
if ( yy > 370 ) break;
Screen.DrawText(fnt,Font.CR_GREEN,origin.x+xx,origin.y+yy,l.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(fnt,Font.CR_WHITE,origin.x+xx,origin.y+yy,l.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += 13;
}
// scrollbar
@ -2328,6 +2354,7 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
[k1, k2] = bindings.GetKeysForCommand("openmenu SWWMKnowledgeBaseMenu");
String kstr = bindings.NameKeys(k1,k2);
str = String.Format(StringTable.Localize("$SWWM_HELPTXT"),kstr);
if ( multiplayer ) str = str..StringTable.Localize("$SWWM_HELPTXT_MP");
BrokenLines l = fnt.BreakLines(str,629);
if ( l.Count() > 28 ) l = fnt.BreakLines(str,620);
xx = 6;
@ -2336,7 +2363,7 @@ Class SWWMKnowledgeBaseMenu : GenericMenu
for ( int i=ofs; i<l.Count(); i++ )
{
if ( yy >= 370 ) break;
Screen.DrawText(fnt,Font.CR_GREEN,origin.x+xx,origin.y+yy,l.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(fnt,Font.CR_WHITE,origin.x+xx,origin.y+yy,l.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += 13;
}
// scrollbar

View file

@ -36,6 +36,7 @@ Class SilverBullet : SWWMWeapon
Weapon.AmmoGive1 1;
SilverBullet.ClipCount 5;
+SWWMWEAPON.NOFIRSTGIVE;
+WEAPON.NO_AUTO_SWITCH;
}
States
{