From 9757aed5e63f7a319e98f5a2a64795fbc32d736b Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Sun, 16 Mar 2025 21:02:13 +0100 Subject: [PATCH] Add blood pools to the effect queue system. --- cvarinfo.base | 1 + language.def_menu | 2 ++ language.es_menu | 2 ++ language.version | 4 +-- menudef.txt | 1 + zscript/handler/swwm_handler.zsc | 3 -- zscript/handler/swwm_handler_process.zsc | 2 +- zscript/handler/swwm_handler_queues.zsc | 45 ++++++++++++++++++++++++ zscript/player/swwm_player_move.zsc | 2 +- zscript/swwm_blod.zsc | 26 +++++--------- 10 files changed, 63 insertions(+), 25 deletions(-) diff --git a/cvarinfo.base b/cvarinfo.base index c4d55002f..640477aae 100644 --- a/cvarinfo.base +++ b/cvarinfo.base @@ -23,6 +23,7 @@ server int swwm_maxblood = 200; // max blood effects at any time server int swwm_maxgibs = 100; // max gibs at any time server int swwm_maxcasings = 100; // max casings and spent mags at any time server int swwm_maxdebris = 200; // max chunks of debris at any time +server int swwm_maxpools = 100; // max corpse blood pools at any time nosave bool swwm_fuzz = true; // allows toggling the fuzz shader on menus/backgrounds, useful if you're streaming/recording since it destroys the encoding quality server bool swwm_cbtall = false; // wallbuster breaks any wall, not just movable ones server bool swwm_doomfall = false; // monsters take fall damage outside of hexen diff --git a/language.def_menu b/language.def_menu index ae3fd26cd..203f7780f 100644 --- a/language.def_menu +++ b/language.def_menu @@ -71,6 +71,7 @@ SWWM_PARTYTIME = "Super Fun Party Time"; SWWM_BIGTAGS = "Use Large Font for Names"; SWWM_MAXBLOOD = "Blood Limit"; SWWM_MAXGIBS = "Gib Limit"; +SWWM_MAXPOOLS = "Pool Limit"; SWWM_MAXCASINGS = "Casing Limit"; SWWM_MAXDEBRIS = "Debris Limit"; SWWM_ENEMYDROPS = "Enemy Ammo/Weapon Drops"; @@ -234,6 +235,7 @@ TOOLTIP_SWWM_PARTYTIME = "When something dies, it shoots out a cloud of confetti TOOLTIP_SWWM_BIGTAGS = "By default name labels on healthbars are shown with a small, compact font. Enabling this will use a bigger one."; TOOLTIP_SWWM_MAXBLOOD = "Caps the maximum amount of blood effects. Surpassing this limit will cause the excess to fade out."; TOOLTIP_SWWM_MAXGIBS = "Caps the maximum amount of gibs. Surpassing this limit will cause the excess to fade out."; +TOOLTIP_SWWM_MAXPOOLS = "Caps the maximum amount of blood pools. Surpassing this limit will cause the excess to fade out."; TOOLTIP_SWWM_MAXCASINGS = "Caps the maximum amount of casings and spent magazines. Surpassing this limit will cause the excess to fade out."; TOOLTIP_SWWM_MAXDEBRIS = "Caps the maximum amount of rubble from explosions and others. Surpassing this limit will cause the excess to fade out."; TOOLTIP_SWWM_ENEMYDROPS = "By default, enemies only drop ammo for a better progression. In maps with excessive amounts of enemies, it's recommended to disable this entirely."; diff --git a/language.es_menu b/language.es_menu index 59d1cf9bd..e831e0b33 100644 --- a/language.es_menu +++ b/language.es_menu @@ -69,6 +69,7 @@ SWWM_PARTYTIME = "Modo Fiesta Tope"; SWWM_BIGTAGS = "Usar Fuente Grande para Nombres"; SWWM_MAXBLOOD = "Límite de Sangre"; SWWM_MAXGIBS = "Límite de Vísceras"; +SWWM_MAXPOOLS = "Límite de Charcos"; SWWM_MAXCASINGS = "Límite de Casquillos"; SWWM_MAXDEBRIS = "Límite de Escombros"; SWWM_ENEMYDROPS = "Drops de Armas y Munición de Enemigos"; @@ -229,6 +230,7 @@ TOOLTIP_SWWM_PARTYTIME = "Cuando algo muere, expulsa una nube de confetti."; TOOLTIP_SWWM_BIGTAGS = "Por defecto los nombres de las barras de vida usan una fuente pequeña. Activando esta opción, se cambiará por una mayor."; TOOLTIP_SWWM_MAXBLOOD = "Limita la cantidad máxima de efectos de sangre. Sobrepasar este límite causará que el exceso se desvanezca."; TOOLTIP_SWWM_MAXGIBS = "Limita la cantidad máxima de vísceras. Sobrepasar este límite causará que el exceso se desvanezca."; +TOOLTIP_SWWM_MAXPOOLS = "Limita la cantidad máxima de charcos de sangre. Sobrepasar este límite causará que el exceso se desvanezca."; TOOLTIP_SWWM_MAXCASINGS = "Limita la cantidad máxima de casquillos y cargadores usados. Sobrepasar este límite causará que el exceso se desvanezca."; TOOLTIP_SWWM_MAXDEBRIS = "Limita la cantidad máxima de escombros por explosiones y otros. Sobrepasar este límite causará que el exceso se desvanezca."; TOOLTIP_SWWM_ENEMYDROPS = "Por defecto, los enemigos solo dropean munición para una mejor progresión. En mapas con enemigos excesivos, se recomienda desactivar los drops por completo."; diff --git a/language.version b/language.version index f4d5e2caf..ae384fdfd 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1204 \cu(dom 16 mar 2025 20:21:10 CET)\c-"; -SWWM_SHORTVER="\cw1.3pre r1204 \cu(2025-03-16 20:21:10)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1205 \cu(dom 16 mar 2025 21:02:13 CET)\c-"; +SWWM_SHORTVER="\cw1.3pre r1205 \cu(2025-03-16 21:02:13)\c-"; diff --git a/menudef.txt b/menudef.txt index 45f384ee9..3c17b8c34 100644 --- a/menudef.txt +++ b/menudef.txt @@ -169,6 +169,7 @@ OptionMenu "SWWMOptionMenu" Option "$SWWM_NOMAGDROP", "swwm_nomagdrop", "NoYes" ScaleSliderFix "$SWWM_MAXBLOOD", "swwm_maxblood", -1, 1000, 100, "$SWWM_NONE", "$SWWM_UNLIMITED" ScaleSliderFix "$SWWM_MAXGIBS", "swwm_maxgibs", -1, 1000, 100, "$SWWM_NONE", "$SWWM_UNLIMITED" + ScaleSliderFix "$SWWM_MAXPOOLS", "swwm_maxpools", -1, 1000, 100, "$SWWM_NONE", "$SWWM_UNLIMITED" ScaleSliderFix "$SWWM_MAXCASINGS", "swwm_maxcasings", -1, 1000, 100, "$SWWM_NONE", "$SWWM_UNLIMITED" ScaleSliderFix "$SWWM_MAXDEBRIS", "swwm_maxdebris", -1, 1000, 100, "$SWWM_NONE", "$SWWM_UNLIMITED" SafeCommand "$SWWM_CLEARFX", "netevent swwmcleareffects" diff --git a/zscript/handler/swwm_handler.zsc b/zscript/handler/swwm_handler.zsc index 5c44f351d..32056ec80 100644 --- a/zscript/handler/swwm_handler.zsc +++ b/zscript/handler/swwm_handler.zsc @@ -53,9 +53,6 @@ Class SWWMHandler : EventHandler transient ui Vector2 oldplayerpos; transient ui bool do_trace_steps; - // for bloody footsteps - mkBloodPool bloodpools; - enum EProfileTimer { PT_WORLDTICK, diff --git a/zscript/handler/swwm_handler_process.zsc b/zscript/handler/swwm_handler_process.zsc index c0d36aff7..58b2b7d03 100644 --- a/zscript/handler/swwm_handler_process.zsc +++ b/zscript/handler/swwm_handler_process.zsc @@ -445,7 +445,7 @@ extend Class SWWMHandler Console.Printf("Only the net arbitrator can call this event."); return; } - int n = casings_cnt+chips_cnt+blods_cnt+meats_cnt; + int n = casings_cnt+chips_cnt+blods_cnt+meats_cnt+pools_cnt; CleanQueues(); Console.Printf("%d effects cleared.",n); return; diff --git a/zscript/handler/swwm_handler_queues.zsc b/zscript/handler/swwm_handler_queues.zsc index 5533a8851..3bdf51b41 100644 --- a/zscript/handler/swwm_handler_queues.zsc +++ b/zscript/handler/swwm_handler_queues.zsc @@ -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; } } diff --git a/zscript/player/swwm_player_move.zsc b/zscript/player/swwm_player_move.zsc index 7c4d0fe51..1fa26c7f2 100644 --- a/zscript/player/swwm_player_move.zsc +++ b/zscript/player/swwm_player_move.zsc @@ -81,7 +81,7 @@ extend Class Demolitionist } // part 2: check for stepping on a blood pool, make feet bloody if ( !hnd ) hnd = SWWMHandler(EventHandler.Find('SWWMHandler')); - for ( mkBloodPool p=hnd.bloodpools; p; p=p.nextpool ) + for ( mkBloodPool p=hnd.pools; p; p=p.nextpool ) { // vertical distance fast check if ( abs(checkpos.z-p.pos.z) > 8. ) diff --git a/zscript/swwm_blod.zsc b/zscript/swwm_blod.zsc index 35cdb985a..0804933cf 100644 --- a/zscript/swwm_blod.zsc +++ b/zscript/swwm_blod.zsc @@ -893,21 +893,14 @@ Class mkBloodPool : SWWMNonInteractiveActor double basesz, sz, accel; Color stepcol; mkBloodPool prevpool, nextpool; - bool bRaised; // dead body was revived, fade out faster + bool killme, bRaised; Property BaseAccel : accel; override void OnDestroy() { + SWWMHandler.DeQueuePool(self); Super.OnDestroy(); - if ( prevpool ) - { - prevpool.nextpool = nextpool; - if ( nextpool ) nextpool.prevpool = prevpool; - } - let hnd = SWWMHandler(EventHandler.Find('SWWMHandler')); - if ( !hnd || (hnd.bloodpools != self) ) return; - hnd.bloodpools = nextpool; } override void PostBeginPlay() @@ -918,13 +911,8 @@ Class mkBloodPool : SWWMNonInteractiveActor basesz = scale.x; sz = .01; A_SetScale(sz); - A_QueueCorpse(); SWWMUtility.SetToSlope(self,FRandom[Blood](0,360)); - let hnd = SWWMHandler(EventHandler.Find('SWWMHandler')); - if ( !hnd ) return; - nextpool = hnd.bloodpools; - hnd.bloodpools = self; - if ( nextpool ) nextpool.prevpool = self; + SWWMHandler.QueuePool(self); } override void Tick() @@ -939,12 +927,14 @@ Class mkBloodPool : SWWMNonInteractiveActor if ( fz != pos.z ) SetOrigin((pos.x,pos.y,fz),true); if ( (waterlevel > 0) || GetFloorTerrain().isliquid ) A_FadeOut(); - if ( !master ) A_FadeOut(.01); - else if ( (master.Health > 0) || bRaised ) + if ( killme ) A_FadeOut(.01); + if ( master && (master.Health > 0) ) { bRaised = true; - A_FadeOut(); + master = null; } + if ( bRaised || !master ) + A_FadeOut(); if ( accel <= 0. ) return; sz += accel; double fact = min(special1++/1200.,1.);