mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-03-04 00:21:44 +00:00
Retain the settings for repeating midtextures when clamping a sidedef's X offset to the texture width
This commit is contained in:
parent
8e068aad5b
commit
72fcc68ba3
5 changed files with 38 additions and 11 deletions
|
@ -1572,7 +1572,11 @@ namespace CodeImp.DoomBuilder.Geometry
|
||||||
texture = General.Map.Data.GetTextureImage(l.Front.LongLowTexture);
|
texture = General.Map.Data.GetTextureImage(l.Front.LongLowTexture);
|
||||||
|
|
||||||
if(texture != null)
|
if(texture != null)
|
||||||
l.Front.OffsetX = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width;
|
{
|
||||||
|
int repeatmidtexoffset = General.Map.SRB2 && l.IsFlagSet(General.Map.Config.RepeatMidtextureFlag) ? (l.Front.OffsetX / 4096) * 4096 : 0;
|
||||||
|
l.Front.OffsetX = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width + repeatmidtexoffset;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(l.Back != null)
|
if(l.Back != null)
|
||||||
|
@ -1587,7 +1591,10 @@ namespace CodeImp.DoomBuilder.Geometry
|
||||||
texture = General.Map.Data.GetTextureImage(l.Back.LongLowTexture);
|
texture = General.Map.Data.GetTextureImage(l.Back.LongLowTexture);
|
||||||
|
|
||||||
if(texture != null)
|
if(texture != null)
|
||||||
l.Back.OffsetX = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width;
|
{
|
||||||
|
int repeatmidtexoffset = General.Map.SRB2 && l.IsFlagSet(General.Map.Config.RepeatMidtextureFlag) ? (l.Back.OffsetX / 4096) * 4096 : 0;
|
||||||
|
l.Back.OffsetX = (int)Math.Round((reversed ? totalLength - curLength - l.Length : curLength)) % texture.Width + repeatmidtexoffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
curLength += l.Length;
|
curLength += l.Length;
|
||||||
|
|
|
@ -1511,7 +1511,12 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
texture = General.Map.Data.GetTextureImage(newline.front.LowTexture);
|
texture = General.Map.Data.GetTextureImage(newline.front.LowTexture);
|
||||||
|
|
||||||
//clamp offsetX
|
//clamp offsetX
|
||||||
if(texture != null) newline.front.OffsetX %= texture.Width;
|
if (texture != null)
|
||||||
|
{
|
||||||
|
int repeatmidtexoffset = General.Map.SRB2 && newline.IsFlagSet(General.Map.Config.RepeatMidtextureFlag) ? (newline.front.OffsetX / 4096) * 4096 : 0;
|
||||||
|
newline.front.OffsetX %= texture.Width;
|
||||||
|
newline.front.OffsetX += repeatmidtexoffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((oldline.back != null) && (newline.back != null))
|
if((oldline.back != null) && (newline.back != null))
|
||||||
|
@ -1527,7 +1532,12 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
texture = General.Map.Data.GetTextureImage(newline.back.LowTexture);
|
texture = General.Map.Data.GetTextureImage(newline.back.LowTexture);
|
||||||
|
|
||||||
//clamp offsetX
|
//clamp offsetX
|
||||||
if(texture != null) newline.back.OffsetX %= texture.Width;
|
if (texture != null)
|
||||||
|
{
|
||||||
|
int repeatmidtexoffset = General.Map.SRB2 && newline.IsFlagSet(General.Map.Config.RepeatMidtextureFlag) ? (newline.back.OffsetX / 4096) * 4096 : 0;
|
||||||
|
newline.back.OffsetX %= texture.Width;
|
||||||
|
newline.back.OffsetX += repeatmidtexoffset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1455,7 +1455,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
protected virtual int ChangeOffsetX(int amount)
|
protected virtual int ChangeOffsetX(int amount)
|
||||||
{
|
{
|
||||||
Sidedef.OffsetX -= amount;
|
Sidedef.OffsetX -= amount;
|
||||||
if (Texture != null) Sidedef.OffsetX %= Texture.Width;
|
if (Texture != null)
|
||||||
|
{
|
||||||
|
int repeatmidtexoffset = General.Map.SRB2 && Sidedef.Line.IsFlagSet(General.Map.Config.RepeatMidtextureFlag) ? (Sidedef.OffsetX / 4096) * 4096 : 0;
|
||||||
|
Sidedef.OffsetX %= Texture.Width;
|
||||||
|
Sidedef.OffsetX += repeatmidtexoffset;
|
||||||
|
}
|
||||||
return Sidedef.OffsetX;
|
return Sidedef.OffsetX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3963,7 +3963,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
// NOTE: We don't use ScaledWidth here because the texture offset is in pixels, not mappixels
|
// NOTE: We don't use ScaledWidth here because the texture offset is in pixels, not mappixels
|
||||||
if(texture.IsImageLoaded && Tools.SidedefTextureMatch(j.sidedef, texture.LongName))
|
if(texture.IsImageLoaded && Tools.SidedefTextureMatch(j.sidedef, texture.LongName))
|
||||||
{
|
{
|
||||||
if(alignx) j.sidedef.OffsetX %= texture.Width;
|
if (alignx)
|
||||||
|
{
|
||||||
|
int repeatmidtexoffset = General.Map.SRB2 && j.sidedef.Line.IsFlagSet(General.Map.Config.RepeatMidtextureFlag) ? (j.sidedef.OffsetX / 4096) * 4096 : 0;
|
||||||
|
j.sidedef.OffsetX %= texture.Width;
|
||||||
|
j.sidedef.OffsetX += repeatmidtexoffset;
|
||||||
|
}
|
||||||
if (aligny)
|
if (aligny)
|
||||||
{
|
{
|
||||||
if (General.Map.SRB2) j.controlSide.OffsetY %= texture.Height;
|
if (General.Map.SRB2) j.controlSide.OffsetY %= texture.Height;
|
||||||
|
|
Loading…
Reference in a new issue