mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- handle another precision issue in MoveDude.
That mulscale16r function is broken enough to affect the values in an observable way that cannot be replicated with real floats.
This commit is contained in:
parent
c9bcfff654
commit
84ce8b29f2
3 changed files with 8 additions and 5 deletions
|
@ -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();
|
||||
|
|
|
@ -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<typename T> bool IsPlayerSprite(T const * const pSprite)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue