From 0a5ff0bdaf90bdbcd2f375f9d1416739f0a70148 Mon Sep 17 00:00:00 2001 From: MaxED Date: Wed, 7 Aug 2013 09:25:37 +0000 Subject: [PATCH] Visual mode: fixed incorrect vertical texture offsets of middle parts of double sided linedefs. ACS support: script numbers/names without space between them and script arguments (like 'script 999(void)' or 'script "test"(void)') were not parsed. --- Source/Core/GZBuilder/GZDoom/AcsParserSE.cs | 9 ++++++++- Source/Core/Windows/MainForm.cs | 2 +- .../VisualModes/BaseVisualGeometrySidedef.cs | 4 +--- .../BuilderModes/VisualModes/VisualMiddleDouble.cs | 14 ++++++++------ 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Source/Core/GZBuilder/GZDoom/AcsParserSE.cs b/Source/Core/GZBuilder/GZDoom/AcsParserSE.cs index 4e19600f..2a71bdb3 100644 --- a/Source/Core/GZBuilder/GZDoom/AcsParserSE.cs +++ b/Source/Core/GZBuilder/GZDoom/AcsParserSE.cs @@ -67,10 +67,17 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom //is it named script? if (token.IndexOf('"') != -1) { + //check if we have something like '"mycoolscript"(void)' as a token + if(token.LastIndexOf('"') != token.Length - 1) + token = token.Substring(0, token.LastIndexOf('"')); + token = StripTokenQuotes(token); ScriptItem i = new ScriptItem(0, token, startPos, (int)stream.Position-1); namedScripts.Add(i); } else { //should be numbered script + //check if we have something like "999(void)" as a token + if (token.Contains("(")) token = token.Substring(0, token.IndexOf("(")); + int n = 0; if (int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out n)) { int endPos = (int)stream.Position - 1; @@ -88,7 +95,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom int commentStart = token.IndexOf("//"); if (commentStart != -1) { //found comment commentStart += 2; - name = token.Substring(commentStart, token.Length - commentStart); + name = token.Substring(commentStart, token.Length - commentStart).Trim(); } } diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs index 5b34747c..498b95fa 100644 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -3130,7 +3130,7 @@ namespace CodeImp.DoomBuilder.Windows if (!this.Disposing && blinkTimer != null) { try { this.Invoke(new CallBlink(blink)); - } catch(ObjectDisposedException oe) { } //la-la-la. We don't care. + } catch(ObjectDisposedException) { } //la-la-la. We don't care. } } else { //get rid of timer diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs index 82c45182..71276adf 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs @@ -183,9 +183,7 @@ namespace CodeImp.DoomBuilder.BuilderModes { // Determine color int lightlevel = lightabsolute ? lightvalue : l.brightnessbelow + lightvalue; - //mxd - //PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel)); - PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel, Sidedef)); + PixelColor wallbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightlevel, Sidedef)); //mxd PixelColor wallcolor = PixelColor.Modulate(l.colorbelow, wallbrightness); np.color = wallcolor.WithAlpha(255).ToInt(); diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs index a6ee69ce..4618f370 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualMiddleDouble.cs @@ -102,9 +102,8 @@ namespace CodeImp.DoomBuilder.BuilderModes if (base.Texture == null){ base.Texture = General.Map.Data.UnknownTexture3D; setuponloadedtexture = Sidedef.LongMiddleTexture; - } else { - if (!base.Texture.IsImageLoaded) - setuponloadedtexture = Sidedef.LongMiddleTexture; + } else if (!base.Texture.IsImageLoaded) { + setuponloadedtexture = Sidedef.LongMiddleTexture; } } else { // Use missing texture @@ -133,10 +132,13 @@ namespace CodeImp.DoomBuilder.BuilderModes float floorbias = (Sidedef.Sector.CeilHeight == Sidedef.Sector.FloorHeight) ? 1.0f : 0.0f; float geotop = (float)Math.Min(Sidedef.Sector.CeilHeight, Sidedef.Other.Sector.CeilHeight); float geobottom = (float)Math.Max(Sidedef.Sector.FloorHeight, Sidedef.Other.Sector.FloorHeight); - if(Sidedef.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag)) { - // When lower unpegged is set, the middle texture is bound to the bottom + float zoffset = Sidedef.Sector.CeilHeight - Sidedef.Other.Sector.CeilHeight; //mxd + + // When lower unpegged is set, the middle texture is bound to the bottom + if(Sidedef.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag)) tp.tlt.y = tsz.y - (float)(geotop - geobottom); - } + + if (zoffset > 0) tp.tlt.y -= zoffset; //mxd tp.trb.x = tp.tlt.x + Sidedef.Line.Length; tp.trb.y = tp.tlt.y + ((float)Sidedef.Sector.CeilHeight - ((float)Sidedef.Sector.FloorHeight + floorbias));