Fixed: for scaled walls, texture offsets should not be scaled (reported by Tormentor667)

This commit is contained in:
ZZYZX 2017-03-07 03:06:15 +02:00
parent bbe651d366
commit 717e48edbb
9 changed files with 21 additions and 15 deletions

View file

@ -30,6 +30,6 @@ using CodeImp.DoomBuilder;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.0.2930")]
[assembly: AssemblyVersion("2.3.0.2932")]
[assembly: NeutralResourcesLanguageAttribute("en")]
[assembly: AssemblyHash("8c36eaf")]
[assembly: AssemblyHash("bbe651d")]

View file

@ -29,5 +29,5 @@ using System.Resources;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.3.0.2930")]
[assembly: AssemblyVersion("2.3.0.2932")]
[assembly: NeutralResourcesLanguageAttribute("en")]

View file

@ -532,7 +532,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected static float GetRoundedTextureOffset(float oldValue, float offset, float scale, float textureSize)
{
if(offset == 0f) return oldValue;
float scaledOffset = offset * scale;
float scaledOffset = offset * Math.Abs(scale);
float result = (float)Math.Round(oldValue + scaledOffset);
if(textureSize > 0) result %= textureSize;
if(result == oldValue) result += (scaledOffset < 0 ? -1 : 1);

View file

@ -99,7 +99,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D tscale = new Vector2D(Sidedef.Fields.GetValue("scalex_bottom", 1.0f),
Sidedef.Fields.GetValue("scaley_bottom", 1.0f));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_bottom", 0.0f),
Vector2D tscaleAbs = new Vector2D(Math.Abs(tscale.x), Math.Abs(tscale.y));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_bottom", 0.0f),
Sidedef.Fields.GetValue("offsety_bottom", 0.0f));
// Texture given?
@ -131,7 +132,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Get texture offsets
Vector2D tof = new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tof = tof + toffset;
tof = tof / tscale;
tof = tof / tscaleAbs;
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
tof = tof * base.Texture.Scale;

View file

@ -83,7 +83,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D tscale = new Vector2D(sourceside.Fields.GetValue("scalex_mid", 1.0f),
sourceside.Fields.GetValue("scaley_mid", 1.0f));
Vector2D toffset1 = new Vector2D(Sidedef.Fields.GetValue("offsetx_mid", 0.0f),
Vector2D tscaleAbs = new Vector2D(Math.Abs(tscale.x), Math.Abs(tscale.y));
Vector2D toffset1 = new Vector2D(Sidedef.Fields.GetValue("offsetx_mid", 0.0f),
Sidedef.Fields.GetValue("offsety_mid", 0.0f));
Vector2D toffset2 = new Vector2D(sourceside.Fields.GetValue("offsetx_mid", 0.0f),
sourceside.Fields.GetValue("offsety_mid", 0.0f));
@ -149,7 +150,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Get texture offsets
Vector2D tof = new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY) + new Vector2D(sourceside.OffsetX, sourceside.OffsetY);
tof = tof + toffset1 + toffset2;
tof = tof / tscale;
tof = tof / tscaleAbs;
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
tof = tof * base.Texture.Scale;

View file

@ -39,7 +39,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D tscale = new Vector2D(sourceside.Fields.GetValue("scalex_mid", 1.0f),
sourceside.Fields.GetValue("scaley_mid", 1.0f));
Vector2D toffset1 = new Vector2D(Sidedef.Fields.GetValue("offsetx_mid", 0.0f),
Vector2D tscaleAbs = new Vector2D(Math.Abs(tscale.x), Math.Abs(tscale.y));
Vector2D toffset1 = new Vector2D(Sidedef.Fields.GetValue("offsetx_mid", 0.0f),
Sidedef.Fields.GetValue("offsety_mid", 0.0f));
Vector2D toffset2 = new Vector2D(sourceside.Fields.GetValue("offsetx_mid", 0.0f),
sourceside.Fields.GetValue("offsety_mid", 0.0f));
@ -105,7 +106,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Get texture offsets
Vector2D tof = new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY) + new Vector2D(sourceside.OffsetX, sourceside.OffsetY);
tof = tof + toffset1 + toffset2;
tof = tof / tscale;
tof = tof / tscaleAbs;
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
tof = tof * base.Texture.Scale;

View file

@ -83,7 +83,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D tscale = new Vector2D(Sidedef.Fields.GetValue("scalex_mid", 1.0f),
Sidedef.Fields.GetValue("scaley_mid", 1.0f));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_mid", 0.0f),
Vector2D tscaleAbs = new Vector2D(Math.Abs(tscale.x), Math.Abs(tscale.y));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_mid", 0.0f),
Sidedef.Fields.GetValue("offsety_mid", 0.0f));
// Left and right vertices for this sidedef
@ -131,7 +132,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Get texture offsets
Vector2D tof = new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tof = tof + toffset;
tof = tof / tscale;
tof = tof / tscaleAbs;
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
tof = tof * base.Texture.Scale;

View file

@ -69,6 +69,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D tscale = new Vector2D(Sidedef.Fields.GetValue("scalex_mid", 1.0f),
Sidedef.Fields.GetValue("scaley_mid", 1.0f));
Vector2D tscaleAbs = new Vector2D(Math.Abs(tscale.x), Math.Abs(tscale.y));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_mid", 0.0f),
Sidedef.Fields.GetValue("offsety_mid", 0.0f));
@ -117,7 +118,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Get texture offsets
Vector2D tof = new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tof = tof + toffset;
tof = tof / tscale;
tof = tof / tscaleAbs;
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
tof = tof * base.Texture.Scale;

View file

@ -100,7 +100,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D tscale = new Vector2D(Sidedef.Fields.GetValue("scalex_top", 1.0f),
Sidedef.Fields.GetValue("scaley_top", 1.0f));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_top", 0.0f),
Vector2D tscaleAbs = new Vector2D(Math.Abs(tscale.x), Math.Abs(tscale.y));
Vector2D toffset = new Vector2D(Sidedef.Fields.GetValue("offsetx_top", 0.0f),
Sidedef.Fields.GetValue("offsety_top", 0.0f));
// Texture given?
@ -132,7 +133,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Get texture offsets
Vector2D tof = new Vector2D(Sidedef.OffsetX, Sidedef.OffsetY);
tof = tof + toffset;
tof = tof / tscale;
tof = tof / tscaleAbs;
if(General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
tof = tof * base.Texture.Scale;