- floatified all of movesprite.

This commit is contained in:
Christoph Oelckers 2022-09-10 23:56:40 +02:00
parent 6854e8030d
commit 7b8b4a48f7
8 changed files with 15 additions and 25 deletions

View file

@ -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;
}

View file

@ -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();

View file

@ -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))
{

View file

@ -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())
{

View file

@ -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)
{

View file

@ -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;

View file

@ -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;
}

View file

@ -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;