floatified body of movesprite and prepared the calls for adjustment.

This commit is contained in:
Christoph Oelckers 2022-09-10 22:25:56 +02:00
parent 98eb4a169d
commit a043c7fa4d
2 changed files with 10 additions and 7 deletions

View file

@ -32,8 +32,13 @@ enum
kAngleMask = 0x7FF kAngleMask = 0x7FF
}; };
Collision movesprite(DExhumedActor* spritenum, DVector2 vect, double dz, double flordist, unsigned int clipmask);
Collision movesprite_(DExhumedActor* spritenum, int dx, int dy, int dz, int ceildist, int flordist, unsigned int clipmask);
Collision movesprite_(DExhumedActor* spritenum, int dx, int dy, int dz, int ceildist, int flordist, unsigned int clipmask)
{
return movesprite(spritenum, DVector2(FixedToFloat<18>(dx), FixedToFloat<18>(dy)), dz * zinttoworld, flordist * zinttoworld, clipmask);
}
Collision movesprite__(DExhumedActor* spritenum, const DVector3& pos, int ceildist, int flordist, unsigned int clipmask) Collision movesprite__(DExhumedActor* spritenum, const DVector3& pos, int ceildist, int flordist, unsigned int clipmask)
{ {
return movesprite_(spritenum, int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint), ceildist, flordist, clipmask); return movesprite_(spritenum, int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint), ceildist, flordist, clipmask);

View file

@ -393,10 +393,8 @@ DExhumedActor* insertActor(sectortype* s, int st)
} }
Collision movesprite_(DExhumedActor* pActor, int dx, int dy, int dz, int ceildist, int flordist, unsigned int clipmask) Collision movesprite(DExhumedActor* pActor, DVector2 vect, double dz, double flordist, unsigned int clipmask)
{ {
DVector2 vect(FixedToFloat<18>(dx), FixedToFloat<18>(dy));
bTouchFloor = false; bTouchFloor = false;
auto spos = pActor->spr.pos; auto spos = pActor->spr.pos;
@ -411,7 +409,7 @@ Collision movesprite_(DExhumedActor* pActor, int dx, int dy, int dz, int ceildis
vect *= 0.5; vect *= 0.5;
} }
Collision nRet = movespritez(pActor, dz * zinttoworld, nSpriteHeight, pActor->fClipdist()); Collision nRet = movespritez(pActor, dz, nSpriteHeight, pActor->fClipdist());
pSector = pActor->sector(); // modified in movespritez so re-grab this variable pSector = pActor->sector(); // modified in movespritez so re-grab this variable
@ -434,7 +432,7 @@ Collision movesprite_(DExhumedActor* pActor, int dx, int dy, int dz, int ceildis
} }
Collision coll; Collision coll;
clipmove(pActor->spr.pos, &pSector, FloatToFixed<18>(vect.X), FloatToFixed<18>(vect.Y), pActor->int_clipdist(), int(nSpriteHeight * zworldtoint), flordist, clipmask, coll); clipmove(pActor->spr.pos, &pSector, FloatToFixed<18>(vect.X), FloatToFixed<18>(vect.Y), pActor->int_clipdist(), int(nSpriteHeight * zworldtoint), int(flordist * zworldtoint), clipmask, coll);
if (coll.type != kHitNone) // originally this or'ed the two values which can create unpredictable bad values in some edge cases. if (coll.type != kHitNone) // originally this or'ed the two values which can create unpredictable bad values in some edge cases.
{ {
coll.exbits = nRet.exbits; coll.exbits = nRet.exbits;
@ -447,7 +445,7 @@ Collision movesprite_(DExhumedActor* pActor, int dx, int dy, int dz, int ceildis
dz = 0; dz = 0;
} }
if ((pSector->floorz - spos.Z) < (dz + flordist) * zinttoworld) if ((pSector->floorz - spos.Z) < (dz + flordist))
{ {
pActor->spr.pos.XY() = spos.XY(); pActor->spr.pos.XY() = spos.XY();
} }