From cc4f1f21f96e34dfac3df13c935c98cc25920b8d Mon Sep 17 00:00:00 2001 From: NY00123 Date: Mon, 13 Apr 2020 22:47:19 +0300 Subject: [PATCH] Interpolation fixes for SW: draw.cpp: Fix the lack of interpolation while walking on a sector object, like the bus roof or the floor of the train in Seppuku Station. track.cpp: Make sure the player's location and angle aren't mistakenly interpolated while standing on a moving sector object as a consequence. --- source/sw/src/draw.cpp | 11 +++++++---- source/sw/src/track.cpp | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 525d6f4b9..5dff0bd2e 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -2056,10 +2056,13 @@ drawscreen(PLAYERp pp) if (pp->sop_riding || pp->sop_control) { - tx = pp->posx; - ty = pp->posy; - tz = pp->posz; - tq16ang = pp->q16ang; + if (pp->sop_control) + { + tx = pp->posx; + ty = pp->posy; + tz = pp->posz; + tq16ang = pp->q16ang; + } tsectnum = pp->cursectnum; updatesectorz(tx, ty, tz, &tsectnum); } diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index 3fabb3295..429d03d08 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -1630,6 +1630,8 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny) pp->posx += BOUND_4PIX(nx); pp->posy += BOUND_4PIX(ny); + pp->oposx = pp->posx; + pp->oposy = pp->posy; if (TEST(sop->flags, SOBJ_DONT_ROTATE)) { @@ -1674,7 +1676,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny) // New angle is formed by taking last known angle and // adjusting by the delta angle - pp->q16ang = fix16_from_int(NORM_ANGLE(pp->RevolveAng + pp->RevolveDeltaAng)); + pp->oq16ang = pp->q16ang = fix16_from_int(NORM_ANGLE(pp->RevolveAng + pp->RevolveDeltaAng)); UpdatePlayerSprite(pp); } @@ -1927,6 +1929,7 @@ PlayerPart: pp->SpriteP->z = pp->loz; } } + pp->oposz = pp->posz; } else {