Add forwardmove rng backwards compat with demos

This commit is contained in:
Sally Coolatta 2023-07-26 07:50:47 -04:00
parent 29f7ecd460
commit dc9346a45d
3 changed files with 11 additions and 0 deletions

View file

@ -58,6 +58,7 @@ static UINT8 demoflags;
static UINT16 demoversion; static UINT16 demoversion;
boolean singledemo; // quit after playing a demo from cmdline boolean singledemo; // quit after playing a demo from cmdline
boolean demo_start; // don't start playing demo right away boolean demo_start; // don't start playing demo right away
boolean demo_forwardmove_rng; // old demo backwards compatibility
boolean demosynced = true; // console warning message boolean demosynced = true; // console warning message
boolean metalrecording; // recording as metal sonic boolean metalrecording; // recording as metal sonic
@ -2028,6 +2029,7 @@ void G_DoPlayDemo(char *defdemoname)
version = READUINT8(demo_p); version = READUINT8(demo_p);
subversion = READUINT8(demo_p); subversion = READUINT8(demo_p);
demoversion = READUINT16(demo_p); demoversion = READUINT16(demo_p);
demo_forwardmove_rng = (demoversion < 0x0010);
switch(demoversion) switch(demoversion)
{ {
case 0x000f: case 0x000f:
@ -2339,6 +2341,7 @@ UINT8 G_CheckDemoForError(char *defdemoname)
demo_p++; // version demo_p++; // version
demo_p++; // subversion demo_p++; // subversion
demoversion = READUINT16(demo_p); demoversion = READUINT16(demo_p);
demo_forwardmove_rng = (demoversion < 0x0010);
switch(demoversion) switch(demoversion)
{ {
case 0x000d: case 0x000d:

View file

@ -38,6 +38,7 @@ extern demo_file_override_e demofileoverride;
// Quit after playing a demo from cmdline. // Quit after playing a demo from cmdline.
extern boolean singledemo; extern boolean singledemo;
extern boolean demo_start; extern boolean demo_start;
extern boolean demo_forwardmove_rng;
extern boolean demosynced; extern boolean demosynced;
extern mobj_t *metalplayback; extern mobj_t *metalplayback;

View file

@ -11623,6 +11623,13 @@ void P_PlayerThink(player_t *player)
cmd = &player->cmd; cmd = &player->cmd;
if (demoplayback && demo_forwardmove_rng)
{
// Smelly demo backwards compatibility
if (cmd->forwardmove)
P_RandomFixed();
}
#ifdef PARANOIA #ifdef PARANOIA
if (player->playerstate == PST_REBORN) if (player->playerstate == PST_REBORN)
I_Error("player %s is in PST_REBORN\n", sizeu1(playeri)); I_Error("player %s is in PST_REBORN\n", sizeu1(playeri));