mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +00:00
Fix staff replay loading using only the first 8 chars of the lump name
- This was causing Aquatic Cathedral and Aqua Tunnel staff
replays to get confused for one another
- Because for both RR_AQUATICCATHEDRAL and
RR_AQUATUNNEL, the first 8 chars are RR_AQUAT
- Now uses the lump id directly instead of the name, which
entirely circumvents the problem
- Fixed:
- Time Attack menu "Replay Staff" option
- Attract mode
- Credits
This commit is contained in:
parent
ae30e1d138
commit
5ffe957676
5 changed files with 28 additions and 21 deletions
|
|
@ -1743,10 +1743,10 @@ void F_TitleScreenTicker(boolean run)
|
||||||
if (!(--demoIdleLeft))
|
if (!(--demoIdleLeft))
|
||||||
{
|
{
|
||||||
char dname[MAXMAPLUMPNAME+1+8+1];
|
char dname[MAXMAPLUMPNAME+1+8+1];
|
||||||
|
lumpnum_t dlump;
|
||||||
UINT16 mapnum;
|
UINT16 mapnum;
|
||||||
UINT8 numstaff;
|
UINT8 numstaff;
|
||||||
static boolean use_netreplay = false;
|
static boolean use_netreplay = false;
|
||||||
const char *lumpname;
|
|
||||||
staffbrief_t *brief;
|
staffbrief_t *brief;
|
||||||
|
|
||||||
if ((use_netreplay = !use_netreplay))
|
if ((use_netreplay = !use_netreplay))
|
||||||
|
|
@ -1760,6 +1760,7 @@ void F_TitleScreenTicker(boolean run)
|
||||||
{
|
{
|
||||||
numstaff = M_RandomKey(numstaff)+1;
|
numstaff = M_RandomKey(numstaff)+1;
|
||||||
snprintf(dname, 9, "TDEMO%03u", numstaff);
|
snprintf(dname, 9, "TDEMO%03u", numstaff);
|
||||||
|
dlump = LUMPERROR;
|
||||||
goto loadreplay;
|
goto loadreplay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1777,14 +1778,14 @@ void F_TitleScreenTicker(boolean run)
|
||||||
|
|
||||||
// Setup demo name
|
// Setup demo name
|
||||||
brief = mapheaderinfo[mapnum]->ghostBrief[numstaff];
|
brief = mapheaderinfo[mapnum]->ghostBrief[numstaff];
|
||||||
lumpname = W_CheckNameForNumPwad(brief->wad, brief->lump);
|
strcpy(dname, "");
|
||||||
strlcpy(dname, lumpname, sizeof(dname));
|
dlump = (brief->wad << 16) | brief->lump;
|
||||||
|
|
||||||
loadreplay:
|
loadreplay:
|
||||||
demo.attract = DEMO_ATTRACT_TITLE;
|
demo.attract = DEMO_ATTRACT_TITLE;
|
||||||
demo.ignorefiles = true;
|
demo.ignorefiles = true;
|
||||||
demo.loadfiles = false;
|
demo.loadfiles = false;
|
||||||
G_DoPlayDemo(dname);
|
G_DoPlayDemoEx(dname, dlump);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2891,7 +2891,7 @@ void G_DeferedPlayDemo(const char *name)
|
||||||
|
|
||||||
#define SKIPERRORS
|
#define SKIPERRORS
|
||||||
|
|
||||||
void G_DoPlayDemo(const char *defdemoname)
|
void G_DoPlayDemoEx(const char *defdemoname, lumpnum_t deflumpnum)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
UINT8 p, numslots = 0;
|
UINT8 p, numslots = 0;
|
||||||
|
|
@ -2918,7 +2918,7 @@ void G_DoPlayDemo(const char *defdemoname)
|
||||||
gtname[MAXGAMETYPELENGTH-1] = '\0';
|
gtname[MAXGAMETYPELENGTH-1] = '\0';
|
||||||
|
|
||||||
// No demo name means we're restarting the current demo
|
// No demo name means we're restarting the current demo
|
||||||
if (defdemoname == NULL)
|
if (defdemoname == NULL && deflumpnum == LUMPERROR)
|
||||||
{
|
{
|
||||||
demobuf.p = demobuf.buffer;
|
demobuf.p = demobuf.buffer;
|
||||||
pdemoname = static_cast<char*>(ZZ_Alloc(1)); // Easier than adding checks for this everywhere it's freed
|
pdemoname = static_cast<char*>(ZZ_Alloc(1)); // Easier than adding checks for this everywhere it's freed
|
||||||
|
|
@ -2929,18 +2929,21 @@ void G_DoPlayDemo(const char *defdemoname)
|
||||||
//Z_Free(demobuf.buffer);
|
//Z_Free(demobuf.buffer);
|
||||||
demobuf.buffer = NULL;
|
demobuf.buffer = NULL;
|
||||||
|
|
||||||
n = defdemoname+strlen(defdemoname);
|
if (defdemoname != NULL)
|
||||||
while (*n != '/' && *n != '\\' && n != defdemoname)
|
{
|
||||||
n--;
|
n = defdemoname+strlen(defdemoname);
|
||||||
if (n != defdemoname)
|
while (*n != '/' && *n != '\\' && n != defdemoname)
|
||||||
n++;
|
n--;
|
||||||
pdemoname = static_cast<char*>(ZZ_Alloc(strlen(n)+1));
|
if (n != defdemoname)
|
||||||
strcpy(pdemoname,n);
|
n++;
|
||||||
|
pdemoname = static_cast<char*>(ZZ_Alloc(strlen(n)+1));
|
||||||
|
strcpy(pdemoname,n);
|
||||||
|
}
|
||||||
|
|
||||||
M_SetPlaybackMenuPointer();
|
M_SetPlaybackMenuPointer();
|
||||||
|
|
||||||
// Internal if no extension, external if one exists
|
// Internal if no extension, external if one exists
|
||||||
if (FIL_CheckExtension(defdemoname))
|
if (defdemoname != NULL && FIL_CheckExtension(defdemoname))
|
||||||
{
|
{
|
||||||
//FIL_DefaultExtension(defdemoname, ".lmp");
|
//FIL_DefaultExtension(defdemoname, ".lmp");
|
||||||
if (P_SaveBufferFromFile(&demobuf, defdemoname) == false)
|
if (P_SaveBufferFromFile(&demobuf, defdemoname) == false)
|
||||||
|
|
@ -2956,7 +2959,12 @@ void G_DoPlayDemo(const char *defdemoname)
|
||||||
// load demo resource from WAD
|
// load demo resource from WAD
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (n == defdemoname)
|
if (deflumpnum != LUMPERROR)
|
||||||
|
{
|
||||||
|
P_SaveBufferFromLump(&demobuf, deflumpnum);
|
||||||
|
pdemoname = Z_StrDup(wadfiles[WADFILENUM(deflumpnum)]->lumpinfo[LUMPNUM(deflumpnum)].fullname);
|
||||||
|
}
|
||||||
|
else if (n == defdemoname)
|
||||||
{
|
{
|
||||||
// Raw lump.
|
// Raw lump.
|
||||||
if ((l = W_CheckNumForName(defdemoname)) == LUMPERROR)
|
if ((l = W_CheckNumForName(defdemoname)) == LUMPERROR)
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,8 @@ extern demoghost *ghosts;
|
||||||
#define DFILE_ERROR_CORRUPT 0x06 // Demo file is corrupted
|
#define DFILE_ERROR_CORRUPT 0x06 // Demo file is corrupted
|
||||||
|
|
||||||
void G_DeferedPlayDemo(const char *demo);
|
void G_DeferedPlayDemo(const char *demo);
|
||||||
void G_DoPlayDemo(const char *defdemoname);
|
void G_DoPlayDemoEx(const char *defdemoname, lumpnum_t deflumpnum);
|
||||||
|
#define G_DoPlayDemo(defdemoname) G_DoPlayDemoEx(defdemoname, LUMPERROR)
|
||||||
void G_TimeDemo(const char *name);
|
void G_TimeDemo(const char *name);
|
||||||
void G_AddGhost(savebuffer_t *buffer, const char *defdemoname);
|
void G_AddGhost(savebuffer_t *buffer, const char *defdemoname);
|
||||||
staffbrief_t *G_GetStaffGhostBrief(UINT8 *buffer);
|
staffbrief_t *G_GetStaffGhostBrief(UINT8 *buffer);
|
||||||
|
|
|
||||||
|
|
@ -521,7 +521,7 @@ static boolean F_CreditsPlayDemo(void)
|
||||||
demo.ignorefiles = true;
|
demo.ignorefiles = true;
|
||||||
demo.loadfiles = false;
|
demo.loadfiles = false;
|
||||||
|
|
||||||
G_DoPlayDemo(demo_name.c_str());
|
G_DoPlayDemoEx("", (brief->wad << 16) | brief->lump);
|
||||||
|
|
||||||
g_fast_forward = 30 * TICRATE;
|
g_fast_forward = 30 * TICRATE;
|
||||||
g_credits.demo_exit = 0;
|
g_credits.demo_exit = 0;
|
||||||
|
|
|
||||||
|
|
@ -416,7 +416,6 @@ void M_HandleStaffReplay(INT32 choice)
|
||||||
{
|
{
|
||||||
mapheader_t *mapheader;
|
mapheader_t *mapheader;
|
||||||
staffbrief_t *staffbrief;
|
staffbrief_t *staffbrief;
|
||||||
const char* lumpname = NULL;
|
|
||||||
restoreMenu = &PLAY_TimeAttackDef;
|
restoreMenu = &PLAY_TimeAttackDef;
|
||||||
|
|
||||||
M_ClearMenus(true);
|
M_ClearMenus(true);
|
||||||
|
|
@ -426,9 +425,7 @@ void M_HandleStaffReplay(INT32 choice)
|
||||||
mapheader = mapheaderinfo[levellist.choosemap];
|
mapheader = mapheaderinfo[levellist.choosemap];
|
||||||
staffbrief = mapheader->ghostBrief[cv_dummystaff.value];
|
staffbrief = mapheader->ghostBrief[cv_dummystaff.value];
|
||||||
|
|
||||||
lumpname = W_CheckNameForNumPwad(staffbrief->wad, staffbrief->lump);
|
G_DoPlayDemoEx("", (staffbrief->wad << 16) | staffbrief->lump);
|
||||||
|
|
||||||
G_DoPlayDemo(lumpname);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue