- updatesector interface cleanup.

This commit is contained in:
Christoph Oelckers 2022-10-25 23:16:25 +02:00
parent 3c72eb43f9
commit b72283e9cb
3 changed files with 20 additions and 10 deletions

View file

@ -221,16 +221,8 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
if (!clip.precise)
{
DVector3 fpos(pos->X* inttoworld, pos->Y* inttoworld, pos->Z* inttoworld);
clip.search.Rewind();
while (auto sect = clip.search.GetNext())
if (inside(fpos.X, fpos.Y, sect) == 1)
{
*sectnum = ::sectnum(sect);
return clipReturn;
}
*sectnum = FindBestSector(fpos);
*sectnum = FindSectorInSearchList(fpos, clip.search);
if (*sectnum == -1) *sectnum = FindBestSector(fpos);
}
return clipReturn;

View file

@ -1606,6 +1606,23 @@ void collectClipObjects(MoveClipper& clip, int spritemask)
//
//==========================================================================
int FindSectorInSearchList(const DVector3& pos, BFSSectorSearch& search)
{
search.Rewind();
while (auto sect = search.GetNext())
if (inside(pos.X, pos.Y, sect) == 1)
{
return ::sectnum(sect);
}
return -1;
}
//==========================================================================
//
//
//
//==========================================================================
int FindBestSector(const DVector3& pos)
{
int bestnum = 1;

View file

@ -313,6 +313,7 @@ struct MoveClipper
void collectClipObjects(MoveClipper& clip, int spritemask);
int FindBestSector(const DVector3& pos);
int FindSectorInSearchList(const DVector3& pos, BFSSectorSearch& search);
int FindBestSector(const DVector3& pos);