diff --git a/Build/Configurations/Includes/Hexen_linedefs.cfg b/Build/Configurations/Includes/Hexen_linedefs.cfg index 7cef156c..fad50451 100755 --- a/Build/Configurations/Includes/Hexen_linedefs.cfg +++ b/Build/Configurations/Includes/Hexen_linedefs.cfg @@ -664,7 +664,7 @@ floor 28 { - title = "Floor Crusher Start"; + title = "Floor Raise And Crush"; id = "Floor_RaiseAndCrush"; arg0 diff --git a/Source/Core/Data/BitmapImage.cs b/Source/Core/Data/BitmapImage.cs index eb293d44..99f436b5 100755 --- a/Source/Core/Data/BitmapImage.cs +++ b/Source/Core/Data/BitmapImage.cs @@ -38,7 +38,7 @@ namespace CodeImp.DoomBuilder.Data public BitmapImage(Bitmap img, string name) { // Initialize - this.img = img; + this.img = new Bitmap(img); this.AllowUnload = false; SetName(name); @@ -62,7 +62,7 @@ namespace CodeImp.DoomBuilder.Data // No failure checking here. I anything fails here, it is not the user's fault, // because the resources this loads are in the assembly. - return new LocalLoadResult(img); + return new LocalLoadResult(new Bitmap(img)); } #endregion diff --git a/Source/Core/Data/DataManager.cs b/Source/Core/Data/DataManager.cs index 61448441..f6f13686 100755 --- a/Source/Core/Data/DataManager.cs +++ b/Source/Core/Data/DataManager.cs @@ -2531,7 +2531,7 @@ namespace CodeImp.DoomBuilder.Data foreach(KeyValuePair group in parser.AmbientSounds) { - configenums[group.Key] = new EnumItem(group.Key.ToString(), group.Value.SoundName); + configenums[group.Key] = new EnumItem(group.Key.ToString(), group.Value.SoundDescription); } // Store results in "ambient_sounds" enum diff --git a/Source/Core/Data/ImageDataFormat.cs b/Source/Core/Data/ImageDataFormat.cs index fca8373d..85446fbf 100755 --- a/Source/Core/Data/ImageDataFormat.cs +++ b/Source/Core/Data/ImageDataFormat.cs @@ -165,10 +165,10 @@ namespace CodeImp.DoomBuilder.Data data.Position += 9; // Skip some stuff... int width = data.ReadByte() + (data.ReadByte() << 8); - if(width < 0 || width > 8192) return false; + if(width <= 0 || width > 8192) return false; int height = data.ReadByte() + (data.ReadByte() << 8); - if(height < 0 || height > 8192) return false; + if(height <= 0 || height > 8192) return false; int bitsperpixel = data.ReadByte(); // Can be 8, 16, 24, 32 return (bitsperpixel == 8 || bitsperpixel == 16 || bitsperpixel == 24 || bitsperpixel == 32); diff --git a/Source/Core/Data/UnknownImage.cs b/Source/Core/Data/UnknownImage.cs index ef652a43..56b5475f 100755 --- a/Source/Core/Data/UnknownImage.cs +++ b/Source/Core/Data/UnknownImage.cs @@ -39,7 +39,7 @@ namespace CodeImp.DoomBuilder.Data // Initialize this.width = 0; this.height = 0; - this.loadbitmap = Properties.Resources.UnknownImage; + this.loadbitmap = new Bitmap(Properties.Resources.UnknownImage); SetName(""); LoadImageNow(); diff --git a/Source/Core/IO/FileImageReader.cs b/Source/Core/IO/FileImageReader.cs index b7220a28..2370fb04 100755 --- a/Source/Core/IO/FileImageReader.cs +++ b/Source/Core/IO/FileImageReader.cs @@ -35,7 +35,7 @@ namespace CodeImp.DoomBuilder.IO offsetx = int.MinValue; offsety = int.MinValue; - using (BinaryReader reader = new BinaryReader(stream)) + using (BinaryReader reader = new BinaryReader(stream, System.Text.Encoding.UTF8, true)) { int manufacturer = reader.ReadByte(); // 10=ZSoft int version = reader.ReadByte(); @@ -64,6 +64,9 @@ namespace CodeImp.DoomBuilder.IO int width = rightMargin - leftMargin + 1; int height = bottomMargin - topMargin + 1; + if (width == 0 || height == 0) + throw new InvalidDataException("Invalid pcx image file"); + int vgaPaletteID = 0; byte[] vgaPalette = null; @@ -218,7 +221,7 @@ namespace CodeImp.DoomBuilder.IO offsetx = int.MinValue; offsety = int.MinValue; - using (BinaryReader reader = new BinaryReader(stream)) + using (BinaryReader reader = new BinaryReader(stream, System.Text.Encoding.UTF8, true)) { read_header(reader); read_image_id(reader); @@ -250,6 +253,12 @@ namespace CodeImp.DoomBuilder.IO if (colormap_type > 1) throw new InvalidDataException("Invalid or unsupported targa image file"); + if (image_type != 1 && image_type != 2 && image_type != 3 && image_type != 9 && image_type != 10 && image_type != 11) + throw new InvalidDataException("Invalid or unsupported targa image type"); + + if (image_width == 0 || image_height == 0) + throw new InvalidDataException("Invalid targa image file"); + if (colormap_type == 0) colormap_length = 0; @@ -581,7 +590,7 @@ namespace CodeImp.DoomBuilder.IO if (isPng) { stream.Position = 8; - using (BinaryReader reader = new BinaryReader(stream)) + using (BinaryReader reader = new BinaryReader(stream, System.Text.Encoding.UTF8, true)) { // Read chunks untill we encounter either "grAb" or "IDAT" while (reader.BaseStream.Position < reader.BaseStream.Length) diff --git a/Source/Core/IO/UniversalMapSetIO.cs b/Source/Core/IO/UniversalMapSetIO.cs index f0d346c2..cfe2fe91 100755 --- a/Source/Core/IO/UniversalMapSetIO.cs +++ b/Source/Core/IO/UniversalMapSetIO.cs @@ -151,7 +151,7 @@ namespace CodeImp.DoomBuilder.IO // Read the UDMF data lump.Stream.Seek(0, SeekOrigin.Begin); - udmfreader.SetKnownCustomTypes = true; + udmfreader.SetKnownCustomTypes = false; udmfreader.Read(map, lump.Stream); // Return result diff --git a/Source/Core/Rendering/Renderer3D.cs b/Source/Core/Rendering/Renderer3D.cs index 95550dd2..f8e86840 100755 --- a/Source/Core/Rendering/Renderer3D.cs +++ b/Source/Core/Rendering/Renderer3D.cs @@ -1739,6 +1739,9 @@ namespace CodeImp.DoomBuilder.Rendering // This collects a visual sector's geometry for rendering public void AddThingGeometry(VisualThing t) { + // The thing might have changed, especially when doing realtime editing from the edit thing dialog, so update it if necessary + t.Update(); + //mxd. Gather lights if (General.Settings.GZDrawLightsMode != LightRenderMode.NONE && !fullbrightness && t.LightType != null) { diff --git a/Source/Core/Types/AngleByteHandler.cs b/Source/Core/Types/AngleByteHandler.cs index d5cd1a3a..77a07409 100755 --- a/Source/Core/Types/AngleByteHandler.cs +++ b/Source/Core/Types/AngleByteHandler.cs @@ -9,7 +9,7 @@ using CodeImp.DoomBuilder.Windows; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.AngleByte, "Byte Angle", true)] + [TypeHandler(UniversalType.AngleByte, "Byte Angle", false)] internal class AngleByteHandler : AngleDegreesHandler { #region ================== Properties diff --git a/Source/Core/Types/AngleDegreesFloatHandler.cs b/Source/Core/Types/AngleDegreesFloatHandler.cs index 5655c38a..693c3c79 100755 --- a/Source/Core/Types/AngleDegreesFloatHandler.cs +++ b/Source/Core/Types/AngleDegreesFloatHandler.cs @@ -26,7 +26,7 @@ using CodeImp.DoomBuilder.Windows; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.AngleDegreesFloat, "Degrees (Decimal)", true)] + [TypeHandler(UniversalType.AngleDegreesFloat, "Degrees (Decimal)", false)] internal class AngleDegreesFloatHandler : AngleDegreesHandler { #region ================== Constants diff --git a/Source/Core/Types/AngleDegreesHandler.cs b/Source/Core/Types/AngleDegreesHandler.cs index 88a73984..3ea3d19b 100755 --- a/Source/Core/Types/AngleDegreesHandler.cs +++ b/Source/Core/Types/AngleDegreesHandler.cs @@ -26,7 +26,7 @@ using CodeImp.DoomBuilder.Windows; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.AngleDegrees, "Degrees (Integer)", true)] + [TypeHandler(UniversalType.AngleDegrees, "Degrees (Integer)", false)] internal class AngleDegreesHandler : TypeHandler { #region ================== Constants diff --git a/Source/Core/Types/AngleRadiansHandler.cs b/Source/Core/Types/AngleRadiansHandler.cs index a3668507..9bafad42 100755 --- a/Source/Core/Types/AngleRadiansHandler.cs +++ b/Source/Core/Types/AngleRadiansHandler.cs @@ -27,7 +27,7 @@ using CodeImp.DoomBuilder.Geometry; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.AngleRadians, "Radians", true)] + [TypeHandler(UniversalType.AngleRadians, "Radians", false)] internal class AngleRadiansHandler : AngleDegreesHandler { #region ================== Constants diff --git a/Source/Core/Types/ColorHandler.cs b/Source/Core/Types/ColorHandler.cs index 1cec933d..13f8129f 100755 --- a/Source/Core/Types/ColorHandler.cs +++ b/Source/Core/Types/ColorHandler.cs @@ -25,7 +25,7 @@ using System.Drawing; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.Color, "Color", true)] + [TypeHandler(UniversalType.Color, "Color", false)] internal class ColorHandler : TypeHandler { #region ================== Constants diff --git a/Source/Core/Types/FlatHandler.cs b/Source/Core/Types/FlatHandler.cs index 1d4f09a5..0be76296 100755 --- a/Source/Core/Types/FlatHandler.cs +++ b/Source/Core/Types/FlatHandler.cs @@ -24,7 +24,7 @@ using CodeImp.DoomBuilder.Windows; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.Flat, "Flat", true)] + [TypeHandler(UniversalType.Flat, "Flat", false)] internal class FlatHandler : TypeHandler { #region ================== Constants diff --git a/Source/Core/Types/LinedefTagHandler.cs b/Source/Core/Types/LinedefTagHandler.cs index 640aec58..858bb771 100755 --- a/Source/Core/Types/LinedefTagHandler.cs +++ b/Source/Core/Types/LinedefTagHandler.cs @@ -24,7 +24,7 @@ using CodeImp.DoomBuilder.Map; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.LinedefTag, "Linedef Tag", true)] + [TypeHandler(UniversalType.LinedefTag, "Linedef Tag", false)] internal class LinedefTagHandler : SectorTagHandler { #region ================== Setup (mxd) diff --git a/Source/Core/Types/LinedefTypeHandler.cs b/Source/Core/Types/LinedefTypeHandler.cs index 0f98f2d4..baa097c5 100755 --- a/Source/Core/Types/LinedefTypeHandler.cs +++ b/Source/Core/Types/LinedefTypeHandler.cs @@ -26,7 +26,7 @@ using System.Windows.Forms; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.LinedefType, "Linedef Action", true)] + [TypeHandler(UniversalType.LinedefType, "Linedef Action", false)] internal class LinedefTypeHandler : TypeHandler { #region ================== Constants diff --git a/Source/Core/Types/RandomFloatHandler.cs b/Source/Core/Types/RandomFloatHandler.cs index 15e0b376..6eee7b04 100755 --- a/Source/Core/Types/RandomFloatHandler.cs +++ b/Source/Core/Types/RandomFloatHandler.cs @@ -8,7 +8,7 @@ using CodeImp.DoomBuilder.Config; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.RandomFloat, "Decimal (Random)", true)] + [TypeHandler(UniversalType.RandomFloat, "Decimal (Random)", false)] internal class RandomFloatHandler : TypeHandler { #region ================== Constants diff --git a/Source/Core/Types/RandomIntegerHandler.cs b/Source/Core/Types/RandomIntegerHandler.cs index 653d3538..b8d185c6 100755 --- a/Source/Core/Types/RandomIntegerHandler.cs +++ b/Source/Core/Types/RandomIntegerHandler.cs @@ -8,7 +8,7 @@ using CodeImp.DoomBuilder.Config; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.RandomInteger, "Integer (Random)", true)] + [TypeHandler(UniversalType.RandomInteger, "Integer (Random)", false)] internal class RandomIntegerHandler : TypeHandler { #region ================== Variables diff --git a/Source/Core/Types/SectorEffectHandler.cs b/Source/Core/Types/SectorEffectHandler.cs index 08cd357f..633c1c55 100755 --- a/Source/Core/Types/SectorEffectHandler.cs +++ b/Source/Core/Types/SectorEffectHandler.cs @@ -26,7 +26,7 @@ using System.Windows.Forms; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.SectorEffect, "Sector Effect", true)] + [TypeHandler(UniversalType.SectorEffect, "Sector Effect", false)] internal class SectorEffectHandler : TypeHandler { #region ================== Constants diff --git a/Source/Core/Types/SectorTagHandler.cs b/Source/Core/Types/SectorTagHandler.cs index c9392206..45a09535 100755 --- a/Source/Core/Types/SectorTagHandler.cs +++ b/Source/Core/Types/SectorTagHandler.cs @@ -26,7 +26,7 @@ using CodeImp.DoomBuilder.Map; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.SectorTag, "Sector Tag", true)] + [TypeHandler(UniversalType.SectorTag, "Sector Tag", false)] internal class SectorTagHandler : IntegerHandler { #region ================== Variables diff --git a/Source/Core/Types/TextureHandler.cs b/Source/Core/Types/TextureHandler.cs index 725342b4..108f17a5 100755 --- a/Source/Core/Types/TextureHandler.cs +++ b/Source/Core/Types/TextureHandler.cs @@ -24,7 +24,7 @@ using CodeImp.DoomBuilder.Windows; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.Texture, "Texture", true)] + [TypeHandler(UniversalType.Texture, "Texture", false)] internal class TextureHandler : TypeHandler { #region ================== Constants diff --git a/Source/Core/Types/ThingClassHandler.cs b/Source/Core/Types/ThingClassHandler.cs index 88e94c7d..cbb5d5bf 100755 --- a/Source/Core/Types/ThingClassHandler.cs +++ b/Source/Core/Types/ThingClassHandler.cs @@ -25,7 +25,7 @@ using CodeImp.DoomBuilder.Windows; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.ThingClass, "Thing Class", true)] + [TypeHandler(UniversalType.ThingClass, "Thing Class", false)] internal class ThingClassHandler : TypeHandler { #region ================== Constants diff --git a/Source/Core/Types/ThingTagHandler.cs b/Source/Core/Types/ThingTagHandler.cs index 0b83788f..18812c33 100755 --- a/Source/Core/Types/ThingTagHandler.cs +++ b/Source/Core/Types/ThingTagHandler.cs @@ -24,7 +24,7 @@ using CodeImp.DoomBuilder.Map; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.ThingTag, "Thing Tag", true)] + [TypeHandler(UniversalType.ThingTag, "Thing Tag", false)] internal class ThingTagHandler : SectorTagHandler { #region ================== Setup (mxd) diff --git a/Source/Core/Types/ThingTypeHandler.cs b/Source/Core/Types/ThingTypeHandler.cs index 71fafcee..ee6daa27 100755 --- a/Source/Core/Types/ThingTypeHandler.cs +++ b/Source/Core/Types/ThingTypeHandler.cs @@ -26,7 +26,7 @@ using System.Windows.Forms; namespace CodeImp.DoomBuilder.Types { - [TypeHandler(UniversalType.ThingType, "Thing Type", true)] + [TypeHandler(UniversalType.ThingType, "Thing Type", false)] internal class ThingTypeHandler : TypeHandler { #region ================== Constants diff --git a/Source/Core/ZDoom/AmbientSoundInfo.cs b/Source/Core/ZDoom/AmbientSoundInfo.cs index a7e9e6cf..af234868 100755 --- a/Source/Core/ZDoom/AmbientSoundInfo.cs +++ b/Source/Core/ZDoom/AmbientSoundInfo.cs @@ -27,6 +27,7 @@ namespace CodeImp.DoomBuilder.ZDoom #region ================== Variables private string soundname; + private string sounddescription; private int index = -1; private AmbientType type = AmbientType.NONE; @@ -48,6 +49,7 @@ namespace CodeImp.DoomBuilder.ZDoom #region ================== Properties public string SoundName { get { return soundname; } } + public string SoundDescription { get { return sounddescription; } } public int Index { get { return index; } } // Ambient sound index // Sound settings @@ -107,7 +109,7 @@ namespace CodeImp.DoomBuilder.ZDoom } // Next token can be either [type] or ... - if(!parser.SkipWhitespace(true)) return false; + if (!parser.SkipWhitespace(true)) return false; string token = parser.ReadToken(false).ToLowerInvariant(); // Can be [type] @@ -191,6 +193,22 @@ namespace CodeImp.DoomBuilder.ZDoom return false; } + // There can be multiple different ambient sounds with the same sound name, so build a description containing the index + // and the name to differentiate them. See https://github.com/jewalky/UltimateDoomBuilder/issues/390 + sounddescription = index.ToString() + ": " + soundname + " (" + type.ToString().ToLowerInvariant(); + + if (type == AmbientType.POINT) + sounddescription += ", attenuation: " + attenuation; + + if (mode == AmbientMode.CONTINUOUS) + sounddescription += ", " + mode.ToString().ToLowerInvariant(); + else if (mode == AmbientMode.RANDOM) + sounddescription += ", every " + minsecs + " to " + maxsecs + " seconds"; + else if (mode == AmbientMode.PERIODIC) + sounddescription += ", every " + secs + " seconds"; + + sounddescription += ", " + volume * 100 + "% volume)"; + return true; } diff --git a/Source/Core/ZDoom/ZScriptActorStructure.cs b/Source/Core/ZDoom/ZScriptActorStructure.cs index 8e629fd9..36c98cb3 100755 --- a/Source/Core/ZDoom/ZScriptActorStructure.cs +++ b/Source/Core/ZDoom/ZScriptActorStructure.cs @@ -452,39 +452,61 @@ namespace CodeImp.DoomBuilder.ZDoom return true; } - private string ParseVersion(bool required) - { - // read in the version. - tokenizer.SkipWhitespace(); - ZScriptToken token = tokenizer.ExpectToken(ZScriptTokenType.OpenParen); - if (token == null || !token.IsValid) - { - if (required) - parser.ReportError("Expected (, got " + ((Object)token ?? "").ToString()); - return null; - } + private string ParseVersion(bool required) + { + // read in the version. + tokenizer.SkipWhitespace(); + ZScriptToken token = tokenizer.ExpectToken(ZScriptTokenType.OpenParen); + if (token == null || !token.IsValid) + { + if (required) + parser.ReportError("Expected (, got " + ((Object)token ?? "").ToString()); + return null; + } - tokenizer.SkipWhitespace(); - token = tokenizer.ExpectToken(ZScriptTokenType.String); - if (token == null || !token.IsValid) - { - parser.ReportError("Expected version, got " + ((Object)token ?? "").ToString()); - return null; - } + tokenizer.SkipWhitespace(); + token = tokenizer.ExpectToken(ZScriptTokenType.String); + if (token == null || !token.IsValid) + { + parser.ReportError("Expected version, got " + ((Object)token ?? "").ToString()); + return null; + } - string version = token.Value.Trim(); - tokenizer.SkipWhitespace(); - token = tokenizer.ExpectToken(ZScriptTokenType.CloseParen); - if (token == null || !token.IsValid) - { - parser.ReportError("Expected ), got " + ((Object)token ?? "").ToString()); - return null; - } + string version = token.Value.Trim(); + tokenizer.SkipWhitespace(); - return version; - } + // As of https://github.com/coelckers/gzdoom/commit/7a141f3aa3b67b5b1d326f5d9b3904da1b65f847 + // there can be helper messages as the 2nd parameter + token = tokenizer.ExpectToken(ZScriptTokenType.CloseParen, ZScriptTokenType.Comma); + if (token == null || !token.IsValid) + { + parser.ReportError("Expected ) or comma, got " + ((Object)token ?? "").ToString()); + return null; + } - internal ZScriptActorStructure(ZDTextParser zdparser, DecorateCategoryInfo catinfo, string _classname, string _replacesname, string _parentname) + if (token.Type == ZScriptTokenType.CloseParen) + return version; + + tokenizer.SkipWhitespace(); + token = tokenizer.ExpectToken(ZScriptTokenType.String); + if (token == null || !token.IsValid) + { + parser.ReportError("Expected helper message string, got " + ((Object)token ?? "").ToString()); + return null; + } + + tokenizer.SkipWhitespace(); + token = tokenizer.ExpectToken(ZScriptTokenType.CloseParen); + if (token == null || !token.IsValid) + { + parser.ReportError("Expected ), got " + ((Object)token ?? "").ToString()); + return null; + } + + return version; + } + + internal ZScriptActorStructure(ZDTextParser zdparser, DecorateCategoryInfo catinfo, string _classname, string _replacesname, string _parentname) { this.catinfo = catinfo; //mxd diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index ac37994e..6d142ce6 100755 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -4621,8 +4621,14 @@ namespace CodeImp.DoomBuilder.BuilderModes backwardoffset = j.offsetx; - if(!worldpanning) - forwardoffset = (float)Math.Round((j.offsetx + (float)Math.Round(j.sidedef.Line.Length) / scalex * first.scaleX) % vwidth, General.Map.FormatInterface.VertexDecimals); + if (!worldpanning) + { + // If the texture gets replaced with a "hires" texture it adds more fuckery + if (texture is HiResImage) + forwardoffset = j.offsetx + (float)Math.Round(((float)Math.Round(j.sidedef.Line.Length) / scalex) % vwidth, General.Map.FormatInterface.VertexDecimals); + else + forwardoffset = j.offsetx + (float)Math.Round(((float)Math.Round(j.sidedef.Line.Length) / scalex * Math.Abs(first.scaleX)) % vwidth, General.Map.FormatInterface.VertexDecimals); + } else forwardoffset = (float)Math.Round((j.offsetx + (float)Math.Round(j.sidedef.Line.Length)) % vwidth, General.Map.FormatInterface.VertexDecimals); @@ -4646,7 +4652,13 @@ namespace CodeImp.DoomBuilder.BuilderModes float offset; if(!worldpanning) - offset = (float)Math.Round((j.offsetx - j.sidedef.OffsetX - (float)Math.Round(j.sidedef.Line.Length) / scalex * first.scaleX) % vwidth, General.Map.FormatInterface.VertexDecimals); + { + // If the texture gets replaced with a "hires" texture it adds more fuckery + if (texture is HiResImage) + offset = (float)Math.Round((j.offsetx - j.sidedef.OffsetX - (float)Math.Round(j.sidedef.Line.Length) / scalex) % vwidth, General.Map.FormatInterface.VertexDecimals); + else + offset = (float)Math.Round((j.offsetx - j.sidedef.OffsetX - (float)Math.Round(j.sidedef.Line.Length) / scalex * first.scaleX) % vwidth, General.Map.FormatInterface.VertexDecimals); + } else offset = (float)Math.Round((j.offsetx - j.sidedef.OffsetX - (float)Math.Round(j.sidedef.Line.Length)) % vwidth, General.Map.FormatInterface.VertexDecimals); @@ -4762,7 +4774,13 @@ namespace CodeImp.DoomBuilder.BuilderModes forwardoffset = j.offsetx; if (!worldpanning) - backwardoffset = (float)Math.Round((j.offsetx - (float)Math.Round(j.sidedef.Line.Length) / scalex * first.scaleX) % vwidth, General.Map.FormatInterface.VertexDecimals); + { + // If the texture gets replaced with a "hires" texture it adds more fuckery + if (texture is HiResImage) + backwardoffset = (float)Math.Round((j.offsetx - (float)Math.Round(j.sidedef.Line.Length) / scalex) % vwidth, General.Map.FormatInterface.VertexDecimals); + else + backwardoffset = (float)Math.Round((j.offsetx - (float)Math.Round(j.sidedef.Line.Length) / scalex * Math.Abs(first.scaleX)) % vwidth, General.Map.FormatInterface.VertexDecimals); + } else backwardoffset = (float)Math.Round((j.offsetx - (float)Math.Round(j.sidedef.Line.Length)) % vwidth, General.Map.FormatInterface.VertexDecimals); diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs b/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs index 95961e99..d8cf9c9b 100755 --- a/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs @@ -139,6 +139,10 @@ namespace CodeImp.DoomBuilder.BuilderModes { tof = tof / tscaleAbs; tof = tof * base.Texture.Scale; + + // If the texture gets replaced with a "hires" texture it adds more fuckery + if (base.Texture is HiResImage) + tof *= tscaleAbs; } // Determine texture coordinates plane as they would be in normal circumstances. diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs index d477b6f0..9eb62058 100755 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddle3D.cs @@ -157,6 +157,10 @@ namespace CodeImp.DoomBuilder.BuilderModes { tof = tof / tscaleAbs; tof = tof * base.Texture.Scale; + + // If the texture gets replaced with a "hires" texture it adds more fuckery + if (base.Texture is HiResImage) + tof *= tscaleAbs; } // For Vavoom type 3D floors the ceiling is lower than floor and they are reversed. diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs index abf3d541..7b03355a 100755 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs @@ -139,6 +139,10 @@ namespace CodeImp.DoomBuilder.BuilderModes { tof = tof / tscaleAbs; tof = tof * base.Texture.Scale; + + // If the texture gets replaced with a "hires" texture it adds more fuckery + if (base.Texture is HiResImage) + tof *= tscaleAbs; } // Determine texture coordinates plane as they would be in normal circumstances. diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs index 3bd3dbf2..c4b21f39 100755 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleSingle.cs @@ -125,6 +125,10 @@ namespace CodeImp.DoomBuilder.BuilderModes { tof = tof / tscaleAbs; tof = tof * base.Texture.Scale; + + // If the texture gets replaced with a "hires" texture it adds more fuckery + if (base.Texture is HiResImage) + tof *= tscaleAbs; } // Determine texture coordinates plane as they would be in normal circumstances. diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs b/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs index 84cd8281..89f794a5 100755 --- a/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs @@ -140,6 +140,10 @@ namespace CodeImp.DoomBuilder.BuilderModes { tof = tof / tscaleAbs; tof = tof * base.Texture.Scale; + + // If the texture gets replaced with a "hires" texture it adds more fuckery + if (base.Texture is HiResImage) + tof *= tscaleAbs; } // Determine texture coordinates plane as they would be in normal circumstances.