Add throttling for blood and gib spawning.

Reduce effects of flying gibs.
Add a command to instantly clear queued effects.
This commit is contained in:
Mari the Deer 2021-11-30 18:13:53 +01:00
commit a91e73f51e
8 changed files with 52 additions and 24 deletions

View file

@ -187,6 +187,19 @@ extend Class SWWMHandler
Console.Printf("%d suckable actors trimmed.",n);
return;
}
else if ( e.Name ~== "swwmcleareffects" )
{
if ( multiplayer && (e.player != Net_Arbitrator) )
{
if ( e.player == consoleplayer )
Console.Printf("Only the net arbitrator can call this event.");
return;
}
int n = casings_cnt+chips_cnt+blods_cnt+meats_cnt;
CleanQueues();
Console.Printf("%d effects cleared.",n);
return;
}
else if ( e.Name ~== "swwmdebugdumprng" )
{
if ( multiplayer && (e.player != Net_Arbitrator) )

View file

@ -9,9 +9,9 @@ extend Class SWWMHandler
int chips_cnt, oldmaxdebris;
// gore
mkBloodDrop blods, blods_end;
int blods_cnt, oldmaxblood;
int blods_cnt, oldmaxblood, blods_realcnt;
mkFlyingGib meats, meats_end;
int meats_cnt, oldmaxgibs;
int meats_cnt, oldmaxgibs, meats_realcnt;
static void QueueCasing( SWWMCasing c )
{
@ -150,6 +150,14 @@ extend Class SWWMHandler
m.nextmeat = null;
}
private void CleanQueues()
{
while ( casings ) DeQueueCasing(casings);
while ( chips ) DeQueueChip(chips);
while ( blods ) DeQueueBlod(blods);
while ( meats ) DeQueueMeat(meats);
}
private void RecheckQueues()
{
while ( casings && (casings_cnt > swwm_maxcasings) )

View file

@ -229,6 +229,9 @@ extend Class SWWMHandler
override void WorldThingDestroyed( WorldEvent e )
{
if ( profiling ) curms = MSTime();
// 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 ( profiling ) worldthingdestroyed_ms += MSTime()-curms;
@ -248,6 +251,9 @@ extend Class SWWMHandler
override void WorldThingSpawned( WorldEvent e )
{
if ( profiling ) curms = MSTime();
// for gibber throttling
if ( e.Thing is 'mkBloodDrop' ) blods_realcnt++;
else if ( e.Thing is 'mkFlyingGib' ) meats_realcnt++;
if ( !e.Thing || SuppressMultiItem(e) )
{
if ( profiling ) worldthingspawned_ms += MSTime()-curms;