mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
M_PrepareTimeAttack
Initialises Time Attack menu
- Check for replay file's existence before showing related options
- Parity with pre-newmenus behaviour
- Replay/guest-save functionality not yet (re)implemented
- Handles mutli-gametype timeattack level select listings more thoroughly
This commit is contained in:
parent
b689e0adf2
commit
493b54d0f2
5 changed files with 145 additions and 5 deletions
|
|
@ -467,6 +467,7 @@ void Moviemode_option_Onchange(void);
|
|||
|
||||
extern menu_t *currentMenu;
|
||||
extern char dummystaffname[22];
|
||||
extern consvar_t cv_dummystaff;
|
||||
|
||||
extern INT16 itemOn; // menu item skull is on, Hack by Tails 09-18-2002
|
||||
extern INT16 skullAnimCounter; // skull animation counter
|
||||
|
|
@ -784,6 +785,7 @@ extern struct mpmenu_s {
|
|||
} mpmenu;
|
||||
|
||||
// Time Attack
|
||||
void M_PrepareTimeAttack(INT32 choice);
|
||||
void M_StartTimeAttack(INT32 choice);
|
||||
void M_ReplayTimeAttack(INT32 choice);
|
||||
void M_HandleStaffReplay(INT32 choice);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ static CV_PossibleValue_t dummystaff_cons_t[] = {{0, "MIN"}, {100, "MAX"}, {0, N
|
|||
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);
|
||||
static consvar_t cv_dummyscramble = CVAR_INIT ("dummyscramble", "Random", CV_HIDDEN, dummyscramble_cons_t, NULL);
|
||||
static consvar_t cv_dummystaff = CVAR_INIT ("dummystaff", "0", CV_HIDDEN|CV_CALL, dummystaff_cons_t, Dummystaff_OnChange);
|
||||
consvar_t cv_dummystaff = CVAR_INIT ("dummystaff", "0", CV_HIDDEN|CV_CALL, dummystaff_cons_t, Dummystaff_OnChange);
|
||||
consvar_t cv_dummyspectate = CVAR_INIT ("dummyspectate", "Spectator", CV_HIDDEN, dummyspectate_cons_t, NULL);
|
||||
|
||||
// ==========================================================================
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "../v_video.h"
|
||||
#include "../d_main.h" // srb2home
|
||||
#include "../m_misc.h" // M_MkdirEach
|
||||
#include "../z_zone.h" // Z_StrDup/Z_Free
|
||||
|
||||
// see ta_e
|
||||
menuitem_t PLAY_TimeAttack[] =
|
||||
|
|
@ -35,6 +36,18 @@ menu_t PLAY_TimeAttackDef = {
|
|||
};
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
tareplay_besttime = 0,
|
||||
tareplay_bestlap,
|
||||
tareplay_gap1,
|
||||
tareplay_last,
|
||||
tareplay_guest,
|
||||
tareplay_staff,
|
||||
tareplay_gap2,
|
||||
tareplay_back
|
||||
} tareplay_e;
|
||||
|
||||
menuitem_t PLAY_TAReplay[] =
|
||||
{
|
||||
{IT_STRING | IT_CALL, "Replay Best Time", NULL, NULL, {.routine = M_ReplayTimeAttack}, 0, 0},
|
||||
|
|
@ -63,6 +76,18 @@ menu_t PLAY_TAReplayDef = {
|
|||
NULL
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
taguest_save = 0,
|
||||
taguest_besttime,
|
||||
taguest_bestlap,
|
||||
taguest_last,
|
||||
taguest_gap1,
|
||||
taguest_delete,
|
||||
taguest_gap2,
|
||||
taguest_back
|
||||
} taguest_e;
|
||||
|
||||
menuitem_t PLAY_TAReplayGuest[] =
|
||||
{
|
||||
{IT_HEADERTEXT|IT_HEADER, "Save as guest...", NULL, NULL, {NULL}, 0, 0},
|
||||
|
|
@ -94,6 +119,17 @@ menu_t PLAY_TAReplayGuestDef = {
|
|||
NULL
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
taghost_besttime = 0,
|
||||
taghost_bestlap,
|
||||
taghost_last,
|
||||
taghost_guest,
|
||||
taghost_staff,
|
||||
taghost_gap1,
|
||||
taghost_back
|
||||
} taghost_e;
|
||||
|
||||
menuitem_t PLAY_TAGhosts[] =
|
||||
{
|
||||
{IT_STRING | IT_CVAR, "Best Time", NULL, NULL, {.cvar = &cv_ghost_besttime}, 0, 0},
|
||||
|
|
@ -134,6 +170,109 @@ consvar_t cv_ghost_guest = CVAR_INIT ("ghost_guest", "Show", CV_SAVE, gh
|
|||
consvar_t cv_ghost_staff = CVAR_INIT ("ghost_staff", "Show", CV_SAVE, ghost2_cons_t, NULL);
|
||||
|
||||
// time attack stuff...
|
||||
void M_PrepareTimeAttack(INT32 choice)
|
||||
{
|
||||
(void) choice;
|
||||
|
||||
if (levellist.guessgt != MAXGAMETYPES)
|
||||
{
|
||||
levellist.newgametype = levellist.guessgt;
|
||||
if (!(gametypes[levellist.newgametype]->tol & mapheaderinfo[levellist.choosemap]->typeoflevel))
|
||||
{
|
||||
INT32 guess = G_GuessGametypeByTOL(mapheaderinfo[levellist.choosemap]->typeoflevel);
|
||||
if (guess != -1)
|
||||
levellist.newgametype = guess;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// see also p_setup.c's P_LoadRecordGhosts
|
||||
char *gpath = Z_StrDup(va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(levellist.choosemap+1)));
|
||||
UINT8 active;
|
||||
|
||||
if (!gpath)
|
||||
return;
|
||||
|
||||
CV_StealthSetValue(&cv_dummystaff, 0);
|
||||
|
||||
active = false;
|
||||
PLAY_TimeAttack[ta_guest].status = IT_DISABLED;
|
||||
PLAY_TimeAttack[ta_replay].status = IT_DISABLED;
|
||||
PLAY_TimeAttack[ta_ghosts].status = IT_DISABLED;
|
||||
|
||||
// Check if file exists, if not, disable options
|
||||
PLAY_TAReplay[tareplay_besttime].status =
|
||||
PLAY_TAReplayGuest[taguest_besttime].status = IT_DISABLED;
|
||||
if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, cv_skin[0].string)))
|
||||
{
|
||||
PLAY_TAReplay[tareplay_besttime].status = IT_STRING|IT_CALL;
|
||||
PLAY_TAReplayGuest[taguest_besttime].status = IT_STRING|IT_CALL;
|
||||
active |= (1|2|4);
|
||||
}
|
||||
|
||||
PLAY_TAReplay[tareplay_bestlap].status =
|
||||
PLAY_TAReplayGuest[taguest_bestlap].status =
|
||||
PLAY_TAGhosts[taghost_bestlap].status = IT_DISABLED;
|
||||
if ((gametypes[levellist.newgametype]->rules & GTR_CIRCUIT)
|
||||
&& (mapheaderinfo[levellist.choosemap]->numlaps > 1)
|
||||
&& FIL_FileExists(va("%s-%s-lap-best.lmp", gpath, cv_skin[0].string)))
|
||||
{
|
||||
PLAY_TAReplay[tareplay_bestlap].status = IT_STRING|IT_CALL;
|
||||
PLAY_TAReplayGuest[taguest_bestlap].status = IT_STRING|IT_CALL;
|
||||
PLAY_TAGhosts[taghost_bestlap].status = IT_STRING|IT_CVAR;
|
||||
active |= (1|2|4);
|
||||
}
|
||||
|
||||
PLAY_TAReplay[tareplay_last].status =
|
||||
PLAY_TAReplayGuest[taguest_last].status = IT_DISABLED;
|
||||
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, cv_skin[0].string)))
|
||||
{
|
||||
PLAY_TAReplay[tareplay_last].status = IT_STRING|IT_CALL;
|
||||
PLAY_TAReplayGuest[taguest_last].status = IT_STRING|IT_CALL;
|
||||
active |= (1|2|4);
|
||||
}
|
||||
|
||||
PLAY_TAReplay[tareplay_guest].status =
|
||||
PLAY_TAGhosts[taghost_guest].status =
|
||||
PLAY_TAReplayGuest[taguest_delete].status = IT_DISABLED;
|
||||
if (FIL_FileExists(va("%s-guest.lmp", gpath)))
|
||||
{
|
||||
PLAY_TAReplay[tareplay_guest].status = IT_STRING|IT_CALL;
|
||||
PLAY_TAReplayGuest[taguest_delete].status = IT_STRING|IT_CALL;
|
||||
PLAY_TAGhosts[taghost_guest].status = IT_STRING|IT_CVAR;
|
||||
active |= (1|2|4);
|
||||
}
|
||||
|
||||
PLAY_TAReplay[tareplay_staff].status =
|
||||
PLAY_TAGhosts[taghost_staff].status = IT_DISABLED;
|
||||
#ifdef STAFFGHOSTS
|
||||
CV_SetValue(&cv_dummystaff, 1);
|
||||
if (cv_dummystaff.value)
|
||||
{
|
||||
PLAY_TAReplay[tareplay_staff].status = IT_STRING|IT_KEYHANDLER;
|
||||
PLAY_TAGhosts[taghost_staff].status = IT_STRING|IT_CVAR;
|
||||
CV_StealthSetValue(&cv_dummystaff, 1);
|
||||
active |= 1|4;
|
||||
}
|
||||
#endif //#ifdef STAFFGHOSTS
|
||||
|
||||
if (active & 1)
|
||||
PLAY_TimeAttack[ta_replay].status = IT_STRING|IT_SUBMENU;
|
||||
else if (PLAY_TimeAttackDef.lastOn == ta_replay)
|
||||
PLAY_TimeAttackDef.lastOn = ta_start;
|
||||
if (active & 2)
|
||||
PLAY_TimeAttack[ta_guest].status = IT_STRING|IT_SUBMENU;
|
||||
else if (PLAY_TimeAttackDef.lastOn == ta_guest)
|
||||
PLAY_TimeAttackDef.lastOn = ta_start;
|
||||
//if (active & 4) -- for possible future use
|
||||
PLAY_TimeAttack[ta_ghosts].status = IT_STRING|IT_SUBMENU;
|
||||
/*else if (PLAY_TimeAttackDef.lastOn == ta_ghosts)
|
||||
PLAY_TimeAttackDef.lastOn = ta_start;*/
|
||||
|
||||
Z_Free(gpath);
|
||||
}
|
||||
}
|
||||
|
||||
void M_HandleStaffReplay(INT32 choice)
|
||||
{
|
||||
// @TODO:
|
||||
|
|
|
|||
|
|
@ -424,8 +424,7 @@ void M_LevelSelected(INT16 add)
|
|||
{
|
||||
S_StartSound(NULL, sfx_s3k63);
|
||||
|
||||
if (levellist.guessgt != MAXGAMETYPES)
|
||||
levellist.newgametype = G_GuessGametypeByTOL(levellist.levelsearch.typeoflevel);
|
||||
M_PrepareTimeAttack(0);
|
||||
|
||||
PLAY_TimeAttackDef.lastOn = ta_start;
|
||||
PLAY_TimeAttackDef.prevMenu = currentMenu;
|
||||
|
|
|
|||
|
|
@ -7139,7 +7139,7 @@ static void P_ResetSpawnpoints(void)
|
|||
|
||||
static void P_LoadRecordGhosts(void)
|
||||
{
|
||||
// see also k_menu.c's Nextmap_OnChange
|
||||
// see also /menus/play-local-race-time-attack.c's M_PrepareTimeAttack
|
||||
char *gpath;
|
||||
INT32 i;
|
||||
|
||||
|
|
@ -7200,7 +7200,7 @@ static void P_LoadRecordGhosts(void)
|
|||
{
|
||||
lumpnum_t l;
|
||||
UINT8 j = 1;
|
||||
// TODO: Use map header to determine lump name
|
||||
// TODO: Use vres for lumps
|
||||
while (j <= 99 && (l = W_CheckNumForLongName(va("%sS%02u",G_BuildMapName(gamemap),j))) != LUMPERROR)
|
||||
{
|
||||
G_AddGhost(va("%sS%02u",G_BuildMapName(gamemap),j));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue