- Exhumed: Store a pos delta on the stack in `doPlayerMovement().

* We need this in a few places.
* Z is inverted because pitch is negated. Previously I just swapped the operation around.
This commit is contained in:
Mitchell Richters 2023-03-27 08:32:52 +11:00
parent 4fa12a9e30
commit d858856e06

View file

@ -1749,11 +1749,12 @@ static bool doPlayerMovement(Player* const pPlayer)
doPlayerMovingBlocks(pPlayer, nMove, spr_pos, spr_vel, spr_sect);
}
const auto posdelta = spr_pos - pPlayerActor->spr.pos;
pPlayer->ototalvel = pPlayer->totalvel;
pPlayer->totalvel = int((spr_pos.XY() - pPlayerActor->spr.pos.XY()).Length() * worldtoint);
pPlayer->totalvel = int(posdelta.XY().Length() * worldtoint);
// This should amplified 8x, not 2x, but it feels very heavy. Add a CVAR?
doPlayerPitch(pPlayer, (pPlayerActor->spr.pos.Z - spr_pos.Z) * 2.);
doPlayerPitch(pPlayer, -posdelta.Z * 2.);
updatePlayerViewSector(pPlayer, nMove, spr_pos, spr_vel, bUnderwater);
pPlayer->nPlayerD = (pPlayerActor->spr.pos - spr_pos);