From a8ed346e67aba0cf601b4f72946f09d0ca07d1ce Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Wed, 1 Jun 2022 18:27:10 +0200 Subject: [PATCH] Reimplement intermission input handling. --- language.version | 4 +- zscript/menu/swwm_inter.zsc | 77 +++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 2 deletions(-) diff --git a/language.version b/language.version index 5e859f7cf..1f828f1a4 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.2.20 r13 \cu(Wed 1 Jun 18:32:44 CEST 2022)\c-"; -SWWM_SHORTVER="\cw1.2.20 r13 \cu(2022-06-01 18:32:44)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.2.21 \cu(Wed 1 Jun 18:33:35 CEST 2022)\c-"; +SWWM_SHORTVER="\cw1.2.21 \cu(2022-06-01 18:33:35)\c-"; diff --git a/zscript/menu/swwm_inter.zsc b/zscript/menu/swwm_inter.zsc index 82e948afc..fd0ecbbf8 100644 --- a/zscript/menu/swwm_inter.zsc +++ b/zscript/menu/swwm_inter.zsc @@ -8,6 +8,8 @@ Class SWWMStatScreen : StatusScreen abstract Font mSmallFont; String tipstr; transient BrokenLines tipl; + double bgfade; + bool bFade; override void Start( wbstartstruct wbstartstruct ) { @@ -231,6 +233,19 @@ Class SWWMStatScreen : StatusScreen abstract drawNoState(); break; } + if ( bgfade <= 0. ) return; + // redraw BG on top, hiding the rest of the ui + TextureID tx; + if ( whichart ) tx = arttex; + else tx = bgtex; + double ar = Screen.GetAspectRatio(); + Vector2 tsize = TexMan.GetScaledSize(tx); + 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(tx,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); } override void Ticker( void ) { @@ -251,6 +266,9 @@ Class SWWMStatScreen : StatusScreen abstract // sorry nothing break; } + // check fade + if ( bFade ) bgfade = min(1.,bgfade+3./GameTicRate); + else bgfade = max(0.,bgfade-4./GameTicRate); // force toggle if ( !swwm_interart && (whichart != 0) ) { @@ -274,6 +292,65 @@ Class SWWMStatScreen : StatusScreen abstract if ( b <= 0 ) return inv?0:100; // for "missed" percentage return (a*100)/b; } + + override bool OnEvent( InputEvent evt ) + { + if ( evt.type == InputEvent.Type_KeyDown ) + { + Array usekey, firekey, altfirekey, reloadkey, zoomkey; + Bindings.GetAllKeysForCommand(usekey,"+use"); + for ( int i=0; i altfirekey; + Bindings.GetAllKeysForCommand(altfirekey,"+altattack"); + for ( int i=0; i