- updatesector interface cleanup.

This commit is contained in:
Christoph Oelckers 2022-10-25 23:16:25 +02:00
parent c5523a99ee
commit 0f57685f48
3 changed files with 10 additions and 26 deletions

View file

@ -586,9 +586,9 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE)
{
DVector3 v(vec.X* inttoworld, vec.Y* inttoworld, 0);
DVector2 v(vec.X* inttoworld, vec.Y* inttoworld);
sectortype* sect = &sector[*sectnum];
updatesectorneighbor(v, &sect, rad * inttoworld);
updatesector(v, &sect, rad * inttoworld);
*sectnum = ::sectnum(sect);
}

View file

@ -80,41 +80,25 @@ void DoUpdateSector(double x, double y, double z, int* sectnum, double maxDistan
constexpr int MAXUPDATESECTORDIST = 96;
inline void updatesector(const DVector3& pos, sectortype** const sectp)
inline void updatesector(const DVector3& pos, sectortype** const sectp, double maxDistance = MAXUPDATESECTORDIST)
{
int sectno = *sectp ? sector.IndexOf(*sectp) : -1;
DoUpdateSector(pos.X, pos.Y, pos.Z, &sectno, MAXUPDATESECTORDIST, inside0);
DoUpdateSector(pos.X, pos.Y, pos.Z, &sectno, maxDistance, inside0);
*sectp = sectno == -1 ? nullptr : &sector[sectno];
}
inline void updatesector(const DVector2& pos, sectortype** const sectp)
inline void updatesector(const DVector2& pos, sectortype** const sectp, double maxDistance = MAXUPDATESECTORDIST)
{
int sectno = *sectp ? sector.IndexOf(*sectp) : -1;
DoUpdateSector(pos.X, pos.Y, 0, &sectno, MAXUPDATESECTORDIST, inside0);
DoUpdateSector(pos.X, pos.Y, 0, &sectno, maxDistance, inside0);
*sectp = sectno == -1 ? nullptr : &sector[sectno];
}
inline void updatesectorz(const DVector3& pos, sectortype** const sectp)
inline void updatesectorz(const DVector3& pos, sectortype** const sectp, double maxDistance = MAXUPDATESECTORDIST)
{
int sectno = *sectp ? sector.IndexOf(*sectp) : -1;
DoUpdateSector(pos.X, pos.Y, pos.Z, &sectno, MAXUPDATESECTORDIST, insideZ);
DoUpdateSector(pos.X, pos.Y, pos.Z, &sectno, maxDistance, insideZ);
*sectp = sectno == -1 ? nullptr : &sector[sectno];
}
inline void updatesectorneighbor(const DVector3& pos, sectortype** const sect, double maxDistance = MAXUPDATESECTORDIST)
{
int sectno = *sect? sector.IndexOf(*sect) : -1;
DoUpdateSector(pos.X, pos.Y, 0, &sectno, maxDistance, inside0);
*sect = sectno < 0? nullptr : &sector[sectno];
}
[[deprecated]]
inline void updatesector(int x_, int y_, int* sectnum)
{
double x = x_ * inttoworld;
double y = y_ * inttoworld;
DoUpdateSector(x, y, 0, sectnum, MAXUPDATESECTORDIST, inside0);
}

View file

@ -878,7 +878,7 @@ static void movetripbomb(DDukeActor *actor)
auto const oldSect = actor->sector();
auto curSect = actor->sector();
updatesectorneighbor(actor->spr.pos, &curSect, 128);
updatesector(actor->spr.pos, &curSect, 128);
ChangeActorSect(actor, curSect);
DDukeActor* hit;
@ -908,7 +908,7 @@ static void movetripbomb(DDukeActor *actor)
x -= 64;
actor->spr.pos += actor->temp_angle.ToVector() * 64;
updatesectorneighbor(actor->spr.pos, &curSect, 128);
updatesector(actor->spr.pos, &curSect, 128);
if (curSect == nullptr)
break;