From 7ad3295046f2f152122fc6403bf42a48e5ab4b7b Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Wed, 27 Apr 2022 17:02:41 +0200 Subject: [PATCH] Statscreen compat fix for recent devbuilds. Unfortunately, the ability to switch art and tips on the fly, as well as fading the foreground, have all been lost in the process. --- language.version | 4 +- zscript/menu/swwm_inter.zsc | 95 +++++----------------------------- zscript/swwm_statichandler.zsc | 2 + 3 files changed, 17 insertions(+), 84 deletions(-) diff --git a/language.version b/language.version index 9f920dbac..cce3375f7 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.2.13 \cu(Fri 22 Apr 13:53:54 CEST 2022)\c-"; -SWWM_SHORTVER="\cw1.2.13 \cu(2022-04-22 13:53:54)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.2.14 \cu(Wed 27 Apr 17:22:20 CEST 2022)\c-"; +SWWM_SHORTVER="\cw1.2.14 \cu(2022-04-27 17:22:20)\c-"; diff --git a/zscript/menu/swwm_inter.zsc b/zscript/menu/swwm_inter.zsc index 46bcda1c4..82e948afc 100644 --- a/zscript/menu/swwm_inter.zsc +++ b/zscript/menu/swwm_inter.zsc @@ -1,17 +1,10 @@ // Custom intermission screens -Class SWWMStatScreenData : SWWMStaticThinker -{ - // to prevent repetition - Array lasttip, lastart; -} - Class SWWMStatScreen : StatusScreen abstract { transient TextureID bgtex, arttex; int whichart, whichtip; double hs, hs2; Vector2 ss, ss2, origin, origin2; - double bgfade; Font mSmallFont; String tipstr; transient BrokenLines tipl; @@ -41,12 +34,7 @@ Class SWWMStatScreen : StatusScreen abstract } private void drawSWWMBg() { - let pdata = SWWMStatScreenData(ThinkerIterator.Create("SWWMStatScreenData",Thinker.STAT_STATIC).Next()); - if ( !pdata ) - { - pdata = new("SWWMStatScreenData"); - pdata.ChangeStatNum(Thinker.STAT_STATIC); - } + let shnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler")); if ( !whichart && swwm_interart ) { int no = StringTable.Localize("$SWWM_NFANART").ToInt(); @@ -63,24 +51,24 @@ Class SWWMStatScreen : StatusScreen abstract rno++; } no = rno; - if ( pdata.lastart.Size() >= no ) + if ( shnd.lastart.Size() >= no ) { // exclude last one, start over - int excludeme = pdata.lastart[pdata.lastart.Size()-1]; + int excludeme = shnd.lastart[shnd.lastart.Size()-1]; ents.Delete(excludeme-1); - pdata.lastart.Clear(); + shnd.lastart.Clear(); } else { - for ( int i=0; i= maxtip ) + if ( shnd.lasttip.Size() >= maxtip ) { // exclude last one, start over - int excludeme = pdata.lasttip[pdata.lasttip.Size()-1]; + int excludeme = shnd.lasttip[shnd.lasttip.Size()-1]; ents.Delete(excludeme-1); - pdata.lasttip.Clear(); + shnd.lasttip.Clear(); } else { - for ( int i=0; i ar ) vsize = (tsize.y*ar,tsize.y); - else if ( sar < ar ) vsize = (tsize.x,tsize.x/ar); - else vsize = tsize; - Screen.DrawTexture(arttex,false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_Alpha,bgfade); - } - else - { - double ar = Screen.GetAspectRatio(); - Vector2 tsize = TexMan.GetScaledSize(bgtex); - double sar = tsize.x/tsize.y; - Vector2 vsize; - if ( sar > ar ) vsize = (tsize.y*ar,tsize.y); - else if ( sar < ar ) vsize = (tsize.x,tsize.x/ar); - else vsize = tsize; - Screen.DrawTexture(bgtex,false,(vsize.x-tsize.x)/2,(vsize.y-tsize.y)/2,DTA_VirtualWidthF,vsize.x,DTA_VirtualHeightF,vsize.y,DTA_KeepRatio,true,DTA_Alpha,bgfade); - } - } - protected void checkForAccelerateNew( void ) - { - // check for button presses to skip delays (but only recognize fire/use buttons) - for ( int i=0; i < MAXPLAYERS; i++ ) - { - if ( !playeringame[i] ) continue; - PlayerInfo p = players[i]; - if ( (p.cmd.buttons^p.oldbuttons) && ((p.cmd.buttons&p.oldbuttons) == p.oldbuttons) && !p.Bot ) - { - if ( p.cmd.buttons&(BT_ATTACK|BT_USE) ) - { - acceleratestage = 1; - playerready[i] = true; - } - if ( p.cmd.buttons&BT_RELOAD ) - { - if ( !swwm_nointertips ) PlaySound("menu/demoscroll"); - whichtip = 0; - } - if ( p.cmd.buttons&BT_ZOOM ) - { - if ( swwm_interart ) PlaySound("menu/demoscroll"); - whichart = 0; - arttex.SetNull(); - } - } - p.oldbuttons = p.buttons; - } } override void Ticker( void ) { bcnt++; if ( bcnt == 1 ) StartMusic(); - checkForAccelerateNew(); switch (CurState) { case StatCount: @@ -317,9 +251,6 @@ Class SWWMStatScreen : StatusScreen abstract // sorry nothing break; } - // check fade - if ( players[me].cmd.buttons&BT_ALTATTACK ) bgfade = min(1.,bgfade+3./GameTicRate); - else bgfade = max(0.,bgfade-4./GameTicRate); // force toggle if ( !swwm_interart && (whichart != 0) ) { diff --git a/zscript/swwm_statichandler.zsc b/zscript/swwm_statichandler.zsc index 11f7fcc0b..fdec0b063 100644 --- a/zscript/swwm_statichandler.zsc +++ b/zscript/swwm_statichandler.zsc @@ -24,6 +24,8 @@ Class SWWMStaticHandler : StaticEventHandler bool mpwarned; // checks ThinkerIterator sti; + // for intermissions, to prevent repetition + ui Array lasttip, lastart; override void NewGame() {