Retire the "suckables list" + some fixes.
This commit is contained in:
parent
c5e7c0edb8
commit
09f5bfd2f6
9 changed files with 135 additions and 231 deletions
|
|
@ -278,16 +278,31 @@ extend Class SWWMHandler
|
|||
// update trackers for anything around the player
|
||||
double viewdist = SWWMStatusBar.MAPVIEWDIST*swwm_mm_zoom;
|
||||
// still about as expensive as using a BlockThingsIterator, but without the need to allocate one every tic
|
||||
int thisgroup = players[consoleplayer].Camera.CurSector.portalgroup;
|
||||
foreach ( s:level.Sectors ) for ( Actor a=s.thinglist; a; a=a.snext )
|
||||
{
|
||||
Vector2 rv = a.pos.xy-players[consoleplayer].Camera.pos.xy;
|
||||
Vector2 rv;
|
||||
if ( s.portalgroup != thisgroup )
|
||||
{
|
||||
Vector2 relpos = players[consoleplayer].Camera.pos.xy+level.GetDisplacement(thisgroup,s.portalgroup);
|
||||
rv = a.pos.xy-relpos;
|
||||
}
|
||||
else rv = a.pos.xy-players[consoleplayer].Camera.pos.xy;
|
||||
double rad;
|
||||
bool isproj = a.bMISSILE;
|
||||
if ( SWWMUtility.IsBeamProj(a) )
|
||||
{
|
||||
isproj = true;
|
||||
rad = SWWMUtility.IsYBeam(a)?(a.scale.y*cos(a.pitch-90)):(a.speed*cos(a.pitch));
|
||||
}
|
||||
else rad = a.radius;
|
||||
if ( max(abs(rv.x)-a.radius,abs(rv.y)-a.radius) > viewdist )
|
||||
continue;
|
||||
if ( a == players[consoleplayer].Camera )
|
||||
continue;
|
||||
if ( a is 'GhostTarget' )
|
||||
continue;
|
||||
if ( !a.player && !a.bSOLID && !a.bSHOOTABLE && !a.bISMONSTER && !a.bFRIENDLY && !(a is 'Inventory') && !(a is 'Chancebox') )
|
||||
if ( !a.player && !a.bSOLID && !a.bSHOOTABLE && !a.bISMONSTER && !a.bFRIENDLY && !(a is 'Inventory') && !(a is 'Chancebox') && !isproj )
|
||||
continue;
|
||||
if ( !level.allmap && !(deathmatch && (a is 'Inventory') && !a.bDROPPED) && !(a.IsFriend(players[consoleplayer].mo) && !(a.player && (a.player.mo != a))) && !a.CheckSight(players[consoleplayer].Camera,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) )
|
||||
continue;
|
||||
|
|
@ -297,81 +312,10 @@ extend Class SWWMHandler
|
|||
continue;
|
||||
if ( (a is 'Chancebox') && (a.CurState != a.SpawnState) )
|
||||
continue;
|
||||
SWWMSimpleTracker.Track(self,a);
|
||||
}
|
||||
// we need to refer to the suckables array to find missiles
|
||||
foreach ( a:suckableactors )
|
||||
{
|
||||
if ( !a || !a.bMISSILE ) continue;
|
||||
Vector2 rv = a.pos.xy-players[consoleplayer].Camera.pos.xy;
|
||||
if ( max(abs(rv.x)-a.radius,abs(rv.y)-a.radius) > viewdist )
|
||||
continue;
|
||||
if ( !level.allmap && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !a.CheckSight(players[consoleplayer].Camera,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) )
|
||||
if ( isproj && !level.allmap && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !a.CheckSight(players[consoleplayer].Camera,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) )
|
||||
continue;
|
||||
SWWMSimpleTracker.Track(self,a);
|
||||
}
|
||||
foreach ( a:beams )
|
||||
{
|
||||
if ( !a ) continue;
|
||||
Vector2 rv = a.pos.xy-players[consoleplayer].Camera.pos.xy;
|
||||
double rad = SWWMUtility.IsYBeam(a)?(a.scale.y*cos(a.pitch-90)):(a.speed*cos(a.pitch));
|
||||
if ( max(abs(rv.x)-rad,abs(rv.y)-rad) > viewdist )
|
||||
continue;
|
||||
if ( !level.allmap && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !a.CheckSight(players[consoleplayer].Camera,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) )
|
||||
continue;
|
||||
SWWMSimpleTracker.Track(self,a);
|
||||
}
|
||||
// oh boy here we go
|
||||
int thisgroup = players[consoleplayer].Camera.CurSector.portalgroup;
|
||||
for ( int i=0; i<level.GetPortalGroupCount(); i++ )
|
||||
{
|
||||
if ( i == thisgroup ) continue;
|
||||
Vector2 relpos = players[consoleplayer].Camera.pos.xy+level.GetDisplacement(thisgroup,i);
|
||||
// still about as expensive as using a BlockThingsIterator, but without the need to allocate one every tic
|
||||
foreach ( s:level.Sectors ) for ( Actor a=s.thinglist; a; a=a.snext )
|
||||
{
|
||||
Vector2 rv = a.pos.xy-relpos;
|
||||
if ( max(abs(rv.x)-a.radius,abs(rv.y)-a.radius) > viewdist )
|
||||
continue;
|
||||
if ( a == players[consoleplayer].Camera )
|
||||
continue;
|
||||
if ( a is 'GhostTarget' )
|
||||
continue;
|
||||
if ( !a.player && !a.bSOLID && !a.bSHOOTABLE && !a.bISMONSTER && !a.bFRIENDLY && !(a is 'Inventory') && !(a is 'Chancebox') )
|
||||
continue;
|
||||
if ( !level.allmap && !(deathmatch && (a is 'Inventory') && !a.bDROPPED) && !a.IsFriend(players[consoleplayer].mo) && !a.CheckSight(players[consoleplayer].Camera,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) )
|
||||
continue;
|
||||
if ( a.bKILLED || (a.Health <= 0) || a.bUnmorphed )
|
||||
continue;
|
||||
if ( (a is 'Inventory') && (!a.bSPECIAL || Inventory(a).Owner) )
|
||||
continue;
|
||||
if ( (a is 'Chancebox') && (a.CurState != a.SpawnState) )
|
||||
continue;
|
||||
SWWMSimpleTracker.Track(self,a);
|
||||
}
|
||||
// we need to refer to the suckables array to find missiles
|
||||
foreach ( a:suckableactors )
|
||||
{
|
||||
if ( !a || !a.bMISSILE ) continue;
|
||||
Vector2 rv = a.pos.xy-relpos;
|
||||
if ( max(abs(rv.x)-a.radius,abs(rv.y)-a.radius) > viewdist )
|
||||
continue;
|
||||
if ( !level.allmap && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !a.CheckSight(players[consoleplayer].Camera,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) )
|
||||
continue;
|
||||
SWWMSimpleTracker.Track(self,a);
|
||||
}
|
||||
foreach ( a:beams )
|
||||
{
|
||||
if ( !a ) continue;
|
||||
Vector2 rv = a.pos.xy-relpos;
|
||||
double rad = SWWMUtility.IsYBeam(a)?(a.scale.y*cos(a.pitch-90)):(a.speed*cos(a.pitch));
|
||||
if ( max(abs(rv.x)-rad,abs(rv.y)-rad) > viewdist )
|
||||
continue;
|
||||
if ( !level.allmap && !(a.target && a.target.IsFriend(players[consoleplayer].mo)) && !a.CheckSight(players[consoleplayer].Camera,SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY) )
|
||||
continue;
|
||||
SWWMSimpleTracker.Track(self,a);
|
||||
}
|
||||
}
|
||||
SWWMSimpleTracker trk = strackers;
|
||||
SWWMSimpleTracker prev = null, next;
|
||||
while ( trk )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue