Initial 1.1 development setup.

This commit is contained in:
Mari the Deer 2021-09-01 09:55:32 +02:00
commit dc4bd4d45d
144 changed files with 2487 additions and 165 deletions

View file

@ -723,13 +723,31 @@ Class ChanceboxSpawner : Actor
return;
}
int numbox = 0;
let ti = ThinkerIterator.Create("ChanceboxSpawner");
ThinkerIterator ti = ThinkerIterator.Create("Chancebox");
while ( ti.Next() ) numbox++;
ti = ThinkerIterator.Create("Chancebox");
while ( ti.Next() ) numbox++;
if ( numbox > 3 )
if ( numbox >= 3 )
{
// there's three boxes in the map already (plus ourselves)
// there's three boxes in the map already
Destroy();
return;
}
BlockLinesIterator bl = BlockLinesIterator.CreateFromPos(pos,32,32,CurSector);
double tbox[4];
// top, bottom, left, right
tbox[0] = pos.y+32;
tbox[1] = pos.y-32;
tbox[2] = pos.x-32;
tbox[3] = pos.x+32;
while ( bl.Next() )
{
Line l = bl.CurLine;
if ( !l ) continue;
if ( tbox[2] > l.bbox[3] ) continue;
if ( tbox[3] < l.bbox[2] ) continue;
if ( tbox[0] < l.bbox[1] ) continue;
if ( tbox[1] > l.bbox[0] ) continue;
if ( SWWMUtility.BoxOnLineSide(tbox[0],tbox[1],tbox[2],tbox[3],l) != -1 ) continue;
// there isn't enough space to spawn a box here
Destroy();
return;
}