mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- updatesector interface cleanup.
This commit is contained in:
parent
c5523a99ee
commit
0f57685f48
3 changed files with 10 additions and 26 deletions
|
@ -586,9 +586,9 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
|
||||||
|
|
||||||
if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE)
|
if (enginecompatibility_mode == ENGINECOMPATIBILITY_NONE)
|
||||||
{
|
{
|
||||||
DVector3 v(vec.X* inttoworld, vec.Y* inttoworld, 0);
|
DVector2 v(vec.X* inttoworld, vec.Y* inttoworld);
|
||||||
sectortype* sect = §or[*sectnum];
|
sectortype* sect = §or[*sectnum];
|
||||||
updatesectorneighbor(v, §, rad * inttoworld);
|
updatesector(v, §, rad * inttoworld);
|
||||||
*sectnum = ::sectnum(sect);
|
*sectnum = ::sectnum(sect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,41 +80,25 @@ void DoUpdateSector(double x, double y, double z, int* sectnum, double maxDistan
|
||||||
|
|
||||||
constexpr int MAXUPDATESECTORDIST = 96;
|
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;
|
int sectno = *sectp ? sector.IndexOf(*sectp) : -1;
|
||||||
DoUpdateSector(pos.X, pos.Y, pos.Z, §no, MAXUPDATESECTORDIST, inside0);
|
DoUpdateSector(pos.X, pos.Y, pos.Z, §no, maxDistance, inside0);
|
||||||
*sectp = sectno == -1 ? nullptr : §or[sectno];
|
*sectp = sectno == -1 ? nullptr : §or[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;
|
int sectno = *sectp ? sector.IndexOf(*sectp) : -1;
|
||||||
DoUpdateSector(pos.X, pos.Y, 0, §no, MAXUPDATESECTORDIST, inside0);
|
DoUpdateSector(pos.X, pos.Y, 0, §no, maxDistance, inside0);
|
||||||
*sectp = sectno == -1 ? nullptr : §or[sectno];
|
*sectp = sectno == -1 ? nullptr : §or[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;
|
int sectno = *sectp ? sector.IndexOf(*sectp) : -1;
|
||||||
DoUpdateSector(pos.X, pos.Y, pos.Z, §no, MAXUPDATESECTORDIST, insideZ);
|
DoUpdateSector(pos.X, pos.Y, pos.Z, §no, maxDistance, insideZ);
|
||||||
*sectp = sectno == -1 ? nullptr : §or[sectno];
|
*sectp = sectno == -1 ? nullptr : §or[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, §no, maxDistance, inside0);
|
|
||||||
*sect = sectno < 0? nullptr : §or[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -878,7 +878,7 @@ static void movetripbomb(DDukeActor *actor)
|
||||||
auto const oldSect = actor->sector();
|
auto const oldSect = actor->sector();
|
||||||
auto curSect = actor->sector();
|
auto curSect = actor->sector();
|
||||||
|
|
||||||
updatesectorneighbor(actor->spr.pos, &curSect, 128);
|
updatesector(actor->spr.pos, &curSect, 128);
|
||||||
ChangeActorSect(actor, curSect);
|
ChangeActorSect(actor, curSect);
|
||||||
|
|
||||||
DDukeActor* hit;
|
DDukeActor* hit;
|
||||||
|
@ -908,7 +908,7 @@ static void movetripbomb(DDukeActor *actor)
|
||||||
x -= 64;
|
x -= 64;
|
||||||
|
|
||||||
actor->spr.pos += actor->temp_angle.ToVector() * 64;
|
actor->spr.pos += actor->temp_angle.ToVector() * 64;
|
||||||
updatesectorneighbor(actor->spr.pos, &curSect, 128);
|
updatesector(actor->spr.pos, &curSect, 128);
|
||||||
|
|
||||||
if (curSect == nullptr)
|
if (curSect == nullptr)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue