From 3d2d9e21ef5baf6835737b85f60dba99df10e9a3 Mon Sep 17 00:00:00 2001 From: MaxED <j.maxed@gmail.com> Date: Fri, 3 Jun 2016 20:22:07 +0000 Subject: [PATCH] Changed, Classic modes: displayed mouse map position coordinates are now snapped to current grid size. Updated model pitch handling to match current GZDoom implementation. Fixed imprecise vertex coordinates generated by Draw Ellipse mode. Fixed a resource loading exception when opened map file wad was located in the root of a Directory resource. Internal: changed output of all InterpolationTools methods from int to float. Fixed, Internal: InterpolationTools.InterpolateColor() delta usage was inverted. --- Source/Core/Data/DirectoryReader.cs | 9 ++- Source/Core/Editing/ClassicMode.cs | 6 +- Source/Core/General/General.cs | 6 +- Source/Core/Geometry/InterpolationTools.cs | 33 +++++++---- Source/Core/Geometry/Tools.cs | 12 ++-- Source/Core/Rendering/Renderer2D.cs | 2 +- Source/Core/Rendering/Renderer3D.cs | 4 +- Source/Core/VisualModes/VisualThing.cs | 2 +- Source/Core/Windows/MainForm.cs | 6 +- .../BuilderModes/ClassicModes/BridgeMode.cs | 8 +-- .../ClassicModes/DrawEllipseMode.cs | 14 ++--- .../BuilderModes/ClassicModes/DrawGridMode.cs | 8 +-- .../BuilderModes/ClassicModes/LinedefsMode.cs | 2 +- .../BuilderModes/ClassicModes/SectorsMode.cs | 26 ++++----- .../Interface/EditSelectionPanel.Designer.cs | 58 +++++++++---------- .../Interface/EditSelectionPanel.resx | 7 ++- .../VisualModes/BaseVisualGeometrySidedef.cs | 4 +- 17 files changed, 111 insertions(+), 96 deletions(-) diff --git a/Source/Core/Data/DirectoryReader.cs b/Source/Core/Data/DirectoryReader.cs index b0f29bb72..d07a2dce7 100644 --- a/Source/Core/Data/DirectoryReader.cs +++ b/Source/Core/Data/DirectoryReader.cs @@ -58,8 +58,13 @@ namespace CodeImp.DoomBuilder.Data wads = new List<WADReader>(wadfiles.Length); foreach(string wadfile in wadfiles) { - DataLocation wdl = new DataLocation(DataLocation.RESOURCE_WAD, Path.Combine(location.location, wadfile), false, false, true); - wads.Add(new WADReader(wdl, isreadonly)); + //mxd. Don't add the map file. Otherwise DataManager will try to load it twice (and fial). + string wadfilepath = Path.Combine(location.location, wadfile); + if(General.Map.FilePathName != wadfilepath) + { + DataLocation wdl = new DataLocation(DataLocation.RESOURCE_WAD, wadfilepath, false, false, true); + wads.Add(new WADReader(wdl, isreadonly)); + } } } diff --git a/Source/Core/Editing/ClassicMode.cs b/Source/Core/Editing/ClassicMode.cs index 05de35633..0425c92cb 100644 --- a/Source/Core/Editing/ClassicMode.cs +++ b/Source/Core/Editing/ClassicMode.cs @@ -214,7 +214,7 @@ namespace CodeImp.DoomBuilder.Editing // Determine new unprojected mouse coordinates mousemappos = renderer2d.DisplayToMap(mousepos); - General.MainWindow.UpdateCoordinates(mousemappos); + General.MainWindow.UpdateCoordinates(mousemappos, true); } // This sets the view to be centered at x,y @@ -511,7 +511,7 @@ namespace CodeImp.DoomBuilder.Editing mousebuttons = MouseButtons.None; // Determine new unprojected mouse coordinates - General.MainWindow.UpdateCoordinates(mousemappos); + General.MainWindow.UpdateCoordinates(mousemappos, true); // Let the base class know base.OnMouseLeave(e); @@ -528,7 +528,7 @@ namespace CodeImp.DoomBuilder.Editing mousebuttons = e.Button; // Update labels in main window - General.MainWindow.UpdateCoordinates(mousemappos); + General.MainWindow.UpdateCoordinates(mousemappos, true); // Holding a button? if(e.Button != MouseButtons.None) diff --git a/Source/Core/General/General.cs b/Source/Core/General/General.cs index 5d7b4d061..200a251b7 100644 --- a/Source/Core/General/General.cs +++ b/Source/Core/General/General.cs @@ -2151,12 +2151,12 @@ namespace CodeImp.DoomBuilder // Try getting exception details... try { - Exception ex = (Exception) e.ExceptionObject; - exceptionmsg = "Fatal Non-UI error occurred: " + ex.Message + "\n\nStack Trace:\n" + ex.StackTrace; + Exception ex = (Exception)e.ExceptionObject; + exceptionmsg = "Fatal Non-UI error:\n" + ex.Message + "\n\nStack Trace:\n" + ex.StackTrace; } catch(Exception exc) { - exceptionmsg = "Failed to get initial exception details: " + exc.Message + "\n\nStack Trace:\n" + exc.StackTrace; + exceptionmsg = "Failed to get initial exception details:\n" + exc.Message + "\n\nStack Trace:\n" + exc.StackTrace; } // Try logging it... diff --git a/Source/Core/Geometry/InterpolationTools.cs b/Source/Core/Geometry/InterpolationTools.cs index 48b69bcd5..86575ba73 100644 --- a/Source/Core/Geometry/InterpolationTools.cs +++ b/Source/Core/Geometry/InterpolationTools.cs @@ -13,7 +13,7 @@ namespace CodeImp.DoomBuilder.Geometry EASE_OUT_SINE, } - public static int Interpolate(float val1, float val2, float delta, Mode mode) + public static float Interpolate(float val1, float val2, float delta, Mode mode) { switch(mode) { @@ -26,44 +26,53 @@ namespace CodeImp.DoomBuilder.Geometry } //Based on Robert Penner's original easing equations (http://www.robertpenner.com/easing/) - public static int Linear(float val1, float val2, float delta) + public static float Linear(float val1, float val2, float delta) { - return (int)Math.Round(delta * val2 + (1.0f - delta) * val1); + return delta * val2 + (1.0f - delta) * val1; } /** * Easing equation function for a sinusoidal (sin(t)) easing in: accelerating from zero velocity. */ - public static int EaseInSine(float val1, float val2, float delta) + public static float EaseInSine(float val1, float val2, float delta) { float f_val1 = val1; float f_val2 = val2 - f_val1; - return (int)Math.Round(-f_val2 * Math.Cos(delta * Angle2D.PIHALF) + f_val2 + f_val1); + return -f_val2 * (float)Math.Cos(delta * Angle2D.PIHALF) + f_val2 + f_val1; } /** * Easing equation function for a sinusoidal (sin(t)) easing out: decelerating from zero velocity. */ - public static int EaseOutSine(float val1, float val2, float delta) + public static float EaseOutSine(float val1, float val2, float delta) { - return (int)Math.Round((val2 - val1) * Math.Sin(delta * Angle2D.PIHALF) + val1); + return (val2 - val1) * (float)Math.Sin(delta * Angle2D.PIHALF) + val1; } /** * Easing equation function for a sinusoidal (sin(t)) easing in/out: acceleration until halfway, then deceleration. */ - public static int EaseInOutSine(float val1, float val2, float delta) + public static float EaseInOutSine(float val1, float val2, float delta) { - return (int)Math.Round(-(val2 - val1) / 2 * (float)(Math.Cos(Math.PI * delta) - 1) + val1); + return -(val2 - val1) / 2 * (float)(Math.Cos(Angle2D.PI * delta) - 1) + val1; } //mxd public static int InterpolateColor(PixelColor c1, PixelColor c2, float delta) { float invdelta = 1.0f - delta; - byte r = (byte)(c1.r * delta + c2.r * invdelta); - byte g = (byte)(c1.g * delta + c2.g * invdelta); - byte b = (byte)(c1.b * delta + c2.b * invdelta); + byte r = (byte)(c1.r * invdelta + c2.r * delta); + byte g = (byte)(c1.g * invdelta + c2.g * delta); + byte b = (byte)(c1.b * invdelta + c2.b * delta); + return new PixelColor(255, r, g, b).ToInt(); + } + + //mxd + public static int InterpolateColor(PixelColor c1, PixelColor c2, float delta, Mode mode) + { + byte r = (byte)Math.Round(Interpolate(c1.r, c2.r, delta, mode)); + byte g = (byte)Math.Round(Interpolate(c1.g, c2.g, delta, mode)); + byte b = (byte)Math.Round(Interpolate(c1.b, c2.b, delta, mode)); return new PixelColor(255, r, g, b).ToInt(); } } diff --git a/Source/Core/Geometry/Tools.cs b/Source/Core/Geometry/Tools.cs index 03412d189..a9c9a5e67 100644 --- a/Source/Core/Geometry/Tools.cs +++ b/Source/Core/Geometry/Tools.cs @@ -2399,15 +2399,13 @@ namespace CodeImp.DoomBuilder.Geometry } //mxd - public static Color GetSectorFadeColor(Sector s) + public static PixelColor GetSectorFadeColor(Sector s) { - if(s.Fields.ContainsKey("fadecolor")) return PixelColor.FromInt(s.Fields.GetValue("fadecolor", 0)).ToColor(); + if(s.Fields.ContainsKey("fadecolor")) return PixelColor.FromInt(s.Fields.GetValue("fadecolor", 0)); if(General.Map.Data.MapInfo.HasOutsideFogColor && s.CeilTexture == General.Map.Config.SkyFlatName) - { - return General.Map.Data.MapInfo.OutsideFogColor.ToColor(); - } - - return (General.Map.Data.MapInfo.HasFadeColor ? General.Map.Data.MapInfo.FadeColor.ToColor() : Color.Black); + return PixelColor.FromColor(General.Map.Data.MapInfo.OutsideFogColor.ToColor()); + + return PixelColor.FromColor(General.Map.Data.MapInfo.HasFadeColor ? General.Map.Data.MapInfo.FadeColor.ToColor() : Color.Black); } #endregion diff --git a/Source/Core/Rendering/Renderer2D.cs b/Source/Core/Rendering/Renderer2D.cs index b339ed3ce..636a3c282 100644 --- a/Source/Core/Rendering/Renderer2D.cs +++ b/Source/Core/Rendering/Renderer2D.cs @@ -1458,7 +1458,7 @@ namespace CodeImp.DoomBuilder.Rendering float sy = t.ScaleY * t.ActorScale.Height; Matrix modelscale = Matrix.Scaling(sx, sx, sy); - Matrix rotation = Matrix.RotationY(-t.RollRad) * Matrix.RotationX(-t.PitchRad) * Matrix.RotationZ(t.Angle); + Matrix rotation = Matrix.RotationY(-t.RollRad) * Matrix.RotationX(t.PitchRad) * Matrix.RotationZ(t.Angle); Matrix position = Matrix.Translation(screenpos.x, screenpos.y, 0.0f); Matrix world = General.Map.Data.ModeldefEntries[t.Type].Transform * modelscale * rotation * viewscale * position; diff --git a/Source/Core/Rendering/Renderer3D.cs b/Source/Core/Rendering/Renderer3D.cs index 81d716ffa..4cfeb8ccb 100644 --- a/Source/Core/Rendering/Renderer3D.cs +++ b/Source/Core/Rendering/Renderer3D.cs @@ -1426,7 +1426,7 @@ namespace CodeImp.DoomBuilder.Rendering float sy = t.Thing.ScaleY * t.Thing.ActorScale.Height; Matrix modelscale = Matrix.Scaling(sx, sx, sy); - Matrix modelrotation = Matrix.RotationY(-t.Thing.RollRad) * Matrix.RotationX(-t.Thing.PitchRad) * Matrix.RotationZ(t.Thing.Angle); + Matrix modelrotation = Matrix.RotationY(-t.Thing.RollRad) * Matrix.RotationX(t.Thing.PitchRad) * Matrix.RotationZ(t.Thing.Angle); world = General.Map.Data.ModeldefEntries[t.Thing.Type].Transform * modelscale * modelrotation * t.Position; ApplyMatrices3D(); @@ -1525,7 +1525,7 @@ namespace CodeImp.DoomBuilder.Rendering float sy = t.Thing.ScaleY * t.Thing.ActorScale.Height; Matrix modelscale = Matrix.Scaling(sx, sx, sy); - Matrix modelrotation = Matrix.RotationY(-t.Thing.RollRad) * Matrix.RotationX(-t.Thing.PitchRad) * Matrix.RotationZ(t.Thing.Angle); + Matrix modelrotation = Matrix.RotationY(-t.Thing.RollRad) * Matrix.RotationX(t.Thing.PitchRad) * Matrix.RotationZ(t.Thing.Angle); world = General.Map.Data.ModeldefEntries[t.Thing.Type].Transform * modelscale * modelrotation * t.Position; ApplyMatrices3D(); diff --git a/Source/Core/VisualModes/VisualThing.cs b/Source/Core/VisualModes/VisualThing.cs index dffd4f567..885e1b867 100644 --- a/Source/Core/VisualModes/VisualThing.cs +++ b/Source/Core/VisualModes/VisualThing.cs @@ -493,7 +493,7 @@ namespace CodeImp.DoomBuilder.VisualModes if(Thing.IsDirectional) { Matrix transform = Matrix.Scaling(thing.Size, thing.Size, thing.Size) - * (Matrix.RotationY(-Thing.RollRad) * Matrix.RotationX(-Thing.PitchRad) * Matrix.RotationZ(Thing.Angle)) + * (Matrix.RotationY(-Thing.RollRad) * Matrix.RotationX(Thing.PitchRad) * Matrix.RotationZ(Thing.Angle)) * (sizeless ? position : position * Matrix.Translation(0.0f, 0.0f, thingheight / 2f)); WorldVertex a0 = new WorldVertex(Vector3D.Transform(0.0f, 0.0f, 0.0f, transform)); //start diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs index 07e3a3112..2e6e2b2be 100644 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -947,8 +947,12 @@ namespace CodeImp.DoomBuilder.Windows } // This changes coordinates display - public void UpdateCoordinates(Vector2D coords) + public void UpdateCoordinates(Vector2D coords){ UpdateCoordinates(coords, false); } //mxd + public void UpdateCoordinates(Vector2D coords, bool snaptogrid) { + //mxd + if(snaptogrid) coords = General.Map.Grid.SnappedToGrid(coords); + // X position xposlabel.Text = (float.IsNaN(coords.x) ? "--" : coords.x.ToString("####0")); diff --git a/Source/Plugins/BuilderModes/ClassicModes/BridgeMode.cs b/Source/Plugins/BuilderModes/ClassicModes/BridgeMode.cs index 807edbdcd..153424fa0 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/BridgeMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/BridgeMode.cs @@ -724,16 +724,16 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes return Math.Min(val1, val2); case BridgeInterpolationMode.LINEAR: - return InterpolationTools.Linear(val1, val2, delta); + return (int)Math.Round(InterpolationTools.Linear(val1, val2, delta)); case BridgeInterpolationMode.IN_SINE: - return InterpolationTools.EaseInSine(val1, val2, delta); + return (int)Math.Round(InterpolationTools.EaseInSine(val1, val2, delta)); case BridgeInterpolationMode.OUT_SINE: - return InterpolationTools.EaseOutSine(val1, val2, delta); + return (int)Math.Round(InterpolationTools.EaseOutSine(val1, val2, delta)); case BridgeInterpolationMode.IN_OUT_SINE: - return InterpolationTools.EaseInOutSine(val1, val2, delta); + return (int)Math.Round(InterpolationTools.EaseInOutSine(val1, val2, delta)); default: throw new Exception("DrawBezierPathMode.IntepolateValue: \"" + mode + "\" mode is not supported!"); diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs index 2e836bd9a..7f371c768 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs @@ -112,8 +112,8 @@ namespace CodeImp.DoomBuilder.BuilderModes Vector2D[] shape = new Vector2D[subdivisions + 1]; bool doBevel = false; - int hw = width / 2; - int hh = height / 2; + float hw = width / 2.0f; + float hh = height / 2.0f; Vector2D center = new Vector2D(pStart.x + hw, pStart.y + hh); float curAngle = angle; @@ -121,16 +121,16 @@ namespace CodeImp.DoomBuilder.BuilderModes for(int i = 0; i < subdivisions; i++) { - int px, py; + float px, py; if(doBevel) { - px = (int)(center.x - (float)Math.Sin(curAngle) * (hw + currentbevelwidth)); - py = (int)(center.y - (float)Math.Cos(curAngle) * (hh + currentbevelwidth)); + px = (float)Math.Round(center.x - (float)Math.Sin(curAngle) * (hw + currentbevelwidth)); + py = (float)Math.Round(center.y - (float)Math.Cos(curAngle) * (hh + currentbevelwidth)); } else { - px = (int)(center.x - (float)Math.Sin(curAngle) * hw); - py = (int)(center.y - (float)Math.Cos(curAngle) * hh); + px = (float)Math.Round(center.x - (float)Math.Sin(curAngle) * hw); + py = (float)Math.Round(center.y - (float)Math.Cos(curAngle) * hh); } doBevel = !doBevel; shape[i] = new Vector2D(px, py); diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs index b9ac6b774..ba91d7467 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs @@ -399,10 +399,10 @@ namespace CodeImp.DoomBuilder.BuilderModes { for(int h = 0; h < slicesV; h++) { - float left = InterpolationTools.Interpolate(s.x, e.x, (float)w / slicesH, horizontalinterpolation); - float top = InterpolationTools.Interpolate(s.y, e.y, (float)h / slicesV, verticalinterpolation); - float right = InterpolationTools.Interpolate(s.x, e.x, (w + 1.0f) / slicesH, horizontalinterpolation); - float bottom = InterpolationTools.Interpolate(s.y, e.y, (h + 1.0f)/ slicesV, verticalinterpolation); + float left = (float)Math.Round(InterpolationTools.Interpolate(s.x, e.x, (float)w / slicesH, horizontalinterpolation)); + float top = (float)Math.Round(InterpolationTools.Interpolate(s.y, e.y, (float)h / slicesV, verticalinterpolation)); + float right = (float)Math.Round(InterpolationTools.Interpolate(s.x, e.x, (w + 1.0f) / slicesH, horizontalinterpolation)); + float bottom = (float)Math.Round(InterpolationTools.Interpolate(s.y, e.y, (h + 1.0f)/ slicesV, verticalinterpolation)); blocks[w, h] = RectangleF.FromLTRB(left, top, right, bottom); } } diff --git a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs index 70dcf935b..985f14675 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs @@ -1795,7 +1795,7 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Linedef l in orderedselection) { float u = index / (float)(orderedselection.Count - 1); - int b = InterpolationTools.Interpolate(startbrightness, endbrightness, u, interpolationmode); + int b = (int)Math.Round(InterpolationTools.Interpolate(startbrightness, endbrightness, u, interpolationmode)); if(SidedefHasVisibleParts(l.Front)) ApplySidedefBrighness(l.Front, b); if(SidedefHasVisibleParts(l.Back)) ApplySidedefBrighness(l.Back, b); index++; diff --git a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs index f6422ee41..4e38c15c7 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs @@ -1992,7 +1992,7 @@ namespace CodeImp.DoomBuilder.BuilderModes { s.Fields.BeforeFieldsChange(); float u = index / (float) (orderedselection.Count - 1); - float b = InterpolationTools.Interpolate(startbrightness, endbrightness, u, interpolationmode); + float b = (float)Math.Round(InterpolationTools.Interpolate(startbrightness, endbrightness, u, interpolationmode)); //absolute flag set? if(s.Fields.GetValue(lightAbsKey, false)) @@ -2032,7 +2032,7 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Sector s in orderedselection) { float u = index / (float)(orderedselection.Count - 1); - s.Brightness = InterpolationTools.Interpolate(start.Brightness, end.Brightness, u, interpolationmode); //mxd + s.Brightness = (int)Math.Round(InterpolationTools.Interpolate(start.Brightness, end.Brightness, u, interpolationmode)); //mxd index++; } } @@ -2058,16 +2058,16 @@ namespace CodeImp.DoomBuilder.BuilderModes } else { - Color startColor, endColor; + PixelColor startcolor, endcolor; if(key == "fadecolor") { - startColor = Tools.GetSectorFadeColor(start); - endColor = Tools.GetSectorFadeColor(end); + startcolor = Tools.GetSectorFadeColor(start); + endcolor = Tools.GetSectorFadeColor(end); } else { - startColor = PixelColor.FromInt(start.Fields.GetValue(key, defaultvalue)).ToColor(); - endColor = PixelColor.FromInt(end.Fields.GetValue(key, defaultvalue)).ToColor(); + startcolor = PixelColor.FromInt(start.Fields.GetValue(key, defaultvalue)); + endcolor = PixelColor.FromInt(end.Fields.GetValue(key, defaultvalue)); } // Go for all sectors in between first and last @@ -2077,12 +2077,10 @@ namespace CodeImp.DoomBuilder.BuilderModes if(index > 0 && index < orderedselection.Count - 1) { s.Fields.BeforeFieldsChange(); - float u = index / (float) (orderedselection.Count - 1); - Color c = Color.FromArgb(0, General.Clamp(InterpolationTools.Interpolate(startColor.R, endColor.R, u, interpolationmode), 0, 255), - General.Clamp(InterpolationTools.Interpolate(startColor.G, endColor.G, u, interpolationmode), 0, 255), - General.Clamp(InterpolationTools.Interpolate(startColor.B, endColor.B, u, interpolationmode), 0, 255)); + float u = index / (orderedselection.Count - 1.0f); + int c = InterpolationTools.InterpolateColor(startcolor, endcolor, u, interpolationmode); - UniFields.SetInteger(s.Fields, key, c.ToArgb(), defaultvalue); + UniFields.SetInteger(s.Fields, key, c, defaultvalue); s.UpdateNeeded = true; } index++; @@ -2111,7 +2109,7 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Sector s in orderedselection) { float u = index / (float)(orderedselection.Count - 1); - s.FloorHeight = InterpolationTools.Interpolate(startlevel, endlevel, u, interpolationmode); //mxd + s.FloorHeight = (int)Math.Round(InterpolationTools.Interpolate(startlevel, endlevel, u, interpolationmode)); //mxd index++; } @@ -2146,7 +2144,7 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Sector s in orderedselection) { float u = (float)index / (orderedselection.Count - 1); - s.CeilHeight = InterpolationTools.Interpolate(startlevel, endlevel, u, interpolationmode); + s.CeilHeight = (int)Math.Round(InterpolationTools.Interpolate(startlevel, endlevel, u, interpolationmode)); index++; } diff --git a/Source/Plugins/BuilderModes/Interface/EditSelectionPanel.Designer.cs b/Source/Plugins/BuilderModes/Interface/EditSelectionPanel.Designer.cs index 16652a30a..e8c0083ea 100644 --- a/Source/Plugins/BuilderModes/Interface/EditSelectionPanel.Designer.cs +++ b/Source/Plugins/BuilderModes/Interface/EditSelectionPanel.Designer.cs @@ -58,6 +58,8 @@ namespace CodeImp.DoomBuilder.BuilderModes this.abssizex = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.label3 = new System.Windows.Forms.Label(); this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.heightmode = new System.Windows.Forms.ComboBox(); + this.label10 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); this.flipv = new System.Windows.Forms.Button(); this.fliph = new System.Windows.Forms.Button(); @@ -75,8 +77,6 @@ namespace CodeImp.DoomBuilder.BuilderModes this.floortexall = new System.Windows.Forms.CheckBox(); this.floortexgroup = new System.Windows.Forms.GroupBox(); this.tooltip = new System.Windows.Forms.ToolTip(this.components); - this.label10 = new System.Windows.Forms.Label(); - this.heightmode = new System.Windows.Forms.ComboBox(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -482,6 +482,33 @@ namespace CodeImp.DoomBuilder.BuilderModes this.groupBox3.TabStop = false; this.groupBox3.Text = "Transform:"; // + // heightmode + // + this.heightmode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.heightmode.FormattingEnabled = true; + this.heightmode.Items.AddRange(new object[] { + "Don\'t adjust height", + "Adjust floor height", + "Adjust ceiling height", + "Adjust floor and ceiling heights"}); + this.heightmode.Location = new System.Drawing.Point(58, 53); + this.heightmode.Name = "heightmode"; + this.heightmode.Size = new System.Drawing.Size(171, 21); + this.heightmode.TabIndex = 29; + this.heightmode.SelectedIndexChanged += new System.EventHandler(this.heightmode_SelectedIndexChanged); + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label10.ForeColor = System.Drawing.SystemColors.HotTrack; + this.label10.Location = new System.Drawing.Point(14, 56); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(41, 13); + this.label10.TabIndex = 28; + this.label10.Text = "Height:"; + this.tooltip.SetToolTip(this.label10, resources.GetString("label10.ToolTip")); + // // label14 // this.label14.AutoSize = true; @@ -668,33 +695,6 @@ namespace CodeImp.DoomBuilder.BuilderModes this.floortexgroup.TabStop = false; this.floortexgroup.Text = " "; // - // label10 - // - this.label10.AutoSize = true; - this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.label10.ForeColor = System.Drawing.SystemColors.HotTrack; - this.label10.Location = new System.Drawing.Point(14, 56); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(41, 13); - this.label10.TabIndex = 28; - this.label10.Text = "Height:"; - this.tooltip.SetToolTip(this.label10, resources.GetString("label10.ToolTip")); - // - // heightmode - // - this.heightmode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.heightmode.FormattingEnabled = true; - this.heightmode.Items.AddRange(new object[] { - "Don\'t adjust height", - "Adjust floor height", - "Adjust ceiling height", - "Adjust floor and ceiling heights"}); - this.heightmode.Location = new System.Drawing.Point(58, 53); - this.heightmode.Name = "heightmode"; - this.heightmode.Size = new System.Drawing.Size(171, 21); - this.heightmode.TabIndex = 29; - this.heightmode.SelectedIndexChanged += new System.EventHandler(this.heightmode_SelectedIndexChanged); - // // EditSelectionPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); diff --git a/Source/Plugins/BuilderModes/Interface/EditSelectionPanel.resx b/Source/Plugins/BuilderModes/Interface/EditSelectionPanel.resx index e02189afe..74d268a3b 100644 --- a/Source/Plugins/BuilderModes/Interface/EditSelectionPanel.resx +++ b/Source/Plugins/BuilderModes/Interface/EditSelectionPanel.resx @@ -125,9 +125,10 @@ based on floor/ceiling heights difference between sectors outside selected sectors. -Applied only when selected sectors were inside a single -sector when the mode was enabled, and are inside a -single sector when the mode is applied.</value> +Applied only when selected sectors were surrounded +by sectors with the same target height when the mode +was enabled, and are surrounded by sectors with the +same target height when the mode is applied.</value> </data> <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs index 75897609e..132410049 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs @@ -302,7 +302,7 @@ namespace CodeImp.DoomBuilder.BuilderModes if(v.z > cgz) { float cz = data.Ceiling.plane.GetZ(v.x, v.y); - float delta = ((v.z - cgz) / (cz - cgz)) * 0.9f; + float delta = 1.0f - (((v.z - cgz) / (cz - cgz)) * 0.9f); PixelColor vc = PixelColor.FromInt(v.c); v.c = InterpolationTools.InterpolateColor(GetGlowColor(data.CeilingGlow, vc), vc, delta); } @@ -317,7 +317,7 @@ namespace CodeImp.DoomBuilder.BuilderModes if(v.z < fgz) { float fz = data.Floor.plane.GetZ(v.x, v.y); - float delta = ((v.z - fz) / (fgz - fz)) * 0.9f; + float delta = 1.0f - (((v.z - fz) / (fgz - fz)) * 0.9f); PixelColor vc = PixelColor.FromInt(v.c); v.c = InterpolationTools.InterpolateColor(vc, GetGlowColor(data.FloorGlow, vc), delta); } -- GitLab