From adbd5c3c69de7784814d95a3f8daef250ca5a30f Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 27 Apr 2023 22:33:42 +1000 Subject: [PATCH] - Exhumed: Fix velocity loss in `movespritez()` when warping. * Old code was adjusting the actor's Z to right off the ceiling with no factoring in of the old interpolation position. * Due to this, we were hitting the `nCamerapos.Z = min(max(nCamerapos.Z, pSector->ceilingz + 1), pSector->floorz - 1);` bounding in the draw code. * Since game puts you right at the ceiling, we apply this to the old interpolation position, as well as the current position, however we then add their velocity back onto the current position to make the warp seamless. --- source/games/exhumed/src/move.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 5a9b58706..d846311f3 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -374,8 +374,14 @@ Collision movespritez(DExhumedActor* pActor, double z, double height, double cli if ((destZ - height) < sprceiling && (hiHit.type == kHitSprite || pActor->sector()->pAbove == nullptr)) { destZ = sprceiling + height; + pActor->spr.pos.Z = pActor->opos.Z = destZ; + pActor->spr.pos.Z += z; nRet.exbits |= kHitAux1; } + else + { + pActor->spr.pos.Z = destZ; + } } if (spriteZ <= floorZ && destZ > floorZ) @@ -387,7 +393,6 @@ Collision movespritez(DExhumedActor* pActor, double z, double height, double cli } pActor->spr.cstat = cstat; // restore cstat - pActor->spr.pos.Z = destZ; if (pActor->spr.statnum == 100) {