mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- pass a vector to GetClosestSpriteSectors
This commit is contained in:
parent
64cf9a4ec6
commit
9460239417
6 changed files with 11 additions and 8 deletions
|
@ -2643,7 +2643,7 @@ void actRadiusDamage(DBloodActor* source, const DVector3& pos, sectortype* pSect
|
|||
int x = pos.X * worldtoint, y = pos.Y * worldtoint, z = pos.Z * worldtoint;
|
||||
auto pOwner = source->GetOwner();
|
||||
const bool newSectCheckMethod = !cl_bloodvanillaexplosions && pOwner && pOwner->IsDudeActor() && !VanillaMode(); // use new sector checking logic
|
||||
auto sectorMap = GetClosestSpriteSectors(pSector, x, y, nDist, nullptr, newSectCheckMethod);
|
||||
auto sectorMap = GetClosestSpriteSectors(pSector, pos.XY(), nDist, nullptr, newSectCheckMethod);
|
||||
nDist <<= 4;
|
||||
if (flags & 2)
|
||||
{
|
||||
|
@ -5801,7 +5801,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(pSector, x, y, radius, &affectedXWalls, newSectCheckMethod);
|
||||
auto sectorMap = GetClosestSpriteSectors(pSector, apos.XY(), radius, &affectedXWalls, newSectCheckMethod);
|
||||
|
||||
for (auto pWall : affectedXWalls)
|
||||
{
|
||||
|
|
|
@ -1582,7 +1582,7 @@ void aiLookForTarget(DBloodActor* actor)
|
|||
if (actor->xspr.state)
|
||||
{
|
||||
const bool newSectCheckMethod = !cl_bloodvanillaenemies && !VanillaMode(); // use new sector checking logic
|
||||
GetClosestSpriteSectors(actor->sector(), actor->int_pos().X, actor->int_pos().Y, 400, nullptr, newSectCheckMethod);
|
||||
GetClosestSpriteSectors(actor->sector(), actor->spr.pos.XY(), 400, nullptr, newSectCheckMethod);
|
||||
|
||||
BloodStatIterator it(kStatDude);
|
||||
while (DBloodActor* actor2 = it.Next())
|
||||
|
|
|
@ -90,7 +90,7 @@ void StompSeqCallback(int, DBloodActor* actor)
|
|||
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(pSector, x, y, vc, nullptr, newSectCheckMethod);
|
||||
auto sectorMap = GetClosestSpriteSectors(pSector, actor->spr.pos.XY(), vc, nullptr, newSectCheckMethod);
|
||||
int hit = HitScan(actor, actor->int_pos().Z, angx, angy, 0, CLIPMASK1, 0);
|
||||
DBloodActor* actorh = nullptr;
|
||||
actHitcodeToData(hit, &gHitInfo, &actorh);
|
||||
|
|
|
@ -762,8 +762,10 @@ void ClipMove(vec3_t& pos, sectortype** pSector, int xv, int yv, int wd, int cd,
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
BitArray GetClosestSpriteSectors(sectortype* pSector, int x, int y, int nDist, TArray<walltype*>* pWalls, bool newSectCheckMethod)
|
||||
BitArray GetClosestSpriteSectors(sectortype* pSector, const DVector2& pos, int nDist, TArray<walltype*>* pWalls, bool newSectCheckMethod)
|
||||
{
|
||||
int x = pos.X * worldtoint;
|
||||
int y = pos.Y * worldtoint;
|
||||
// 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
|
||||
// E1M2: throwing TNT at the double doors while standing on the train platform
|
||||
|
@ -792,7 +794,7 @@ BitArray GetClosestSpriteSectors(sectortype* pSector, int x, int y, int nDist, T
|
|||
}
|
||||
else // new method using proper math and no bad shortcut.
|
||||
{
|
||||
double dist1 = SquareDistToWall(x * inttoworld, y * inttoworld, &wal);
|
||||
double dist1 = SquareDistToWall(pos.X, pos.Y, &wal);
|
||||
withinRange = dist1 <= nDist4sq;
|
||||
}
|
||||
if (withinRange) // if new sector is within range, add it to the processing queue
|
||||
|
|
|
@ -54,7 +54,7 @@ inline void ClipMove(DVector3& pos, sectortype** pSector, int xv, int yv, int wd
|
|||
ClipMove(ipos, pSector, xv, yv, wd, cd, fd, nMask, hit, tracecount);
|
||||
pos = { ipos.X * inttoworld, ipos.Y * inttoworld, ipos.Z * zinttoworld };
|
||||
}
|
||||
BitArray GetClosestSpriteSectors(sectortype* pSector, int x, int y, int nDist, TArray<walltype*>* pWalls, bool newSectCheckMethod = false);
|
||||
BitArray GetClosestSpriteSectors(sectortype* pSector, const DVector2& pos, int nDist, TArray<walltype*>* pWalls, bool newSectCheckMethod = false);
|
||||
int picWidth(int nPic, int repeat);
|
||||
int picHeight(int nPic, int repeat);
|
||||
|
||||
|
|
|
@ -2992,6 +2992,7 @@ void WeaponProcess(PLAYER* pPlayer) {
|
|||
|
||||
void teslaHit(DBloodActor* missileactor, int a2)
|
||||
{
|
||||
auto mpos = missileactor->spr.pos;
|
||||
int x = missileactor->int_pos().X;
|
||||
int y = missileactor->int_pos().Y;
|
||||
int z = missileactor->int_pos().Z;
|
||||
|
@ -2999,7 +3000,7 @@ void teslaHit(DBloodActor* missileactor, int a2)
|
|||
auto pSector = missileactor->sector();
|
||||
auto owneractor = missileactor->GetOwner();
|
||||
const bool newSectCheckMethod = !cl_bloodvanillaexplosions && !VanillaMode(); // use new sector checking logic
|
||||
auto sectorMap = GetClosestSpriteSectors(pSector, x, y, nDist, nullptr, newSectCheckMethod);
|
||||
auto sectorMap = GetClosestSpriteSectors(pSector, mpos.XY(), nDist, nullptr, newSectCheckMethod);
|
||||
bool v4 = true;
|
||||
DBloodActor* actor = nullptr;
|
||||
actHitcodeToData(a2, &gHitInfo, &actor);
|
||||
|
|
Loading…
Reference in a new issue