mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 20:11:47 +00:00
Merge branch 'demo-reliability' into 'master'
Demo reliability stuff Closes #1258 and #1291 See merge request KartKrew/Kart!2335
This commit is contained in:
commit
954a95488c
6 changed files with 47 additions and 11 deletions
|
|
@ -4137,7 +4137,7 @@ void G_SaveDemo(void)
|
||||||
strindex++;
|
strindex++;
|
||||||
dash = false;
|
dash = false;
|
||||||
}
|
}
|
||||||
else if (!dash)
|
else if (strindex && !dash)
|
||||||
{
|
{
|
||||||
demo_slug[strindex] = '-';
|
demo_slug[strindex] = '-';
|
||||||
strindex++;
|
strindex++;
|
||||||
|
|
@ -4145,12 +4145,31 @@ void G_SaveDemo(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
demo_slug[strindex] = 0;
|
if (dash && strindex)
|
||||||
if (dash) demo_slug[strindex-1] = 0;
|
{
|
||||||
|
strindex--;
|
||||||
|
}
|
||||||
|
demo_slug[strindex] = '\0';
|
||||||
|
|
||||||
writepoint = strstr(strrchr(demoname, *PATHSEP), "-") + 1;
|
if (demo_slug[0] != '\0')
|
||||||
demo_slug[128 - (writepoint - demoname) - 4] = 0;
|
{
|
||||||
sprintf(writepoint, "%s.lmp", demo_slug);
|
// Slug is valid, write the chosen filename.
|
||||||
|
writepoint = strstr(strrchr(demoname, *PATHSEP), "-") + 1;
|
||||||
|
demo_slug[128 - (writepoint - demoname) - 4] = 0;
|
||||||
|
sprintf(writepoint, "%s.lmp", demo_slug);
|
||||||
|
}
|
||||||
|
else if (demo.titlename[0] == '\0')
|
||||||
|
{
|
||||||
|
// Slug is completely blank? Will crash if we attempt to save
|
||||||
|
// No bailout because empty seems like a good "no thanks" choice
|
||||||
|
G_ResetDemoRecording();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If a title that is invalid is provided, the user clearly wanted
|
||||||
|
// to save. But we can't do so at that name, so we only apply the
|
||||||
|
// title INSIDE the file, not in the naked filesystem.
|
||||||
|
// (A hypothetical example is bamboozling bot behaviour causing
|
||||||
|
// a player to write "?????????".) ~toast 010524
|
||||||
}
|
}
|
||||||
|
|
||||||
length = *(UINT32 *)demoinfo_p;
|
length = *(UINT32 *)demoinfo_p;
|
||||||
|
|
@ -4176,8 +4195,11 @@ void G_SaveDemo(void)
|
||||||
if (gamedata->eversavedreplay == false)
|
if (gamedata->eversavedreplay == false)
|
||||||
{
|
{
|
||||||
gamedata->eversavedreplay = true;
|
gamedata->eversavedreplay = true;
|
||||||
M_UpdateUnlockablesAndExtraEmblems(true, true);
|
// The following will IMMEDIATELY happen on either next level load
|
||||||
G_SaveGameData();
|
// or returning to menu, so don't make the sound just to get cut off
|
||||||
|
//M_UpdateUnlockablesAndExtraEmblems(true, true);
|
||||||
|
//G_SaveGameData();
|
||||||
|
gamedata->deferredsave = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -555,7 +555,6 @@ static boolean F_CreditsPlayDemo(void)
|
||||||
|
|
||||||
UINT8 ghost_id = M_RandomKey( mapheaderinfo[map_id]->ghostCount );
|
UINT8 ghost_id = M_RandomKey( mapheaderinfo[map_id]->ghostCount );
|
||||||
brief = mapheaderinfo[map_id]->ghostBrief[ghost_id];
|
brief = mapheaderinfo[map_id]->ghostBrief[ghost_id];
|
||||||
std::string demo_name = static_cast<const char *>(W_CheckNameForNumPwad(brief->wad, brief->lump));
|
|
||||||
|
|
||||||
demo.attract = DEMO_ATTRACT_CREDITS;
|
demo.attract = DEMO_ATTRACT_CREDITS;
|
||||||
demo.ignorefiles = true;
|
demo.ignorefiles = true;
|
||||||
|
|
|
||||||
|
|
@ -7901,7 +7901,7 @@ static void P_LoadRecordGhosts(void)
|
||||||
savebuffer_t buf = {0};
|
savebuffer_t buf = {0};
|
||||||
|
|
||||||
staffbrief_t* ghostbrief = mapheaderinfo[gamemap-1]->ghostBrief[i - 1];
|
staffbrief_t* ghostbrief = mapheaderinfo[gamemap-1]->ghostBrief[i - 1];
|
||||||
const char* lumpname = W_CheckNameForNumPwad(ghostbrief->wad, ghostbrief->lump);
|
const char* lumpname = W_CheckLongNameForNumPwad(ghostbrief->wad, ghostbrief->lump);
|
||||||
size_t lumplength = W_LumpLengthPwad(ghostbrief->wad, ghostbrief->lump);
|
size_t lumplength = W_LumpLengthPwad(ghostbrief->wad, ghostbrief->lump);
|
||||||
if (lumplength == 0)
|
if (lumplength == 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1490,7 +1490,7 @@ void ST_DrawSaveReplayHint(INT32 flags)
|
||||||
V_DrawRightAlignedThinString(
|
V_DrawRightAlignedThinString(
|
||||||
BASEVIDWIDTH - 2, 2,
|
BASEVIDWIDTH - 2, 2,
|
||||||
flags|V_YELLOWMAP,
|
flags|V_YELLOWMAP,
|
||||||
demo.willsave ? "Replay will be saved. \xAB Change title" : "\xAB or \xAD Save replay"
|
(demo.willsave && demo.titlename[0]) ? "Replay will be saved. \xAB Change title" : "\xAB or \xAD Save replay"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1021,6 +1021,19 @@ const char *W_CheckNameForNum(lumpnum_t lumpnum)
|
||||||
return W_CheckNameForNumPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum));
|
return W_CheckNameForNumPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *W_CheckLongNameForNumPwad(UINT16 wad, UINT16 lump)
|
||||||
|
{
|
||||||
|
if (lump >= wadfiles[wad]->numlumps || !TestValidLump(wad, 0))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return wadfiles[wad]->lumpinfo[lump].longname;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *W_CheckLongNameForNum(lumpnum_t lumpnum)
|
||||||
|
{
|
||||||
|
return W_CheckLongNameForNumPwad(WADFILENUM(lumpnum),LUMPNUM(lumpnum));
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// wadid is a wad number
|
// wadid is a wad number
|
||||||
// (Used for sprites loading)
|
// (Used for sprites loading)
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,8 @@ INT32 W_InitMultipleFiles(char **filenames, boolean addons);
|
||||||
|
|
||||||
const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump);
|
const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump);
|
||||||
const char *W_CheckNameForNum(lumpnum_t lumpnum);
|
const char *W_CheckNameForNum(lumpnum_t lumpnum);
|
||||||
|
const char *W_CheckLongNameForNumPwad(UINT16 wad, UINT16 lump);
|
||||||
|
const char *W_CheckLongNameForNum(lumpnum_t lumpnum);
|
||||||
|
|
||||||
UINT16 W_FindNextEmptyInPwad(UINT16 wad, UINT16 startlump); // checks only in one pwad
|
UINT16 W_FindNextEmptyInPwad(UINT16 wad, UINT16 startlump); // checks only in one pwad
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue