Fix Sealed Star GP replays after retrying

- Increment DEMOVERSION
- Always write specialDamage
- Only read specialDamage if DEMOVERSION >= this

Needs testing, I am going to go eat a big lunch
This commit is contained in:
toaster 2024-05-06 14:54:28 +01:00
parent 8326292a3f
commit 3170d8b90a

View file

@ -170,8 +170,9 @@ demoghost *ghosts = NULL;
// - SPB cup TA replays were recorded at this time
// - Slope physics changed with a scaling fix
// - 0x000C (Ring Racers v2.2)
// - 0x000D (Ring Racers v2.3)
#define DEMOVERSION 0x000C
#define DEMOVERSION 0x000D
boolean G_CompatLevel(UINT16 level)
{
@ -2278,6 +2279,7 @@ void G_BeginRecording(void)
WRITEUINT8(demobuf.p, grandprixinfo.gamespeed);
WRITEUINT8(demobuf.p, grandprixinfo.masterbots == true);
WRITEUINT8(demobuf.p, grandprixinfo.eventmode);
WRITEUINT32(demobuf.p, grandprixinfo.specialDamage);
}
// Save netUnlocked from actual unlocks
@ -2525,8 +2527,9 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
{
case DEMOVERSION: // latest always supported
case 0x0009: // older staff ghosts
case 0x000A: // older staff ghosts
case 0x000B: // older staff ghosts
case 0x000A: // 2.0, 2.1
case 0x000B: // 2.2 indev (staff ghosts)
case 0x000C: // 2.2
break;
// too old, cannot support.
default:
@ -2676,8 +2679,9 @@ void G_LoadDemoInfo(menudemo_t *pdemo, boolean allownonmultiplayer)
{
case DEMOVERSION: // latest always supported
case 0x0009: // older staff ghosts
case 0x000A: // older staff ghosts
case 0x000B: // older staff ghosts
case 0x000A: // 2.0, 2.1
case 0x000B: // 2.2 indev (staff ghosts)
case 0x000C: // 2.2
if (P_SaveBufferRemaining(&info) < 64)
{
goto corrupt;
@ -3105,8 +3109,9 @@ void G_DoPlayDemoEx(const char *defdemoname, lumpnum_t deflumpnum)
{
case DEMOVERSION: // latest always supported
case 0x0009: // older staff ghosts
case 0x000A: // older staff ghosts
case 0x000B: // older staff ghosts
case 0x000A: // 2.0, 2.1
case 0x000B: // 2.2 indev (staff ghosts)
case 0x000C: // 2.2
break;
// too old, cannot support.
default:
@ -3275,6 +3280,10 @@ void G_DoPlayDemoEx(const char *defdemoname, lumpnum_t deflumpnum)
grandprixinfo.gamespeed = READUINT8(demobuf.p);
grandprixinfo.masterbots = READUINT8(demobuf.p) != 0;
grandprixinfo.eventmode = static_cast<gpEvent_e>(READUINT8(demobuf.p));
if (demo.version >= 0x000D)
{
grandprixinfo.specialDamage = READUINT32(demobuf.p);
}
}
// Load unlocks into netUnlocked
@ -3565,8 +3574,9 @@ void G_AddGhost(savebuffer_t *buffer, const char *defdemoname)
{
case DEMOVERSION: // latest always supported
case 0x0009: // older staff ghosts
case 0x000A: // older staff ghosts
case 0x000B: // older staff ghosts
case 0x000A: // 2.0, 2.1
case 0x000B: // 2.2 indev (staff ghosts)
case 0x000C: // 2.2
break;
// too old, cannot support.
default:
@ -3653,7 +3663,11 @@ void G_AddGhost(savebuffer_t *buffer, const char *defdemoname)
}
if ((flags & DF_GRANDPRIX))
{
p += 3;
if (ghostversion >= 0x000D)
p++;
}
// Skip unlockables
{
@ -3823,8 +3837,9 @@ staffbrief_t *G_GetStaffGhostBrief(UINT8 *buffer)
{
case DEMOVERSION: // latest always supported
case 0x0009: // older staff ghosts
case 0x000A: // older staff ghosts
case 0x000B: // older staff ghosts
case 0x000A: // 2.0, 2.1
case 0x000B: // 2.2 indev (staff ghosts)
case 0x000C: // 2.2
break;
// too old, cannot support.
@ -3878,7 +3893,11 @@ staffbrief_t *G_GetStaffGhostBrief(UINT8 *buffer)
}
if ((flags & DF_GRANDPRIX))
{
p += 3;
if (ghostversion >= 0x000D)
p++;
}
// Skip unlockables
{