mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-26 16:36:05 +00:00
Make a first-class feature instead of a passworded secret
- Now called "Grand Prix Backup"
- Filename is now `gpringsav.bkp`
- Since available in standard contexts, do a little extra guarding against unsporting behaviour:
- In non-DEVELOP builds, delete Grand Prix Backup when returning to the titlescreen/menus.
- "undo your extra work and make it more generic" - Tyron
This commit is contained in:
parent
304bd383de
commit
12ff436877
10 changed files with 37 additions and 69 deletions
|
|
@ -140,7 +140,7 @@ UINT16 numskincolors;
|
|||
menucolor_t *menucolorhead, *menucolortail;
|
||||
|
||||
char savegamename[256];
|
||||
char liveeventbackup[256];
|
||||
char gpbackup[256];
|
||||
|
||||
char srb2home[256] = ".";
|
||||
char srb2path[256] = ".";
|
||||
|
|
@ -1327,7 +1327,7 @@ void D_SRB2Main(void)
|
|||
|
||||
// default savegame
|
||||
strcpy(savegamename, SAVEGAMENAME"%u.ssg");
|
||||
strcpy(liveeventbackup, "live"SAVEGAMENAME".bkp"); // intentionally not ending with .ssg
|
||||
strcpy(gpbackup, "gp"SAVEGAMENAME".bkp"); // intentionally not ending with .ssg
|
||||
|
||||
// Init the joined IP table for quick rejoining of past games.
|
||||
M_InitJoinedIPArray();
|
||||
|
|
@ -1358,7 +1358,7 @@ void D_SRB2Main(void)
|
|||
|
||||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, srb2home, PATHSEP);
|
||||
strcatbf(liveeventbackup, srb2home, PATHSEP);
|
||||
strcatbf(gpbackup, srb2home, PATHSEP);
|
||||
|
||||
snprintf(luafiledir, sizeof luafiledir, "%s" PATHSEP "luafiles", srb2home);
|
||||
#else // DEFAULTDIR
|
||||
|
|
@ -1370,7 +1370,7 @@ void D_SRB2Main(void)
|
|||
|
||||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, userhome, PATHSEP);
|
||||
strcatbf(liveeventbackup, userhome, PATHSEP);
|
||||
strcatbf(gpbackup, userhome, PATHSEP);
|
||||
|
||||
snprintf(luafiledir, sizeof luafiledir, "%s" PATHSEP "luafiles", userhome);
|
||||
#endif // DEFAULTDIR
|
||||
|
|
|
|||
|
|
@ -6241,6 +6241,11 @@ void Command_ExitGame_f(void)
|
|||
{
|
||||
INT32 i;
|
||||
|
||||
#ifndef DEVELOP
|
||||
// Wipes gp backup if appropriate
|
||||
G_HandleSaveLevel(true);
|
||||
#endif
|
||||
|
||||
LUA_HookBool(false, HOOK(GameQuit));
|
||||
|
||||
D_QuitNetGame();
|
||||
|
|
|
|||
|
|
@ -2997,8 +2997,8 @@ void readmaincfg(MYFILE *f, boolean mainfile)
|
|||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, srb2home, PATHSEP);
|
||||
|
||||
strcpy(liveeventbackup, va("live%s.bkp", timeattackfolder));
|
||||
strcatbf(liveeventbackup, srb2home, PATHSEP);
|
||||
strcpy(gpbackup, va("gp%s.bkp", timeattackfolder));
|
||||
strcatbf(gpbackup, srb2home, PATHSEP);
|
||||
|
||||
refreshdirmenu |= REFRESHDIR_GAMEDATA;
|
||||
gamedataadded = true;
|
||||
|
|
|
|||
|
|
@ -519,7 +519,7 @@ void CONS_Debug(UINT32 debugflags, const char *fmt, ...) FUNCDEBUG;
|
|||
// Things that used to be in dstrings.h
|
||||
#define SAVEGAMENAME "ringsav"
|
||||
extern char savegamename[256];
|
||||
extern char liveeventbackup[256];
|
||||
extern char gpbackup[256];
|
||||
|
||||
// m_misc.h
|
||||
#ifdef GETTEXT
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ extern UINT32 maptol;
|
|||
|
||||
extern INT32 cursaveslot;
|
||||
extern UINT8 lastqueuesaved;
|
||||
extern boolean makelivebackup;
|
||||
extern UINT8 gamecomplete;
|
||||
|
||||
// Extra abilities/settings for skins (combinable stuff)
|
||||
|
|
|
|||
32
src/g_game.c
32
src/g_game.c
|
|
@ -124,7 +124,6 @@ preciptype_t precip_freeslot = PRECIP_FIRSTFREESLOT;
|
|||
|
||||
INT32 cursaveslot = 0; // Auto-save 1p savegame slot
|
||||
UINT8 lastqueuesaved = 0;
|
||||
boolean makelivebackup = false;
|
||||
UINT8 gamecomplete = 0;
|
||||
|
||||
marathonmode_t marathonmode = 0;
|
||||
|
|
@ -4018,17 +4017,16 @@ void G_UpdateVisited(void)
|
|||
G_SaveGameData();
|
||||
}
|
||||
|
||||
void G_HandleSaveLevel(void)
|
||||
void G_HandleSaveLevel(boolean removecondition)
|
||||
{
|
||||
if (!grandprixinfo.gp || !grandprixinfo.cup
|
||||
|| splitscreen || netgame
|
||||
|| !(makelivebackup || cursaveslot > 0))
|
||||
|| splitscreen || netgame)
|
||||
return;
|
||||
|
||||
if (gamestate == GS_CEREMONY && makelivebackup)
|
||||
if (removecondition)
|
||||
{
|
||||
if (FIL_FileExists(liveeventbackup))
|
||||
remove(liveeventbackup);
|
||||
if (FIL_FileExists(gpbackup))
|
||||
remove(gpbackup);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -5665,10 +5663,10 @@ void G_LoadGame(void)
|
|||
// memset savedata to all 0, fixes calling perfectly valid saves corrupt because of bots
|
||||
memset(&savedata, 0, sizeof(savedata));
|
||||
|
||||
if (makelivebackup)
|
||||
strcpy(savename, liveeventbackup);
|
||||
else
|
||||
sprintf(savename, savegamename, cursaveslot);
|
||||
//if (makelivebackup)
|
||||
strcpy(savename, gpbackup);
|
||||
//else
|
||||
//sprintf(savename, savegamename, cursaveslot);
|
||||
|
||||
if (P_SaveBufferFromFile(&save, savename) == false)
|
||||
{
|
||||
|
|
@ -5677,7 +5675,7 @@ void G_LoadGame(void)
|
|||
}
|
||||
|
||||
memset(vcheck, 0, sizeof (vcheck));
|
||||
sprintf(vcheck, (makelivebackup ? "back-up %d" : "version %d"), VERSION);
|
||||
sprintf(vcheck, "version %d", VERSION);
|
||||
if (strcmp((const char *)save.p, (const char *)vcheck))
|
||||
{
|
||||
M_StartMessage("Savegame Load", va(M_GetText("Save game %s from different version"), savename), NULL, MM_NOTHING, NULL, "Return to Menu");
|
||||
|
|
@ -5718,10 +5716,10 @@ void G_SaveGame(void)
|
|||
char savename[256] = "";
|
||||
savebuffer_t save = {0};
|
||||
|
||||
if (makelivebackup)
|
||||
strcpy(savename, liveeventbackup);
|
||||
else
|
||||
sprintf(savename, savegamename, cursaveslot);
|
||||
//if (makelivebackup)
|
||||
strcpy(savename, gpbackup);
|
||||
//else
|
||||
//sprintf(savename, savegamename, cursaveslot);
|
||||
|
||||
gameaction = ga_nothing;
|
||||
{
|
||||
|
|
@ -5735,7 +5733,7 @@ void G_SaveGame(void)
|
|||
}
|
||||
|
||||
memset(name, 0, sizeof (name));
|
||||
sprintf(name, (makelivebackup ? "back-up %d" : "version %d"), VERSION);
|
||||
sprintf(name, "version %d", VERSION);
|
||||
WRITEMEM(save.p, name, VERSIONSIZE);
|
||||
|
||||
P_SaveGame(&save);
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ void G_StartTitleCard(void);
|
|||
void G_PreLevelTitleCard(void);
|
||||
boolean G_IsTitleCardAvailable(void);
|
||||
|
||||
void G_HandleSaveLevel(void);
|
||||
void G_HandleSaveLevel(boolean removecondition);
|
||||
void G_SaveGame(void);
|
||||
void G_LoadGame(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -116,26 +116,6 @@ static UINT8 cheatf_wrongwarp(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static UINT8 cheatf_backup(void)
|
||||
{
|
||||
/*if (modifiedgame)
|
||||
return 0;*/
|
||||
|
||||
makelivebackup = true;
|
||||
|
||||
M_ClearMenus(true);
|
||||
S_StartSound(0, sfx_kc42);
|
||||
|
||||
M_StartMessage("Live Event Mode",
|
||||
M_GetText(
|
||||
"Your progression in GP cups will be.\n"
|
||||
"backed up whenever you complete a\n"
|
||||
"round, in case of game crashes.\n"
|
||||
), NULL, MM_NOTHING, NULL, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef DEVELOP
|
||||
static UINT8 cheatf_devmode(void)
|
||||
{
|
||||
|
|
@ -172,16 +152,6 @@ static cheatseq_t cheat_wrongwarp = {
|
|||
(UINT8[]){ SCRAMBLE('b'), SCRAMBLE('a'), SCRAMBLE('n'), SCRAMBLE('a'), SCRAMBLE('n'), SCRAMBLE('a'), 0xff }
|
||||
};
|
||||
|
||||
static cheatseq_t cheat_backup1 = {
|
||||
NULL, cheatf_backup,
|
||||
(UINT8[]){ SCRAMBLE('s'), SCRAMBLE('a'), SCRAMBLE('v'), SCRAMBLE('e'), SCRAMBLE('t'), SCRAMBLE('h'), SCRAMBLE('e'), SCRAMBLE('f'), SCRAMBLE('r'), SCRAMBLE('a'), SCRAMBLE('m'), SCRAMBLE('e'), SCRAMBLE('s'), 0xff }
|
||||
};
|
||||
|
||||
static cheatseq_t cheat_backup2 = {
|
||||
NULL, cheatf_backup,
|
||||
(UINT8[]){ SCRAMBLE('s'), SCRAMBLE('a'), SCRAMBLE('v'), SCRAMBLE('e'), SCRAMBLE('t'), SCRAMBLE('h'), SCRAMBLE('e'), SCRAMBLE('a'), SCRAMBLE('n'), SCRAMBLE('i'), SCRAMBLE('m'), SCRAMBLE('a'), SCRAMBLE('l'), SCRAMBLE('s'), 0xff }
|
||||
};
|
||||
|
||||
#ifdef DEVELOP
|
||||
static cheatseq_t cheat_devmode = {
|
||||
NULL, cheatf_devmode,
|
||||
|
|
@ -193,8 +163,6 @@ cheatseq_t *cheatseqlist[] =
|
|||
{
|
||||
&cheat_warp,
|
||||
&cheat_wrongwarp,
|
||||
&cheat_backup1,
|
||||
&cheat_backup2,
|
||||
#ifdef DEVELOP
|
||||
&cheat_devmode,
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -487,11 +487,10 @@ void M_CharacterSelectInit(void)
|
|||
}
|
||||
|
||||
|
||||
static void M_MarathonLiveEventBackup(INT32 choice)
|
||||
static void M_GPBackup(INT32 choice)
|
||||
{
|
||||
if (choice == MA_YES)
|
||||
{
|
||||
makelivebackup = true;
|
||||
G_LoadGame();
|
||||
|
||||
if (savedata.lives != 0)
|
||||
|
|
@ -550,8 +549,8 @@ static void M_MarathonLiveEventBackup(INT32 choice)
|
|||
}
|
||||
else if (choice == MA_NO)
|
||||
{
|
||||
if (FIL_FileExists(liveeventbackup)) // just in case someone deleted it while we weren't looking.
|
||||
remove(liveeventbackup);
|
||||
if (FIL_FileExists(gpbackup)) // just in case someone deleted it while we weren't looking.
|
||||
remove(gpbackup);
|
||||
|
||||
M_CharacterSelect(0);
|
||||
}
|
||||
|
|
@ -562,14 +561,13 @@ void M_CharacterSelect(INT32 choice)
|
|||
(void)choice;
|
||||
|
||||
if (currentMenu == &MainDef
|
||||
&& FIL_FileExists(liveeventbackup))
|
||||
&& FIL_FileExists(gpbackup))
|
||||
{
|
||||
M_StartMessage(
|
||||
"Live Event Backup",
|
||||
"A Live Event Backup was found.\n"
|
||||
"Do you want to resurrect the last run?\n"
|
||||
"(Fs in chat if we crashed on stream.)\n",
|
||||
M_MarathonLiveEventBackup,
|
||||
"Grand Prix Backup",
|
||||
"A Grand Prix Backup was found.\n"
|
||||
"Do you want to resurrect the last session?\n",
|
||||
M_GPBackup,
|
||||
MM_YESNO,
|
||||
"Resume the last run",
|
||||
"Delete, play another way");
|
||||
|
|
|
|||
|
|
@ -8362,7 +8362,7 @@ void P_PostLoadLevel(void)
|
|||
|
||||
P_RunCachedActions();
|
||||
|
||||
G_HandleSaveLevel();
|
||||
G_HandleSaveLevel(gamestate == GS_CEREMONY);
|
||||
|
||||
if (marathonmode & MA_INGAME)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue