From 4e763a058e1bf4b785526d69c3d2894208e75244 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 3 Mar 2024 22:39:16 -0800 Subject: [PATCH] Fix G_AddGhost and G_GetStaffGhostBrief to handle unlockables and mapmusrng --- src/g_demo.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/g_demo.cpp b/src/g_demo.cpp index e727eacba..fbeb4d98d 100644 --- a/src/g_demo.cpp +++ b/src/g_demo.cpp @@ -3588,6 +3588,14 @@ void G_AddGhost(savebuffer_t *buffer, const char *defdemoname) if ((flags & DF_GRANDPRIX)) p += 3; + // Skip unlockables + { + UINT32 unlockables = READUINT32(p); + p += std::min(unlockables, MAXUNLOCKABLES); + } + + p++; // mapmusrng + if (*p == DEMOMARKER) { CONS_Alert(CONS_NOTICE, M_GetText("Failed to add ghost %s: Replay is empty.\n"), defdemoname); @@ -3803,6 +3811,14 @@ staffbrief_t *G_GetStaffGhostBrief(UINT8 *buffer) if ((flags & DF_GRANDPRIX)) p += 3; + // Skip unlockables + { + UINT32 unlockables = READUINT32(p); + p += std::min(unlockables, MAXUNLOCKABLES); + } + + p++; // mapmusrng + // Assert first player is in and then read name if (READUINT8(p) != 0) goto fail;