From 4890f1d9dc70f546137d692fc8f527f56b34ef0f Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 23 Dec 2022 19:10:33 +1100 Subject: [PATCH] - SW: Adjustments to the death height code on the back of the last commit. --- source/games/sw/src/draw.cpp | 4 ++++ source/games/sw/src/player.cpp | 17 ++--------------- source/games/sw/src/player.h | 6 +----- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 985a66c26..ede2ca01c 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -798,6 +798,10 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub } pos.Z = tsp->pos.Z + pp->si.Z + pp->getViewHeightDiff(); + + if ((pp->Flags & PF_DEAD) && pos.Z > pp->actor->user.loz - pp->actor->user.floor_dist) + pos.Z = pp->actor->user.loz - pp->actor->user.floor_dist; + tsp->pos = pos; tsp->Angles.Yaw = pp->siang; //continue; diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 6caeef3d1..82f287fdd 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1483,8 +1483,9 @@ void DoPlayerSetWadeDepth(PLAYER* pp) // //--------------------------------------------------------------------------- -void DoPlayerHeight(PLAYER* pp, const double scale = PLAYER_NORMAL_FALL_VALUEF) +void DoPlayerHeight(PLAYER* pp) { + constexpr double scale = 0.375; pp->actor->viewzoffset -= pp->getViewHeightDiff() * scale; pp->actor->spr.pos.Z -= (pp->actor->spr.pos.Z - pp->loz) * scale; } @@ -6289,7 +6290,6 @@ void DoPlayerDeathFlip(PLAYER* pp) } DoPlayerDeathCheckKeys(pp); - if (pp->height == PLAYER_DEATH_HEIGHTF) DoPlayerHeight(pp, PLAYER_DEATH_FALL_VALUEF); } @@ -6332,7 +6332,6 @@ void DoPlayerDeathDrown(PLAYER* pp) DoPlayerDeathFollowKiller(pp); DoPlayerDeathCheckKeys(pp); - if (pp->height == PLAYER_DEATH_HEIGHTF) DoPlayerHeight(pp, PLAYER_DEATH_FALL_VALUEF); } @@ -6423,12 +6422,6 @@ void DoPlayerDeathCrumble(PLAYER* pp) DoPlayerDeathCheckKeys(pp); DoPlayerHeadDebris(pp); - - if (pp->height == PLAYER_DEATH_HEIGHTF) - { - pp->loz = pp->actor->user.loz - PLAYER_DEAD_HEAD_FLOORZ_OFFSET; - DoPlayerHeight(pp, PLAYER_DEATH_FALL_VALUEF); - } } //--------------------------------------------------------------------------- @@ -6487,12 +6480,6 @@ void DoPlayerDeathExplode(PLAYER* pp) DoPlayerDeathCheckKeys(pp); DoPlayerHeadDebris(pp); - - if (pp->height == PLAYER_DEATH_HEIGHTF) - { - pp->loz = pp->actor->user.loz - PLAYER_DEAD_HEAD_FLOORZ_OFFSET; - DoPlayerHeight(pp, PLAYER_DEATH_FALL_VALUEF); - } } //--------------------------------------------------------------------------- diff --git a/source/games/sw/src/player.h b/source/games/sw/src/player.h index 8ed65f575..466b0a6a6 100644 --- a/source/games/sw/src/player.h +++ b/source/games/sw/src/player.h @@ -112,15 +112,11 @@ constexpr double PLAYER_FALL_HEIGHTF = 28; // dead head height - used in DeathFall #define PLAYER_DEATH_HEIGHT (Z(16)) constexpr double PLAYER_DEATH_HEIGHTF = 16; -constexpr double PLAYER_DEAD_HEAD_FLOORZ_OFFSET = PLAYER_DEATH_HEIGHTF * 0.5; +constexpr double PLAYER_DEAD_HEAD_FLOORZ_OFFSET = 7; constexpr double PLAYER_NINJA_XREPEAT = 0.734375; constexpr double PLAYER_NINJA_YREPEAT = 0.515625; -// Fall rates -constexpr double PLAYER_NORMAL_FALL_VALUEF = (96. / 256.); -constexpr double PLAYER_DEATH_FALL_VALUEF = PLAYER_NORMAL_FALL_VALUEF * 0.5; - BEGIN_SW_NS int SetVisHigh(void);