- another movesprite wrapper to get rid of int_yvel and int_xvel

This commit is contained in:
Christoph Oelckers 2022-09-09 19:26:31 +02:00
parent 47ad4fccdc
commit fdc6a49a97
7 changed files with 13 additions and 15 deletions

View file

@ -143,12 +143,6 @@ public:
vel.X += v * inttoworld;
}
// Only used this way by Exhumed.
int int_yvel() const
{
return vel.Y * worldtoint;
}
vec3_t int_vel() const
{
return vec3_t(FloatToFixed(vel.X), FloatToFixed(vel.Y), FloatToFixed(vel.Z));

View file

@ -38,6 +38,10 @@ Collision movesprite(DExhumedActor* spritenum, const DVector3& pos, int ceildist
{
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);
}
void precache();
void resettiming();

View file

@ -119,7 +119,7 @@ void AIFishLimb::Tick(RunListEvent* ev)
}
else
{
auto coll = movesprite(pActor, pActor->int_xvel() << 8, pActor->int_yvel() << 8, pActor->int_zvel(), 2560, -2560, CLIPMASK1);
auto coll = movesprite(pActor, pActor->vel, 256., 2560, -2560, 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->int_xvel() << 13, pActor->int_yvel() << 13, pActor->int_zvel() << 2, 0, 0, CLIPMASK0);
Collision coll = movesprite(pActor, pActor->vel * 4, 2048., 0, 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->int_xvel() << 12, pActor->int_yvel() << 12, pActor->int_zvel(), 2560, -2560, CLIPMASK1);
auto coll = movesprite(pActor, pActor->vel, 4096., 2560, -2560, 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, pActor->int_xvel() << 8, pActor->int_yvel() << 8, 0, 0, 0, CLIPMASK0);
auto coll = movesprite(pActor, DVector3(pActor->vel.XY(), 0), 256., 0, 0, CLIPMASK0);
if (pSector != pActor->sector())
{

View file

@ -520,7 +520,7 @@ void Gravity(DExhumedActor* pActor)
Collision MoveCreature(DExhumedActor* pActor)
{
return movesprite(pActor, pActor->int_xvel() << 8, pActor->int_yvel() << 8, pActor->int_zvel(), 15360, -5120, CLIPMASK0);
return movesprite(pActor, pActor->vel, 256., 15360, -5120, CLIPMASK0);
}
Collision MoveCreatureWithCaution(DExhumedActor* pActor)
@ -1221,7 +1221,7 @@ void AICreatureChunk::Tick(RunListEvent* ev)
auto pSector = pActor->sector();
pActor->spr.pal = pSector->ceilingpal;
auto nVal = movesprite(pActor, pActor->int_xvel() << 10, pActor->int_yvel() << 10, pActor->int_zvel(), 2560, -2560, CLIPMASK1);
auto nVal = movesprite(pActor, pActor->vel, 1024., 2560, -2560, CLIPMASK1);
if (pActor->spr.pos.Z >= pSector->floorz)
{

View file

@ -1434,7 +1434,7 @@ void AISpark::Tick(RunListEvent* ev)
pActor->add_int_zvel( 128);
auto nMov = movesprite(pActor, pActor->int_xvel() << 12, pActor->int_yvel() << 12, pActor->int_zvel(), 2560, -2560, CLIPMASK1);
auto nMov = movesprite(pActor, pActor->vel, 4096, 2560, -2560, CLIPMASK1);
if (!nMov.type && !nMov.exbits) {
return;
}
@ -1886,7 +1886,7 @@ void AIObject::Tick(RunListEvent* ev)
FUNCOBJECT_GOTO:
if (nStat != kStatExplodeTarget)
{
auto nMov = movesprite(pActor, pActor->int_xvel() << 6, pActor->int_yvel() << 6, pActor->int_zvel(), 0, 0, CLIPMASK0);
auto nMov = movesprite(pActor, pActor->vel, 64., 0, 0, CLIPMASK0);
if (pActor->spr.statnum == kStatExplodeTrigger) {
pActor->spr.pal = 1;

View file

@ -273,7 +273,7 @@ void AISpider::Tick(RunListEvent* ev)
spp->vel.Y = 0;
}
auto nMov = movesprite(spp, spp->int_xvel() << nVel, spp->int_yvel() << nVel, spp->int_zvel(), 1280, -1280, CLIPMASK0);
auto nMov = movesprite(spp, spp->vel, 1 << nVel, 1280, -1280, CLIPMASK0);
if (nMov.type == kHitNone && nMov.exbits == 0)
return;