From 438cabcd24a1019f6a7f296fd152f1e3dba3f9c0 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 19 Mar 2019 22:59:27 -0500 Subject: [PATCH] Don't resync position until off for two tics in a row This patches over a few trouble spots, like Misty Maze, causing consistent resyncs and screwing up playback. --- src/g_game.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 313156d3..02f70316 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -323,6 +323,8 @@ static struct { INT32 kartitem, kartamount, kartbumpers; boolean kartresync; //@TODO backwards compat with old replays. remove eventually + UINT8 desyncframes; // Don't try to resync unless we've been off for two frames, to monkeypatch a few trouble spots + // EZT_HIT UINT16 hits; mobj_t **hitlist; @@ -5548,16 +5550,25 @@ void G_ConsGhostTic(INT32 playernum) if (nightsfail || abs(px-gx) > syncleeway || abs(py-gy) > syncleeway || abs(pz-gz) > syncleeway) { - if (demosynced) - CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n")); - demosynced = false; + ghostext[playernum].desyncframes++; - P_UnsetThingPosition(testmo); - testmo->x = oldghost[playernum].x; - testmo->y = oldghost[playernum].y; - P_SetThingPosition(testmo); - testmo->z = oldghost[playernum].z; + if (ghostext[playernum].desyncframes >= 2) + { + if (demosynced) + CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n")); + demosynced = false; + + P_UnsetThingPosition(testmo); + testmo->x = oldghost[playernum].x; + testmo->y = oldghost[playernum].y; + P_SetThingPosition(testmo); + testmo->z = oldghost[playernum].z; + + ghostext[playernum].desyncframes = 2; + } } + else + ghostext[playernum].desyncframes = 0; if ( ghostext[playernum].kartresync && (