- CheckProximity

This commit is contained in:
Christoph Oelckers 2021-11-24 00:52:54 +01:00
parent e172d0c138
commit b187f3c028
7 changed files with 21 additions and 21 deletions

View file

@ -2663,7 +2663,7 @@ void actRadiusDamage(DBloodActor* source, int x, int y, int z, sectortype* pSect
{
if (pSprite2->flags & 0x20) continue;
if (!CheckSector(sectorMap, pSprite2)) continue;
if (!CheckProximity(act2, x, y, z, sectnum(pSector), nDist)) continue;
if (!CheckProximity(act2, x, y, z, pSector, nDist)) continue;
int dx = abs(x - pSprite2->x);
int dy = abs(y - pSprite2->y);
@ -2690,7 +2690,7 @@ void actRadiusDamage(DBloodActor* source, int x, int y, int z, sectortype* pSect
if (pSprite2->flags & 0x20) continue;
if (!CheckSector(sectorMap, pSprite2)) continue;
if (!CheckProximity(act2, x, y, z, sectnum(pSector), nDist)) continue;
if (!CheckProximity(act2, x, y, z, pSector, nDist)) continue;
XSPRITE* pXSprite2 = &act2->x();
if (pXSprite2->locked) continue;
@ -5701,7 +5701,7 @@ static void actCheckProximity()
proxyDist = 512;
}
if (CheckProximity(dudeactor, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, proxyDist))
if (CheckProximity(dudeactor, pSprite->x, pSprite->y, pSprite->z, pSprite->sector(), proxyDist))
{
switch (pSprite->type)
{
@ -5924,7 +5924,7 @@ static void actCheckExplosion()
if (CheckSector(sectorMap, pDude))
{
if (pXSprite->data1 && CheckProximity(dudeactor, x, y, z, nSector, radius))
if (pXSprite->data1 && CheckProximity(dudeactor, x, y, z, pSector, radius))
{
if (pExplodeInfo->dmg && actor->explosionhackflag)
{
@ -5953,7 +5953,7 @@ static void actCheckExplosion()
if (CheckSector(sectorMap, pThing))
{
if (pXSprite->data1 && CheckProximity(thingactor, x, y, z, nSector, radius) && thingactor->hasX())
if (pXSprite->data1 && CheckProximity(thingactor, x, y, z, pSector, radius) && thingactor->hasX())
{
XSPRITE* pXThing = &thingactor->x();
if (!pXThing->locked)
@ -5995,7 +5995,7 @@ static void actCheckExplosion()
spritetype* pDebris = &physactor->s();
if (pDebris->sectnum < 0 || (pDebris->flags & kHitagFree) != 0) continue;
if (!CheckSector(sectorMap, pDebris) || !CheckProximity(physactor, x, y, z, nSector, radius)) continue;
if (!CheckSector(sectorMap, pDebris) || !CheckProximity(physactor, x, y, z, pSector, radius)) continue;
else debrisConcuss(Owner, i, x, y, z, pExplodeInfo->dmgType);
}
}
@ -6009,7 +6009,7 @@ static void actCheckExplosion()
auto impactactor = gImpactSpritesList[i];
if (!impactactor->hasX() || !impactactor->s().insector() || (impactactor->s().flags & kHitagFree) != 0) continue;
if (!CheckSector(sectorMap, &impactactor->s()) || !CheckProximity(impactactor, x, y, z, nSector, radius))
if (!CheckSector(sectorMap, &impactactor->s()) || !CheckProximity(impactactor, x, y, z, pSector, radius))
continue;
trTriggerSprite(impactactor, kCmdSpriteImpact);
@ -6157,7 +6157,7 @@ static void actCheckDudes()
if ((unsigned int)pXSprite2->health > 0 && actor2->IsPlayerActor())
{
if (CheckProximity(actor2, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, 128))
if (CheckProximity(actor2, pSprite->x, pSprite->y, pSprite->z, pSprite->sector(), 128))
trTriggerSprite(actor, kCmdSpriteProximity);
}
}

View file

@ -111,7 +111,7 @@ void StompSeqCallback(int, DBloodActor* actor1)
continue;
if (pSprite2->flags & 32)
continue;
if (CheckSector(sectorMap, pSprite2) && CheckProximity(actor2, x, y, z, nSector, vc))
if (CheckSector(sectorMap, pSprite2) && CheckProximity(actor2, x, y, z, pSector, vc))
{
int top, bottom;
GetActorExtents(actor1, &top, &bottom);
@ -142,7 +142,7 @@ void StompSeqCallback(int, DBloodActor* actor1)
spritetype* pSprite2 = &actor2->s();
if (pSprite2->flags & 32)
continue;
if (CheckSector(sectorMap, pSprite2) && CheckProximity(actor2, x, y, z, nSector, vc))
if (CheckSector(sectorMap, pSprite2) && CheckProximity(actor2, x, y, z, pSector, vc))
{
XSPRITE* pXSprite = &actor2->x();
if (pXSprite->locked)

View file

@ -751,7 +751,7 @@ static void unicultThinkChase(DBloodActor* actor)
{
int nType = curWeapon - kTrapExploder;
const EXPLOSION* pExpl = &explodeInfo[nType];
if (CheckProximity(actor, pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pExpl->radius >> 1))
if (CheckProximity(actor, pTarget->x, pTarget->y, pTarget->z, pTarget->sector(), pExpl->radius >> 1))
{
actor->xvel = actor->yvel = actor->zvel = 0;
if (doExplosion(actor, nType) && pXSprite->health > 0)

View file

@ -102,7 +102,7 @@ bool FindSector(int nX, int nY, int *nSector)
return 0;
}
bool CheckProximity(DBloodActor *actor, int nX, int nY, int nZ, int nSector, int nDist)
bool CheckProximity(DBloodActor *actor, int nX, int nY, int nZ, sectortype* pSector, int nDist)
{
assert(actor != NULL);
auto pSprite = &actor->s();
@ -119,11 +119,11 @@ bool CheckProximity(DBloodActor *actor, int nX, int nY, int nZ, int nSector, int
int bottom, top;
GetActorExtents(actor, &top, &bottom);
if (cansee(pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, nX, nY, nZ, nSector))
if (cansee(pSprite->x, pSprite->y, pSprite->z, pSprite->sector(), nX, nY, nZ, pSector))
return 1;
if (cansee(pSprite->x, pSprite->y, bottom, pSprite->sectnum, nX, nY, nZ, nSector))
if (cansee(pSprite->x, pSprite->y, bottom, pSprite->sector(), nX, nY, nZ, pSector))
return 1;
if (cansee(pSprite->x, pSprite->y, top, pSprite->sectnum, nX, nY, nZ, nSector))
if (cansee(pSprite->x, pSprite->y, top, pSprite->sector(), nX, nY, nZ, pSector))
return 1;
return 0;
}

View file

@ -74,7 +74,7 @@ bool FindSector(int nX, int nY, int nZ, int* nSector);
[[deprecated]]
bool FindSector(int nX, int nY, int* nSector);
bool CheckProximity(DBloodActor *pSprite, int nX, int nY, int nZ, int nSector, int nDist);
bool CheckProximity(DBloodActor *pSprite, int nX, int nY, int nZ, sectortype* pSector, int nDist);
bool CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, int nDist);
bool CheckProximityWall(walltype* pWall, int x, int y, int nDist);
int GetWallAngle(walltype* pWall);

View file

@ -1196,7 +1196,7 @@ void nnExtProcessSuperSprites()
int x = pProxSpr->x;
int y = pProxSpr->y;
int z = pProxSpr->z;
int sectnum = pProxSpr->sectnum;
auto pSect = pProxSpr->sector();
if (!pXProxSpr->DudeLockout)
{
@ -1204,7 +1204,7 @@ void nnExtProcessSuperSprites()
while (auto affected = it.Next())
{
if (!affected->hasX() || affected->x().health <= 0) continue;
else if (CheckProximity(affected, x, y, z, sectnum, okDist))
else if (CheckProximity(affected, x, y, z, pSect, okDist))
{
trTriggerSprite(gProxySpritesList[i], kCmdSpriteProximity);
break;
@ -1219,7 +1219,7 @@ void nnExtProcessSuperSprites()
if (!pPlayer || !pPlayer->actor->hasX() || pPlayer->pXSprite->health <= 0)
continue;
if (pPlayer->pXSprite->health > 0 && CheckProximity(gPlayer->actor, x, y, z, sectnum, okDist))
if (pPlayer->pXSprite->health > 0 && CheckProximity(gPlayer->actor, x, y, z, pSect, okDist))
{
trTriggerSprite(gProxySpritesList[i], kCmdSpriteProximity);
break;

View file

@ -2680,7 +2680,7 @@ void teslaHit(DBloodActor *missileactor, int a2)
spritetype *pHitSprite = &hitactor->s();
if (pHitSprite->flags&32)
continue;
if (CheckSector(sectorMap, pHitSprite) && CheckProximity(hitactor, x, y, z, nSector, nDist))
if (CheckSector(sectorMap, pHitSprite) && CheckProximity(hitactor, x, y, z, pSector, nDist))
{
int dx = pMissile->x-pHitSprite->x;
int dy = pMissile->y-pHitSprite->y;
@ -2697,7 +2697,7 @@ void teslaHit(DBloodActor *missileactor, int a2)
spritetype *pHitSprite = &hitactor->s();
if (pHitSprite->flags&32)
continue;
if (CheckSector(sectorMap, pHitSprite) && CheckProximity(hitactor, x, y, z, nSector, nDist))
if (CheckSector(sectorMap, pHitSprite) && CheckProximity(hitactor, x, y, z, pSector, nDist))
{
XSPRITE *pXSprite = &hitactor->x();
if (!pXSprite->locked)