Menus/Time Attack: fix staff replay selector getting stuck

- If you viewed a map with multiple staff ghosts and moved
  the selector
- Then viewed a map with only one staff ghost
- Then went back and viewed a map with multiple
- The selector would get stuck on only the first option
This commit is contained in:
James R 2024-03-14 22:52:29 -07:00
parent 35d9079140
commit ae30e1d138
3 changed files with 5 additions and 22 deletions

View file

@ -980,8 +980,7 @@ consvar_t cv_dummyspbattack = MenuDummy("dummyspbattack", "Off").on_off().onchan
consvar_t cv_dummyspectate = MenuDummy("dummyspectate", "Spectator").values({{0, "Spectator"}, {1, "Playing"}});
extern CV_PossibleValue_t dummystaff_cons_t[];
void Dummystaff_OnChange(void);
consvar_t cv_dummystaff = MenuDummy("dummystaff", "0").values(dummystaff_cons_t).onchange(Dummystaff_OnChange);
consvar_t cv_dummystaff = MenuDummy("dummystaff", "0").values(dummystaff_cons_t);
consvar_t cv_dummyteam = MenuDummy("dummyteam", "Spectator").values({{0, "Spectator"}, {1, "Red"}, {2, "Blue"}});

View file

@ -59,25 +59,6 @@ static boolean noFurtherInput = false;
CV_PossibleValue_t dummystaff_cons_t[] = {{0, "MIN"}, {999, "MAX"}, {0, NULL}};
// ==========================================================================
// CVAR ONCHANGE EVENTS GO HERE
// ==========================================================================
// (there's only a couple anyway)
void Dummystaff_OnChange(void);
void Dummystaff_OnChange(void)
{
if (mapheaderinfo[levellist.choosemap] == NULL || mapheaderinfo[levellist.choosemap]->ghostCount <= 0)
return;
dummystaff_cons_t[1].value = mapheaderinfo[levellist.choosemap]->ghostCount-1;
if (cv_dummystaff.value > dummystaff_cons_t[1].value)
{
CV_StealthSetValue(&cv_dummystaff, 0);
return;
}
}
// =========================================================================
// BASIC MENU HANDLING

View file

@ -335,9 +335,12 @@ void CV_SPBAttackChanged(void)
PLAY_TAGhosts[taghost_staff].status = IT_DISABLED;
if (mapheaderinfo[levellist.choosemap]->ghostCount > 0 && !modeprefix[0])
{
extern CV_PossibleValue_t dummystaff_cons_t[];
dummystaff_cons_t[1].value = mapheaderinfo[levellist.choosemap]->ghostCount-1;
CV_SetValue(&cv_dummystaff, 0);
PLAY_TAReplay[tareplay_staff].status = IT_STRING|IT_ARROWS;
PLAY_TAGhosts[taghost_staff].status = IT_STRING|IT_CVAR;
CV_SetValue(&cv_dummystaff, 0);
active |= 1|4;
}