- consolidated Duke’s ‚away from wall‘ check in the backend

This was also very useful in SW to avoid spawning ‚floating‘ footprints due to lack of an equivalent check in the original.
This commit is contained in:
Christoph Oelckers 2022-09-13 19:40:32 +02:00
parent 1a597c4e0b
commit 3c9a94dba8
5 changed files with 42 additions and 58 deletions

View file

@ -560,6 +560,35 @@ sectortype* nextsectorneighborzptr(sectortype* sectp, double startz, int flags)
return bestsec;
}
//==========================================================================
//
//
//
//==========================================================================
bool isAwayFromWall(DCoreActor* ac, double delta)
{
sectortype* s1;
updatesector(ac->spr.pos + DVector2(delta, delta), &s1);
if (s1 == ac->sector())
{
updatesector(ac->spr.pos - DVector2(delta, delta), &s1);
if (s1 == ac->sector())
{
updatesector(ac->spr.pos + DVector2(delta, -delta), &s1);
if (s1 == ac->sector())
{
updatesector(ac->spr.pos + DVector2(-delta, delta), &s1);
if (s1 == ac->sector())
return true;
}
}
}
return false;
}
//==========================================================================
//
//