From a643a740838e496cade7c3fd9dab82bcba3b9623 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 15 Dec 2022 18:15:11 +1100 Subject: [PATCH] - SW: Revert last commit and apply changes directly in `pp->setHeightAndZ()` so all bases are covered. --- source/games/sw/src/game.h | 2 +- source/games/sw/src/player.cpp | 6 ++---- source/games/sw/src/track.cpp | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index e262fa995..d9511840c 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1888,7 +1888,7 @@ struct PLAYER void setHeightAndZ(const double newz, const double newheight) { - actor->spr.pos.Z = newz; + actor->spr.pos.Z = newz - newheight - actor->viewzoffset; height = newheight; } diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 209fceb73..57176ecc3 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -3142,8 +3142,7 @@ void DoPlayerFall(PLAYER* pp) // i any kind of crawl key get rid of recoil if (DoPlayerTestCrawl(pp) || (pp->input.actions & SB_CROUCH)) { - pp->actor->spr.pos.Z = pp->loz - PLAYER_CRAWL_HEIGHTF - pp->actor->viewzoffset; - pp->height = PLAYER_CRAWL_HEIGHTF; + pp->setHeightAndZ(pp->loz, PLAYER_CRAWL_HEIGHTF); } else { @@ -3606,8 +3605,7 @@ void DoPlayerCrawl(PLAYER* pp) if (pp->insector() && (pp->cursector->extra & SECTFX_DYNAMIC_AREA)) { - pp->actor->spr.pos.Z = pp->loz - PLAYER_CRAWL_HEIGHTF - pp->actor->viewzoffset; - pp->height = PLAYER_CRAWL_HEIGHTF; + pp->setHeightAndZ(pp->loz, PLAYER_CRAWL_HEIGHTF); } DoPlayerBob(pp); diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 5c0b51b13..ab3a6eeb7 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -1743,8 +1743,7 @@ PlayerPart: { // move up some for really fast moving plats DoPlayerZrange(pp); - pp->actor->spr.pos.Z = pp->loz - PLAYER_CRAWL_HEIGHTF - pp->actor->viewzoffset; - pp->height = PLAYER_CRAWL_HEIGHTF; + pp->setHeightAndZ(pp->loz, PLAYER_CRAWL_HEIGHTF); } else {