mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-20 18:42:26 +00:00
- GetClosestSpriteSectors
This commit is contained in:
parent
f9b2b6311f
commit
3d336c13ac
6 changed files with 12 additions and 9 deletions
|
@ -2649,7 +2649,7 @@ void actRadiusDamage(DBloodActor* source, int x, int y, int z, int nSector, int
|
|||
{
|
||||
auto pOwner = source->GetOwner();
|
||||
const bool newSectCheckMethod = !cl_bloodvanillaexplosions && pOwner && pOwner->IsDudeActor() && !VanillaMode(); // use new sector checking logic
|
||||
auto sectorMap = GetClosestSpriteSectors(nSector, x, y, nDist, nullptr, newSectCheckMethod);
|
||||
auto sectorMap = GetClosestSpriteSectors(§or[nSector], x, y, nDist, nullptr, newSectCheckMethod);
|
||||
nDist <<= 4;
|
||||
if (flags & 2)
|
||||
{
|
||||
|
@ -5893,6 +5893,7 @@ static void actCheckExplosion()
|
|||
int y = pSprite->y;
|
||||
int z = pSprite->z;
|
||||
int nSector = pSprite->sectnum;
|
||||
auto pSector = pSprite->sector();
|
||||
int radius = pExplodeInfo->radius;
|
||||
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
|
@ -5907,7 +5908,7 @@ static void actCheckExplosion()
|
|||
// so only allow this new checking method for dude spawned explosions
|
||||
affectedXWalls.Clear();
|
||||
const bool newSectCheckMethod = !cl_bloodvanillaexplosions && Owner && Owner->IsDudeActor() && !VanillaMode(); // use new sector checking logic
|
||||
auto sectorMap = GetClosestSpriteSectors(nSector, x, y, radius, &affectedXWalls, newSectCheckMethod);
|
||||
auto sectorMap = GetClosestSpriteSectors(pSector, x, y, radius, &affectedXWalls, newSectCheckMethod);
|
||||
|
||||
for (auto pWall : affectedXWalls)
|
||||
{
|
||||
|
|
|
@ -1609,7 +1609,7 @@ void aiLookForTarget(DBloodActor* actor)
|
|||
if (pXSprite->state)
|
||||
{
|
||||
const bool newSectCheckMethod = !cl_bloodvanillaenemies && !VanillaMode(); // use new sector checking logic
|
||||
GetClosestSpriteSectors(pSprite->sectnum, pSprite->x, pSprite->y, 400, nullptr, newSectCheckMethod);
|
||||
GetClosestSpriteSectors(pSprite->sector(), pSprite->x, pSprite->y, 400, nullptr, newSectCheckMethod);
|
||||
|
||||
BloodStatIterator it(kStatDude);
|
||||
while (DBloodActor* actor2 = it.Next())
|
||||
|
|
|
@ -89,10 +89,11 @@ void StompSeqCallback(int, DBloodActor* actor1)
|
|||
int z = pSprite->z;
|
||||
int vc = 400;
|
||||
auto nSector = pSprite->sectnum;
|
||||
auto pSector = pSprite->sector();
|
||||
int v1c = 5 + 2 * gGameOptions.nDifficulty;
|
||||
int v10 = 25 + 30 * gGameOptions.nDifficulty;
|
||||
const bool newSectCheckMethod = !cl_bloodvanillaenemies && !VanillaMode(); // use new sector checking logic
|
||||
auto sectorMap = GetClosestSpriteSectors(nSector, x, y, vc, nullptr, newSectCheckMethod);
|
||||
auto sectorMap = GetClosestSpriteSectors(pSector, x, y, vc, nullptr, newSectCheckMethod);
|
||||
int hit = HitScan(actor1, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
|
||||
DBloodActor* actor2 = nullptr;
|
||||
actHitcodeToData(hit, &gHitInfo, &actor2);
|
||||
|
|
|
@ -712,7 +712,7 @@ unsigned int ClipMove(vec3_t* pos, sectortype** pSector, int xv, int yv, int wd,
|
|||
return nRes;
|
||||
}
|
||||
|
||||
BitArray GetClosestSpriteSectors(int nSector, int x, int y, int nDist, TArray<walltype*>* pWalls, bool newSectCheckMethod)
|
||||
BitArray GetClosestSpriteSectors(sectortype* pSector, int x, int y, int nDist, TArray<walltype*>* pWalls, bool newSectCheckMethod)
|
||||
{
|
||||
// by default this function fails with sectors that linked with wide spans, or there was more than one link to the same sector. for example...
|
||||
// E6M1: throwing TNT on the stone footpath while standing on the brown road will fail due to the start/end points of the span being too far away. it'll only do damage at one end of the road
|
||||
|
@ -721,10 +721,10 @@ BitArray GetClosestSpriteSectors(int nSector, int x, int y, int nDist, TArray<wa
|
|||
|
||||
BitArray sectorMap(numsectors); // this gets returned to the caller.
|
||||
sectorMap.Zero();
|
||||
sectorMap.Set(nSector);
|
||||
sectorMap.Set(sectnum(pSector));
|
||||
double nDist4sq = 256. * nDist * nDist; // (nDist * 16)^2 - * 16 to account for Build's 28.4 fixed point format.
|
||||
|
||||
BFSSectorSearch search(§or[nSector]);
|
||||
BFSSectorSearch search(pSector);
|
||||
|
||||
while (auto pCurSector = search.GetNext())
|
||||
{
|
||||
|
|
|
@ -86,7 +86,7 @@ void GetZRange(DBloodActor *pSprite, int *ceilZ, Collision *ceilHit, int *floorZ
|
|||
void GetZRangeAtXYZ(int x, int y, int z, sectortype* pSector, int *ceilZ, Collision *ceilHit, int *floorZ, Collision *floorHit, int nDist, unsigned int nMask, unsigned int nClipParallax = 0);
|
||||
int GetDistToLine(int x1, int y1, int x2, int y2, int x3, int y3);
|
||||
unsigned int ClipMove(vec3_t* pos, sectortype** pSector, int xv, int yv, int wd, int cd, int fd, unsigned int nMask, int tracecount = 3);
|
||||
BitArray GetClosestSpriteSectors(int nSector, int x, int y, int nDist, TArray<walltype*>* pWalls, bool newSectCheckMethod = false);
|
||||
BitArray GetClosestSpriteSectors(sectortype* pSector, int x, int y, int nDist, TArray<walltype*>* pWalls, bool newSectCheckMethod = false);
|
||||
int picWidth(int nPic, int repeat);
|
||||
int picHeight(int nPic, int repeat);
|
||||
|
||||
|
|
|
@ -2663,9 +2663,10 @@ void teslaHit(DBloodActor *missileactor, int a2)
|
|||
int z = pMissile->z;
|
||||
int nDist = 300;
|
||||
int nSector = pMissile->sectnum;
|
||||
auto pSector = pMissile->sector();
|
||||
auto owneractor = missileactor->GetOwner();
|
||||
const bool newSectCheckMethod = !cl_bloodvanillaexplosions && !VanillaMode(); // use new sector checking logic
|
||||
auto sectorMap = GetClosestSpriteSectors(nSector, x, y, nDist, nullptr, newSectCheckMethod);
|
||||
auto sectorMap = GetClosestSpriteSectors(pSector, x, y, nDist, nullptr, newSectCheckMethod);
|
||||
bool v4 = true;
|
||||
DBloodActor* actor = nullptr;
|
||||
actHitcodeToData(a2, &gHitInfo, &actor);
|
||||
|
|
Loading…
Reference in a new issue