mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 04:21:47 +00:00
Save SPB Attack replays with "spb-" in the file name
- Files
- spb-time-best
- spb-time-lap
- spb-last
- Menu
- Toggling SPB Attack refreshes the menu (to show/hide
certain replay options)
This commit is contained in:
parent
2bf115cd46
commit
378fb8ed07
3 changed files with 78 additions and 43 deletions
12
src/g_game.c
12
src/g_game.c
|
|
@ -582,6 +582,12 @@ static void G_UpdateRecordReplays(void)
|
||||||
{
|
{
|
||||||
char *gpath;
|
char *gpath;
|
||||||
char lastdemo[256], bestdemo[256];
|
char lastdemo[256], bestdemo[256];
|
||||||
|
const char *modeprefix = "";
|
||||||
|
|
||||||
|
if (modeattacking & ATTACKING_SPB)
|
||||||
|
{
|
||||||
|
modeprefix = "spb-";
|
||||||
|
}
|
||||||
|
|
||||||
if (players[consoleplayer].pflags & PF_NOCONTEST)
|
if (players[consoleplayer].pflags & PF_NOCONTEST)
|
||||||
{
|
{
|
||||||
|
|
@ -601,7 +607,7 @@ static void G_UpdateRecordReplays(void)
|
||||||
strcat(gpath, PATHSEP);
|
strcat(gpath, PATHSEP);
|
||||||
strcat(gpath, G_BuildMapName(gamemap));
|
strcat(gpath, G_BuildMapName(gamemap));
|
||||||
|
|
||||||
snprintf(lastdemo, 255, "%s-%s-last.lmp", gpath, cv_skin[0].string);
|
snprintf(lastdemo, 255, "%s-%s-%slast.lmp", gpath, cv_skin[0].string, modeprefix);
|
||||||
|
|
||||||
if (modeattacking != ATTACKING_NONE && FIL_FileExists(lastdemo))
|
if (modeattacking != ATTACKING_NONE && FIL_FileExists(lastdemo))
|
||||||
{
|
{
|
||||||
|
|
@ -614,7 +620,7 @@ static void G_UpdateRecordReplays(void)
|
||||||
|
|
||||||
if (modeattacking & ATTACKING_TIME)
|
if (modeattacking & ATTACKING_TIME)
|
||||||
{
|
{
|
||||||
snprintf(bestdemo, 255, "%s-%s-time-best.lmp", gpath, cv_skin[0].string);
|
snprintf(bestdemo, 255, "%s-%s-%stime-best.lmp", gpath, cv_skin[0].string, modeprefix);
|
||||||
if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & 1)
|
if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & 1)
|
||||||
{ // Better time, save this demo.
|
{ // Better time, save this demo.
|
||||||
if (FIL_FileExists(bestdemo))
|
if (FIL_FileExists(bestdemo))
|
||||||
|
|
@ -626,7 +632,7 @@ static void G_UpdateRecordReplays(void)
|
||||||
|
|
||||||
if (modeattacking & ATTACKING_LAP)
|
if (modeattacking & ATTACKING_LAP)
|
||||||
{
|
{
|
||||||
snprintf(bestdemo, 255, "%s-%s-lap-best.lmp", gpath, cv_skin[0].string);
|
snprintf(bestdemo, 255, "%s-%s-%slap-best.lmp", gpath, cv_skin[0].string, modeprefix);
|
||||||
if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & (1<<1))
|
if (!FIL_FileExists(bestdemo) || G_CmpDemoTime(bestdemo, lastdemo) & (1<<1))
|
||||||
{ // Better lap time, save this demo.
|
{ // Better lap time, save this demo.
|
||||||
if (FIL_FileExists(bestdemo))
|
if (FIL_FileExists(bestdemo))
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,6 @@
|
||||||
#include "../z_zone.h" // Z_StrDup/Z_Free
|
#include "../z_zone.h" // Z_StrDup/Z_Free
|
||||||
#include "../m_cond.h"
|
#include "../m_cond.h"
|
||||||
|
|
||||||
void CV_SPBAttackChanged(void);
|
|
||||||
void CV_SPBAttackChanged(void)
|
|
||||||
{
|
|
||||||
G_UpdateTimeStickerMedals(levellist.choosemap, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct timeattackmenu_s timeattackmenu;
|
struct timeattackmenu_s timeattackmenu;
|
||||||
|
|
||||||
void M_TimeAttackTick(void)
|
void M_TimeAttackTick(void)
|
||||||
|
|
@ -214,40 +208,24 @@ menu_t PLAY_TAGhostsDef = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
// time attack stuff...
|
void CV_SPBAttackChanged(void);
|
||||||
void M_PrepareTimeAttack(INT32 choice)
|
void CV_SPBAttackChanged(void)
|
||||||
{
|
{
|
||||||
(void) choice;
|
|
||||||
|
|
||||||
timeattackmenu.ticker = 0;
|
|
||||||
|
|
||||||
// Gametype guess
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (levellist.levelsearch.timeattack == false || levellist.newgametype != GT_RACE || !M_SecretUnlocked(SECRET_SPBATTACK, true))
|
|
||||||
CV_SetValue(&cv_dummyspbattack, 0);
|
|
||||||
|
|
||||||
// Time-sticker Medals
|
|
||||||
G_UpdateTimeStickerMedals(levellist.choosemap, false);
|
G_UpdateTimeStickerMedals(levellist.choosemap, false);
|
||||||
|
|
||||||
// Menu options
|
// Menu options
|
||||||
{
|
{
|
||||||
// see also p_setup.c's P_LoadRecordGhosts
|
// 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)));
|
char *gpath = Z_StrDup(va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s", srb2home, timeattackfolder, G_BuildMapName(levellist.choosemap+1)));
|
||||||
|
const char *modeprefix = "";
|
||||||
UINT8 active;
|
UINT8 active;
|
||||||
|
|
||||||
if (!gpath)
|
if (!gpath)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (cv_dummyspbattack.value)
|
||||||
|
modeprefix = "spb-";
|
||||||
|
|
||||||
active = false;
|
active = false;
|
||||||
PLAY_TimeAttack[ta_guest].status = IT_DISABLED;
|
PLAY_TimeAttack[ta_guest].status = IT_DISABLED;
|
||||||
PLAY_TimeAttack[ta_replay].status = IT_DISABLED;
|
PLAY_TimeAttack[ta_replay].status = IT_DISABLED;
|
||||||
|
|
@ -256,11 +234,11 @@ void M_PrepareTimeAttack(INT32 choice)
|
||||||
// Check if file exists, if not, disable options
|
// Check if file exists, if not, disable options
|
||||||
PLAY_TAReplay[tareplay_besttime].status =
|
PLAY_TAReplay[tareplay_besttime].status =
|
||||||
PLAY_TAReplayGuest[taguest_besttime].status = IT_DISABLED;
|
PLAY_TAReplayGuest[taguest_besttime].status = IT_DISABLED;
|
||||||
if (FIL_FileExists(va("%s-%s-time-best.lmp", gpath, cv_skin[0].string)))
|
if (FIL_FileExists(va("%s-%s-%stime-best.lmp", gpath, cv_skin[0].string, modeprefix)))
|
||||||
{
|
{
|
||||||
PLAY_TAReplay[tareplay_besttime].status = IT_STRING|IT_CALL;
|
PLAY_TAReplay[tareplay_besttime].status = IT_STRING|IT_CALL;
|
||||||
PLAY_TAReplayGuest[taguest_besttime].status = IT_STRING|IT_CALL;
|
PLAY_TAReplayGuest[taguest_besttime].status = IT_STRING|IT_CALL;
|
||||||
active |= (1|2|4);
|
active |= (1|2|4|8);
|
||||||
}
|
}
|
||||||
else if (PLAY_TAReplayGuestDef.lastOn == taguest_besttime)
|
else if (PLAY_TAReplayGuestDef.lastOn == taguest_besttime)
|
||||||
PLAY_TAReplayGuestDef.lastOn = taguest_back;
|
PLAY_TAReplayGuestDef.lastOn = taguest_back;
|
||||||
|
|
@ -270,23 +248,23 @@ void M_PrepareTimeAttack(INT32 choice)
|
||||||
PLAY_TAGhosts[taghost_bestlap].status = IT_DISABLED;
|
PLAY_TAGhosts[taghost_bestlap].status = IT_DISABLED;
|
||||||
if ((gametypes[levellist.newgametype]->rules & GTR_CIRCUIT)
|
if ((gametypes[levellist.newgametype]->rules & GTR_CIRCUIT)
|
||||||
&& (mapheaderinfo[levellist.choosemap]->numlaps != 1)
|
&& (mapheaderinfo[levellist.choosemap]->numlaps != 1)
|
||||||
&& FIL_FileExists(va("%s-%s-lap-best.lmp", gpath, cv_skin[0].string)))
|
&& FIL_FileExists(va("%s-%s-%slap-best.lmp", gpath, cv_skin[0].string, modeprefix)))
|
||||||
{
|
{
|
||||||
PLAY_TAReplay[tareplay_bestlap].status = IT_STRING|IT_CALL;
|
PLAY_TAReplay[tareplay_bestlap].status = IT_STRING|IT_CALL;
|
||||||
PLAY_TAReplayGuest[taguest_bestlap].status = IT_STRING|IT_CALL;
|
PLAY_TAReplayGuest[taguest_bestlap].status = IT_STRING|IT_CALL;
|
||||||
PLAY_TAGhosts[taghost_bestlap].status = IT_STRING|IT_CVAR;
|
PLAY_TAGhosts[taghost_bestlap].status = IT_STRING|IT_CVAR;
|
||||||
active |= (1|2|4);
|
active |= (1|2|4|8);
|
||||||
}
|
}
|
||||||
else if (PLAY_TAReplayGuestDef.lastOn == taguest_bestlap)
|
else if (PLAY_TAReplayGuestDef.lastOn == taguest_bestlap)
|
||||||
PLAY_TAReplayGuestDef.lastOn = taguest_back;
|
PLAY_TAReplayGuestDef.lastOn = taguest_back;
|
||||||
|
|
||||||
PLAY_TAReplay[tareplay_last].status =
|
PLAY_TAReplay[tareplay_last].status =
|
||||||
PLAY_TAReplayGuest[taguest_last].status = IT_DISABLED;
|
PLAY_TAReplayGuest[taguest_last].status = IT_DISABLED;
|
||||||
if (FIL_FileExists(va("%s-%s-last.lmp", gpath, cv_skin[0].string)))
|
if (FIL_FileExists(va("%s-%s-%slast.lmp", gpath, cv_skin[0].string, modeprefix)))
|
||||||
{
|
{
|
||||||
PLAY_TAReplay[tareplay_last].status = IT_STRING|IT_CALL;
|
PLAY_TAReplay[tareplay_last].status = IT_STRING|IT_CALL;
|
||||||
PLAY_TAReplayGuest[taguest_last].status = IT_STRING|IT_CALL;
|
PLAY_TAReplayGuest[taguest_last].status = IT_STRING|IT_CALL;
|
||||||
active |= (1|2|4);
|
active |= (1|2|4|8);
|
||||||
}
|
}
|
||||||
else if (PLAY_TAReplayGuestDef.lastOn == taguest_last)
|
else if (PLAY_TAReplayGuestDef.lastOn == taguest_last)
|
||||||
PLAY_TAReplayGuestDef.lastOn = taguest_back;
|
PLAY_TAReplayGuestDef.lastOn = taguest_back;
|
||||||
|
|
@ -314,6 +292,9 @@ void M_PrepareTimeAttack(INT32 choice)
|
||||||
active |= 1|4;
|
active |= 1|4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentMenu == &PLAY_TimeAttackDef)
|
||||||
|
PLAY_TimeAttackDef.lastOn = itemOn;
|
||||||
|
|
||||||
if (active & 1)
|
if (active & 1)
|
||||||
PLAY_TimeAttack[ta_replay].status = IT_STRING|IT_SUBMENU;
|
PLAY_TimeAttack[ta_replay].status = IT_STRING|IT_SUBMENU;
|
||||||
else if (PLAY_TimeAttackDef.lastOn == ta_replay)
|
else if (PLAY_TimeAttackDef.lastOn == ta_replay)
|
||||||
|
|
@ -327,10 +308,42 @@ void M_PrepareTimeAttack(INT32 choice)
|
||||||
/*else if (PLAY_TimeAttackDef.lastOn == ta_ghosts)
|
/*else if (PLAY_TimeAttackDef.lastOn == ta_ghosts)
|
||||||
PLAY_TimeAttackDef.lastOn = ta_start;*/
|
PLAY_TimeAttackDef.lastOn = ta_start;*/
|
||||||
|
|
||||||
|
if ((active & 8) && levellist.newgametype == GT_RACE && M_SecretUnlocked(SECRET_SPBATTACK, true))
|
||||||
|
PLAY_TAReplay[tareplay_header].status = IT_HEADER;
|
||||||
|
|
||||||
|
if (currentMenu == &PLAY_TimeAttackDef)
|
||||||
|
itemOn = PLAY_TimeAttackDef.lastOn;
|
||||||
|
|
||||||
Z_Free(gpath);
|
Z_Free(gpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// time attack stuff...
|
||||||
|
void M_PrepareTimeAttack(INT32 choice)
|
||||||
|
{
|
||||||
|
(void) choice;
|
||||||
|
|
||||||
|
timeattackmenu.ticker = 0;
|
||||||
|
|
||||||
|
// Gametype guess
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (levellist.levelsearch.timeattack == false || levellist.newgametype != GT_RACE || !M_SecretUnlocked(SECRET_SPBATTACK, true))
|
||||||
|
CV_StealthSetValue(&cv_dummyspbattack, 0);
|
||||||
|
|
||||||
|
// Menu options / Time-sticker medals
|
||||||
|
CV_SPBAttackChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void M_HandleStaffReplay(INT32 choice)
|
void M_HandleStaffReplay(INT32 choice)
|
||||||
{
|
{
|
||||||
if (choice == 2)
|
if (choice == 2)
|
||||||
|
|
@ -383,7 +396,12 @@ void M_ReplayTimeAttack(INT32 choice)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_DoPlayDemo(va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(levellist.choosemap+1), cv_skin[0].string, which));
|
const char *modeprefix = "";
|
||||||
|
|
||||||
|
if (cv_dummyspbattack.value)
|
||||||
|
modeprefix = "spb-";
|
||||||
|
|
||||||
|
G_DoPlayDemo(va("%s"PATHSEP"media"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s%s.lmp", srb2home, timeattackfolder, G_BuildMapName(levellist.choosemap+1), cv_skin[0].string, modeprefix, which));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *TA_GuestReplay_Str = NULL;
|
static const char *TA_GuestReplay_Str = NULL;
|
||||||
|
|
@ -402,7 +420,12 @@ static void M_WriteGuestReplay(INT32 ch)
|
||||||
|
|
||||||
if (TA_GuestReplay_Str != NULL)
|
if (TA_GuestReplay_Str != NULL)
|
||||||
{
|
{
|
||||||
len = FIL_ReadFile(va("%s-%s-%s.lmp", gpath, cv_skin[0].string, TA_GuestReplay_Str), &buf);
|
const char *modeprefix = "";
|
||||||
|
|
||||||
|
if (cv_dummyspbattack.value)
|
||||||
|
modeprefix = "spb-";
|
||||||
|
|
||||||
|
len = FIL_ReadFile(va("%s-%s-%s%s.lmp", gpath, cv_skin[0].string, modeprefix, TA_GuestReplay_Str), &buf);
|
||||||
if (!len)
|
if (!len)
|
||||||
{
|
{
|
||||||
M_StartMessage("Guest Replay", "Replay to copy no longer exists!", NULL, MM_NOTHING, NULL, NULL);
|
M_StartMessage("Guest Replay", "Replay to copy no longer exists!", NULL, MM_NOTHING, NULL, NULL);
|
||||||
|
|
@ -468,6 +491,7 @@ void M_StartTimeAttack(INT32 choice)
|
||||||
{
|
{
|
||||||
char *gpath;
|
char *gpath;
|
||||||
char nameofdemo[256];
|
char nameofdemo[256];
|
||||||
|
const char *modeprefix = "";
|
||||||
|
|
||||||
(void)choice;
|
(void)choice;
|
||||||
|
|
||||||
|
|
@ -482,6 +506,7 @@ void M_StartTimeAttack(INT32 choice)
|
||||||
if (cv_dummyspbattack.value)
|
if (cv_dummyspbattack.value)
|
||||||
{
|
{
|
||||||
modeattacking |= ATTACKING_SPB;
|
modeattacking |= ATTACKING_SPB;
|
||||||
|
modeprefix = "spb-";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Still need to reset devmode
|
// Still need to reset devmode
|
||||||
|
|
@ -516,7 +541,7 @@ void M_StartTimeAttack(INT32 choice)
|
||||||
strcat(gpath, PATHSEP);
|
strcat(gpath, PATHSEP);
|
||||||
strcat(gpath, G_BuildMapName(levellist.choosemap+1));
|
strcat(gpath, G_BuildMapName(levellist.choosemap+1));
|
||||||
|
|
||||||
snprintf(nameofdemo, sizeof nameofdemo, "%s-%s-last", gpath, cv_skin[0].string);
|
snprintf(nameofdemo, sizeof nameofdemo, "%s-%s-%slast", gpath, cv_skin[0].string, modeprefix);
|
||||||
|
|
||||||
if (!cv_autorecord.value)
|
if (!cv_autorecord.value)
|
||||||
remove(va("%s"PATHSEP"%s.lmp", srb2home, nameofdemo));
|
remove(va("%s"PATHSEP"%s.lmp", srb2home, nameofdemo));
|
||||||
|
|
|
||||||
|
|
@ -7785,10 +7785,14 @@ static void P_LoadRecordGhosts(void)
|
||||||
{
|
{
|
||||||
// see also /menus/play-local-race-time-attack.c's M_PrepareTimeAttack
|
// see also /menus/play-local-race-time-attack.c's M_PrepareTimeAttack
|
||||||
char *gpath;
|
char *gpath;
|
||||||
|
const char *modeprefix = "";
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
gpath = Z_StrDup(va("%s" PATHSEP "media" PATHSEP "replay" PATHSEP "%s" PATHSEP "%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)));
|
gpath = Z_StrDup(va("%s" PATHSEP "media" PATHSEP "replay" PATHSEP "%s" PATHSEP "%s", srb2home, timeattackfolder, G_BuildMapName(gamemap)));
|
||||||
|
|
||||||
|
if (modeattacking & ATTACKING_SPB)
|
||||||
|
modeprefix = "spb-";
|
||||||
|
|
||||||
// Best Time ghost
|
// Best Time ghost
|
||||||
if (modeattacking & ATTACKING_TIME)
|
if (modeattacking & ATTACKING_TIME)
|
||||||
{
|
{
|
||||||
|
|
@ -7799,7 +7803,7 @@ static void P_LoadRecordGhosts(void)
|
||||||
if (cv_ghost_besttime.value == 1 && players[consoleplayer].skin != i)
|
if (cv_ghost_besttime.value == 1 && players[consoleplayer].skin != i)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
P_TryAddExternalGhost(va("%s-%s-time-best.lmp", gpath, skins[i].name));
|
P_TryAddExternalGhost(va("%s-%s-%stime-best.lmp", gpath, skins[i].name, modeprefix));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7814,7 +7818,7 @@ static void P_LoadRecordGhosts(void)
|
||||||
if (cv_ghost_bestlap.value == 1 && players[consoleplayer].skin != i)
|
if (cv_ghost_bestlap.value == 1 && players[consoleplayer].skin != i)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
P_TryAddExternalGhost(va("%s-%s-lap-best.lmp", gpath, skins[i].name));
|
P_TryAddExternalGhost(va("%s-%s-%slap-best.lmp", gpath, skins[i].name, modeprefix));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7827,7 +7831,7 @@ static void P_LoadRecordGhosts(void)
|
||||||
if (cv_ghost_last.value == 1 && players[consoleplayer].skin != i)
|
if (cv_ghost_last.value == 1 && players[consoleplayer].skin != i)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
P_TryAddExternalGhost(va("%s-%s-last.lmp", gpath, skins[i].name));
|
P_TryAddExternalGhost(va("%s-%s-%slast.lmp", gpath, skins[i].name, modeprefix));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue