Actually use GetMidTexturePosition() to simplify some code.

This commit is contained in:
Mari the Deer 2025-03-07 11:48:03 +01:00
commit 7dd20c93e4
2 changed files with 16 additions and 41 deletions

View file

@ -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-";

View file

@ -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));