From af98f5f1012a9d81e4cb829ba36fd30313b53bb6 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Fri, 5 Jun 2020 14:22:24 +0200 Subject: [PATCH] Wallbuster menu remembers last selected ammo. --- cvarinfo.txt | 3 ++- language.version | 2 +- zscript/swwm_cbt.zsc | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cvarinfo.txt b/cvarinfo.txt index a8e4560a5..2a3698792 100644 --- a/cvarinfo.txt +++ b/cvarinfo.txt @@ -55,4 +55,5 @@ user bool swwm_fuzz = true; // allows toggling the fuzz shader on the demoliti user bool swwm_cbtpause = true; // wallbuster menu pauses the game user noarchive int swwm_cbtmeme = 0; // easter egg, hidden cvar user noarchive bool swwm_cbttime = false; // debug: times how long a reload takes -server bool swwm_crouchjump = false; // allows crouch-jumping (which looks weird af but some maps may need it) \ No newline at end of file +server bool swwm_crouchjump = false; // allows crouch-jumping (which looks weird af but some maps may need it) +user noarchive int swwm_cbtlast = 0; // last selected ammo for the wallbuster diff --git a/language.version b/language.version index 55a501191..d88eaf365 100644 --- a/language.version +++ b/language.version @@ -1,2 +1,2 @@ [default] -SWWM_MODVER="\cxSWWM GZ\c- r310 (Fri 5 Jun 11:51:50 CEST 2020)"; +SWWM_MODVER="\cxSWWM GZ\c- r311 (Fri 5 Jun 14:22:24 CEST 2020)"; diff --git a/zscript/swwm_cbt.zsc b/zscript/swwm_cbt.zsc index d0a76cda8..bd4713dc2 100644 --- a/zscript/swwm_cbt.zsc +++ b/zscript/swwm_cbt.zsc @@ -45,7 +45,7 @@ Class WallbusterReloadMenu : GenericMenu AmmoIcon[3] = TexMan.CheckForTexture("graphics/HUD/PurpleShell.png",TexMan.Type_Any); MenuSound("menu/demotab"); queue.Clear(); - sel0 = 0; + sel0 = CVar.GetCVar('swwm_cbtlast',players[consoleplayer]).GetInt();; } override void Ticker() @@ -85,6 +85,7 @@ Class WallbusterReloadMenu : GenericMenu if ( (players[consoleplayer].mo.CountInv(types[idx])-AmmoSets[idx]) > 0 ) { sel0 = idx; + CVar.GetCVar('swwm_cbtlast',players[consoleplayer]).SetInt(sel0); return PushAmmo(true); } } @@ -111,6 +112,7 @@ Class WallbusterReloadMenu : GenericMenu candidates.Push(i); } sel0 = Random[WallbusterMenu](0,candidates.Size()-1); + CVar.GetCVar('swwm_cbtlast',players[consoleplayer]).SetInt(sel0); AmmoSets[sel0]++; queue.Push(sel0); } @@ -171,11 +173,13 @@ Class WallbusterReloadMenu : GenericMenu MenuSound("menu/demotab"); sel0++; if ( sel0 > 3 ) sel0 = 0; + CVar.GetCVar('swwm_cbtlast',players[consoleplayer]).SetInt(sel0); return true; case MKEY_LEFT: MenuSound("menu/demotab"); sel0--; if ( sel0 < 0 ) sel0 = 3; + CVar.GetCVar('swwm_cbtlast',players[consoleplayer]).SetInt(sel0); return true; case MKEY_PAGEUP: if ( queue.Size() <= 0 )