- Exhumed: Store dedicated player velocity in Player struct.

* Changes implementation in 67c7dd65f9.
* Cannot rely on the actor's velocity alone as parts of the game modify this, such as getting hit by lava dudes, but game nullifies this at the start of the player's tic.
This commit is contained in:
Mitchell Richters 2023-03-16 12:17:42 +11:00
parent b42b9de2a2
commit 3d6f1e1a04
4 changed files with 9 additions and 5 deletions

View file

@ -379,7 +379,7 @@ void GameInterface::Ticker()
PlayerList[nLocalPlayer].input = playercmds[nLocalPlayer].ucmd;
if (oldactions & SB_CENTERVIEW) PlayerList[nLocalPlayer].input.actions |= SB_CENTERVIEW;
auto& lPlayerVel = PlayerList[nLocalPlayer].pActor->vel.XY();
auto& lPlayerVel = PlayerList[nLocalPlayer].vel;
auto inputvect = DVector2(PlayerList[nLocalPlayer].input.fvel, PlayerList[nLocalPlayer].input.svel).Rotated(inita) * 0.375;

View file

@ -68,9 +68,9 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
{
processMovement(&input, &localInput, hidInput, scaleAdjust);
}
else if (pPlayer->pActor)
else
{
pPlayer->pActor->vel.Zero();
pPlayer->vel.Zero();
}
if (!SyncInput() && gamestate == GS_LEVEL && !nFreeze)

View file

@ -854,7 +854,7 @@ bool CheckMovingBlocks(int nPlayer, Collision& nMove, DVector3& spr_pos, sectort
{
PlayerList[nPlayer].pPlayerPushSect = sect;
DVector2 vel = PlayerList[nPlayer].pActor->vel.XY();
DVector2 vel = PlayerList[nPlayer].vel;
auto nMyAngle = vel.Angle().Normalized360();
setsectinterpolate(sect);
@ -905,6 +905,8 @@ void AIPlayer::Tick(RunListEvent* ev)
int nAction = PlayerList[nPlayer].nAction;
int nActionB = PlayerList[nPlayer].nAction;
pPlayerActor->vel.XY() = PlayerList[nPlayer].vel;
if (PlayerList[nPlayer].nCurrentItem > -1)
{
UseItem(nPlayer, PlayerList[nPlayer].nCurrentItem);
@ -1003,7 +1005,7 @@ void AIPlayer::Tick(RunListEvent* ev)
auto playerPos = pPlayerActor->spr.pos.XY();
DVector2 vect = pPlayerActor->vel.XY();
DVector2 vect = PlayerList[nPlayer].vel;
double zz = pPlayerActor->vel.Z;
if (pPlayerActor->vel.Z > 32)
@ -1071,6 +1073,7 @@ void AIPlayer::Tick(RunListEvent* ev)
pPlayerActor->spr.Angles = DRotator(nullAngle, GetAngleToSprite(pPlayerActor, pSpiritSprite), nullAngle);
pPlayerActor->backupang();
PlayerList[nPlayer].vel.Zero();
pPlayerActor->vel.Zero();
if (nFreeze < 1)

View file

@ -81,6 +81,7 @@ struct Player
InputPacket input;
PlayerAngles Angles;
DVector2 vel;
sectortype* pPlayerPushSect;
sectortype* pPlayerViewSect;