Add blood pools to the effect queue system.

This commit is contained in:
Mari the Deer 2025-03-16 21:02:13 +01:00
commit 9757aed5e6
10 changed files with 63 additions and 25 deletions

View file

@ -12,6 +12,8 @@ extend Class SWWMHandler
int blods_cnt, oldmaxblood, blods_realcnt;
mkFlyingGib meats, meats_end;
int meats_cnt, oldmaxgibs, meats_realcnt;
mkBloodPool pools, pools_end;
int pools_cnt, oldmaxpools, pools_realcnt;
static void QueueCasing( SWWMCasing c )
{
@ -149,6 +151,40 @@ extend Class SWWMHandler
m.prevmeat = null;
m.nextmeat = null;
}
static void QueuePool( mkBloodPool p )
{
let hnd = SWWMHandler(EventHandler.Find('SWWMHandler'));
if ( !hnd ) return;
hnd.pools_cnt++;
if ( !hnd.pools )
{
// this is the initial one
hnd.pools = p;
hnd.pools_end = p;
}
else
{
hnd.pools_end.nextpool = p;
p.prevpool = hnd.pools_end;
hnd.pools_end = p;
}
while ( hnd.pools && (swwm_maxpools >= 0) && (hnd.pools_cnt > swwm_maxpools) )
DeQueuePool(hnd.pools);
}
static void DeQueuePool( mkBloodPool p )
{
let hnd = SWWMHandler(EventHandler.Find('SWWMHandler'));
if ( !hnd || !hnd.pools ) return;
if ( (hnd.pools != p) && !p.prevpool && !p.nextpool ) return;
hnd.pools_cnt--;
if ( !p.prevpool ) hnd.pools = p.nextpool;
else p.prevpool.nextpool = p.nextpool;
if ( p == hnd.pools_end ) hnd.pools_end = p.prevpool;
if ( p.nextpool ) p.nextpool.prevpool = p.prevpool;
p.killme = true;
p.prevpool = null;
p.nextpool = null;
}
private void CleanQueues()
{
@ -156,6 +192,7 @@ extend Class SWWMHandler
while ( chips ) DeQueueChip(chips);
while ( blods ) DeQueueBlod(blods);
while ( meats ) DeQueueMeat(meats);
while ( pools ) DeQueuePool(pools);
}
private void RecheckQueues()
@ -168,6 +205,8 @@ extend Class SWWMHandler
DeQueueBlod(blods);
while ( meats && (meats_cnt > swwm_maxgibs) )
DeQueueMeat(meats);
while ( pools && (pools_cnt > swwm_maxpools) )
DeQueuePool(pools);
}
private void QueueMaintenance()
@ -192,9 +231,15 @@ extend Class SWWMHandler
while ( meats && (swwm_maxgibs >= 0) && (meats_cnt > swwm_maxgibs) )
DeQueueMeat(meats);
}
if ( swwm_maxpools != oldmaxpools )
{
while ( pools && (swwm_maxpools >= 0) && (pools_cnt > swwm_maxpools) )
DeQueuePool(pools);
}
oldmaxcasings = swwm_maxcasings;
oldmaxdebris = swwm_maxdebris;
oldmaxblood = swwm_maxblood;
oldmaxgibs = swwm_maxgibs;
oldmaxpools = swwm_maxpools;
}
}