- Blood: Make bobPhase a proper float.

This commit is contained in:
Mitchell Richters 2022-10-07 14:27:10 +11:00 committed by Christoph Oelckers
parent 80f4124b17
commit ffc16635b2
3 changed files with 6 additions and 6 deletions

View file

@ -1825,8 +1825,8 @@ void playerProcess(PLAYER* pPlayer)
else else
pPlayer->zWeaponVel += dz * FixedToFloat(0xc00); pPlayer->zWeaponVel += dz * FixedToFloat(0xc00);
pPlayer->zWeapon += pPlayer->zWeaponVel; pPlayer->zWeapon += pPlayer->zWeaponVel;
pPlayer->bobPhase = ClipLow(pPlayer->bobPhase - 4, 0); pPlayer->bobPhase = max(pPlayer->bobPhase - 4, 0.);
int nSpeed = int(actor->vel.XY().Length()); double nSpeed = actor->vel.XY().Length();
if (pPlayer->posture == 1) if (pPlayer->posture == 1)
{ {
pPlayer->bobAmp = (pPlayer->bobAmp + 17) & 2047; pPlayer->bobAmp = (pPlayer->bobAmp + 17) & 2047;
@ -1846,12 +1846,12 @@ void playerProcess(PLAYER* pPlayer)
if (running) if (running)
{ {
if (pPlayer->bobPhase < 60) if (pPlayer->bobPhase < 60)
pPlayer->bobPhase = ClipHigh(pPlayer->bobPhase + nSpeed, 60); pPlayer->bobPhase = min(pPlayer->bobPhase + nSpeed, 60.);
} }
else else
{ {
if (pPlayer->bobPhase < 30) if (pPlayer->bobPhase < 30)
pPlayer->bobPhase = ClipHigh(pPlayer->bobPhase + nSpeed, 30); pPlayer->bobPhase = min(pPlayer->bobPhase + nSpeed, 30.);
} }
} }
pPlayer->bobHeight = pPosture->bobV * pPlayer->bobPhase * BobVal(pPlayer->bobAmp * 2); pPlayer->bobHeight = pPosture->bobV * pPlayer->bobPhase * BobVal(pPlayer->bobAmp * 2);

View file

@ -92,7 +92,7 @@ struct PLAYER
bool isRunning; bool isRunning;
int posture; // stand, crouch, swim int posture; // stand, crouch, swim
int sceneQav; // by NoOne: used to keep qav id int sceneQav; // by NoOne: used to keep qav id
int bobPhase; double bobPhase;
int bobAmp; int bobAmp;
double bobHeight; double bobHeight;
double bobWidth; double bobWidth;

View file

@ -62,7 +62,7 @@ struct BloodPlayer native
native bool isRunning; native bool isRunning;
native int posture; // stand, crouch, swim native int posture; // stand, crouch, swim
native int sceneQav; // by NoOne: used to keep qav id native int sceneQav; // by NoOne: used to keep qav id
native int bobPhase; native double bobPhase;
native int bobAmp; native int bobAmp;
native double bobHeight; native double bobHeight;
native double bobWidth; native double bobWidth;