Skip to content

Commit

Permalink
- Blood: Fix view rolling while underwater.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjr4077au committed Sep 24, 2023
1 parent 8d8c30d commit 2916fe5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions source/games/blood/src/actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5142,23 +5142,24 @@ void MoveDude(DBloodActor* actor)
return;
}
}
if (IsUnderwaterSector(actor->sector()))
return;
if (actor->xspr.height >= 0x100)
return;
int nDrag = gDudeDrag;
if (actor->xspr.height > 0)
nDrag -= Scale(gDudeDrag, actor->xspr.height, 256);

// this cannot be floatified due to the effect of mulscale16r on the value.
actor->vel.X += FixedToFloat(-mulscale16r(FloatToFixed(actor->vel.X), nDrag));
actor->vel.Y += FixedToFloat(-mulscale16r(FloatToFixed(actor->vel.Y), nDrag));

if (pPlayer)
{
pPlayer->Angles.StrafeVel += FixedToFloat(-mulscale16r(FloatToFixed(pPlayer->Angles.StrafeVel), nDrag));
}

if (IsUnderwaterSector(actor->sector()))
return;
if (actor->xspr.height >= 0x100)
return;

// this cannot be floatified due to the effect of mulscale16r on the value.
actor->vel.X += FixedToFloat(-mulscale16r(FloatToFixed(actor->vel.X), nDrag));
actor->vel.Y += FixedToFloat(-mulscale16r(FloatToFixed(actor->vel.Y), nDrag));

if (actor->vel.XY().Length() < 0.0625)
{
actor->vel.XY().Zero();
Expand Down

0 comments on commit 2916fe5

Please sign in to comment.