mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-20 18:52:43 +00:00
- CheckProximity
# Conflicts: # source/games/blood/src/aibeast.cpp
This commit is contained in:
parent
db75e4d2bf
commit
c2916259d7
7 changed files with 23 additions and 21 deletions
|
@ -2672,7 +2672,7 @@ void actRadiusDamage(DBloodActor* source, int x, int y, int z, int nSector, int
|
|||
{
|
||||
if (pSprite2->flags & 0x20) continue;
|
||||
if (!TestBitString(sectmap, pSprite2->sectnum)) continue;
|
||||
if (!CheckProximity(pSprite2, x, y, z, nSector, nDist)) continue;
|
||||
if (!CheckProximity(act2, x, y, z, nSector, nDist)) continue;
|
||||
|
||||
int dx = abs(x - pSprite2->x);
|
||||
int dy = abs(y - pSprite2->y);
|
||||
|
@ -2699,7 +2699,7 @@ void actRadiusDamage(DBloodActor* source, int x, int y, int z, int nSector, int
|
|||
|
||||
if (pSprite2->flags & 0x20) continue;
|
||||
if (!TestBitString(sectmap, pSprite2->sectnum)) continue;
|
||||
if (!CheckProximity(pSprite2, x, y, z, nSector, nDist)) continue;
|
||||
if (!CheckProximity(act2, x, y, z, nSector, nDist)) continue;
|
||||
|
||||
XSPRITE* pXSprite2 = &act2->x();
|
||||
if (pXSprite2->locked) continue;
|
||||
|
@ -5740,7 +5740,7 @@ static void actCheckProximity()
|
|||
proxyDist = 512;
|
||||
}
|
||||
|
||||
if (CheckProximity(pSprite2, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, proxyDist))
|
||||
if (CheckProximity(dudeactor, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, proxyDist))
|
||||
{
|
||||
switch (pSprite->type)
|
||||
{
|
||||
|
@ -5974,7 +5974,7 @@ static void actCheckExplosion()
|
|||
|
||||
if (TestBitString(sectormap, pDude->sectnum))
|
||||
{
|
||||
if (pXSprite->data1 && CheckProximity(pDude, x, y, z, nSector, radius))
|
||||
if (pXSprite->data1 && CheckProximity(dudeactor, x, y, z, nSector, radius))
|
||||
{
|
||||
if (pExplodeInfo->dmg && actor->explosionhackflag)
|
||||
{
|
||||
|
@ -6003,7 +6003,7 @@ static void actCheckExplosion()
|
|||
|
||||
if (TestBitString(sectormap, pThing->sectnum))
|
||||
{
|
||||
if (pXSprite->data1 && CheckProximity(pThing, x, y, z, nSector, radius) && thingactor->hasX())
|
||||
if (pXSprite->data1 && CheckProximity(thingactor, x, y, z, nSector, radius) && thingactor->hasX())
|
||||
{
|
||||
XSPRITE* pXThing = &thingactor->x();
|
||||
if (!pXThing->locked)
|
||||
|
@ -6045,7 +6045,7 @@ static void actCheckExplosion()
|
|||
spritetype* pDebris = &physactor->s();
|
||||
if (pDebris->sectnum < 0 || (pDebris->flags & kHitagFree) != 0) continue;
|
||||
|
||||
if (!TestBitString(sectormap, pDebris->sectnum) || !CheckProximity(pDebris, x, y, z, nSector, radius)) continue;
|
||||
if (!TestBitString(sectormap, pDebris->sectnum) || !CheckProximity(physactor, x, y, z, nSector, radius)) continue;
|
||||
else debrisConcuss(Owner, i, x, y, z, pExplodeInfo->dmgType);
|
||||
}
|
||||
}
|
||||
|
@ -6059,7 +6059,7 @@ static void actCheckExplosion()
|
|||
auto impactactor = gImpactSpritesList[i];
|
||||
if (!impactactor->hasX() || impactactor->s().sectnum < 0 || (impactactor->s().flags & kHitagFree) != 0) continue;
|
||||
|
||||
if (/*pXImpact->state == pXImpact->restState ||*/ !TestBitString(sectormap, impactactor->s().sectnum) || !CheckProximity(&impactactor->s(), x, y, z, nSector, radius))
|
||||
if (/*pXImpact->state == pXImpact->restState ||*/ !TestBitString(sectormap, impactactor->s().sectnum) || !CheckProximity(impactactor, x, y, z, nSector, radius))
|
||||
continue;
|
||||
|
||||
trTriggerSprite(impactactor, kCmdSpriteImpact);
|
||||
|
@ -6205,9 +6205,9 @@ static void actCheckDudes()
|
|||
|
||||
XSPRITE* pXSprite2 = &actor2->x();
|
||||
|
||||
if ((unsigned int)pXSprite2->health > 0 && IsPlayerSprite(pSprite2))
|
||||
if ((unsigned int)pXSprite2->health > 0 && actor2->IsPlayerActor())
|
||||
{
|
||||
if (CheckProximity(pSprite2, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, 128))
|
||||
if (CheckProximity(actor2, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, 128))
|
||||
trTriggerSprite(actor, kCmdSpriteProximity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ void StompSeqCallback(int, DBloodActor* actor1)
|
|||
continue;
|
||||
if (pSprite2->flags & 32)
|
||||
continue;
|
||||
if (TestBitString(sectmap, pSprite2->sectnum) && CheckProximity(pSprite2, x, y, z, nSector, vc))
|
||||
if (TestBitString(sectmap, pSprite2->sectnum) && CheckProximity(actor2, x, y, z, nSector, vc))
|
||||
{
|
||||
int top, bottom;
|
||||
GetActorExtents(actor1, &top, &bottom);
|
||||
|
@ -150,7 +150,7 @@ void StompSeqCallback(int, DBloodActor* actor1)
|
|||
spritetype* pSprite2 = &actor2->s();
|
||||
if (pSprite2->flags & 32)
|
||||
continue;
|
||||
if (TestBitString(sectmap, pSprite2->sectnum) && CheckProximity(pSprite2, x, y, z, nSector, vc))
|
||||
if (TestBitString(sectmap, pSprite2->sectnum) && CheckProximity(actor2, x, y, z, nSector, vc))
|
||||
{
|
||||
XSPRITE* pXSprite = &actor2->x();
|
||||
if (pXSprite->locked)
|
||||
|
|
|
@ -756,8 +756,9 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
}
|
||||
else if (weaponType == kGenDudeWeaponKamikaze)
|
||||
{
|
||||
int nType = curWeapon - kTrapExploder; const EXPLOSION* pExpl = &explodeInfo[nType];
|
||||
if (CheckProximity(pSprite, pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pExpl->radius >> 1))
|
||||
int nType = curWeapon - kTrapExploder;
|
||||
const EXPLOSION* pExpl = &explodeInfo[nType];
|
||||
if (CheckProximity(actor, pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pExpl->radius >> 1))
|
||||
{
|
||||
actor->xvel = actor->yvel = actor->zvel = 0;
|
||||
if (doExplosion(actor, nType) && pXSprite->health > 0)
|
||||
|
|
|
@ -138,9 +138,10 @@ bool FindSector(int nX, int nY, int *nSector)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool CheckProximity(spritetype *pSprite, int nX, int nY, int nZ, int nSector, int nDist)
|
||||
bool CheckProximity(DBloodActor *actor, int nX, int nY, int nZ, int nSector, int nDist)
|
||||
{
|
||||
assert(pSprite != NULL);
|
||||
assert(actor != NULL);
|
||||
auto pSprite = &actor->s();
|
||||
int oX = abs(nX-pSprite->x)>>4;
|
||||
if (oX >= nDist) return 0;
|
||||
|
||||
|
@ -153,7 +154,7 @@ bool CheckProximity(spritetype *pSprite, int nX, int nY, int nZ, int nSector, in
|
|||
if (approxDist(oX, oY) >= nDist) return 0;
|
||||
|
||||
int bottom, top;
|
||||
GetSpriteExtents(pSprite, &top, &bottom);
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
if (cansee(pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, nX, nY, nZ, nSector))
|
||||
return 1;
|
||||
if (cansee(pSprite->x, pSprite->y, bottom, pSprite->sectnum, nX, nY, nZ, nSector))
|
||||
|
|
|
@ -74,7 +74,7 @@ struct Collision;
|
|||
bool AreSectorsNeighbors(int sect1, int sect2);
|
||||
bool FindSector(int nX, int nY, int nZ, int *nSector);
|
||||
bool FindSector(int nX, int nY, int *nSector);
|
||||
bool CheckProximity(spritetype *pSprite, int nX, int nY, int nZ, int nSector, int nDist);
|
||||
bool CheckProximity(DBloodActor *pSprite, int nX, int nY, int nZ, int nSector, int nDist);
|
||||
bool CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, int nDist);
|
||||
bool CheckProximityWall(int nWall, int x, int y, int nDist);
|
||||
int GetWallAngle(int nWall);
|
||||
|
|
|
@ -1258,7 +1258,7 @@ void nnExtProcessSuperSprites()
|
|||
while (auto affected = it.Next())
|
||||
{
|
||||
if (!affected->hasX() || affected->x().health <= 0) continue;
|
||||
else if (CheckProximity(&affected->s(), x, y, z, sectnum, okDist))
|
||||
else if (CheckProximity(affected, x, y, z, sectnum, okDist))
|
||||
{
|
||||
trTriggerSprite(gProxySpritesList[i], kCmdSpriteProximity);
|
||||
break;
|
||||
|
@ -1273,7 +1273,7 @@ void nnExtProcessSuperSprites()
|
|||
if (!pPlayer || !pPlayer->actor()->hasX() || pPlayer->pXSprite->health <= 0)
|
||||
continue;
|
||||
|
||||
if (pPlayer->pXSprite->health > 0 && CheckProximity(gPlayer->pSprite, x, y, z, sectnum, okDist))
|
||||
if (pPlayer->pXSprite->health > 0 && CheckProximity(gPlayer->actor(), x, y, z, sectnum, okDist))
|
||||
{
|
||||
trTriggerSprite(gProxySpritesList[i], kCmdSpriteProximity);
|
||||
break;
|
||||
|
|
|
@ -2673,7 +2673,7 @@ void teslaHit(spritetype *pMissile, int a2)
|
|||
spritetype *pHitSprite = &hitactor->s();
|
||||
if (pHitSprite->flags&32)
|
||||
continue;
|
||||
if (TestBitString(sectmap, pHitSprite->sectnum) && CheckProximity(pHitSprite, x, y, z, nSector, nDist))
|
||||
if (TestBitString(sectmap, pHitSprite->sectnum) && CheckProximity(hitactor, x, y, z, nSector, nDist))
|
||||
{
|
||||
int dx = pMissile->x-pHitSprite->x;
|
||||
int dy = pMissile->y-pHitSprite->y;
|
||||
|
@ -2690,7 +2690,7 @@ void teslaHit(spritetype *pMissile, int a2)
|
|||
spritetype *pHitSprite = &hitactor->s();
|
||||
if (pHitSprite->flags&32)
|
||||
continue;
|
||||
if (TestBitString(sectmap, pHitSprite->sectnum) && CheckProximity(pHitSprite, x, y, z, nSector, nDist))
|
||||
if (TestBitString(sectmap, pHitSprite->sectnum) && CheckProximity(hitactor, x, y, z, nSector, nDist))
|
||||
{
|
||||
XSPRITE *pXSprite = &hitactor->x();
|
||||
if (!pXSprite->locked)
|
||||
|
|
Loading…
Reference in a new issue