From a043c7fa4d6fe3364f95d6866ed00b091dbf59fc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 10 Sep 2022 22:25:56 +0200 Subject: [PATCH] floatified body of movesprite and prepared the calls for adjustment. --- source/games/exhumed/src/engine.h | 7 ++++++- source/games/exhumed/src/move.cpp | 10 ++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/source/games/exhumed/src/engine.h b/source/games/exhumed/src/engine.h index e813f8b00..c9363254f 100644 --- a/source/games/exhumed/src/engine.h +++ b/source/games/exhumed/src/engine.h @@ -32,8 +32,13 @@ enum 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) { return movesprite_(spritenum, int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint), ceildist, flordist, clipmask); diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 2d1c7dc96..2b9d1ad17 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -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; auto spos = pActor->spr.pos; @@ -411,7 +409,7 @@ Collision movesprite_(DExhumedActor* pActor, int dx, int dy, int dz, int ceildis 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 @@ -434,7 +432,7 @@ Collision movesprite_(DExhumedActor* pActor, int dx, int dy, int dz, int ceildis } 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. { coll.exbits = nRet.exbits; @@ -447,7 +445,7 @@ Collision movesprite_(DExhumedActor* pActor, int dx, int dy, int dz, int ceildis dz = 0; } - if ((pSector->floorz - spos.Z) < (dz + flordist) * zinttoworld) + if ((pSector->floorz - spos.Z) < (dz + flordist)) { pActor->spr.pos.XY() = spos.XY(); }