From ce2aee49df1e70453dc2ed4da6d3fbce4b15a444 Mon Sep 17 00:00:00 2001 From: NY00123 Date: Wed, 27 May 2020 22:47:29 +0300 Subject: [PATCH] SW: This should hopefully be a better way of fixing the lack of interpolation of player turning/aiming/movement, while being carried by a sector object, without SO interpolation. This is a continuation of 73a0aa394e906a65633d61f3c749c9b9b7e66aaa and bf31bc2987a3eccd31d343622327bd4ee0f9c5a1, aiming to fix a jitter in case the player is continuously getting pushed by a wall (e.g., on the boat in level 5). Basically, this moves the relevant assignments from track.cpp:MovePlayer and MovePoints to player.cpp:DoPlayerMove. Unless a call to one of these functions has been missed, pushwall and clipmove can be called from player.cpp in the following instances, which should be covered: - Via DoPlayerMove, which is the function getting the fix now. - Via DoPlayerSlide, which is called in the beginning of DoPlayerMove. - Via DoPlayerCurrent when called from DoPlayerCrawl/DoPlayerWade, followed by DoPlayerMove. - Via DoPlayerCurrent when called from DoPlayerDive, followed by DoPlayerMove if the player doesn't stop diving. # Conflicts: # source/sw/src/track.cpp --- source/sw/src/player.cpp | 24 ++++++++++++++++++++++++ source/sw/src/track.cpp | 13 ------------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index 4b9bf4c05..017919a84 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -2650,6 +2650,13 @@ DoPlayerMove(PLAYERp pp) int friction; int save_cstat; int push_ret = 0; + + // If SO interpolation is disabled, make sure the player's aiming, + // turning and movement still get appropriately interpolated. + // We do this from here instead of MovePlayer, covering the case + // the player gets pushed by a wall (e.g., on the boat in level 5). + SWBOOL interpolate_ride = pp->sop_riding && (!gs.InterpolateSO || CommEnabled); + void SlipSlope(PLAYERp pp); SlipSlope(pp); @@ -2704,6 +2711,11 @@ DoPlayerMove(PLAYERp pp) if (TEST(pp->Flags, PF_CLIP_CHEAT)) { short sectnum=pp->cursectnum; + if (interpolate_ride) + { + pp->oposx = pp->posx; + pp->oposy = pp->posy; + } pp->posx += pp->xvect >> 14; pp->posy += pp->yvect >> 14; COVERupdatesector(pp->posx, pp->posy, §num); @@ -2726,6 +2738,12 @@ DoPlayerMove(PLAYERp pp) } } + if (interpolate_ride) + { + pp->oposx = pp->posx; + pp->oposy = pp->posy; + } + save_cstat = pp->SpriteP->cstat; RESET(pp->SpriteP->cstat, CSTAT_SPRITE_BLOCK); COVERupdatesector(pp->posx, pp->posy, &pp->cursectnum); @@ -2748,6 +2766,12 @@ DoPlayerMove(PLAYERp pp) } } + if (interpolate_ride) + { + pp->oposz = pp->posz; + pp->oq16ang = pp->q16ang; + } + // check for warp - probably can remove from CeilingHit if (WarpPlane(&pp->posx, &pp->posy, &pp->posz, &pp->cursectnum)) PlayerWarpUpdatePos(pp); diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index 1672ccff9..f20e2c06f 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -1636,11 +1636,6 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny) if (TEST(sop->flags, SOBJ_DONT_ROTATE)) { - if (!cl_sointerpolation || CommEnabled) - { - pp->oposx = pp->posx; - pp->oposy = pp->posy; - } UpdatePlayerSprite(pp); return; } @@ -1686,12 +1681,6 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny) pp->camq16ang = NORM_Q16ANGLE(pp->camq16ang); pp->q16ang = NORM_Q16ANGLE(pp->RevolveQ16Ang + fix16_from_int(pp->RevolveDeltaAng)); - if (!cl_sointerpolation || CommEnabled) - { - pp->oq16ang = pp->q16ang; - pp->oposx = pp->posx; - pp->oposy = pp->posy; - } UpdatePlayerSprite(pp); } @@ -1946,8 +1935,6 @@ PlayerPart: pp->SpriteP->z = pp->loz; } } - if (!cl_sointerpolation || CommEnabled) - pp->oposz = pp->posz; } else {