Wallbuster menu remembers last selected ammo.

This commit is contained in:
Mari the Deer 2020-06-05 14:22:24 +02:00
commit af98f5f101
3 changed files with 8 additions and 3 deletions

View file

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

View file

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

View file

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