From 7dd20c93e426af6970978585979110122d14fc2f Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Fri, 7 Mar 2025 11:48:03 +0100 Subject: [PATCH] Actually use GetMidTexturePosition() to simplify some code. --- language.version | 4 +-- zscript/utility/swwm_utility_map.zsc | 53 ++++++++-------------------- 2 files changed, 16 insertions(+), 41 deletions(-) diff --git a/language.version b/language.version index 3b8a3fab0..918c44600 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1189 \cu(miƩ 05 mar 2025 20:34:06 CET)\c-"; -SWWM_SHORTVER="\cw1.3pre r1189 \cu(2025-03-05 20:34:06)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1190 \cu(vie 07 mar 2025 11:48:03 CET)\c-"; +SWWM_SHORTVER="\cw1.3pre r1190 \cu(2025-03-07 11:48:03)\c-"; diff --git a/zscript/utility/swwm_utility_map.zsc b/zscript/utility/swwm_utility_map.zsc index 697db15aa..6f581d52a 100644 --- a/zscript/utility/swwm_utility_map.zsc +++ b/zscript/utility/swwm_utility_map.zsc @@ -409,54 +409,29 @@ extend Class SWWMUtility } if ( floorfound ) return (al+ah+bl+bh)*.25; // check for midtex - // TODO: see if GetMidTexturePosition() is useful here to simplify code if ( !l.sidedef[0].GetTexture(1).IsNull() ) { - double ofs = l.sidedef[0].GetTextureYOffset(1); - Vector2 siz = TexMan.GetScaledSize(l.sidedef[0].GetTexture(1)); - Vector2 tofs = TexMan.GetScaledOffset(l.sidedef[0].GetTexture(1)); - ofs += tofs.y; - ofs *= l.sidedef[0].GetTextureYScale(1); - siz.y *= l.sidedef[0].GetTextureYScale(1); - if ( l.flags&Line.ML_DONTPEGBOTTOM ) + let [valid,low,high] = l.GetMidTexturePosition(0); + if ( valid ) { - al = (l.v1.p,highestfloor.ZAtPoint(l.v1.p)+ofs); - bl = (l.v2.p,highestfloor.ZAtPoint(l.v2.p)+ofs); - ah = al+(0,0,siz.y); - bh = bl+(0,0,siz.y); + al = (l.v1.p,low); + bl = (l.v2.p,low); + ah = (l.v1.p,high); + bh = (l.v2.p,high); + return (al+ah+bl+bh)*.25; } - else - { - ah = (l.v1.p,lowestceiling.ZAtPoint(l.v1.p)+ofs); - bh = (l.v2.p,lowestceiling.ZAtPoint(l.v2.p)+ofs); - al = ah-(0,0,siz.y); - bl = bh-(0,0,siz.y); - } - return (al+ah+bl+bh)*.25; } if ( !l.sidedef[1].GetTexture(1).IsNull() ) { - double ofs = l.sidedef[1].GetTextureYOffset(1); - Vector2 siz = TexMan.GetScaledSize(l.sidedef[1].GetTexture(1)); - Vector2 tofs = TexMan.GetScaledOffset(l.sidedef[1].GetTexture(1)); - ofs += tofs.y; - ofs *= l.sidedef[1].GetTextureYScale(1); - siz.y *= l.sidedef[1].GetTextureYScale(1); - if ( l.flags&Line.ML_DONTPEGBOTTOM ) + let [valid,low,high] = l.GetMidTexturePosition(1); + if ( valid ) { - al = (l.v1.p,highestfloor.ZAtPoint(l.v1.p)+ofs); - bl = (l.v2.p,highestfloor.ZAtPoint(l.v2.p)+ofs); - ah = al+(0,0,siz.y); - bh = bl+(0,0,siz.y); + al = (l.v1.p,low); + bl = (l.v2.p,low); + ah = (l.v1.p,high); + bh = (l.v2.p,high); + return (al+ah+bl+bh)*.25; } - else - { - ah = (l.v1.p,lowestceiling.ZAtPoint(l.v1.p)+ofs); - bh = (l.v2.p,lowestceiling.ZAtPoint(l.v2.p)+ofs); - al = ah-(0,0,siz.y); - bl = bh-(0,0,siz.y); - } - return (al+ah+bl+bh)*.25; } // just use the intersection al = (l.v1.p,highestfloor.ZatPoint(l.v1.p));