From dc9346a45df2e5f9e7711846cd198c6d150e5537 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 26 Jul 2023 07:50:47 -0400 Subject: [PATCH] Add forwardmove rng backwards compat with demos --- src/g_demo.c | 3 +++ src/g_demo.h | 1 + src/p_user.c | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/src/g_demo.c b/src/g_demo.c index a7b9098fa..adb8e891d 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -58,6 +58,7 @@ static UINT8 demoflags; static UINT16 demoversion; boolean singledemo; // quit after playing a demo from cmdline 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 metalrecording; // recording as metal sonic @@ -2028,6 +2029,7 @@ void G_DoPlayDemo(char *defdemoname) version = READUINT8(demo_p); subversion = READUINT8(demo_p); demoversion = READUINT16(demo_p); + demo_forwardmove_rng = (demoversion < 0x0010); switch(demoversion) { case 0x000f: @@ -2339,6 +2341,7 @@ UINT8 G_CheckDemoForError(char *defdemoname) demo_p++; // version demo_p++; // subversion demoversion = READUINT16(demo_p); + demo_forwardmove_rng = (demoversion < 0x0010); switch(demoversion) { case 0x000d: diff --git a/src/g_demo.h b/src/g_demo.h index 383d2719b..379c57428 100644 --- a/src/g_demo.h +++ b/src/g_demo.h @@ -38,6 +38,7 @@ extern demo_file_override_e demofileoverride; // Quit after playing a demo from cmdline. extern boolean singledemo; extern boolean demo_start; +extern boolean demo_forwardmove_rng; extern boolean demosynced; extern mobj_t *metalplayback; diff --git a/src/p_user.c b/src/p_user.c index dcb84451b..1c2e4f7c9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11623,6 +11623,13 @@ void P_PlayerThink(player_t *player) cmd = &player->cmd; + if (demoplayback && demo_forwardmove_rng) + { + // Smelly demo backwards compatibility + if (cmd->forwardmove) + P_RandomFixed(); + } + #ifdef PARANOIA if (player->playerstate == PST_REBORN) I_Error("player %s is in PST_REBORN\n", sizeu1(playeri));