From a91e73f51e66e20ceb9bb4879c315d205ba1aec3 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Tue, 30 Nov 2021 18:13:53 +0100 Subject: [PATCH] Add throttling for blood and gib spawning. Reduce effects of flying gibs. Add a command to instantly clear queued effects. --- language.def_menu | 2 ++ language.es_menu | 2 ++ language.version | 4 +-- menudef.txt | 1 + zscript/handler/swwm_handler_process.zsc | 13 +++++++ zscript/handler/swwm_handler_queues.zsc | 12 +++++-- zscript/handler/swwm_handler_worldthings.zsc | 6 ++++ zscript/swwm_blod.zsc | 36 +++++++++----------- 8 files changed, 52 insertions(+), 24 deletions(-) diff --git a/language.def_menu b/language.def_menu index 98461651e..d4aac159a 100644 --- a/language.def_menu +++ b/language.def_menu @@ -212,6 +212,7 @@ SWWM_NOINTERTIPS = "Hide Intermission Tips"; SWWM_DEMOSLAYER = "Demoslayer Mode"; SWWM_BEEPBOOP = "Switch Emoting"; SWWM_VOICEAMP = "Voice Amplification"; +SWWM_CLEARFX = "Clear All Effects"; SWWM_MMTITLE = "Minimap Settings"; SWWM_MM_ENABLE = "Show Minimap"; SWWM_MM_ROTATE = "Rotate Minimap"; @@ -374,6 +375,7 @@ TOOLTIP_SWWM_NOINTERTIPS = "Hides intermission tips, in case you don't want to s TOOLTIP_SWWM_DEMOSLAYER = "Killed enemies may drop health and armor orbs."; TOOLTIP_SWWM_BEEPBOOP = "The Demolitionist will make cute noises whenever pressing any usable line. This might get annoying, so it's optional."; TOOLTIP_SWWM_VOICEAMP = "At their default volume, the Demolitionist's voice lines might be drowned out by in-game audio. This sets an additional amplification level so they're louder than other sounds."; +TOOLTIP_SWWM_NETEVENT_SWWMCLEAREFFECTS = "Fades out any active blood, gore, debris and casings."; TOOLTIP_SWWMMINIMAPMENU = "Configure the minimap."; TOOLTIP_SWWMACHIEVEMENTMENU = "View your achievements."; TOOLTIP_SWWM_MM_ENABLE = "Displays a minimap under the score counter."; diff --git a/language.es_menu b/language.es_menu index 7281c0296..57606241c 100644 --- a/language.es_menu +++ b/language.es_menu @@ -211,6 +211,7 @@ SWWM_NOINTERTIPS = "Ocultar Consejos de Intermisión"; SWWM_DEMOSLAYER = "Modo Demoslayer"; SWWM_BEEPBOOP = "Ruiditos de Activación"; SWWM_VOICEAMP = "Amplificación de Voz"; +SWWM_CLEARFX = "Limpiar todos los Efectos"; SWWM_MMTITLE = "Opciones de Minimapa"; SWWM_MM_ENABLE = "Mostrar Minimapa"; SWWM_MM_ROTATE = "Rotar Minimapa"; @@ -373,6 +374,7 @@ TOOLTIP_SWWM_NOINTERTIPS = "Oculta los consejos de intermisión, por si no quier TOOLTIP_SWWM_DEMOSLAYER = "Los enemigos que mates soltarán orbes de salud y armadura."; TOOLTIP_SWWM_BEEPBOOP = "La Demolicionista hará ruiditos adorables cuando pulse cualquier línea utilizable. Esto puede que resulte cansino, así que es opcional."; TOOLTIP_SWWM_VOICEAMP = "A su volumen normal, las voces de la Demolicionista pueden ser ahogadas por el audio del juego. Con esto se le dá un nivel de amplificación extra para que sean más estridentes que otros sonidos."; +TOOLTIP_SWWM_NETEVENT_SWWMCLEAREFFECTS = "Desvanece cualquier sangre, vísceras, escombros y casquillos activos."; TOOLTIP_SWWMMINIMAPMENU = "Configura el minimapa."; TOOLTIP_SWWMACHIEVEMENTMENU = "Revisa tus logros."; TOOLTIP_SWWM_MM_ENABLE = "Muestra un minimapa bajo el contador de puntuación."; diff --git a/language.version b/language.version index c53208248..4fc7ff674 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\chSWWM \czGZ\c- \cw1.2pre r59 \cu(Tue 30 Nov 18:13:09 CET 2021)\c-"; -SWWM_SHORTVER="\cw1.2pre r59 \cu(2021-11-30 18:13:09)\c-"; +SWWM_MODVER="\chSWWM \czGZ\c- \cw1.2pre r61 \cu(Tue 30 Nov 18:14:49 CET 2021)\c-"; +SWWM_SHORTVER="\cw1.2pre r61 \cu(2021-11-30 18:14:49)\c-"; diff --git a/menudef.txt b/menudef.txt index ff05d4753..079a0a90c 100644 --- a/menudef.txt +++ b/menudef.txt @@ -155,6 +155,7 @@ OptionMenu "SWWMOptionMenu" ScaleSlider "$SWWM_MAXGIBS", "swwm_maxgibs", -1, 1000, 1, "$SWWM_NONE", "$SWWM_UNLIMITED" ScaleSlider "$SWWM_MAXCASINGS", "swwm_maxcasings", -1, 1000, 1, "$SWWM_NONE", "$SWWM_UNLIMITED" ScaleSlider "$SWWM_MAXDEBRIS", "swwm_maxdebris", -1, 1000, 1, "$SWWM_NONE", "$SWWM_UNLIMITED" + SafeCommand "$SWWM_CLEARFX", "netevent swwmcleareffects" StaticText " " StaticText "$SWWM_FTITLE", "Blue" Option "$SWWM_FUNTAGS", "swwm_funtags", "YesNo" diff --git a/zscript/handler/swwm_handler_process.zsc b/zscript/handler/swwm_handler_process.zsc index 828fdc5a3..5c590c16d 100644 --- a/zscript/handler/swwm_handler_process.zsc +++ b/zscript/handler/swwm_handler_process.zsc @@ -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) ) diff --git a/zscript/handler/swwm_handler_queues.zsc b/zscript/handler/swwm_handler_queues.zsc index e7297f7d7..bd0837ad3 100644 --- a/zscript/handler/swwm_handler_queues.zsc +++ b/zscript/handler/swwm_handler_queues.zsc @@ -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) ) diff --git a/zscript/handler/swwm_handler_worldthings.zsc b/zscript/handler/swwm_handler_worldthings.zsc index 9cc86f8de..8ca39a372 100644 --- a/zscript/handler/swwm_handler_worldthings.zsc +++ b/zscript/handler/swwm_handler_worldthings.zsc @@ -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; diff --git a/zscript/swwm_blod.zsc b/zscript/swwm_blod.zsc index 099683b26..bdbd5871b 100644 --- a/zscript/swwm_blod.zsc +++ b/zscript/swwm_blod.zsc @@ -535,12 +535,6 @@ Class mkFlyingGib : Actor Vector3 ppos = level.Vec3Offset(oldpos,ndiff*i)-pos; A_SpawnParticle(shadecol,0,40,20.*scale.x*FRandom[Blood](.6,1.4),0,ppos.x,ppos.y,ppos.z,vel.x*.1+FRandom[Blood](-1.,1.),vel.y*.1+FRandom[Blood](-1.,1.),vel.z*.1+FRandom[Blood](-1.,1.),0,0,-.25,.5*alpha,-1,-.5*scale.x); } - if ( !Random[Blood](0,2) ) - { - let s = Spawn("mkBloodSmoke",pos); - s.SetShade(shadecol); - s.special1 += Random[Gibs](1,2); - } } override bool CanCollideWith(Actor other, bool passive) @@ -563,20 +557,6 @@ Class mkFlyingGib : Actor invoker.rollvel = FRandom[Gibs](10,50)*RandomPick[Gibs](-1,1)*clamp(vel.length()/10.,.25,4.); if ( invoker.lastbleed > level.maptime ) return; invoker.lastbleed = level.maptime+5; - double ang; - double pt; - Vector3 dir; - int numpt = Random[Blood](2,4); - for ( int i=0; i