diff --git a/Build/Configurations/Includes/GZDoom_things.cfg b/Build/Configurations/Includes/GZDoom_things.cfg index 5339a85e..4b11047e 100755 --- a/Build/Configurations/Includes/GZDoom_things.cfg +++ b/Build/Configurations/Includes/GZDoom_things.cfg @@ -1,10 +1,10 @@ gzdoom_lights { - staticlights + lightmaplights { color = 7; arrow = 0; - title = "Static Lights"; + title = "Lightmap Lights"; sort = 1; width = 0; height = 0; @@ -15,8 +15,8 @@ gzdoom_lights 9876 { - title = "Static Point Light"; - class = "StaticPointLight"; // Fake class name + title = "Lightmap Point Light"; + class = "pointlighttraceattenuated"; arg0 { title = "Red"; @@ -38,11 +38,104 @@ gzdoom_lights default = 64; } } + + 9877 + { + title = "Lightmap Point Light (Pulsing)"; + class = "pointlightpulsetraceattenuated"; + arg0 + { + title = "Red"; + default = 255; + } + arg1 + { + title = "Green"; + default = 255; + } + arg2 + { + title = "Blue"; + default = 255; + } + arg3 + { + title = "Start intensity"; + default = 64; + } + arg4 + { + title = "End intensity"; + default = 32; + } + } + + 9878 + { + title = "Lightmap Point Light (Flickering)"; + class = "pointlightflickertraceattenuated"; + arg0 + { + title = "Red"; + default = 255; + } + arg1 + { + title = "Green"; + default = 255; + } + arg2 + { + title = "Blue"; + default = 255; + } + arg3 + { + title = "Primary intensity"; + default = 64; + } + arg4 + { + title = "Secondary intensity"; + default = 32; + } + } + + 9879 + { + title = "Lightmap Point Light (Random Flickering)"; + class = "pointlightflickerrandomtraceattenuated"; + arg0 + { + title = "Red"; + default = 255; + } + arg1 + { + title = "Green"; + default = 255; + } + arg2 + { + title = "Blue"; + default = 255; + } + arg3 + { + title = "Primary intensity"; + default = 64; + } + arg4 + { + title = "Secondary intensity"; + default = 32; + } + } 9881 { - title = "Static Spotlight"; - class = "StaticSpotLight"; // Fake class name + title = "Lightmap Spotlight"; + class = "spotlighttraceattenuated"; arg0 { title = "Color"; @@ -65,6 +158,102 @@ gzdoom_lights default = 64; } } + + 9882 + { + title = "Lightmap Spotlight (Pulsing)"; + class = "spotlightpulsetraceattenuated"; + arg0 + { + title = "Color"; + default = 16777215; + str = true; + } + arg1 + { + title = "Inner angle"; + default = 8; + } + arg2 + { + title = "Outer angle"; + default = 32; + } + arg3 + { + title = "Start intensity"; + default = 64; + } + arg4 + { + title = "End intensity"; + default = 32; + } + } + + 9883 + { + title = "Lightmap Spotlight (Flickering)"; + class = "spotlightflickertraceattenuated"; + arg0 + { + title = "Color"; + default = 16777215; + str = true; + } + arg1 + { + title = "Inner angle"; + default = 8; + } + arg2 + { + title = "Outer angle"; + default = 32; + } + arg3 + { + title = "Primary intensity"; + default = 64; + } + arg4 + { + title = "Secondary intensity"; + default = 32; + } + } + + 9884 + { + title = "Lightmap Spotlight (Random Flickering)"; + class = "spotlightflickerrandomtraceattenuated"; + arg0 + { + title = "Color"; + default = 16777215; + str = true; + } + arg1 + { + title = "Inner angle"; + default = 8; + } + arg2 + { + title = "Outer angle"; + default = 32; + } + arg3 + { + title = "Primary intensity"; + default = 64; + } + arg4 + { + title = "Secondary intensity"; + default = 32; + } + } 9890 { @@ -73,7 +262,7 @@ gzdoom_lights adduniversalfields { lm_suncolor; - lm_sampledistance; + lm_sampledist; } } } diff --git a/Build/Configurations/Includes/ZDoom_misc.cfg b/Build/Configurations/Includes/ZDoom_misc.cfg index 207c0296..aeda05a0 100755 --- a/Build/Configurations/Includes/ZDoom_misc.cfg +++ b/Build/Configurations/Includes/ZDoom_misc.cfg @@ -377,7 +377,7 @@ universalfields default = ""; } - lm_sampledist_line + lm_sampledist { type = 0; default = 0; @@ -529,6 +529,30 @@ universalfields type = 3; default = false; } + + lm_sampledist + { + type = 0; + default = 0; + } + + lm_sampledist_top + { + type = 0; + default = 0; + } + + lm_sampledist_mid + { + type = 0; + default = 0; + } + + lm_sampledist_bot + { + type = 0; + default = 0; + } } thing @@ -744,7 +768,7 @@ universalfields thingtypespecific = true; } - lm_sampledistance + lm_sampledist { type = 0; default = 16; diff --git a/Source/Core/GZBuilder/Data/LinksCollector.cs b/Source/Core/GZBuilder/Data/LinksCollector.cs index 2d24b930..25035c73 100755 --- a/Source/Core/GZBuilder/Data/LinksCollector.cs +++ b/Source/Core/GZBuilder/Data/LinksCollector.cs @@ -584,7 +584,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data color = new PixelColor((byte)linealpha, (byte)t.Args[1], (byte)t.Args[2], (byte)t.Args[3]); break; - case GZGeneral.LightDef.POINT_STATIC: + case GZGeneral.LightDef.POINT_LIGHTMAP: // ZDRay static lights have an intensity that's set through the thing's alpha value double intensity = t.Fields.GetValue("alpha", 1.0); byte r = (byte)General.Clamp(t.Args[0] * intensity, 0.0, 255.0); @@ -627,7 +627,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data else color = new PixelColor((byte)linealpha, (byte)((t.Args[0] & 0xFF0000) >> 16), (byte)((t.Args[0] & 0x00FF00) >> 8), (byte)((t.Args[0] & 0x0000FF))); // ZDRay static lights have an intensity that's set through the thing's alpha value - if (t.DynamicLightType.LightDef == GZGeneral.LightDef.SPOT_STATIC) + if (t.DynamicLightType.LightDef == GZGeneral.LightDef.SPOT_LIGHTMAP) { double intensity = t.Fields.GetValue("alpha", 1.0); if (intensity != 1.0) diff --git a/Source/Core/GZBuilder/GZGeneral.cs b/Source/Core/GZBuilder/GZGeneral.cs index 759336c8..508ee16b 100755 --- a/Source/Core/GZBuilder/GZGeneral.cs +++ b/Source/Core/GZBuilder/GZGeneral.cs @@ -120,17 +120,17 @@ namespace CodeImp.DoomBuilder.GZBuilder [LightDefClass("vavoomlightcolor")] VAVOOM_COLORED, - [LightDefRenderStyle(LightRenderStyle.STATIC)] - [LightDefNum(9876)] - [LightDefClass("staticpointlight")] - [LightDefModifier(LightModifier.NORMAL)] - POINT_STATIC, + [LightDefRenderStyle(LightRenderStyle.LIGHTMAP)] + [LightDefNum(9876, 9877, 9878, 9879)] + [LightDefClass("pointlighttraceattenuated", "pointlightpulsetraceattenuated", "pointlightflickertraceattenuated", "pointlightflickerrandomtraceattenuated")] + [LightDefModifier(LightModifier.NORMAL, LightModifier.PULSE, LightModifier.FLICKER, LightModifier.FLICKERRANDOM)] + POINT_LIGHTMAP, - [LightDefRenderStyle(LightRenderStyle.STATIC)] - [LightDefNum(9881)] - [LightDefClass("staticspotlight")] - [LightDefModifier(LightModifier.NORMAL)] - SPOT_STATIC, + [LightDefRenderStyle(LightRenderStyle.LIGHTMAP)] + [LightDefNum(9881, 9882, 9883, 9884)] + [LightDefClass("spotlighttraceattenuated", "spotlightpulsetraceattenuated", "spotlightflickertraceattenuated", "spotlightflickerrandomtraceattenuated")] + [LightDefModifier(LightModifier.NORMAL, LightModifier.PULSE, LightModifier.FLICKER, LightModifier.FLICKERRANDOM)] + SPOT_LIGHTMAP, [LightDefRenderStyle(LightRenderStyle.NONE)] [LightDefNum(9890)] @@ -150,7 +150,7 @@ namespace CodeImp.DoomBuilder.GZBuilder ATTENUATED = 98, VAVOOM = 50, ADDITIVE = 25, - STATIC = 98, // Same as attenuated + LIGHTMAP = 98, // Same as attenuated NONE = 0, } @@ -232,14 +232,14 @@ namespace CodeImp.DoomBuilder.GZBuilder case LightDef.POINT_ADDITIVE: case LightDef.POINT_SUBTRACTIVE: case LightDef.POINT_ATTENUATED: - case LightDef.POINT_STATIC: + case LightDef.POINT_LIGHTMAP: LightType = LightType.POINT; break; case LightDef.SPOT_NORMAL: case LightDef.SPOT_ADDITIVE: case LightDef.SPOT_SUBTRACTIVE: case LightDef.SPOT_ATTENUATED: - case LightDef.SPOT_STATIC: + case LightDef.SPOT_LIGHTMAP: LightType = LightType.SPOT; break; case LightDef.VAVOOM_GENERIC: diff --git a/Source/Core/Rendering/Renderer2D.cs b/Source/Core/Rendering/Renderer2D.cs index 3ba9c230..907aaa49 100644 --- a/Source/Core/Rendering/Renderer2D.cs +++ b/Source/Core/Rendering/Renderer2D.cs @@ -593,7 +593,7 @@ namespace CodeImp.DoomBuilder.Rendering color = new PixelColor(255, (byte)((t.Args[0] & 0xFF0000) >> 16), (byte)((t.Args[0] & 0x00FF00) >> 8), (byte)((t.Args[0] & 0x0000FF))); // ZDRay static lights have an intensity that's set through the thing's alpha value - if (t.DynamicLightType.LightDef == GZGeneral.LightDef.SPOT_STATIC) + if (t.DynamicLightType.LightDef == GZGeneral.LightDef.SPOT_LIGHTMAP) { double intensity = t.Fields.GetValue("alpha", 1.0); if (intensity != 1.0) @@ -609,7 +609,7 @@ namespace CodeImp.DoomBuilder.Rendering } // Point light - if (t.DynamicLightType.LightDef == GZGeneral.LightDef.POINT_STATIC) + if (t.DynamicLightType.LightDef == GZGeneral.LightDef.POINT_LIGHTMAP) { // ZDRay static lights have an intensity that's set through the thing's alpha value double intensity = t.Fields.GetValue("alpha", 1.0); diff --git a/Source/Core/Rendering/Renderer3D.cs b/Source/Core/Rendering/Renderer3D.cs index e28cc8f4..87980e40 100755 --- a/Source/Core/Rendering/Renderer3D.cs +++ b/Source/Core/Rendering/Renderer3D.cs @@ -608,7 +608,7 @@ namespace CodeImp.DoomBuilder.Rendering case GZGeneral.LightRenderStyle.VAVOOM: lightOffsets[0]++; break; case GZGeneral.LightRenderStyle.ADDITIVE: lightOffsets[2]++; break; case GZGeneral.LightRenderStyle.SUBTRACTIVE: lightOffsets[3]++; break; - case GZGeneral.LightRenderStyle.STATIC: // Static lights look the same as attenuated lights + case GZGeneral.LightRenderStyle.LIGHTMAP: // Static lights look the same as attenuated lights default: lightOffsets[1]++; break; // attenuated } } diff --git a/Source/Core/Types/EnumBitsHandler.cs b/Source/Core/Types/EnumBitsHandler.cs index a5842331..fef66615 100755 --- a/Source/Core/Types/EnumBitsHandler.cs +++ b/Source/Core/Types/EnumBitsHandler.cs @@ -62,8 +62,17 @@ namespace CodeImp.DoomBuilder.Types list = arginfo.Enum; } + // When set up for an UDMF field + public override void SetupField(TypeHandlerAttribute attr, UniversalFieldInfo fieldinfo) + { + defaultvalue = (int)fieldinfo.Default; + base.SetupField(attr, fieldinfo); + + // Keep enum list reference + list = fieldinfo.Enum; + } #endregion - + #region ================== Methods public override void Browse(IWin32Window parent) diff --git a/Source/Core/Types/FloatHandler.cs b/Source/Core/Types/FloatHandler.cs index fab04e03..ded0f684 100755 --- a/Source/Core/Types/FloatHandler.cs +++ b/Source/Core/Types/FloatHandler.cs @@ -16,6 +16,7 @@ #region ================== Namespaces +using CodeImp.DoomBuilder.Config; using System; using System.Globalization; @@ -33,6 +34,7 @@ namespace CodeImp.DoomBuilder.Types #region ================== Variables private double value; + private double defaultvalue; #endregion @@ -42,6 +44,18 @@ namespace CodeImp.DoomBuilder.Types #region ================== Methods + public override void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo) + { + defaultvalue = (double)arginfo.DefaultValue; + base.SetupArgument(attr, arginfo); + } + + public override void SetupField(TypeHandlerAttribute attr, UniversalFieldInfo fieldinfo) + { + defaultvalue = (fieldinfo == null || fieldinfo.Default == null) ? 0.0 : (double)fieldinfo.Default; + base.SetupField(attr, fieldinfo); + } + public override void SetValue(object value) { // Null? @@ -87,7 +101,7 @@ namespace CodeImp.DoomBuilder.Types public override object GetDefaultValue() { - return 0.0; + return defaultvalue; } #endregion diff --git a/Source/Core/Types/IntegerHandler.cs b/Source/Core/Types/IntegerHandler.cs index 0d6ff053..780cf78e 100755 --- a/Source/Core/Types/IntegerHandler.cs +++ b/Source/Core/Types/IntegerHandler.cs @@ -51,6 +51,12 @@ namespace CodeImp.DoomBuilder.Types base.SetupArgument(attr, arginfo); } + public override void SetupField(TypeHandlerAttribute attr, UniversalFieldInfo fieldinfo) + { + defaultvalue = (fieldinfo == null || fieldinfo.Default == null) ? 0 : (int)fieldinfo.Default; + base.SetupField(attr, fieldinfo); + } + public override void SetValue(object value) { // Null? diff --git a/Source/Core/VisualModes/VisualThing.cs b/Source/Core/VisualModes/VisualThing.cs index 9797808a..125ea525 100755 --- a/Source/Core/VisualModes/VisualThing.cs +++ b/Source/Core/VisualModes/VisualThing.cs @@ -681,7 +681,7 @@ namespace CodeImp.DoomBuilder.VisualModes if (ld.LightDef != GZGeneral.LightDef.POINT_SUBTRACTIVE) // normal, additive, attenuated { // ZDRay static lights have an intensity that's set through the thing's alpha value - float intensity = ld.LightRenderStyle == GZGeneral.LightRenderStyle.STATIC ? (float)thing.Fields.GetValue("alpha", 1.0) : 1.0f; + float intensity = ld.LightRenderStyle == GZGeneral.LightRenderStyle.LIGHTMAP ? (float)thing.Fields.GetValue("alpha", 1.0) : 1.0f; //lightColor.Alpha used in shader to perform some calculations based on light type lightColor = new Color4( @@ -720,7 +720,7 @@ namespace CodeImp.DoomBuilder.VisualModes if (ld.LightDef != GZGeneral.LightDef.SPOT_SUBTRACTIVE) { // ZDRay static lights have an intensity that's set through the thing's alpha value - float intensity = ld.LightRenderStyle == GZGeneral.LightRenderStyle.STATIC ? (float)thing.Fields.GetValue("alpha", 1.0) : 1.0f; + float intensity = ld.LightRenderStyle == GZGeneral.LightRenderStyle.LIGHTMAP ? (float)thing.Fields.GetValue("alpha", 1.0) : 1.0f; lightColor = new Color4( c1 / DYNLIGHT_INTENSITY_SCALER * intensity, diff --git a/Source/Core/ZDoom/ZDTextParser.cs b/Source/Core/ZDoom/ZDTextParser.cs index 7a7e3edb..919d5629 100755 --- a/Source/Core/ZDoom/ZDTextParser.cs +++ b/Source/Core/ZDoom/ZDTextParser.cs @@ -258,6 +258,11 @@ namespace CodeImp.DoomBuilder.ZDoom // Skip entire line char c4 = c3; while((c4 != '\n') && (datastream.Position < datastream.Length)) { c4 = (char)datareader.ReadByte(); } + + // Reached end of file? + if (datastream.Position == datastream.Length) + return true; + c = c4; } else diff --git a/Source/Core/ZDoom/ZScriptTokenizer.cs b/Source/Core/ZDoom/ZScriptTokenizer.cs index 8a6db87c..91a976cd 100755 --- a/Source/Core/ZDoom/ZScriptTokenizer.cs +++ b/Source/Core/ZDoom/ZScriptTokenizer.cs @@ -30,6 +30,7 @@ namespace CodeImp.DoomBuilder.ZDoom LineComment, // // blablabla BlockComment, // /* blablabla */ Whitespace, // whitespace is a legit token. + Region, // #region, #endregion // invalid token Invalid, @@ -199,7 +200,7 @@ namespace CodeImp.DoomBuilder.ZDoom { while (true) { - ZScriptToken tok = ExpectToken(ZScriptTokenType.Newline, ZScriptTokenType.BlockComment, ZScriptTokenType.LineComment, ZScriptTokenType.Whitespace); + ZScriptToken tok = ExpectToken(ZScriptTokenType.Newline, ZScriptTokenType.BlockComment, ZScriptTokenType.LineComment, ZScriptTokenType.Whitespace, ZScriptTokenType.Region); if (tok == null || !tok.IsValid) break; } } @@ -460,7 +461,7 @@ namespace CodeImp.DoomBuilder.ZDoom return null; } - private ZScriptToken TryReadStringOrComment(bool allowstring, bool allowname, bool allowblock, bool allowline) + private ZScriptToken TryReadStringOrComment(bool allowstring, bool allowname, bool allowblock, bool allowline, bool allowregion) { long cpos = LastPosition = reader.BaseStream.Position; char c; @@ -552,7 +553,41 @@ namespace CodeImp.DoomBuilder.ZDoom } break; } + case '#': // #region and #endregion + { + if (!allowregion) break; + char cnext; + SB.Length = 0; + // Read until the end of the line + while (true) + { + try + { + cnext = reader.ReadChar(); + } + catch(EndOfStreamException) + { + break; + } + if(cnext == '\n') + { + reader.BaseStream.Position--; + break; + } + + SB.Append(cnext); + } + + string line = SB.ToString(); + + // GZDoom actually doesn't care what's coming after #region or #endregion, so something like #regionlalala is valid. + // But they have to be in lower case + if (line.StartsWith("region") || line.StartsWith("endregion")) + return new ZScriptToken() { Position = cpos, Type = ZScriptTokenType.Region, Value = "" }; + + break; + } case '"': case '\'': { @@ -586,7 +621,6 @@ namespace CodeImp.DoomBuilder.ZDoom } } } - } reader.BaseStream.Position = cpos; @@ -642,11 +676,12 @@ namespace CodeImp.DoomBuilder.ZDoom bool bblockcomment = oneof.Contains(ZScriptTokenType.BlockComment); bool bstring = oneof.Contains(ZScriptTokenType.String); bool bname = oneof.Contains(ZScriptTokenType.Name); + bool bregion = oneof.Contains(ZScriptTokenType.Region); - if (bstring || bname || bblockcomment || blinecomment) + if (bstring || bname || bblockcomment || blinecomment || bregion) { // try to expect a string - ZScriptToken tok = TryReadStringOrComment(bstring, bname, bblockcomment, blinecomment); + ZScriptToken tok = TryReadStringOrComment(bstring, bname, bblockcomment, blinecomment, bregion); if (tok != null) return tok; } @@ -721,7 +756,7 @@ namespace CodeImp.DoomBuilder.ZDoom if (tok != null) return tok; } - tok = TryReadStringOrComment(true, true, true, true); + tok = TryReadStringOrComment(true, true, true, true, true); if (tok != null) return tok; if (!short_circuit) diff --git a/Source/Plugins/BuilderModes/IO/WavefrontExporter.cs b/Source/Plugins/BuilderModes/IO/WavefrontExporter.cs index c4074ffa..0882a09b 100755 --- a/Source/Plugins/BuilderModes/IO/WavefrontExporter.cs +++ b/Source/Plugins/BuilderModes/IO/WavefrontExporter.cs @@ -513,11 +513,13 @@ namespace CodeImp.DoomBuilder.BuilderModes.IO foreach(VisualMiddle3D m3d in part.middle3d) { if(m3d.Vertices == null) continue; - texture = m3d.GetControlLinedef().Front.MiddleTexture; + texture = m3d.GetTextureName(); if (!skipTextures.Contains(texture)) { CheckTextureName(ref texturegeo, ref texture); - texturegeo[texture].AddRange(OptimizeGeometry(m3d.Vertices, m3d.GeometryType)); + // 3D floor sides are cut so that there are only triangles for the visible parts. Some of those might be + // triangles and not rectangles, so we can't optimize them into rectangles + texturegeo[texture].AddRange(OptimizeGeometry(m3d.Vertices, m3d.GeometryType, true)); } } } diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs index 5ec65156..b7f4ce06 100755 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs @@ -848,15 +848,15 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Texture offset change - public virtual void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) + public virtual bool OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { - if(horizontal == 0 && vertical == 0) return; //mxd + if(horizontal == 0 && vertical == 0) return false; //mxd //mxd if(!General.Map.UDMF) { General.Interface.DisplayStatus(StatusType.Warning, "Floor/ceiling texture offsets cannot be changed in this map format!"); - return; + return false; } if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket)) @@ -914,6 +914,8 @@ namespace CodeImp.DoomBuilder.BuilderModes } if(vs != null) vs.UpdateSectorGeometry(false); + + return true; } //mxd diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs index 24dffc1e..14c08c2a 100755 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs @@ -1660,7 +1660,7 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Texture offset change - public virtual void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) + public virtual bool OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket)) undoticket = mode.CreateUndo("Change texture offsets"); @@ -1695,6 +1695,8 @@ namespace CodeImp.DoomBuilder.BuilderModes //mxd. Update linked effects SectorData sd = mode.GetSectorDataEx(Sector.Sector); if(sd != null) sd.Reset(true); + + return true; } //mxd diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualSlope.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualSlope.cs index f76b70be..00cda9e3 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualSlope.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualSlope.cs @@ -111,7 +111,7 @@ namespace CodeImp.DoomBuilder.VisualModes public void OnSelectBegin() { } public void OnEditBegin() { } public void OnChangeTargetBrightness(bool up, bool local) { } - public void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { } + public bool OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { return true; } public void OnSelectTexture() { } public void OnCopyTexture() { } public void OnPasteTexture() { } diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualThing.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualThing.cs index c83bc109..208eb4a2 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualThing.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualThing.cs @@ -704,7 +704,7 @@ namespace CodeImp.DoomBuilder.BuilderModes public void OnSelectBegin() { } public void OnEditBegin() { } public void OnChangeTargetBrightness(bool up, bool local) { } - public void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { } + public bool OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { return true; } public void OnSelectTexture() { } public void OnCopyTexture() { } public void OnPasteTexture() { } diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualVertex.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualVertex.cs old mode 100755 new mode 100644 index e7483c76..ba5a1037 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualVertex.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualVertex.cs @@ -241,7 +241,7 @@ namespace CodeImp.DoomBuilder.BuilderModes public void OnEditBegin() { } public void OnMouseMove(MouseEventArgs e) { } public void OnChangeTargetBrightness(bool up, bool local) { } - public void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { } + public bool OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { return true; } public void OnChangeScale(int incrementX, int incrementY) { } public void OnSelectTexture() { } public void OnCopyTexture() { } diff --git a/Source/Plugins/BuilderModes/VisualModes/IVisualEventReceiver.cs b/Source/Plugins/BuilderModes/VisualModes/IVisualEventReceiver.cs old mode 100755 new mode 100644 index 8c5d73dd..94b8baa3 --- a/Source/Plugins/BuilderModes/VisualModes/IVisualEventReceiver.cs +++ b/Source/Plugins/BuilderModes/VisualModes/IVisualEventReceiver.cs @@ -35,7 +35,7 @@ namespace CodeImp.DoomBuilder.BuilderModes void OnMouseMove(MouseEventArgs e); void OnChangeTargetHeight(int amount); void OnChangeTargetBrightness(bool up, bool local); - void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection); + bool OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection); void OnChangeScale(int incrementX, int incrementY); //mxd void OnResetTextureOffset(); void OnResetLocalTextureOffset(); //mxd. This should reset upper/middle/lower offsets (UDMF only) diff --git a/Source/Plugins/BuilderModes/VisualModes/NullVisualEventReceiver.cs b/Source/Plugins/BuilderModes/VisualModes/NullVisualEventReceiver.cs old mode 100755 new mode 100644 index dfe8b05b..92f81103 --- a/Source/Plugins/BuilderModes/VisualModes/NullVisualEventReceiver.cs +++ b/Source/Plugins/BuilderModes/VisualModes/NullVisualEventReceiver.cs @@ -34,7 +34,7 @@ namespace CodeImp.DoomBuilder.BuilderModes public void OnMouseMove(MouseEventArgs e) { } public void OnChangeTargetHeight(int amount) { } public void OnChangeTargetBrightness(bool up, bool local) { } - public void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { } + public bool OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { return true; } public void OnChangeScale(int incrementX, int incrementY) { } //mxd public void OnResetTextureOffset() { } public void OnResetLocalTextureOffset() { } //mxd diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs b/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs index 1ee4422a..5d25b796 100755 --- a/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualCeiling.cs @@ -279,16 +279,19 @@ namespace CodeImp.DoomBuilder.BuilderModes } //mxd - public override void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) + public override bool OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { + bool appliedoffset = false; + // Only do this when not done yet in this call // Because we may be able to select the same 3D floor multiple times through multiple sectors SectorData sd = mode.GetSectorData(level.sector); if(!sd.CeilingChanged) { - sd.CeilingChanged = true; - base.OnChangeTextureOffset(horizontal, vertical, doSurfaceAngleCorrection); + sd.CeilingChanged = appliedoffset = base.OnChangeTextureOffset(horizontal, vertical, doSurfaceAngleCorrection); } + + return appliedoffset; } // Move texture coordinates diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs b/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs index 64a6732e..658cc727 100755 --- a/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualFloor.cs @@ -233,16 +233,19 @@ namespace CodeImp.DoomBuilder.BuilderModes } //mxd - public override void OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) + public override bool OnChangeTextureOffset(int horizontal, int vertical, bool doSurfaceAngleCorrection) { + bool appliedoffset = false; + // Only do this when not done yet in this call // Because we may be able to select the same 3D floor multiple times through multiple sectors SectorData sd = mode.GetSectorData(level.sector); if(!sd.FloorChanged) { - sd.FloorChanged = true; - base.OnChangeTextureOffset(horizontal, vertical, doSurfaceAngleCorrection); + sd.FloorChanged = appliedoffset = base.OnChangeTextureOffset(horizontal, vertical, doSurfaceAngleCorrection); } + + return appliedoffset; } // Move texture coordinates diff --git a/builder.sh b/builder.sh index 3bad9623..86ec9a25 100644 --- a/builder.sh +++ b/builder.sh @@ -1,2 +1,3 @@ #!/usr/bin/env bash +cd "$(dirname "$0")" mono Builder.exe