Some savegame nonsense with certain hudmessages.

This commit is contained in:
Mari the Deer 2022-09-24 21:46:21 +02:00
commit afce3c6582
2 changed files with 17 additions and 2 deletions

View file

@ -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-";

View file

@ -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);
}