Allow player extradatas past p0 in ghost demos

bcd4a9d93e
This commit is contained in:
NepDisk 2025-01-09 15:16:39 -05:00
parent 490e70764d
commit 42cdb5997f

View file

@ -1119,8 +1119,12 @@ void G_GhostTicker(void)
while (ziptic != DW_END) // Get rid of extradata stuff
{
if (ziptic == 0) // Only support player 0 info for now
if (ziptic < MAXPLAYERS)
{
UINT8 playerid = ziptic;
// We want to skip *any* player extradata because some demos have extradata for bogus players,
// but if there is tic data later for those players *then* we'll consider it invalid.
ziptic = READUINT8(g->p);
if (ziptic & DXD_SKIN)
g->p += 18; // We _could_ read this info, but it shouldn't change anything in record attack...
@ -1130,8 +1134,17 @@ void G_GhostTicker(void)
g->p += 16; // yea
if (ziptic & DXD_FOLLOWER)
g->p += 32; // ok (32 because there's both the skin and the colour)
if (ziptic & DXD_PLAYSTATE && READUINT8(g->p) != DXD_PST_PLAYING)
I_Error("Ghost is not a record attack ghost PLAYSTATE"); //@TODO lmao don't blow up like this
if (ziptic & DXD_PLAYSTATE)
{
UINT8 playstate = READUINT8(g->p);
if (playstate != DXD_PST_PLAYING)
{
#ifdef DEVELOP
CONS_Alert(CONS_WARNING, "Ghost demo has non-playing playstate for player %d\n", playerid + 1);
#endif
;
}
}
if (ziptic & DXD_WEAPONPREF)
g->p++; // ditto
}