diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 60f52d1dd..1274d5817 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -5159,10 +5159,13 @@ void MoveDude(DBloodActor* actor) return; if (actor->xspr.height >= 0x100) return; - double nDrag = gDudeDrag; + int nDrag = gDudeDrag; if (actor->xspr.height > 0) - nDrag -= Scale(gDudeDrag, (double)actor->xspr.height, 256.); - actor->vel.XY() += -actor->vel * nDrag; + 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 (actor->vel.XY().Length() < 0.0625) actor->ZeroVelocityXY(); diff --git a/source/games/blood/src/actor.h b/source/games/blood/src/actor.h index bd68497c6..c2d69db80 100644 --- a/source/games/blood/src/actor.h +++ b/source/games/blood/src/actor.h @@ -169,7 +169,7 @@ extern const EXPLOSION explodeInfo[]; extern const THINGINFO thingInfo[]; extern VECTORDATA gVectorData[]; -const double gDudeDrag = FixedToFloat(0x2a00); +const int gDudeDrag = 0x2a00; template bool IsPlayerSprite(T const * const pSprite) { diff --git a/source/games/blood/src/common_game.h b/source/games/blood/src/common_game.h index e663e1a1b..d85f40b93 100644 --- a/source/games/blood/src/common_game.h +++ b/source/games/blood/src/common_game.h @@ -605,7 +605,7 @@ inline int scale(int a1, int a2, int a3, int a4, int a5) return a4 + (a5 - a4) * (a1 - a2) / (a3 - a2); } -inline int mulscale16r(int a, int b) +inline int mulscale16r(int a, int b) // do not delete! { int64_t acc = 1 << (16 - 1); acc += ((int64_t)a) * b;