A whole fat load of micro-optimizations.

Okuplok still lags like fuck, unfortunately.
This commit is contained in:
Mari the Deer 2022-06-17 22:36:51 +02:00
commit 6825146e51
15 changed files with 369 additions and 280 deletions

View file

@ -16,7 +16,7 @@ extend Class SWWMHandler
if ( profiling ) ProfileTick();
// reattach combat tracker
if ( !swwm_notrack && (e.Thing.bSHOOTABLE || e.Thing.bISMONSTER) && !(e.Thing is 'LampMoth') && !(e.Thing is 'CompanionLamp') )
SWWMCombatTracker.Spawn(e.Thing);
SWWMCombatTracker.Spawn(self,e.Thing,true);
// reattach headpats
if ( SWWMUtility.IdentifyingDog(e.Thing) || SWWMUtility.IdentifyingCaco(e.Thing)
|| SWWMUtility.IdentifyingDrug(e.Thing) || SWWMUtility.IdentifyingDoubleBoi(e.Thing) )
@ -232,19 +232,20 @@ extend Class SWWMHandler
// for gibber throttling
if ( e.Thing is 'mkBloodDrop' ) blods_realcnt--;
else if ( e.Thing is 'mkFlyingGib' ) meats_realcnt--;
if ( !e.Thing.default.bSHOOTABLE && !e.Thing.default.bMISSILE && !(e.Thing is 'Inventory') && !SWWMUtility.IsBeamProj(e.Thing) )
if ( e.Thing.default.bSHOOTABLE || (e.Thing is 'Inventory') || SWWMUtility.ValidProjectile(e.Thing) )
{
if ( profiling ) ProfileTock(PT_WORLDTHINGDESTROYED);
return;
// remove from suckables
int pos = suckableactors.Find(e.Thing);
if ( pos < suckableactors.Size() )
suckableactors.Delete(pos);
}
else if ( SWWMUtility.IsBeamProj(e.Thing) )
{
// remove from beams
int pos = beams.Find(e.Thing);
if ( pos < beams.Size() )
beams.Delete(pos);
}
// remove from suckables
int pos = suckableactors.Find(e.Thing);
if ( pos < suckableactors.Size() )
suckableactors.Delete(pos);
// remove from beams
pos = beams.Find(e.Thing);
if ( pos < beams.Size() )
beams.Delete(pos);
if ( profiling ) ProfileTock(PT_WORLDTHINGDESTROYED);
}
@ -280,7 +281,7 @@ extend Class SWWMHandler
if ( e.Thing is 'Key' )
{
DoKeyTagFix(e.Thing);
SWWMInterest.Spawn(thekey:Key(e.Thing));
SWWMInterest.Spawn(self,thekey:Key(e.Thing));
}
if ( indoomvacation == -1 ) indoomvacation = SWWMUtility.InDoomVacation();
if ( inultdoom2 == -1 ) inultdoom2 = SWWMUtility.IsUltDoom2();
@ -403,13 +404,13 @@ extend Class SWWMHandler
let hp = Actor.Spawn("HeadpatTracker",e.Thing.pos);
hp.target = e.Thing;
}
SWWMCombatTracker trk;
SWWMCombatTracker trk = null;
if ( !swwm_notrack && (e.Thing.bSHOOTABLE || e.Thing.bISMONSTER) && !(e.Thing is 'LampMoth') && !(e.Thing is 'CompanionLamp') )
trk = SWWMCombatTracker.Spawn(e.Thing);
trk = SWWMCombatTracker.Spawn(self,e.Thing);
if ( swwm_shadows && !(e.Thing is 'LampMoth') && (e.Thing.bSHOOTABLE || e.Thing.bISMONSTER || (e.Thing is 'Inventory') || (e.Thing is 'CompanionLamp')) && ((e.Thing is 'Demolitionist') || (e.Thing.SpawnState.sprite == e.Thing.GetSpriteIndex('XZW1'))) )
SWWMShadow.Track(e.Thing);
// Ynykron vortex optimization (faster than a thinker iterator)
if ( e.Thing.bSHOOTABLE || SWWMUtility.ValidProjectile(e.Thing) || (e.Thing is 'Inventory') )
if ( e.Thing.bSHOOTABLE || (e.Thing is 'Inventory') || SWWMUtility.ValidProjectile(e.Thing) )
SuckableActors.Push(e.Thing);
else if ( SWWMUtility.IsBeamProj(e.Thing) )
Beams.Push(e.Thing);