From e93248ddd28fff091e12d0b633e8d59074e95012 Mon Sep 17 00:00:00 2001 From: sphere Date: Mon, 3 Jun 2024 13:45:37 +0000 Subject: [PATCH] Merge branch 'allowdesync' into 'next' Add a console variable that will allow individual demos to desync.... See merge request STJr/SRB2!2361 --- src/d_netcmd.c | 2 ++ src/g_demo.c | 15 ++++++++++----- src/g_demo.h | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 84ace9545..40e955362 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1055,7 +1055,9 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_verticallook[i]); } + CV_RegisterVar(&cv_resyncdemo); CV_RegisterVar(&cv_demodateformat); + CV_RegisterVar(&cv_showspecstuff); // ingame object placing diff --git a/src/g_demo.c b/src/g_demo.c index 9bae514c1..33957fb67 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -88,6 +88,8 @@ static UINT8 *metalbuffer = NULL; static UINT8 *metal_p; static UINT16 metalversion; +consvar_t cv_resyncdemo = {"resyncdemo", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + // extra data stuff (events registered this frame while recording) static struct { UINT8 flags; // EZT flags @@ -1102,11 +1104,14 @@ void G_ConsGhostTic(INT32 playernum) CONS_Alert(CONS_WARNING, "Demo playback has desynced (player %s)!\n", player_names[playernum]); demosynced = false; - P_UnsetThingPosition(testmo); - testmo->x = oldghost[playernum].x; - testmo->y = oldghost[playernum].y; - P_SetThingPosition(testmo); - testmo->z = oldghost[playernum].z; + if (cv_resyncdemo.value) + { + P_UnsetThingPosition(testmo); + testmo->x = oldghost[playernum].x; + testmo->y = oldghost[playernum].y; + P_SetThingPosition(testmo); + testmo->z = oldghost[playernum].z; + } if (abs(testmo->z - testmo->floorz) < 4*FRACUNIT) testmo->z = testmo->floorz; // Sync players to the ground when they're likely supposed to be there... diff --git a/src/g_demo.h b/src/g_demo.h index 6bfaa0a2c..de1495e91 100644 --- a/src/g_demo.h +++ b/src/g_demo.h @@ -29,6 +29,7 @@ extern savebuffer_t demobuf; // demoplaying back and demo recording extern consvar_t cv_recordmultiplayerdemos, cv_netdemosyncquality, cv_maxdemosize, cv_demochangemap; extern consvar_t cv_demodateformat; +extern consvar_t cv_resyncdemo; // Publicly-accessible demo vars struct demovars_s {