mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-20 20:41:10 +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))
|
||||
{
|
||||
char dname[MAXMAPLUMPNAME+1+8+1];
|
||||
lumpnum_t dlump;
|
||||
UINT16 mapnum;
|
||||
UINT8 numstaff;
|
||||
static boolean use_netreplay = false;
|
||||
const char *lumpname;
|
||||
staffbrief_t *brief;
|
||||
|
||||
if ((use_netreplay = !use_netreplay))
|
||||
|
|
@ -1760,6 +1760,7 @@ void F_TitleScreenTicker(boolean run)
|
|||
{
|
||||
numstaff = M_RandomKey(numstaff)+1;
|
||||
snprintf(dname, 9, "TDEMO%03u", numstaff);
|
||||
dlump = LUMPERROR;
|
||||
goto loadreplay;
|
||||
}
|
||||
}
|
||||
|
|
@ -1777,14 +1778,14 @@ void F_TitleScreenTicker(boolean run)
|
|||
|
||||
// Setup demo name
|
||||
brief = mapheaderinfo[mapnum]->ghostBrief[numstaff];
|
||||
lumpname = W_CheckNameForNumPwad(brief->wad, brief->lump);
|
||||
strlcpy(dname, lumpname, sizeof(dname));
|
||||
strcpy(dname, "");
|
||||
dlump = (brief->wad << 16) | brief->lump;
|
||||
|
||||
loadreplay:
|
||||
demo.attract = DEMO_ATTRACT_TITLE;
|
||||
demo.ignorefiles = true;
|
||||
demo.loadfiles = false;
|
||||
G_DoPlayDemo(dname);
|
||||
G_DoPlayDemoEx(dname, dlump);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2891,7 +2891,7 @@ void G_DeferedPlayDemo(const char *name)
|
|||
|
||||
#define SKIPERRORS
|
||||
|
||||
void G_DoPlayDemo(const char *defdemoname)
|
||||
void G_DoPlayDemoEx(const char *defdemoname, lumpnum_t deflumpnum)
|
||||
{
|
||||
INT32 i;
|
||||
UINT8 p, numslots = 0;
|
||||
|
|
@ -2918,7 +2918,7 @@ void G_DoPlayDemo(const char *defdemoname)
|
|||
gtname[MAXGAMETYPELENGTH-1] = '\0';
|
||||
|
||||
// No demo name means we're restarting the current demo
|
||||
if (defdemoname == NULL)
|
||||
if (defdemoname == NULL && deflumpnum == LUMPERROR)
|
||||
{
|
||||
demobuf.p = demobuf.buffer;
|
||||
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);
|
||||
demobuf.buffer = NULL;
|
||||
|
||||
n = defdemoname+strlen(defdemoname);
|
||||
while (*n != '/' && *n != '\\' && n != defdemoname)
|
||||
n--;
|
||||
if (n != defdemoname)
|
||||
n++;
|
||||
pdemoname = static_cast<char*>(ZZ_Alloc(strlen(n)+1));
|
||||
strcpy(pdemoname,n);
|
||||
if (defdemoname != NULL)
|
||||
{
|
||||
n = defdemoname+strlen(defdemoname);
|
||||
while (*n != '/' && *n != '\\' && n != defdemoname)
|
||||
n--;
|
||||
if (n != defdemoname)
|
||||
n++;
|
||||
pdemoname = static_cast<char*>(ZZ_Alloc(strlen(n)+1));
|
||||
strcpy(pdemoname,n);
|
||||
}
|
||||
|
||||
M_SetPlaybackMenuPointer();
|
||||
|
||||
// Internal if no extension, external if one exists
|
||||
if (FIL_CheckExtension(defdemoname))
|
||||
if (defdemoname != NULL && FIL_CheckExtension(defdemoname))
|
||||
{
|
||||
//FIL_DefaultExtension(defdemoname, ".lmp");
|
||||
if (P_SaveBufferFromFile(&demobuf, defdemoname) == false)
|
||||
|
|
@ -2956,7 +2959,12 @@ void G_DoPlayDemo(const char *defdemoname)
|
|||
// load demo resource from WAD
|
||||
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.
|
||||
if ((l = W_CheckNumForName(defdemoname)) == LUMPERROR)
|
||||
|
|
|
|||
|
|
@ -214,7 +214,8 @@ extern demoghost *ghosts;
|
|||
#define DFILE_ERROR_CORRUPT 0x06 // Demo file is corrupted
|
||||
|
||||
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_AddGhost(savebuffer_t *buffer, const char *defdemoname);
|
||||
staffbrief_t *G_GetStaffGhostBrief(UINT8 *buffer);
|
||||
|
|
|
|||
|
|
@ -521,7 +521,7 @@ static boolean F_CreditsPlayDemo(void)
|
|||
demo.ignorefiles = true;
|
||||
demo.loadfiles = false;
|
||||
|
||||
G_DoPlayDemo(demo_name.c_str());
|
||||
G_DoPlayDemoEx("", (brief->wad << 16) | brief->lump);
|
||||
|
||||
g_fast_forward = 30 * TICRATE;
|
||||
g_credits.demo_exit = 0;
|
||||
|
|
|
|||
|
|
@ -416,7 +416,6 @@ void M_HandleStaffReplay(INT32 choice)
|
|||
{
|
||||
mapheader_t *mapheader;
|
||||
staffbrief_t *staffbrief;
|
||||
const char* lumpname = NULL;
|
||||
restoreMenu = &PLAY_TimeAttackDef;
|
||||
|
||||
M_ClearMenus(true);
|
||||
|
|
@ -426,9 +425,7 @@ void M_HandleStaffReplay(INT32 choice)
|
|||
mapheader = mapheaderinfo[levellist.choosemap];
|
||||
staffbrief = mapheader->ghostBrief[cv_dummystaff.value];
|
||||
|
||||
lumpname = W_CheckNameForNumPwad(staffbrief->wad, staffbrief->lump);
|
||||
|
||||
G_DoPlayDemo(lumpname);
|
||||
G_DoPlayDemoEx("", (staffbrief->wad << 16) | staffbrief->lump);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue