Replace usage of ThinkerIterator and BlockThingsIterator in various places where we can instead loop through sector thing lists.
While in the latter case this may result in longer loops, it also reduces GC thrashing by not needing to allocate an iterator every time. This also simplifies the DoBlast code as there is no longer a need to manually traverse portals vertically.
This commit is contained in:
parent
ea86ab99d0
commit
2bd1cb0657
17 changed files with 113 additions and 220 deletions
|
|
@ -1036,14 +1036,18 @@ Class MisterGrenade : Actor
|
|||
if ( bNoProx ) return;
|
||||
// "safe delay" for main grenade
|
||||
if ( !bAMBUSH && (ReactionTime > default.ReactionTime-20) ) return;
|
||||
let bt = BlockThingsIterator.Create(self,120);
|
||||
while ( bt.Next() )
|
||||
bool breakout = false;
|
||||
foreach ( s:level.Sectors )
|
||||
{
|
||||
let t = bt.Thing;
|
||||
if ( !t || !t.bSHOOTABLE || (!t.bISMONSTER && !(t is 'BossBrain') && !t.player) || (t.Health <= 0) || (target && t.IsFriend(target)) || !SWWMUtility.SphereIntersect(t,level.Vec3Offset(pos,vel),bAMBUSH?80:120) || !CheckSight(t,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue;
|
||||
special1++;
|
||||
tracer = t;
|
||||
break;
|
||||
for ( Actor t=s.thinglist; t; t=t.snext )
|
||||
{
|
||||
if ( !t.bSHOOTABLE || (!t.bISMONSTER && !(t is 'BossBrain') && !t.player) || (t.Health <= 0) || (target && t.IsFriend(target)) || !SWWMUtility.SphereIntersect(t,level.Vec3Offset(pos,vel),bAMBUSH?80:120) || !CheckSight(t,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue;
|
||||
special1++;
|
||||
tracer = t;
|
||||
breakout = true;
|
||||
break;
|
||||
}
|
||||
if ( breakout ) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1129,13 +1133,11 @@ Class MisterGrenade : Actor
|
|||
}
|
||||
// gather seekable targets
|
||||
Array<Actor> candidates;
|
||||
let bt = BlockThingsIterator.Create(self,2000);
|
||||
let tt = new("TargetTracer");
|
||||
tt.target = target;
|
||||
while ( bt.Next() )
|
||||
foreach ( s:level.Sectors ) for ( Actor t=s.thinglist; t; t=t.snext )
|
||||
{
|
||||
let t = bt.Thing;
|
||||
if ( !t || (t == tracer) || !t.bSHOOTABLE || (!t.bISMONSTER && !(t is 'BossBrain')) || (t.Health <= 0) || (target && t.IsFriend(target)) || !CheckSight(t,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue;
|
||||
if ( (t == tracer) || !t.bSHOOTABLE || (!t.bISMONSTER && !(t is 'BossBrain')) || (t.Health <= 0) || (target && t.IsFriend(target)) || !CheckSight(t,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) ) continue;
|
||||
// don't seek if enemy is too close to shooter
|
||||
if ( target && SWWMUtility.SphereIntersect(t,target.pos,250) ) continue;
|
||||
// don't seek if shooter is between us and the enemy
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue