From afce3c6582756593f1c86abe1c705102476f98c1 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Sat, 24 Sep 2022 21:46:21 +0200 Subject: [PATCH] Some savegame nonsense with certain hudmessages. --- language.version | 4 ++-- zscript/hud/swwm_hudextra.zsc | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/language.version b/language.version index 326b7f792..58f72fd3a 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r503 \cu(Sat 24 Sep 21:33:48 CEST 2022)\c-"; -SWWM_SHORTVER="\cw1.3pre r503 \cu(2022-09-24 21:33:48)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r504 \cu(Sat 24 Sep 21:46:21 CEST 2022)\c-"; +SWWM_SHORTVER="\cw1.3pre r504 \cu(2022-09-24 21:46:21)\c-"; diff --git a/zscript/hud/swwm_hudextra.zsc b/zscript/hud/swwm_hudextra.zsc index 270e5c96a..bf6cb68a4 100644 --- a/zscript/hud/swwm_hudextra.zsc +++ b/zscript/hud/swwm_hudextra.zsc @@ -288,6 +288,7 @@ Class SWWMDirectMessage : HUDMessageBase bool nextdirect; // skips directly to next message without delays or fades Font mSmallFont; SWWMHandler hnd; + transient bool bDontResetMe; // savegame safeguard private int GetRandom() { @@ -317,6 +318,7 @@ Class SWWMDirectMessage : HUDMessageBase pausedelay = 30; rss = 1232; mSmallFont = Font.GetFont('TewiFont'); + bDontResetMe = true; return self; } @@ -439,6 +441,14 @@ Class SWWMDirectMessage : HUDMessageBase override bool Tick() { + // reset when loading from a save, to avoid some wacky nonsense + if ( !bDontResetMe ) + { + bDontResetMe = true; + seqnum = -1; + delay = 10; + fadein = fadeout = 0; + } if ( seqnum < 0 ) { // if there's a map message active, wait until it isn't @@ -485,6 +495,7 @@ Class SWWMDirectMessage : HUDMessageBase if ( nextmsg && nextdirect ) { nextmsg.seqnum = 1; + nextmsg.bDontResetMe = true; StatusBar.AttachMessage(nextmsg,-1232); return true; } @@ -560,6 +571,8 @@ Class DSMapTitle : HUDMessageBase int tics, holdtics, fadeintics, fadeouttics; int ultics; + transient bool bDontDeleteMe; // safeguard for savegames + // all the actual hard code int MyStringWidth( String str ) { @@ -765,11 +778,13 @@ Class DSMapTitle : HUDMessageBase // this is for compat with the dialogues, and should not go into other mods let hnd = SWWMHandler(EventHandler.Find("SWWMHandler")); if ( hnd ) hnd.mapmsg = self; + bDontDeleteMe = true; return self; } override bool Tick() { + if ( !bDontDeleteMe ) return true; if ( tics == 0 ) S_StartSound("misc/newarea",CHAN_VOICE,CHANF_UI,pitch:.75); // dunno why the source file is pitched up return (++tics > holdtics+fadeintics+fadeouttics); }