- SpriteOverlap

This commit is contained in:
Christoph Oelckers 2021-11-05 22:25:41 +01:00
parent 2c4862b220
commit f8eac8c8eb
4 changed files with 11 additions and 11 deletions

View file

@ -571,7 +571,7 @@ int DoEelMove(DSWActor* actor)
ASSERT(u->Rot != nullptr);
if (SpriteOverlap(actor->GetSpriteIndex(), u->targetActor->GetSpriteIndex()))
if (SpriteOverlap(actor, u->targetActor))
NewStateGroup(actor, u->ActorActionSet->CloseAttack[0]);
if (TEST(u->Flags,SPR_SLIDING))

View file

@ -4596,12 +4596,12 @@ int NewStateGroup(DSWActor* actor, STATEp StateGroup[])
}
bool SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b)
bool SpriteOverlap(DSWActor* actor_a, DSWActor* actor_b)
{
SPRITEp spa = &sprite[spritenum_a], spb = &sprite[spritenum_b];
SPRITEp spa = &actor_a->s(), spb = &actor_b->s();
USERp ua = User[spritenum_a].Data();
USERp ub = User[spritenum_b].Data();
USERp ua = actor_a->u();
USERp ub = actor_b->u();
int spa_tos, spa_bos, spb_tos, spb_bos, overlap_z;
@ -5507,7 +5507,7 @@ DoGet(DSWActor* actor)
continue;
}
if (!SpriteOverlap(actor->GetSpriteIndex(), pp->Actor()->GetSpriteIndex()))
if (!SpriteOverlap(actor, pp->Actor()))
{
continue;
}

View file

@ -46,7 +46,7 @@ void SpriteFindNewDirection(short SpriteNum, short range);
int DoWalk(short SpriteNum);
int DoBody(short SpriteNum);
bool CanMoveHere(int16_t spritenum);
bool SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b);
bool SpriteOverlap(DSWActor*, DSWActor*);
int DoActorDie(DSWActor* actor, DSWActor* weapActor, int meansofdeath);
void SpriteControl(void);
void DoActorZrange(DSWActor*);

View file

@ -7346,7 +7346,7 @@ int DoDamageTest(DSWActor* actor)
continue;
}
if (GetOwner(actor) != itActor && SpriteOverlap(actor->GetSpriteIndex(), itActor->GetSpriteIndex()))
if (GetOwner(actor) != itActor && SpriteOverlap(actor, itActor))
{
DoDamage(itActor->GetSpriteIndex(), actor->GetSpriteIndex());
}
@ -7428,7 +7428,7 @@ int DoFlamesDamageTest(DSWActor* actor)
DoDamage(itActor->GetSpriteIndex(), actor->GetSpriteIndex());
}
}
else if (SpriteOverlap(actor->GetSpriteIndex(), itActor->GetSpriteIndex()))
else if (SpriteOverlap(actor, itActor))
{
DoDamage(itActor->GetSpriteIndex(), actor->GetSpriteIndex());
}
@ -7708,7 +7708,7 @@ int DoMineExpMine(DSWActor* actor)
// Explosions are spherical, not planes, so let's check that way, well cylindrical at least.
zdist = abs(sp->z - wp->z)>>4;
if (SpriteOverlap(actor->GetSpriteIndex(), itActor->GetSpriteIndex()) || (unsigned)zdist < wu->Radius + u->Radius)
if (SpriteOverlap(actor, itActor) || (unsigned)zdist < wu->Radius + u->Radius)
{
DoDamage(itActor->GetSpriteIndex(), actor->GetSpriteIndex());
// only explode one mine at a time
@ -14964,7 +14964,7 @@ int DoStaticFlamesDamage(DSWActor* actor)
if (dist > 2000)
continue;
if (SpriteOverlap(actor->GetSpriteIndex(), itActor->GetSpriteIndex())) // If sprites are overlapping, cansee will fail!
if (SpriteOverlap(actor, itActor)) // If sprites are overlapping, cansee will fail!
DoDamage(itActor->GetSpriteIndex(), actor->GetSpriteIndex());
else if (u->Radius > 200)
{