From 47aeedc6e0613b312891e0f130ea3b39cdca3340 Mon Sep 17 00:00:00 2001 From: MaxED 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/Editing/ClassicMode.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 +- 15 files changed, 101 insertions(+), 91 deletions(-) diff --git a/Source/Core/Editing/ClassicMode.cs b/Source/Core/Editing/ClassicMode.cs index 880f051..ee8d38f 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/Geometry/InterpolationTools.cs b/Source/Core/Geometry/InterpolationTools.cs index 7d8f2fb..61011d1 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 0af4510..81ba260 100644 --- a/Source/Core/Geometry/Tools.cs +++ b/Source/Core/Geometry/Tools.cs @@ -2414,15 +2414,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 6667c76..1dfec92 100644 --- a/Source/Core/Rendering/Renderer2D.cs +++ b/Source/Core/Rendering/Renderer2D.cs @@ -1457,7 +1457,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.SRB2Type].Transform * modelscale * rotation * viewscale * position; diff --git a/Source/Core/Rendering/Renderer3D.cs b/Source/Core/Rendering/Renderer3D.cs index 990eb90..d9b7918 100644 --- a/Source/Core/Rendering/Renderer3D.cs +++ b/Source/Core/Rendering/Renderer3D.cs @@ -1448,7 +1448,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.SRB2Type].Transform * modelscale * modelrotation * t.Position; ApplyMatrices3D(); @@ -1557,7 +1557,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.SRB2Type].Transform * modelscale * modelrotation * t.Position; ApplyMatrices3D(); diff --git a/Source/Core/VisualModes/VisualThing.cs b/Source/Core/VisualModes/VisualThing.cs index 85bb6a2..51b982a 100644 --- a/Source/Core/VisualModes/VisualThing.cs +++ b/Source/Core/VisualModes/VisualThing.cs @@ -469,7 +469,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 || info.CenterHitbox) ? 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 2d3e953..37a2442 100644 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -936,8 +936,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 80d9ce4..c32ab4c 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/BridgeMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/BridgeMode.cs @@ -725,16 +725,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 a2c3ee4..3a56a9d 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 c7b4350..30792f4 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs @@ -398,10 +398,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 b907575..061d5b8 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs @@ -2034,7 +2034,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 c7b48e1..a389b20 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs @@ -2127,7 +2127,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)) @@ -2167,7 +2167,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++; } } @@ -2193,16 +2193,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 @@ -2212,12 +2212,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++; @@ -2246,7 +2244,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++; } @@ -2281,7 +2279,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 25d7b16..fea745c 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 d0f6adc..b6c665b 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. +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. True diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs index 6e2a8b5..8fd6117 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs @@ -312,7 +312,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); } @@ -327,7 +327,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); }