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.
This commit is contained in:
MaxED 2016-06-03 20:22:07 +00:00
parent 3bef7dbf72
commit 3d2d9e21ef
17 changed files with 111 additions and 96 deletions

View file

@ -58,10 +58,15 @@ namespace CodeImp.DoomBuilder.Data
wads = new List<WADReader>(wadfiles.Length); wads = new List<WADReader>(wadfiles.Length);
foreach(string wadfile in wadfiles) foreach(string wadfile in wadfiles)
{ {
DataLocation wdl = new DataLocation(DataLocation.RESOURCE_WAD, Path.Combine(location.location, wadfile), false, false, true); //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)); wads.Add(new WADReader(wdl, isreadonly));
} }
} }
}
// Disposer // Disposer
public override void Dispose() public override void Dispose()

View file

@ -214,7 +214,7 @@ namespace CodeImp.DoomBuilder.Editing
// Determine new unprojected mouse coordinates // Determine new unprojected mouse coordinates
mousemappos = renderer2d.DisplayToMap(mousepos); mousemappos = renderer2d.DisplayToMap(mousepos);
General.MainWindow.UpdateCoordinates(mousemappos); General.MainWindow.UpdateCoordinates(mousemappos, true);
} }
// This sets the view to be centered at x,y // This sets the view to be centered at x,y
@ -511,7 +511,7 @@ namespace CodeImp.DoomBuilder.Editing
mousebuttons = MouseButtons.None; mousebuttons = MouseButtons.None;
// Determine new unprojected mouse coordinates // Determine new unprojected mouse coordinates
General.MainWindow.UpdateCoordinates(mousemappos); General.MainWindow.UpdateCoordinates(mousemappos, true);
// Let the base class know // Let the base class know
base.OnMouseLeave(e); base.OnMouseLeave(e);
@ -528,7 +528,7 @@ namespace CodeImp.DoomBuilder.Editing
mousebuttons = e.Button; mousebuttons = e.Button;
// Update labels in main window // Update labels in main window
General.MainWindow.UpdateCoordinates(mousemappos); General.MainWindow.UpdateCoordinates(mousemappos, true);
// Holding a button? // Holding a button?
if(e.Button != MouseButtons.None) if(e.Button != MouseButtons.None)

View file

@ -2151,12 +2151,12 @@ namespace CodeImp.DoomBuilder
// Try getting exception details... // Try getting exception details...
try try
{ {
Exception ex = (Exception) e.ExceptionObject; Exception ex = (Exception)e.ExceptionObject;
exceptionmsg = "Fatal Non-UI error occurred: " + ex.Message + "\n\nStack Trace:\n" + ex.StackTrace; exceptionmsg = "Fatal Non-UI error:\n" + ex.Message + "\n\nStack Trace:\n" + ex.StackTrace;
} }
catch(Exception exc) 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... // Try logging it...

View file

@ -13,7 +13,7 @@ namespace CodeImp.DoomBuilder.Geometry
EASE_OUT_SINE, 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) switch(mode)
{ {
@ -26,44 +26,53 @@ namespace CodeImp.DoomBuilder.Geometry
} }
//Based on Robert Penner's original easing equations (http://www.robertpenner.com/easing/) //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. * 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_val1 = val1;
float f_val2 = val2 - f_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. * 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. * 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 //mxd
public static int InterpolateColor(PixelColor c1, PixelColor c2, float delta) public static int InterpolateColor(PixelColor c1, PixelColor c2, float delta)
{ {
float invdelta = 1.0f - delta; float invdelta = 1.0f - delta;
byte r = (byte)(c1.r * delta + c2.r * invdelta); byte r = (byte)(c1.r * invdelta + c2.r * delta);
byte g = (byte)(c1.g * delta + c2.g * invdelta); byte g = (byte)(c1.g * invdelta + c2.g * delta);
byte b = (byte)(c1.b * delta + c2.b * invdelta); 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(); return new PixelColor(255, r, g, b).ToInt();
} }
} }

View file

@ -2399,15 +2399,13 @@ namespace CodeImp.DoomBuilder.Geometry
} }
//mxd //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) if(General.Map.Data.MapInfo.HasOutsideFogColor && s.CeilTexture == General.Map.Config.SkyFlatName)
{ return PixelColor.FromColor(General.Map.Data.MapInfo.OutsideFogColor.ToColor());
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.HasFadeColor ? General.Map.Data.MapInfo.FadeColor.ToColor() : Color.Black);
} }
#endregion #endregion

View file

@ -1458,7 +1458,7 @@ namespace CodeImp.DoomBuilder.Rendering
float sy = t.ScaleY * t.ActorScale.Height; float sy = t.ScaleY * t.ActorScale.Height;
Matrix modelscale = Matrix.Scaling(sx, sx, sy); 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 position = Matrix.Translation(screenpos.x, screenpos.y, 0.0f);
Matrix world = General.Map.Data.ModeldefEntries[t.Type].Transform * modelscale * rotation * viewscale * position; Matrix world = General.Map.Data.ModeldefEntries[t.Type].Transform * modelscale * rotation * viewscale * position;

View file

@ -1426,7 +1426,7 @@ namespace CodeImp.DoomBuilder.Rendering
float sy = t.Thing.ScaleY * t.Thing.ActorScale.Height; float sy = t.Thing.ScaleY * t.Thing.ActorScale.Height;
Matrix modelscale = Matrix.Scaling(sx, sx, sy); 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; world = General.Map.Data.ModeldefEntries[t.Thing.Type].Transform * modelscale * modelrotation * t.Position;
ApplyMatrices3D(); ApplyMatrices3D();
@ -1525,7 +1525,7 @@ namespace CodeImp.DoomBuilder.Rendering
float sy = t.Thing.ScaleY * t.Thing.ActorScale.Height; float sy = t.Thing.ScaleY * t.Thing.ActorScale.Height;
Matrix modelscale = Matrix.Scaling(sx, sx, sy); 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; world = General.Map.Data.ModeldefEntries[t.Thing.Type].Transform * modelscale * modelrotation * t.Position;
ApplyMatrices3D(); ApplyMatrices3D();

View file

@ -493,7 +493,7 @@ namespace CodeImp.DoomBuilder.VisualModes
if(Thing.IsDirectional) if(Thing.IsDirectional)
{ {
Matrix transform = Matrix.Scaling(thing.Size, thing.Size, thing.Size) 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)); * (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 WorldVertex a0 = new WorldVertex(Vector3D.Transform(0.0f, 0.0f, 0.0f, transform)); //start

View file

@ -947,8 +947,12 @@ namespace CodeImp.DoomBuilder.Windows
} }
// This changes coordinates display // 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 // X position
xposlabel.Text = (float.IsNaN(coords.x) ? "--" : coords.x.ToString("####0")); xposlabel.Text = (float.IsNaN(coords.x) ? "--" : coords.x.ToString("####0"));

View file

@ -724,16 +724,16 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes
return Math.Min(val1, val2); return Math.Min(val1, val2);
case BridgeInterpolationMode.LINEAR: case BridgeInterpolationMode.LINEAR:
return InterpolationTools.Linear(val1, val2, delta); return (int)Math.Round(InterpolationTools.Linear(val1, val2, delta));
case BridgeInterpolationMode.IN_SINE: case BridgeInterpolationMode.IN_SINE:
return InterpolationTools.EaseInSine(val1, val2, delta); return (int)Math.Round(InterpolationTools.EaseInSine(val1, val2, delta));
case BridgeInterpolationMode.OUT_SINE: case BridgeInterpolationMode.OUT_SINE:
return InterpolationTools.EaseOutSine(val1, val2, delta); return (int)Math.Round(InterpolationTools.EaseOutSine(val1, val2, delta));
case BridgeInterpolationMode.IN_OUT_SINE: case BridgeInterpolationMode.IN_OUT_SINE:
return InterpolationTools.EaseInOutSine(val1, val2, delta); return (int)Math.Round(InterpolationTools.EaseInOutSine(val1, val2, delta));
default: default:
throw new Exception("DrawBezierPathMode.IntepolateValue: \"" + mode + "\" mode is not supported!"); throw new Exception("DrawBezierPathMode.IntepolateValue: \"" + mode + "\" mode is not supported!");

View file

@ -112,8 +112,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D[] shape = new Vector2D[subdivisions + 1]; Vector2D[] shape = new Vector2D[subdivisions + 1];
bool doBevel = false; bool doBevel = false;
int hw = width / 2; float hw = width / 2.0f;
int hh = height / 2; float hh = height / 2.0f;
Vector2D center = new Vector2D(pStart.x + hw, pStart.y + hh); Vector2D center = new Vector2D(pStart.x + hw, pStart.y + hh);
float curAngle = angle; float curAngle = angle;
@ -121,16 +121,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
for(int i = 0; i < subdivisions; i++) for(int i = 0; i < subdivisions; i++)
{ {
int px, py; float px, py;
if(doBevel) if(doBevel)
{ {
px = (int)(center.x - (float)Math.Sin(curAngle) * (hw + currentbevelwidth)); px = (float)Math.Round(center.x - (float)Math.Sin(curAngle) * (hw + currentbevelwidth));
py = (int)(center.y - (float)Math.Cos(curAngle) * (hh + currentbevelwidth)); py = (float)Math.Round(center.y - (float)Math.Cos(curAngle) * (hh + currentbevelwidth));
} }
else else
{ {
px = (int)(center.x - (float)Math.Sin(curAngle) * hw); px = (float)Math.Round(center.x - (float)Math.Sin(curAngle) * hw);
py = (int)(center.y - (float)Math.Cos(curAngle) * hh); py = (float)Math.Round(center.y - (float)Math.Cos(curAngle) * hh);
} }
doBevel = !doBevel; doBevel = !doBevel;
shape[i] = new Vector2D(px, py); shape[i] = new Vector2D(px, py);

View file

@ -399,10 +399,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
for(int h = 0; h < slicesV; h++) for(int h = 0; h < slicesV; h++)
{ {
float left = InterpolationTools.Interpolate(s.x, e.x, (float)w / slicesH, horizontalinterpolation); float left = (float)Math.Round(InterpolationTools.Interpolate(s.x, e.x, (float)w / slicesH, horizontalinterpolation));
float top = InterpolationTools.Interpolate(s.y, e.y, (float)h / slicesV, verticalinterpolation); float top = (float)Math.Round(InterpolationTools.Interpolate(s.y, e.y, (float)h / slicesV, verticalinterpolation));
float right = InterpolationTools.Interpolate(s.x, e.x, (w + 1.0f) / slicesH, horizontalinterpolation); float right = (float)Math.Round(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 bottom = (float)Math.Round(InterpolationTools.Interpolate(s.y, e.y, (h + 1.0f)/ slicesV, verticalinterpolation));
blocks[w, h] = RectangleF.FromLTRB(left, top, right, bottom); blocks[w, h] = RectangleF.FromLTRB(left, top, right, bottom);
} }
} }

View file

@ -1795,7 +1795,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Linedef l in orderedselection) foreach(Linedef l in orderedselection)
{ {
float u = index / (float)(orderedselection.Count - 1); 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.Front)) ApplySidedefBrighness(l.Front, b);
if(SidedefHasVisibleParts(l.Back)) ApplySidedefBrighness(l.Back, b); if(SidedefHasVisibleParts(l.Back)) ApplySidedefBrighness(l.Back, b);
index++; index++;

View file

@ -1992,7 +1992,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
s.Fields.BeforeFieldsChange(); s.Fields.BeforeFieldsChange();
float u = index / (float) (orderedselection.Count - 1); 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? //absolute flag set?
if(s.Fields.GetValue(lightAbsKey, false)) if(s.Fields.GetValue(lightAbsKey, false))
@ -2032,7 +2032,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sector s in orderedselection) foreach(Sector s in orderedselection)
{ {
float u = index / (float)(orderedselection.Count - 1); 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++; index++;
} }
} }
@ -2058,16 +2058,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
else else
{ {
Color startColor, endColor; PixelColor startcolor, endcolor;
if(key == "fadecolor") if(key == "fadecolor")
{ {
startColor = Tools.GetSectorFadeColor(start); startcolor = Tools.GetSectorFadeColor(start);
endColor = Tools.GetSectorFadeColor(end); endcolor = Tools.GetSectorFadeColor(end);
} }
else else
{ {
startColor = PixelColor.FromInt(start.Fields.GetValue(key, defaultvalue)).ToColor(); startcolor = PixelColor.FromInt(start.Fields.GetValue(key, defaultvalue));
endColor = PixelColor.FromInt(end.Fields.GetValue(key, defaultvalue)).ToColor(); endcolor = PixelColor.FromInt(end.Fields.GetValue(key, defaultvalue));
} }
// Go for all sectors in between first and last // Go for all sectors in between first and last
@ -2077,12 +2077,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(index > 0 && index < orderedselection.Count - 1) if(index > 0 && index < orderedselection.Count - 1)
{ {
s.Fields.BeforeFieldsChange(); s.Fields.BeforeFieldsChange();
float u = index / (float) (orderedselection.Count - 1); float u = index / (orderedselection.Count - 1.0f);
Color c = Color.FromArgb(0, General.Clamp(InterpolationTools.Interpolate(startColor.R, endColor.R, u, interpolationmode), 0, 255), int c = InterpolationTools.InterpolateColor(startcolor, endcolor, u, interpolationmode);
General.Clamp(InterpolationTools.Interpolate(startColor.G, endColor.G, u, interpolationmode), 0, 255),
General.Clamp(InterpolationTools.Interpolate(startColor.B, endColor.B, u, interpolationmode), 0, 255));
UniFields.SetInteger(s.Fields, key, c.ToArgb(), defaultvalue); UniFields.SetInteger(s.Fields, key, c, defaultvalue);
s.UpdateNeeded = true; s.UpdateNeeded = true;
} }
index++; index++;
@ -2111,7 +2109,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sector s in orderedselection) foreach(Sector s in orderedselection)
{ {
float u = index / (float)(orderedselection.Count - 1); 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++; index++;
} }
@ -2146,7 +2144,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sector s in orderedselection) foreach(Sector s in orderedselection)
{ {
float u = (float)index / (orderedselection.Count - 1); 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++; index++;
} }

View file

@ -58,6 +58,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.abssizex = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.abssizex = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox(); 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.label14 = new System.Windows.Forms.Label();
this.flipv = new System.Windows.Forms.Button(); this.flipv = new System.Windows.Forms.Button();
this.fliph = 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.floortexall = new System.Windows.Forms.CheckBox();
this.floortexgroup = new System.Windows.Forms.GroupBox(); this.floortexgroup = new System.Windows.Forms.GroupBox();
this.tooltip = new System.Windows.Forms.ToolTip(this.components); 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.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
@ -482,6 +482,33 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.groupBox3.TabStop = false; this.groupBox3.TabStop = false;
this.groupBox3.Text = "Transform:"; 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 // label14
// //
this.label14.AutoSize = true; this.label14.AutoSize = true;
@ -668,33 +695,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.floortexgroup.TabStop = false; this.floortexgroup.TabStop = false;
this.floortexgroup.Text = " "; 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 // EditSelectionPanel
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);

View file

@ -125,9 +125,10 @@
based on floor/ceiling heights difference between based on floor/ceiling heights difference between
sectors outside selected sectors. sectors outside selected sectors.
Applied only when selected sectors were inside a single Applied only when selected sectors were surrounded
sector when the mode was enabled, and are inside a by sectors with the same target height when the mode
single sector when the mode is applied.</value> was enabled, and are surrounded by sectors with the
same target height when the mode is applied.</value>
</data> </data>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>

View file

@ -302,7 +302,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(v.z > cgz) if(v.z > cgz)
{ {
float cz = data.Ceiling.plane.GetZ(v.x, v.y); 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); PixelColor vc = PixelColor.FromInt(v.c);
v.c = InterpolationTools.InterpolateColor(GetGlowColor(data.CeilingGlow, vc), vc, delta); v.c = InterpolationTools.InterpolateColor(GetGlowColor(data.CeilingGlow, vc), vc, delta);
} }
@ -317,7 +317,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(v.z < fgz) if(v.z < fgz)
{ {
float fz = data.Floor.plane.GetZ(v.x, v.y); 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); PixelColor vc = PixelColor.FromInt(v.c);
v.c = InterpolationTools.InterpolateColor(vc, GetGlowColor(data.FloorGlow, vc), delta); v.c = InterpolationTools.InterpolateColor(vc, GetGlowColor(data.FloorGlow, vc), delta);
} }