From 8d0a087e6c36b1704579fabb1be0825fea0ad1b4 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Fri, 14 Mar 2025 16:19:00 +0100 Subject: [PATCH] Reduce perf hit of bullet trails by only spawning underwater bubbles actually underwater, instead of always spawning them and then relying on them despawning themselves after checking their own water level. Further optimization could be possible if I found a way to divide the trace results into segments based on intersections with water volumes. This would save on countless calls to Vec3Offset and PointInSector. Something to keep in mind, I suppose. While I was at it, I did make the underwater check into a new utility function. It is more or less based on how updating water level is done internally, but saves time by just checking a single point rather than an actor's full height. Not sure if I'll need to use it elsewhere, but if that turns out to not be the case I'll change it to a private function of the SWWMBulletTrail class afterwards. --- language.version | 4 ++-- zscript/swwm_common_fx.zsc | 9 ++++++++- zscript/utility/swwm_utility_map.zsc | 29 ++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/language.version b/language.version index 55ce61373..2daf15ef5 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1198 \cu(vie 14 mar 2025 15:59:42 CET)\c-"; -SWWM_SHORTVER="\cw1.3pre r1198 \cu(2025-03-14 15:59:42)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1200 \cu(vie 14 mar 2025 16:23:20 CET)\c-"; +SWWM_SHORTVER="\cw1.3pre r1200 \cu(2025-03-14 16:23:20)\c-"; diff --git a/zscript/swwm_common_fx.zsc b/zscript/swwm_common_fx.zsc index 5b3bf3668..e492fedc7 100644 --- a/zscript/swwm_common_fx.zsc +++ b/zscript/swwm_common_fx.zsc @@ -1400,11 +1400,18 @@ Class SWWMBulletTrail : LineTracer b.target = target; b.A_CheckTerrain(); } + Vector3 ppos; + SWWMAnimSprite b; + bool bInWater; for ( int i=5; i hsec.ceilingplane.ZAtPoint(p.xy)) ) + return true; + } + else // check 3D floors + { + for ( int i=0; i p.z) ) continue; + return true; + } + } + return false; + } + static bool, TextureID DefaceTexture( TextureID checkme ) { String tn = TexMan.GetName(checkme);