From df84963b4408681a0d9a6a8bfd127904f3dd5625 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Thu, 23 Jun 2022 23:11:34 +0200 Subject: [PATCH] Interpolation for all menus (choppy in 4.8.0 due to a bug). --- language.version | 4 ++-- zscript/games/swwm_madcat.zsc | 2 +- zscript/kbase/swwm_kbase.zsc | 7 ++++--- zscript/kbase/swwm_kbase_priv.zsc | 4 ++-- zscript/kbase/swwm_kbase_tab.zsc | 2 +- zscript/kbase/swwm_kbase_textbox.zsc | 7 ++++--- zscript/kbase/swwm_kbasetab_chat.zsc | 7 ++++--- zscript/kbase/swwm_kbasetab_games.zsc | 10 +++++----- zscript/kbase/swwm_kbasetab_help.zsc | 4 ++-- zscript/kbase/swwm_kbasetab_inventory.zsc | 7 ++++--- zscript/kbase/swwm_kbasetab_keychain.zsc | 7 ++++--- zscript/kbase/swwm_kbasetab_library.zsc | 11 ++++++----- zscript/kbase/swwm_kbasetab_mission.zsc | 6 +++--- zscript/kbase/swwm_kbasetab_secret.zsc | 7 ++++--- zscript/kbase/swwm_kbasetab_stats.zsc | 13 +++++++------ zscript/kbase/swwm_kbasetab_store.zsc | 11 ++++++----- zscript/menu/swwm_achievementmenu.zsc | 4 ++-- zscript/menu/swwm_credits.zsc | 3 ++- zscript/menu/swwm_help.zsc | 11 ++++++----- zscript/menu/swwm_menus.zsc | 18 ++++++++++++------ 20 files changed, 81 insertions(+), 64 deletions(-) diff --git a/language.version b/language.version index 18f28e509..8f339d15a 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r137 \cu(Thu 23 Jun 23:11:10 CEST 2022)\c-"; -SWWM_SHORTVER="\cw1.3pre r137 \cu(2022-06-23 23:11:10)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r138 \cu(Thu 23 Jun 23:11:34 CEST 2022)\c-"; +SWWM_SHORTVER="\cw1.3pre r138 \cu(2022-06-23 23:11:34)\c-"; diff --git a/zscript/games/swwm_madcat.zsc b/zscript/games/swwm_madcat.zsc index 4cda13ac5..58e0b5102 100644 --- a/zscript/games/swwm_madcat.zsc +++ b/zscript/games/swwm_madcat.zsc @@ -221,7 +221,7 @@ Class MadcatGame ui // draw on the virtual screen // coordinates are absolute - virtual void Draw( Vector2 screen_pos, double screen_zoom ) + virtual void Draw( Vector2 screen_pos, double screen_zoom, double fractic ) { // only bootup is handled here if ( global_state != CAT_BOOT ) return; diff --git a/zscript/kbase/swwm_kbase.zsc b/zscript/kbase/swwm_kbase.zsc index 3267af1d4..08b043d0a 100644 --- a/zscript/kbase/swwm_kbase.zsc +++ b/zscript/kbase/swwm_kbase.zsc @@ -149,6 +149,7 @@ Class DemolitionistMenu : GenericMenu override void Init( Menu parent ) { Super.Init(parent); + Animated = true; // can't open this menu outside of the game or if dead // also can't if you're not the Demolitionist if ( (gamestate != GS_LEVEL) || (players[consoleplayer].Health <= 0) || !(players[consoleplayer].mo is 'Demolitionist') ) @@ -176,7 +177,7 @@ Class DemolitionistMenu : GenericMenu mkey[0] = Bindings.NameKeys(ikey[0],0); mkey[1] = Bindings.NameKeys(ikey[1],0); tmsg = StringTable.Localize("$SWWM_MAINCONTROLS"); - tmsgtic = gametic+50; + tmsgtic = MenuTime()+50; lasttuid = Random[TUID](); hnd = SWWMHandler(EventHandler.Find("SWWMHandler")); shnd = SWWMStaticHandler(StaticEventHandler.Find("SWWMStaticHandler")); @@ -549,7 +550,7 @@ Class DemolitionistMenu : GenericMenu Screen.DrawText(mSmallFont,Font.CR_FIRE,origin.x+xx,origin.y+yy,munstr,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); yy = ws.y-13; // draw clock / messages - if ( gametic < tmsgtic ) str = tmsg; + if ( MenuTime() < tmsgtic ) str = tmsg; else str = clockstr; xx = 4; Screen.DrawText(mSmallFont,Font.CR_WHITE,origin.x+xx,origin.y+yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); @@ -559,6 +560,6 @@ Class DemolitionistMenu : GenericMenu Screen.DrawText(mSmallFont,Font.CR_WHITE,origin.x+xx,origin.y+yy,str,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true); // draw tab contents if ( (tabs.Size() <= 0) || (curtab == -1) || !tabs[curtab] ) return; - tabs[curtab].Drawer(); + tabs[curtab].Drawer(System.GetTimeFrac()); } } diff --git a/zscript/kbase/swwm_kbase_priv.zsc b/zscript/kbase/swwm_kbase_priv.zsc index 188567c0d..52a88f19d 100644 --- a/zscript/kbase/swwm_kbase_priv.zsc +++ b/zscript/kbase/swwm_kbase_priv.zsc @@ -206,7 +206,7 @@ extend Class DemolitionistMenu else { tmsg = StringTable.Localize("$SWWM_INVFAIL"); - tmsgtic = gametic+70; + tmsgtic = MenuTime()+70; MenuSound("menu/noinvuse"); } } @@ -216,7 +216,7 @@ extend Class DemolitionistMenu if ( !hnd.checklist[j].result ) { tmsg = StringTable.Localize("$SWWM_INVNDROP"); - tmsgtic = gametic+70; + tmsgtic = MenuTime()+70; MenuSound("menu/noinvuse"); } } diff --git a/zscript/kbase/swwm_kbase_tab.zsc b/zscript/kbase/swwm_kbase_tab.zsc index 0ab4934b2..34fa8a503 100644 --- a/zscript/kbase/swwm_kbase_tab.zsc +++ b/zscript/kbase/swwm_kbase_tab.zsc @@ -46,7 +46,7 @@ Class DemolitionistMenuTab ui abstract } // called every frame while selected - virtual void Drawer() + virtual void Drawer( double fractic ) { // placeholder (so don't call super) String str = StringTable.Localize("$SWWM_COMINGSOON"); diff --git a/zscript/kbase/swwm_kbase_textbox.zsc b/zscript/kbase/swwm_kbase_textbox.zsc index c9769b24f..45f290d19 100644 --- a/zscript/kbase/swwm_kbase_textbox.zsc +++ b/zscript/kbase/swwm_kbase_textbox.zsc @@ -93,10 +93,11 @@ Class DemolitionistMenuTextBox ui if ( abs(smofs-ofs) < (1./master.hs) ) smofs = ofs; } - void Drawer( bool dark = false ) + void Drawer( double fractic, bool dark = false ) { + double ssmofs = smofs*(1.-fractic)+((smofs*.6)+(ofs*.4))*fractic; double xx = x+6; - double yy = 17-smofs; + double yy = 17-ssmofs; Screen.SetClipRect(int((master.origin.x+xx)*master.hs),int((master.origin.y+17)*master.hs),int(w*master.hs),int((master.ws.y-34)*master.hs)); // draw image if defined and visible if ( img.IsValid() ) @@ -118,7 +119,7 @@ Class DemolitionistMenuTextBox ui xx = x+(w-8); master.DrawVSeparator(xx,14,master.ws.y-28); xx += 2; - yy = floor(smofs*((master.ws.y-39)/maxofs))+14; + yy = floor(ssmofs*((master.ws.y-39)/maxofs))+14; Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,"▮",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); } } diff --git a/zscript/kbase/swwm_kbasetab_chat.zsc b/zscript/kbase/swwm_kbasetab_chat.zsc index 23d7b93ed..d4116350c 100644 --- a/zscript/kbase/swwm_kbasetab_chat.zsc +++ b/zscript/kbase/swwm_kbasetab_chat.zsc @@ -146,7 +146,7 @@ Class DemolitionistChatTab : DemolitionistMenuTab break; } } - override void Drawer() + override void Drawer( double fractic ) { if ( !hist || (msglist.items.Size() <= 0) ) { @@ -156,16 +156,17 @@ Class DemolitionistChatTab : DemolitionistMenuTab Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); return; } + double ssmofs = smofs*(1.-fractic)+((smofs*.6)+(ofs*.4))*fractic; double xx = 3; double yy = 23; Screen.SetClipRect(int((master.origin.x+3)*master.hs),int((master.origin.y+23)*master.hs),int((master.ws.x-12)*master.hs),int((master.ws.y-46)*master.hs)); - msglist.Drawer((xx,yy-smofs)); + msglist.Drawer((xx,yy-ssmofs)); Screen.ClearClipRect(); if ( maxofs <= 0 ) return; xx = master.ws.x-8; master.DrawVSeparator(xx,14,master.ws.y-28); xx += 2; - yy = floor(smofs*((master.ws.y-39)/maxofs))+14; + yy = floor(ssmofs*((master.ws.y-39)/maxofs))+14; Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,"▮",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); } } diff --git a/zscript/kbase/swwm_kbasetab_games.zsc b/zscript/kbase/swwm_kbasetab_games.zsc index 42f3985e5..1fed59322 100644 --- a/zscript/kbase/swwm_kbasetab_games.zsc +++ b/zscript/kbase/swwm_kbasetab_games.zsc @@ -41,7 +41,7 @@ Class DemolitionistGameTab : DemolitionistMenuTab EventHandler.SendNetworkEvent("swwmgamelore",consoleplayer); // notify master.tmsg = StringTable.Localize("$SWWM_NEWLORE"); - master.tmsgtic = gametic+70; + master.tmsgtic = Menu.MenuTime()+70; } } override void OnDeselect() @@ -120,7 +120,7 @@ Class DemolitionistGameTab : DemolitionistMenuTab if ( game ) game.Tick(); } - override void Drawer() + override void Drawer( double fractic ) { if ( game ) { // calculate res to fit @@ -138,7 +138,7 @@ Class DemolitionistGameTab : DemolitionistMenuTab Screen.Dim("Black",1.,int((master.origin.x+xx-4)*master.hs),int((master.origin.y+yy-4)*master.hs),int((res.x+8)*master.hs),int((res.y+8)*master.hs)); master.DrawFrame(xx-4,yy-4,res.x+8,res.y+8); Screen.SetClipRect(int((master.origin.x+xx)*master.hs),int((master.origin.y+yy)*master.hs),int(res.x*master.hs),int(res.y*master.hs)); - game.Draw((master.origin.x+xx,master.origin.y+yy)*master.hs,scl); + game.Draw((master.origin.x+xx,master.origin.y+yy)*master.hs,scl,fractic); Screen.ClearClipRect(); } else @@ -160,8 +160,8 @@ Class DemolitionistGameTab : DemolitionistMenuTab Screen.DrawText(master.mSmallFont,(i==sel)?Font.CR_WHITE:Font.CR_DARKGRAY,master.origin.x+xx,master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); if ( i == sel ) { - Screen.DrawChar(master.mSmallFont,Font.CR_GREEN,master.origin.x+xx-12,master.origin.y+yy,((gametic&8)>=4)?0x2727:0x2726,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); - Screen.DrawChar(master.mSmallFont,Font.CR_GREEN,master.origin.x+xx+w+6,master.origin.y+yy,((gametic&8)>=4)?0x2727:0x2726,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); + Screen.DrawChar(master.mSmallFont,Font.CR_GREEN,master.origin.x+xx-12,master.origin.y+yy,((Menu.MenuTime()&8)>=4)?0x2727:0x2726,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); + Screen.DrawChar(master.mSmallFont,Font.CR_GREEN,master.origin.x+xx+w+6,master.origin.y+yy,((Menu.MenuTime()&8)>=4)?0x2727:0x2726,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); } yy += 14; } diff --git a/zscript/kbase/swwm_kbasetab_help.zsc b/zscript/kbase/swwm_kbasetab_help.zsc index f55b4b6db..5be5f7479 100644 --- a/zscript/kbase/swwm_kbasetab_help.zsc +++ b/zscript/kbase/swwm_kbasetab_help.zsc @@ -76,8 +76,8 @@ Class DemolitionistHelpTab : DemolitionistMenuTab { mtext.Ticker(); } - override void Drawer() + override void Drawer( double fractic ) { - mtext.Drawer(); + mtext.Drawer(fractic); } } diff --git a/zscript/kbase/swwm_kbasetab_inventory.zsc b/zscript/kbase/swwm_kbasetab_inventory.zsc index ae08dba5b..65201fd49 100644 --- a/zscript/kbase/swwm_kbasetab_inventory.zsc +++ b/zscript/kbase/swwm_kbasetab_inventory.zsc @@ -449,7 +449,7 @@ Class DemolitionistInventoryTab : DemolitionistMenuTab } } - override void Drawer() + override void Drawer( double fractic ) { if ( !invlist || (invlist.items.Size() <= 0) ) { @@ -459,16 +459,17 @@ Class DemolitionistInventoryTab : DemolitionistMenuTab Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); return; } + double ssmofs = smofs*(1.-fractic)+((smofs*.6)+(ofs*.4))*fractic; double xx = 9; double yy = 23; Screen.SetClipRect(int((master.origin.x+9)*master.hs),int((master.origin.y+23)*master.hs),int((master.ws.x-18)*master.hs),int((master.ws.y-46)*master.hs)); - invlist.Drawer((xx-smofs,yy)); + invlist.Drawer((xx-ssmofs,yy)); Screen.ClearClipRect(); if ( maxofs <= 0 ) return; yy = master.ws.y-21; master.DrawHSeparator(0,yy,master.ws.x); yy -= 4; - xx = floor(smofs*((master.ws.x-10)/maxofs))+2; + xx = floor(ssmofs*((master.ws.x-10)/maxofs))+2; Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,"▬",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); } } diff --git a/zscript/kbase/swwm_kbasetab_keychain.zsc b/zscript/kbase/swwm_kbasetab_keychain.zsc index 505a3a35c..d19fea2bf 100644 --- a/zscript/kbase/swwm_kbasetab_keychain.zsc +++ b/zscript/kbase/swwm_kbasetab_keychain.zsc @@ -292,7 +292,7 @@ Class DemolitionistKeychainTab : DemolitionistMenuTab } } - override void Drawer() + override void Drawer( double fractic ) { if ( !invlist || (invlist.items.Size() <= 0) ) { @@ -302,16 +302,17 @@ Class DemolitionistKeychainTab : DemolitionistMenuTab Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); return; } + double ssmofs = smofs*(1.-fractic)+((smofs*.6)+(ofs*.4))*fractic; double xx = 9; double yy = 23; Screen.SetClipRect(int((master.origin.x+9)*master.hs),int((master.origin.y+23)*master.hs),int((master.ws.x-18)*master.hs),int((master.ws.y-46)*master.hs)); - invlist.Drawer((xx-smofs,yy)); + invlist.Drawer((xx-ssmofs,yy)); Screen.ClearClipRect(); if ( maxofs <= 0 ) return; yy = master.ws.y-21; master.DrawHSeparator(0,yy,master.ws.x); yy -= 4; - xx = floor(smofs*((master.ws.x-10)/maxofs))+2; + xx = floor(ssmofs*((master.ws.x-10)/maxofs))+2; Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,"▬",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); } } diff --git a/zscript/kbase/swwm_kbasetab_library.zsc b/zscript/kbase/swwm_kbasetab_library.zsc index 15b3b4f1f..afe4c1fb0 100644 --- a/zscript/kbase/swwm_kbasetab_library.zsc +++ b/zscript/kbase/swwm_kbasetab_library.zsc @@ -127,7 +127,7 @@ Class DemolitionistLibraryTab : DemolitionistMenuTab loresz = lore.ent.Size(); // append the notification for new lore master.tmsg = StringTable.Localize("$SWWM_NEWLORE"); - master.tmsgtic = gametic+70; + master.tmsgtic = Menu.MenuTime()+70; if ( ((lwidth != olwidth) || (maxofs[section] != olmaxofs)) && clore && ltext ) ltext.Reinit(StringTable.Localize(clore.text),lwidth+((maxofs[section]>0)?8:0)); } @@ -352,7 +352,7 @@ Class DemolitionistLibraryTab : DemolitionistMenuTab break; } } - override void Drawer() + override void Drawer( double fractic ) { double xx = 0; double yy = 15; @@ -398,18 +398,19 @@ Class DemolitionistLibraryTab : DemolitionistMenuTab Screen.DrawText(master.mSmallFont,Font.CR_GOLD,master.origin.x+lwidth-15,master.origin.y+yy,"‼",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); xx = 3; yy = 32; + double ssmofs = smofs[section]*(1.-fractic)+((smofs[section]*.6)+(ofs[section]*.4))*fractic; Screen.SetClipRect(int((master.origin.x+3)*master.hs),int((master.origin.y+32)*master.hs),int((lwidth-6)*master.hs),int((master.ws.y-50)*master.hs)); - lists[section].Drawer((xx,yy-smofs[section])); + lists[section].Drawer((xx,yy-ssmofs)); Screen.ClearClipRect(); if ( maxofs[section] > 0 ) { xx = lwidth; master.DrawVSeparator(xx+8,14,master.ws.y-28); xx += 2; - yy = floor(smofs[section]*((master.ws.y-39)/maxofs[section]))+14; + yy = floor(ssmofs*((master.ws.y-39)/maxofs[section]))+14; Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,"▮",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); } - if ( clore && ltext ) ltext.Drawer(); + if ( clore && ltext ) ltext.Drawer(fractic); else { str = StringTable.Localize("$SWWM_LOREUNSEL"); diff --git a/zscript/kbase/swwm_kbasetab_mission.zsc b/zscript/kbase/swwm_kbasetab_mission.zsc index 19ef331e5..404909eba 100644 --- a/zscript/kbase/swwm_kbasetab_mission.zsc +++ b/zscript/kbase/swwm_kbasetab_mission.zsc @@ -263,7 +263,7 @@ Class DemolitionistMissionTab : DemolitionistMenuTab if ( newent ) { master.tmsg = StringTable.Localize("$SWWM_NEWMISSION"); - master.tmsgtic = gametic+70; + master.tmsgtic = Menu.MenuTime()+70; } } // just tick the current textbox @@ -271,9 +271,9 @@ Class DemolitionistMissionTab : DemolitionistMenuTab mtext[sel].Ticker(); } - override void Drawer() + override void Drawer( double fractic ) { - if ( mtext.Size() > 0 ) mtext[sel].Drawer(!!sel); + if ( mtext.Size() > 0 ) mtext[sel].Drawer(fractic,!!sel); else { String str = StringTable.Localize("$SWWM_MISSION_NONE"); diff --git a/zscript/kbase/swwm_kbasetab_secret.zsc b/zscript/kbase/swwm_kbasetab_secret.zsc index 331ecc646..e62f468c1 100644 --- a/zscript/kbase/swwm_kbasetab_secret.zsc +++ b/zscript/kbase/swwm_kbasetab_secret.zsc @@ -120,12 +120,13 @@ Class DemolitionistSecretTab : DemolitionistMenuTab if ( abs(smofs-ofs) < (1./master.hs) ) smofs = ofs; } - override void Drawer() + override void Drawer( double fractic ) { + double ssmofs = smofs*(1.-fractic)+((smofs*.6)+(ofs*.4))*fractic; double xx = 20; double yy; if ( maxofs <= 0 ) yy = master.ws.y/2-160; - else yy = 20-smofs; + else yy = 20-ssmofs; Screen.SetClipRect(int((master.origin.x+20)*master.hs),int((master.origin.y+20)*master.hs),int((master.ws.x-40)*master.hs),int((master.ws.y-40)*master.hs)); Screen.DrawTexture(img,false,master.origin.x+xx,master.origin.y+yy,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); int mxlen = 0; @@ -143,7 +144,7 @@ Class DemolitionistSecretTab : DemolitionistMenuTab xx = master.ws.x-8; master.DrawVSeparator(xx,14,master.ws.y-28); xx += 2; - yy = floor(smofs*((master.ws.y-39)/maxofs))+14; + yy = floor(ssmofs*((master.ws.y-39)/maxofs))+14; Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,"▮",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); } } diff --git a/zscript/kbase/swwm_kbasetab_stats.zsc b/zscript/kbase/swwm_kbasetab_stats.zsc index 501dd3c0b..d18a238a8 100644 --- a/zscript/kbase/swwm_kbasetab_stats.zsc +++ b/zscript/kbase/swwm_kbasetab_stats.zsc @@ -534,7 +534,7 @@ Class DemolitionistStatsTab : DemolitionistMenuTab break; } } - override void Drawer() + override void Drawer( double fractic ) { if ( !stats ) return; double xx = 9; @@ -553,20 +553,21 @@ Class DemolitionistStatsTab : DemolitionistMenuTab Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); return; } + double ssmofs = smofs[section]*(1.-fractic)+((smofs[section]*.6)+(ofs[section]*.4))*fractic; if ( section == 3 ) { // achievement drawer has different margins xx = lwidth+12; yy = 26; Screen.SetClipRect(int((master.origin.x+lwidth+12)*master.hs),int((master.origin.y+26)*master.hs),int((master.ws.x-(lwidth+24))*master.hs),int((master.ws.y-52)*master.hs)); - lists[section].Drawer((xx,yy-smofs[section])); + lists[section].Drawer((xx,yy-ssmofs)); } else { xx = lwidth+9; yy = 23; Screen.SetClipRect(int((master.origin.x+lwidth+9)*master.hs),int((master.origin.y+23)*master.hs),int((master.ws.x-(lwidth+18))*master.hs),int((master.ws.y-46)*master.hs)); - lists[section].Drawer((xx,yy-smofs[section])); + lists[section].Drawer((xx,yy-ssmofs)); } Screen.ClearClipRect(); if ( maxofs[section] > 0 ) @@ -574,7 +575,7 @@ Class DemolitionistStatsTab : DemolitionistMenuTab xx = master.ws.x-8; master.DrawVSeparator(xx,14,master.ws.y-28); xx += 2; - yy = floor(smofs[section]*((master.ws.y-39)/maxofs[section]))+14; + yy = floor(ssmofs*((master.ws.y-39)/maxofs[section]))+14; Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,"▮",DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); } } @@ -750,13 +751,13 @@ Class DemolitionistMenuAchievementItem : DemolitionistMenuListItem oldstr = str; } str = StringTable.Localize("$SWWM_ACHIEVEMENT_"..a.basename.."_TAG"); - if ( !completed && !hasprogress && ShouldObscure ) SWWMUtility.ObscureText(str,(gametic/3)+ypos*2+1); + if ( !completed && !hasprogress && ShouldObscure ) SWWMUtility.ObscureText(str,(Menu.MenuTime()/3)+ypos*2+1); int oy = (32-(14+(9*l.Count())))/2; Screen.DrawText(master.mSmallFont,completed?Font.CR_GREEN:Font.CR_DARKGRAY,xx+36,yy+oy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true); for ( int i=0; i= 1.) ) DrawPage(curpage); else { diff --git a/zscript/menu/swwm_menus.zsc b/zscript/menu/swwm_menus.zsc index 3482a9714..13275fef6 100644 --- a/zscript/menu/swwm_menus.zsc +++ b/zscript/menu/swwm_menus.zsc @@ -247,6 +247,12 @@ Class SWWMOptionMenu : OptionMenu Class SWWMCleanMenu : ListMenu { + override void Init( Menu parent, ListMenuDescriptor desc ) + { + Super.Init(parent,desc); + Animated = true; + } + override bool MouseEvent( int type, int x, int y ) { if ( mDesc.DisplayWidth() != ListMenuDescriptor.CleanScale ) @@ -771,17 +777,17 @@ Mixin Class SWWMSelector yofs *= CleanYFac_1; double x = (320-GetWidth())/2; SWWMUtility.AdjustClean_1(x,y); - Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_Rotate,15.*sin(8*Menu.MenuTime())); + Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_Rotate,15.*sin(8*(Menu.MenuTime()+System.GetTimeFrac()))); x = (320+GetWidth())/2; SWWMUtility.AdjustClean_1x(x); - Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_Rotate,-15.*sin(8*Menu.MenuTime())); + Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,CleanXFac_1/4.,DTA_ScaleY,CleanYFac_1/4.,DTA_Rotate,-15.*sin(8*(Menu.MenuTime()+System.GetTimeFrac()))); } else { double x = (w-GetWidth())/2; - Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_Rotate,15.*sin(8*Menu.MenuTime())); + Screen.DrawTexture(tex,true,x+xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_Rotate,15.*sin(8*(Menu.MenuTime()+System.GetTimeFrac()))); x = (w+GetWidth())/2; - Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_Rotate,-15.*sin(8*Menu.MenuTime())); + Screen.DrawTexture(tex,true,x-xofs,y+yofs,DTA_ScaleX,.25,DTA_ScaleY,.25,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_Rotate,-15.*sin(8*(Menu.MenuTime()+System.GetTimeFrac()))); } } } @@ -869,7 +875,7 @@ Class ListMenuItemSWWMTextItemM : ListMenuItemSelectable { int ch; [ch, pos] = text.GetNextCodePoint(pos); - double yy = y+4*sin(32*i+8*Menu.MenuTime())*CleanYFac_1; + double yy = y+4*sin(32*i+8*(Menu.MenuTime()+System.GetTimeFrac()))*CleanYFac_1; Screen.DrawChar(font,mColorSelected,xx,yy,ch,DTA_ScaleX,CleanXFac_1*scl,DTA_ScaleY,CleanYFac_1*scl); xx += (font.GetCharWidth(ch)+kern)*CleanXFac_1*scl; } @@ -880,7 +886,7 @@ Class ListMenuItemSWWMTextItemM : ListMenuItemSelectable { int ch; [ch, pos] = text.GetNextCodePoint(pos); - double yy = y+4*sin(32*i+8*Menu.MenuTime()); + double yy = y+4*sin(32*i+8*(Menu.MenuTime()+System.GetTimeFrac())); Screen.DrawChar(mFont,mColorSelected,xx,yy,ch,DTA_VirtualWidth,w,DTA_VirtualHeight,h,DTA_FullscreenScale,FSMode_ScaleToFit43,DTA_ScaleX,scl,DTA_ScaleY,scl); xx += (font.GetCharWidth(ch)+kern)*scl; }