diff --git a/source/games/exhumed/src/bullet.cpp b/source/games/exhumed/src/bullet.cpp index 2afc5abfd..95bfd5978 100644 --- a/source/games/exhumed/src/bullet.cpp +++ b/source/games/exhumed/src/bullet.cpp @@ -344,7 +344,7 @@ int MoveBullet(int nBullet) } } - coll = movesprite__(pActor, pBullet->vect, pActor->native_clipdist() >> 1, pActor->native_clipdist() >> 1, CLIPMASK1); + coll = movesprite(pActor, pBullet->vect.XY(), pBullet->vect.Z, pActor->fClipdist() / 128., CLIPMASK1); MOVEEND: if (coll.type || coll.exbits) @@ -731,7 +731,7 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, double fZOffset, DA } pBullet->vect.Z = 0; - pBullet->vect.XY() = nAngle.ToVector() * (1 << 14) * pActor->fClipdist(); + pBullet->vect.XY() = nAngle.ToVector() * pActor->fClipdist(); BulletList[nBullet].pEnemy = nullptr; @@ -742,7 +742,7 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, double fZOffset, DA else { pBullet->field_10 = pBulletInfo->field_4; - pBullet->vect.XY() = nAngle.ToVector() * pBulletInfo->field_4 * 128; + pBullet->vect.XY() = nAngle.ToVector() * pBulletInfo->field_4 / 128.; pBullet->vect.Z = nVertVel * 0.125 * zmaptoworld; } diff --git a/source/games/exhumed/src/engine.h b/source/games/exhumed/src/engine.h index c9363254f..946ec2647 100644 --- a/source/games/exhumed/src/engine.h +++ b/source/games/exhumed/src/engine.h @@ -34,18 +34,9 @@ enum 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) +inline Collision movespritevel(DExhumedActor* spritenum, const DVector3& pos, double xyfactor, 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); -} -Collision movesprite___(DExhumedActor* spritenum, const DVector3& pos, double xyfactor, int ceildist, int flordist, unsigned int clipmask) -{ - return movesprite_(spritenum, int(pos.X * xyfactor * worldtoint), int(pos.Y * xyfactor * worldtoint), int(pos.Z * zworldtoint), ceildist, flordist, clipmask); + return movesprite(spritenum, pos.XY() * xyfactor / 16384., pos.Z, flordist, clipmask); } void precache(); diff --git a/source/games/exhumed/src/fish.cpp b/source/games/exhumed/src/fish.cpp index 26580a66f..eb3238eec 100644 --- a/source/games/exhumed/src/fish.cpp +++ b/source/games/exhumed/src/fish.cpp @@ -119,7 +119,7 @@ void AIFishLimb::Tick(RunListEvent* ev) } else { - auto coll = movesprite___(pActor, pActor->vel, 256., 2560, -2560, CLIPMASK1); + auto coll = movespritevel(pActor, pActor->vel, 256., -10, CLIPMASK1); if (coll.type != kHitNone) { pActor->vel.X = 0; @@ -413,7 +413,7 @@ void AIFish::Tick(RunListEvent* ev) auto pSector =pActor->sector(); // loc_2EF54 - Collision coll = movesprite___(pActor, pActor->vel * 4, 2048., 0, 0, CLIPMASK0); + Collision coll = movespritevel(pActor, pActor->vel * 4, 2048., 0, CLIPMASK0); if (!(pActor->sector()->Flag & kSectUnderwater)) { diff --git a/source/games/exhumed/src/lavadude.cpp b/source/games/exhumed/src/lavadude.cpp index 18a600d1d..a69592bfa 100644 --- a/source/games/exhumed/src/lavadude.cpp +++ b/source/games/exhumed/src/lavadude.cpp @@ -73,7 +73,7 @@ void AILavaDudeLimb::Tick(RunListEvent* ev) pActor->spr.shade += 3; - auto coll = movesprite___(pActor, pActor->vel, 4096., 2560, -2560, CLIPMASK1); + auto coll = movespritevel(pActor, pActor->vel, 4096., -10, CLIPMASK1); if (coll.type || pActor->spr.shade > 100) { @@ -279,7 +279,7 @@ void AILavaDude::Tick(RunListEvent* ev) auto pos = pActor->spr.pos; auto pSector =pActor->sector(); - auto coll = movesprite___(pActor, DVector3(pActor->vel.XY(), 0), 256., 0, 0, CLIPMASK0); + auto coll = movespritevel(pActor, DVector3(pActor->vel.XY(), 0), 256., 0, CLIPMASK0); if (pSector != pActor->sector()) { diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 168d52df6..726054fad 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -509,7 +509,7 @@ void Gravity(DExhumedActor* pActor) Collision MoveCreature(DExhumedActor* pActor) { - return movesprite___(pActor, pActor->vel, 256., 15360, -5120, CLIPMASK0); + return movespritevel(pActor, pActor->vel, 256., -20, CLIPMASK0); } Collision MoveCreatureWithCaution(DExhumedActor* pActor) @@ -1118,7 +1118,7 @@ void AICreatureChunk::Tick(RunListEvent* ev) auto pSector = pActor->sector(); pActor->spr.pal = pSector->ceilingpal; - auto nVal = movesprite___(pActor, pActor->vel, 1024., 2560, -2560, CLIPMASK1); + auto nVal = movespritevel(pActor, pActor->vel, 1024., -10, CLIPMASK1); if (pActor->spr.pos.Z >= pSector->floorz) { diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index 47c64d995..9b9c0fb54 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -1372,7 +1372,7 @@ void AISpark::Tick(RunListEvent* ev) pActor->vel.Z += 0.5; - auto nMov = movesprite___(pActor, pActor->vel, 4096, 2560, -2560, CLIPMASK1); + auto nMov = movespritevel(pActor, pActor->vel, 4096, -10, CLIPMASK1); if (!nMov.type && !nMov.exbits) { return; } @@ -1823,7 +1823,7 @@ void AIObject::Tick(RunListEvent* ev) FUNCOBJECT_GOTO: if (nStat != kStatExplodeTarget) { - auto nMov = movesprite___(pActor, pActor->vel, 64., 0, 0, CLIPMASK0); + auto nMov = movespritevel(pActor, pActor->vel, 64., 0, CLIPMASK0); if (pActor->spr.statnum == kStatExplodeTrigger) { pActor->spr.pal = 1; diff --git a/source/games/exhumed/src/snake.cpp b/source/games/exhumed/src/snake.cpp index 3a56a9e39..5d1060a8c 100644 --- a/source/games/exhumed/src/snake.cpp +++ b/source/games/exhumed/src/snake.cpp @@ -364,8 +364,7 @@ void AISnake::Tick(RunListEvent* ev) DVector2 vect; vect.X = cosang + cosang * i + eax * normalang.Cos(); vect.Y = cosang + sinang * i + eax * normalang.Sin(); - movesprite_(pActor2, FloatToFixed<18>(vect.X), FloatToFixed<18>(vect.Y), - int(- zVal * (i - 1) * zworldtoint), 0, 0, CLIPMASK1); + movesprite(pActor2, vect, - zVal * (i - 1), 0, CLIPMASK1); snakeang += DAngle22_5; } diff --git a/source/games/exhumed/src/spider.cpp b/source/games/exhumed/src/spider.cpp index 7db9710d0..1406cc99f 100644 --- a/source/games/exhumed/src/spider.cpp +++ b/source/games/exhumed/src/spider.cpp @@ -273,7 +273,7 @@ void AISpider::Tick(RunListEvent* ev) spp->vel.Y = 0; } - auto nMov = movesprite___(spp, spp->vel, 1 << nVel, 1280, -1280, CLIPMASK0); + auto nMov = movespritevel(spp, spp->vel, 1 << nVel, -5, CLIPMASK0); if (nMov.type == kHitNone && nMov.exbits == 0) return;