- Duke/RR: Properly fix movement() so the player's Z always makes it back to floorz.

* The `abs(k)` here was really messing it up.
* RR's height of 40 is actually a fix of Duke's 38, which left the player slightly off the ground.
* Duke when returning from crouching, jumping, or otherwise changing the Z always correctly ends up at the floor's Z now.
This commit is contained in:
Mitchell Richters 2022-11-24 13:38:03 +11:00 committed by Christoph Oelckers
parent 7e6bc02d45
commit 4a6e2683f2
5 changed files with 5 additions and 10 deletions

View file

@ -438,8 +438,6 @@ enum miscConstants
MOVEFIFOSIZ =256,
AUTO_AIM_ANGLE =48,
PHEIGHT_DUKE =38,
PHEIGHT_RR =40,
MAXMINECARTS = 16,
MAXJAILDOORS = 32,

View file

@ -321,7 +321,6 @@ void initactorflags_r()
TILE_BIGORBIT1 = BIGORBIT1;
TILE_EGG = EGG;
gs.playerheight = PHEIGHT_RR;
gs.firstdebris = SCRAP6;
}

View file

@ -3187,7 +3187,7 @@ void loadcons()
gs.shrinkerblastradius = 650;
gs.gravity = 0.6875;
gs.tripbombblastradius = 3880;
gs.playerheight = PHEIGHT_DUKE;
gs.playerheight = 40;
gs.displayflags = DUKE3D_NO_WIDESCREEN_PINNING;

View file

@ -1754,7 +1754,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
if (p->scuba_on == 1)
p->scuba_on = 0;
double i = 40;
double i = gs.playerheight;
if (psectlotag == ST_1_ABOVE_WATER && p->spritebridge == 0)
{
if (shrunk == 0)
@ -1844,12 +1844,11 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
p->on_ground = 1;
if (i == 40)
if (i == gs.playerheight)
{
//Smooth on the ground
double k = (floorz - i - p->GetActor()->getOffsetZ()) * 0.5;
if (abs(k) < 1) k = 0;
p->GetActor()->spr.pos.Z += k;
p->vel.Z -= 3;
if (p->vel.Z < 0) p->vel.Z = 0;

View file

@ -2034,7 +2034,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
if (p->scuba_on == 1)
p->scuba_on = 0;
double i = 40;
double i = gs.playerheight;
if (psectlotag == ST_1_ABOVE_WATER && p->spritebridge == 0)
{
if (shrunk == 0)
@ -2171,12 +2171,11 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
p->on_ground = 1;
if (i == 40)
if (i == gs.playerheight)
{
//Smooth on the ground
double k = (floorz - i - p->GetActor()->getOffsetZ()) * 0.5;
if (abs(k) < 1) k = 0;
p->GetActor()->spr.pos.Z += k;
p->vel.Z -= 3;
if (p->vel.Z < 0) p->vel.Z = 0;