- floatified nnextCanMove and deleted most deprecated updatesector variants.

This commit is contained in:
Mitchell Richters 2022-09-27 21:58:22 +10:00 committed by Christoph Oelckers
parent c5a5e3cef5
commit 2e4996e8fc
2 changed files with 11 additions and 29 deletions

View file

@ -124,26 +124,6 @@ inline void updatesector(int x_, int y_, int* sectnum)
DoUpdateSector(x, y, 0, sectnum, MAXUPDATESECTORDIST, inside0);
}
[[deprecated]]
inline void updatesectorz(int x_, int y_, int z_, int* sectnum)
{
double x = x_ * inttoworld;
double y = y_ * inttoworld;
double z = z_ * zinttoworld;
DoUpdateSector(x, y, z, sectnum, MAXUPDATESECTORDIST, insideZ);
}
[[deprecated]]
inline void updatesector(int const x_, int const y_, sectortype** const sectp)
{
double x = x_ * inttoworld;
double y = y_ * inttoworld;
int sectno = *sectp ? sector.IndexOf(*sectp) : -1;
DoUpdateSector(x, y, 0, &sectno, MAXUPDATESECTORDIST, inside0);
*sectp = sectno == -1 ? nullptr : &sector[sectno];
}
[[deprecated]]
inline void updatesectorz(int x_, int y_, int z_, sectortype** const sectp)
{

View file

@ -7691,19 +7691,21 @@ bool setDataValueOfObject(int objType, sectortype* sect, walltype* wal, DBloodAc
//
//---------------------------------------------------------------------------
bool nnExtCanMove(DBloodActor* actor, DBloodActor* target, DAngle nAngle_, int nRange)
bool nnExtCanMove(DBloodActor* actor, DBloodActor* target, DAngle nAngle, int nRange_)
{
int nAngle = nAngle_.Buildang();
int x = actor->int_pos().X, y = actor->int_pos().Y, z = actor->int_pos().Z;
double nRange = nRange_ * inttoworld;
DVector3 pos = actor->spr.pos;
DVector2 nAngVect = nAngle.ToVector();
auto pSector = actor->sector();
HitScan(actor, z, Cos(nAngle) >> 16, Sin(nAngle) >> 16, 0, CLIPMASK0, nRange);
int nDist = approxDist(actor->spr.pos.XY() - gHitInfo.hitpos.XY());
if (target != nullptr && nDist - (actor->int_clipdist()) < nRange)
HitScan(actor, pos.Z * zworldtoint, nAngVect.X * (1 << 14), nAngVect.Y * (1 << 14), 0, CLIPMASK0, nRange);
double nDist = (actor->spr.pos.XY() - gHitInfo.hitpos.XY()).Length();
if (target != nullptr && nDist - actor->fClipdist() < nRange)
return (target == gHitInfo.actor());
x += MulScale(nRange, Cos(nAngle), 30);
y += MulScale(nRange, Sin(nAngle), 30);
updatesectorz(x, y, z, &pSector);
pos += nAngVect * nRange;
updatesectorz(pos, &pSector);
if (!pSector) return false;
if (pSector->hasX()) {