- pass an array of wall pointers to GetClosestSpriteSectors

This commit is contained in:
Christoph Oelckers 2021-11-23 17:10:04 +01:00
parent d5e660a40c
commit 292f100114
3 changed files with 6 additions and 6 deletions

View file

@ -5872,7 +5872,7 @@ static void actCheckProjectiles()
//
//
//---------------------------------------------------------------------------
static TArray<int> affectedXWalls; // keep this outside the function so that it only needs to be allocated once
static TArray<walltype*> affectedXWalls; // keep this outside the function so that it only needs to be allocated once
static void actCheckExplosion()
{
@ -5912,9 +5912,9 @@ static void actCheckExplosion()
const bool newSectCheckMethod = !cl_bloodvanillaexplosions && Owner && Owner->IsDudeActor() && !VanillaMode(); // use new sector checking logic
auto sectorMap = GetClosestSpriteSectors(nSector, x, y, radius, &affectedXWalls, newSectCheckMethod);
for (auto& nWall : affectedXWalls)
for (auto pWall : affectedXWalls)
{
trTriggerWall(&wall[nWall], kCmdWallImpact);
trTriggerWall(pWall, kCmdWallImpact);
}
BloodStatIterator it1(kStatDude);

View file

@ -712,7 +712,7 @@ unsigned int ClipMove(vec3_t *pos, int *nSector, int xv, int yv, int wd, int cd,
return nRes;
}
BitArray GetClosestSpriteSectors(int nSector, int x, int y, int nDist, TArray<int>* pWalls, bool newSectCheckMethod)
BitArray GetClosestSpriteSectors(int nSector, 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
@ -753,7 +753,7 @@ BitArray GetClosestSpriteSectors(int nSector, int x, int y, int nDist, TArray<in
{
XWALL* pXWall = &wal.xw();
if (pXWall->triggerVector && !pXWall->isTriggered && !pXWall->state)
pWalls->Push(wallnum(&wal));
pWalls->Push(&wal);
}
}
}

View file

@ -66,7 +66,7 @@ void GetZRange(DBloodActor *pSprite, int *ceilZ, Collision *ceilHit, int *floorZ
void GetZRangeAtXYZ(int x, int y, int z, int nSector, 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, int *nSector, 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<int>* pWalls, bool newSectCheckMethod = false);
BitArray GetClosestSpriteSectors(int nSector, int x, int y, int nDist, TArray<walltype*>* pWalls, bool newSectCheckMethod = false);
int picWidth(int nPic, int repeat);
int picHeight(int nPic, int repeat);