- Exhumed: Increase precision of Player::totalvel.

This commit is contained in:
Mitchell Richters 2023-04-19 19:01:58 +10:00
parent e0964eef7a
commit 8283895828
4 changed files with 13 additions and 13 deletions

View file

@ -86,7 +86,7 @@ void ThrowGrenade(int nPlayer, double dz, double push1)
if (push1 <= 23.4375)
{
int nVel = PlayerList[nPlayer].totalvel << 5;
int nVel = (int)(PlayerList[nPlayer].totalvel * 512.);
pActor->nTurn = ((90 - pActor->nIndex2) * (90 - pActor->nIndex2)) + nVel;
pActor->vel.Z = ((32. * push1) - 17);

View file

@ -946,8 +946,8 @@ void DrawWeapons(Player* const pPlayer, double interpfrac)
nTotalVel = interpolatedvalue<double>(pPlayer->ototalvel, pPlayer->totalvel, interpfrac);
}
const auto xBob = nTotalVel * BobVal(nBobAngle + 512) * (1. / 16.) * (nState == 1);
const auto yBob = nTotalVel * fabs(BobVal(nBobAngle)) * (1. / 16.);
const auto xBob = nTotalVel * BobVal(nBobAngle + 512) * (nState == 1);
const auto yBob = nTotalVel * fabs(BobVal(nBobAngle));
nFlameAng += xBob;
xPos += xBob * 2.;

View file

@ -1258,7 +1258,7 @@ static void updatePlayerAction(Player* const pPlayer, const bool bUnderwater)
else
{
scaleViewZ(-32.5);
nextAction = 7 - (pPlayer->totalvel < 1);
nextAction = 7 - (pPlayer->totalvel < 0.0625);
}
}
else
@ -1286,17 +1286,17 @@ static void updatePlayerAction(Player* const pPlayer, const bool bUnderwater)
if (bUnderwater)
{
nextAction = 10 - (pPlayer->totalvel <= 1);
nextAction = 10 - (pPlayer->totalvel <= 0.0625);
}
else if (bTallerThanSector)
{
nextAction = 7 - (pPlayer->totalvel < 1);
nextAction = 7 - (pPlayer->totalvel < 0.0625);
}
else if (pPlayer->totalvel <= 1)
else if (pPlayer->totalvel <= 0.0625)
{
nextAction = bUnderwater;
}
else if (pPlayer->totalvel <= 30)
else if (pPlayer->totalvel <= 1.875)
{
nextAction = 2;
}
@ -1321,7 +1321,7 @@ static void updatePlayerAction(Player* const pPlayer, const bool bUnderwater)
}
else if (pPlayerActor->nAction != 15)
{
nextAction = 14 - (pPlayer->totalvel <= 1);
nextAction = 14 - (pPlayer->totalvel <= 0.0625);
}
if (nextAction != pPlayerActor->nAction && pPlayerActor->nAction != 4)
@ -1477,7 +1477,7 @@ static void doPlayerUnderwater(Player* const pPlayer, const bool oUnderwater)
else
{
const auto pPlayerSect = pPlayerActor->sector();
const auto highSpeed = pPlayer->totalvel > 25;
const auto highSpeed = pPlayer->totalvel > 1.5625;
const auto belowFloor = pPlayerActor->spr.pos.Z > pPlayerSect->floorz;
if (highSpeed && belowFloor && pPlayerSect->Depth && !pPlayerSect->Speed && !pPlayerSect->Damage)
@ -1833,7 +1833,7 @@ static bool doPlayerInput(Player* const pPlayer)
const auto posdelta = pPlayerActor->opos - pPlayerActor->spr.pos;
pPlayer->ototalvel = pPlayer->totalvel;
pPlayer->totalvel = int(posdelta.XY().Length() * worldtoint);
pPlayer->totalvel = posdelta.XY().Length();
// Effects such as slope tilting, view bobbing, etc.
// This should amplified 8x, not 2x, but it feels very heavy. Add a CVAR?

View file

@ -97,8 +97,8 @@ struct Player
int16_t nTemperature;
double nStandHeight;
PlayerSave sPlayerSave;
int ototalvel;
int totalvel;
double ototalvel;
double totalvel;
bool crouch_toggle;
bool bTouchFloor;
bool bJumping;