From 2d734664259e47b999fe989b924ecaa0a97bb109 Mon Sep 17 00:00:00 2001 From: NY00123 Date: Sat, 11 Apr 2020 11:26:06 +0300 Subject: [PATCH] SW: Use the old interpolation path in drawscreen if player is dead --- source/sw/src/draw.cpp | 14 ++++++++++++-- source/sw/src/game.h | 1 + source/sw/src/player.cpp | 14 ++++++++------ source/sw/src/predict.cpp | 2 ++ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index 5a7b1c54b..d2edbfcaf 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -2011,8 +2011,18 @@ drawscreen(PLAYERp pp) tx = camerapp->oposx + mulscale16(camerapp->posx - camerapp->oposx, smoothratio); ty = camerapp->oposy + mulscale16(camerapp->posy - camerapp->oposy, smoothratio); tz = camerapp->oposz + mulscale16(camerapp->posz - camerapp->oposz, smoothratio); - tq16ang = camerapp->q16ang; - tq16horiz = camerapp->q16horiz; + + if (!TEST(pp->Flags, PF_DEAD)) + { + tq16ang = camerapp->q16ang; + tq16horiz = camerapp->q16horiz; + } + else + { + tq16ang = camerapp->oq16ang + mulscale16(((camerapp->q16ang + fix16_from_int(1024) - camerapp->oq16ang) & 0x7FFFFFF) - fix16_from_int(1024), smoothratio); + tq16horiz = camerapp->oq16horiz + mulscale16(camerapp->q16horiz - camerapp->oq16horiz, smoothratio); + } + tsectnum = camerapp->cursectnum; //ASSERT(tsectnum >= 0 && tsectnum <= MAXSECTORS); diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 5f546d6a4..09ac2b2c4 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -1092,6 +1092,7 @@ struct PLAYERstruct // interpolation int oposx, oposy, oposz; + fix16_t oq16horiz, oq16ang; // Map follow mode pos values. int32_t mfposx, mfposy; diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index cd6368908..b813ec487 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1351,7 +1351,7 @@ DoPlayerTeleportPause(PLAYERp pp) void DoPlayerTeleportToSprite(PLAYERp pp, SPRITEp sp) { - pp->q16ang = fix16_from_int(sp->ang); + pp->q16ang = pp->oq16ang = fix16_from_int(sp->ang); pp->posx = pp->oposx = pp->oldposx = sp->x; pp->posy = pp->oposy = pp->oldposy = sp->y; @@ -5643,9 +5643,9 @@ DoPlayerStopOperate(PLAYERp pp) if (pp->sop_remote) { if (TEST_BOOL1(pp->remote_sprite)) - pp->q16ang = fix16_from_int(pp->remote_sprite->ang); + pp->q16ang = pp->oq16ang = fix16_from_int(pp->remote_sprite->ang); else - pp->q16ang = fix16_from_int(getangle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy)); + pp->q16ang = pp->oq16ang = fix16_from_int(getangle(pp->sop_remote->xmid - pp->posx, pp->sop_remote->ymid - pp->posy)); } if (pp->sop_control) @@ -7067,6 +7067,8 @@ MoveSkipSavePos(void) pp->oposx = pp->posx; pp->oposy = pp->posy; pp->oposz = pp->posz; + pp->oq16ang = pp->q16ang; + pp->oq16horiz = pp->q16horiz; } // save off stats for skip4 @@ -7613,8 +7615,8 @@ InitAllPlayers(void) pp->posx = pp->oposx = pfirst->posx; pp->posy = pp->oposy = pfirst->posy; pp->posz = pp->oposz = pfirst->posz; - pp->q16ang = pfirst->q16ang; - pp->q16horiz = pfirst->q16horiz; + pp->q16ang = pp->oq16ang = pfirst->q16ang; + pp->q16horiz = pp->oq16horiz = pfirst->q16horiz; pp->cursectnum = pfirst->cursectnum; // set like this so that player can trigger something on start of the level pp->lastcursectnum = pfirst->cursectnum+1; @@ -7764,7 +7766,7 @@ PlayerSpawnPosition(PLAYERp pp) pp->posx = pp->oposx = sp->x; pp->posy = pp->oposy = sp->y; pp->posz = pp->oposz = sp->z; - pp->q16ang = fix16_from_int(sp->ang); + pp->q16ang = pp->oq16ang = fix16_from_int(sp->ang); pp->cursectnum = sp->sectnum; getzsofslope(pp->cursectnum, pp->posx, pp->posy, &cz, &fz); diff --git a/source/sw/src/predict.cpp b/source/sw/src/predict.cpp index 3c8f52935..8314f9a30 100644 --- a/source/sw/src/predict.cpp +++ b/source/sw/src/predict.cpp @@ -157,9 +157,11 @@ DoPrediction(PLAYERp ppp) u = User[ppp->PlayerSprite]; User[ppp->PlayerSprite] = &PredictUser; + ppp->oq16ang = ppp->q16ang; ppp->oposx = ppp->posx; ppp->oposy = ppp->posy; ppp->oposz = ppp->posz; + ppp->oq16horiz = ppp->q16horiz; #if PREDICT_DEBUG PredictDebug(ppp);