diff --git a/src/k_menu.h b/src/k_menu.h index 9b1a383f7..b1b699fbc 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -469,7 +469,6 @@ void Moviemode_option_Onchange(void); extern menu_t *currentMenu; extern menu_t *restoreMenu; -extern char dummystaffname[22]; extern consvar_t cv_dummystaff; extern INT16 itemOn; // menu item skull is on, Hack by Tails 09-18-2002 diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 20c51b412..92197d18d 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -2240,7 +2240,6 @@ void M_DrawTimeAttack(void) INT32 w; patch_t *minimap = NULL; UINT8 i; - consvar_t *cv; M_DrawLevelSelectBlock(0, 2, map, true, false); @@ -2303,19 +2302,56 @@ void M_DrawTimeAttack(void) opty += 10; // Cvar specific handling - - if (currentMenu->menuitems[i].status & IT_CVAR) { - cv = currentMenu->menuitems[i].itemaction.cvar; + const char *str = NULL; + INT32 optflags = f; + boolean drawarrows = (i == itemOn); - w = V_StringWidth(cv->string, 0); - V_DrawString(leftedge, opty, f, cv->string); - if (i == itemOn) + if ((currentMenu->menuitems[i].status & IT_TYPE) == IT_ARROWS) { - V_DrawCharacter(leftedge - 10 - (skullAnimCounter/5), opty, '\x1C' | f, false); // left arrow - V_DrawCharacter(leftedge + w + 2+ (skullAnimCounter/5), opty, '\x1D' | f, false); // right arrow + // Currently assumes M_HandleStaffReplay + if (mapheaderinfo[levellist.choosemap]->ghostCount <= 1) + drawarrows = false; + + optflags |= V_ALLOWLOWERCASE; + if (mapheaderinfo[levellist.choosemap] == NULL) + str = "Invalid map"; + else if (cv_dummystaff.value > mapheaderinfo[levellist.choosemap]->ghostCount) + str = va("%u - Invalid ID", cv_dummystaff.value+1); + else if (mapheaderinfo[levellist.choosemap]->ghostBrief[cv_dummystaff.value] == NULL) + str = va("%u - Invalid brief", cv_dummystaff.value+1); + else + { + const char *th = "th"; + if (cv_dummystaff.value+1 == 1) + th = "st"; + else if (cv_dummystaff.value+1 == 2) + th = "nd"; + else if (cv_dummystaff.value+1 == 3) + th = "rd"; + str = va("%u%s - %s", + cv_dummystaff.value+1, + th, + mapheaderinfo[levellist.choosemap]->ghostBrief[cv_dummystaff.value]->name + ); + } + } + else if ((currentMenu->menuitems[i].status & IT_TYPE) == IT_CVAR) + { + str = currentMenu->menuitems[i].itemaction.cvar->string; + } + + if (str) + { + w = V_StringWidth(str, optflags); + V_DrawString(leftedge+12, opty, optflags, str); + if (drawarrows) + { + V_DrawCharacter(leftedge+12 - 10 - (skullAnimCounter/5), opty, '\x1C' | f, false); // left arrow + V_DrawCharacter(leftedge+12 + w + 2+ (skullAnimCounter/5), opty, '\x1D' | f, false); // right arrow + } + opty += 10; } - opty += 10; } break; diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 177b30442..53cb6745a 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -37,8 +37,6 @@ boolean fromlevelselect = false; menu_t *currentMenu = &MAIN_ProfilesDef; menu_t *restoreMenu = NULL; -char dummystaffname[22]; - INT16 itemOn = 0; // menu item skull is on, Hack by Tails 09-18-2002 INT16 skullAnimCounter = 8; // skull animation counter struct menutransition_s menutransition; // Menu transition properties @@ -77,7 +75,7 @@ consvar_t cv_tutorialprompt = CVAR_INIT ("tutorialprompt", "On", CV_SAVE, CV_OnO static CV_PossibleValue_t dummyteam_cons_t[] = {{0, "Spectator"}, {1, "Red"}, {2, "Blue"}, {0, NULL}}; static CV_PossibleValue_t dummyspectate_cons_t[] = {{0, "Spectator"}, {1, "Playing"}, {0, NULL}}; static CV_PossibleValue_t dummyscramble_cons_t[] = {{0, "Random"}, {1, "Points"}, {0, NULL}}; -static CV_PossibleValue_t dummystaff_cons_t[] = {{0, "MIN"}, {100, "MAX"}, {0, NULL}}; +static CV_PossibleValue_t dummystaff_cons_t[] = {{0, "MIN"}, {MAXSTAFF-1, "MAX"}, {0, NULL}}; static consvar_t cv_dummyteam = CVAR_INIT ("dummyteam", "Spectator", CV_HIDDEN, dummyteam_cons_t, NULL); //static cv_dummyspectate = CVAR_INITconsvar_t ("dummyspectate", "Spectator", CV_HIDDEN, dummyspectate_cons_t, NULL); @@ -92,39 +90,15 @@ consvar_t cv_dummyspectate = CVAR_INIT ("dummyspectate", "Spectator", CV_HIDDEN, static void Dummystaff_OnChange(void) { -#ifdef STAFFGHOSTS - lumpnum_t l; + if (mapheaderinfo[levellist.choosemap] == NULL || mapheaderinfo[levellist.choosemap]->ghostCount <= 0) + return; - dummystaffname[0] = '\0'; - - if ((l = W_CheckNumForName(va("%sS01",G_BuildMapName(cv_nextmap.value)))) == LUMPERROR) + 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; } - else - { - char *temp = dummystaffname; - UINT8 numstaff = 1; - while (numstaff < 99 && (l = W_CheckNumForName(va("%sS%02u",G_BuildMapName(cv_nextmap.value),numstaff+1))) != LUMPERROR) - numstaff++; - - if (cv_dummystaff.value < 1) - CV_StealthSetValue(&cv_dummystaff, numstaff); - else if (cv_dummystaff.value > numstaff) - CV_StealthSetValue(&cv_dummystaff, 1); - - if ((l = W_CheckNumForName(va("%sS%02u",G_BuildMapName(cv_nextmap.value), cv_dummystaff.value))) == LUMPERROR) - return; // shouldn't happen but might as well check... - - G_UpdateStaffGhostName(l); - - while (*temp) - temp++; - - sprintf(temp, " - %d", cv_dummystaff.value); - } -#endif //#ifdef STAFFGHOSTS } @@ -968,19 +942,17 @@ static void M_HandleMenuInput(void) if (routine && ((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_ARROWS || (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_CVAR)) { - consvar_t *cv = currentMenu->menuitems[itemOn].itemaction.cvar; + /*consvar_t *cv = currentMenu->menuitems[itemOn].itemaction.cvar; // Make these CVar options? if (cv == &cv_chooseskin || cv == &cv_dummystaff - /* || cv == &cv_nextmap || cv == &cv_newgametype - */ ) { return; - } + }*/ S_StartSound(NULL, sfx_s3k5b); diff --git a/src/menus/play-local-race-time-attack.c b/src/menus/play-local-race-time-attack.c index 244b720b2..9443379f1 100644 --- a/src/menus/play-local-race-time-attack.c +++ b/src/menus/play-local-race-time-attack.c @@ -56,7 +56,7 @@ menuitem_t PLAY_TAReplay[] = {IT_HEADERTEXT|IT_HEADER, "", NULL, NULL, {NULL}, 0, 0}, {IT_STRING | IT_CALL, "Replay Last", NULL, NULL, {.routine = M_ReplayTimeAttack}, 0, 0}, {IT_STRING | IT_CALL, "Replay Guest", NULL, NULL, {.routine = M_ReplayTimeAttack}, 0, 0}, - {IT_STRING | IT_CALL, "Replay Staff", NULL, NULL, {.routine = M_HandleStaffReplay}, 0, 0}, + {IT_STRING | IT_ARROWS, "Replay Staff", NULL, NULL, {.routine = M_HandleStaffReplay}, 0, 0}, {IT_HEADERTEXT|IT_HEADER, "", NULL, NULL, {NULL}, 0, 0}, {IT_STRING | IT_SUBMENU, "Back", NULL, NULL, {.submenu = &PLAY_TimeAttackDef}, 0, 0}, @@ -197,8 +197,6 @@ void M_PrepareTimeAttack(INT32 choice) if (!gpath) return; - CV_StealthSetValue(&cv_dummystaff, 0); - active = false; PLAY_TimeAttack[ta_guest].status = IT_DISABLED; PLAY_TimeAttack[ta_replay].status = IT_DISABLED; @@ -257,16 +255,13 @@ void M_PrepareTimeAttack(INT32 choice) PLAY_TAReplay[tareplay_staff].status = PLAY_TAGhosts[taghost_staff].status = IT_DISABLED; -#ifdef STAFFGHOSTS - CV_SetValue(&cv_dummystaff, 1); - if (cv_dummystaff.value) + if (mapheaderinfo[levellist.choosemap]->ghostCount > 0) { - PLAY_TAReplay[tareplay_staff].status = IT_STRING|IT_KEYHANDLER; + PLAY_TAReplay[tareplay_staff].status = IT_STRING|IT_ARROWS; PLAY_TAGhosts[taghost_staff].status = IT_STRING|IT_CVAR; - CV_StealthSetValue(&cv_dummystaff, 1); + CV_SetValue(&cv_dummystaff, 0); active |= 1|4; } -#endif //#ifdef STAFFGHOSTS if (active & 1) PLAY_TimeAttack[ta_replay].status = IT_STRING|IT_SUBMENU; @@ -287,8 +282,19 @@ void M_PrepareTimeAttack(INT32 choice) void M_HandleStaffReplay(INT32 choice) { - // @TODO: - (void) choice; + if (choice == 2) + { + restoreMenu = &PLAY_TimeAttackDef; + + M_ClearMenus(true); + demo.loadfiles = false; + demo.ignorefiles = true; // Just assume that record attack replays have the files needed + + G_DoPlayDemo(va("%s/GHOST_%u", mapheaderinfo[levellist.choosemap]->lumpname, cv_dummystaff.value+1)); + return; + } + + M_ChangeCvarDirect(choice, &cv_dummystaff); } void M_ReplayTimeAttack(INT32 choice)