diff --git a/Source/Core/Data/DirectoryReader.cs b/Source/Core/Data/DirectoryReader.cs
index b0f29bb7279894c27c748ae53750e2bb6f08dd00..d07a2dce70504280cfe7adf4d3a118e52af7eb6e 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 05de356332ccdc67c20ca9a77d8c85a67b7a1243..0425c92cb92e1316be2a917b40ae145e763f3f38 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 5d7b4d061696a5c5a9d9fea67123c9456710b87b..200a251b739e587f83caf1dfea71a5b019058bac 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 48b69bcd58d3a6287b018685ac293b026acd3ba7..86575ba73255de992c2ef4635b8f2c15ab8a5ab9 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 03412d1893dcb7267848224c53e85198e4ebfda2..a9c9a5e677e2147ee915bb650654289cee87bfc6 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 b339ed3ce88cedac1d2437b87cb4e870b1d073c3..636a3c282f42e48cf639437399513542b567eb8f 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 81d716ffaad81e70f2bdf8478529fbd142ad1566..4cfeb8ccb201456f0ec89baae3424136f961a8a8 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 dffd4f5679ae52879463ad80f7138be034e0f77c..885e1b867a211db5a63ef7bec4de44b4b3971155 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 07e3a311207e52698d7939db85be21ca28ed61e5..2e6e2b2bea6b8578f59556d486b238c9e5e59af8 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 807edbdcd8ef4df59c793853db18c1e5e02e548c..153424fa0d0af2ac1d71451996470debb00b3796 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 2e836bd9ac16f4e19d37efc49f5309adaec25adb..7f371c768a180f79374692db2884a3d8730471a7 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 b9ac6b774e10825ee5518654e26af038b0f09733..ba91d7467d67448c74102aad11b12b64810606d4 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 70dcf935bcd1c9f359067c09e883815e89549e63..985f14675fe1ae839b3c153eae22e6149d0b661f 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 f6422ee4183af35884b6bbfb80e030b71316ee80..4e38c15c7e9407d684c7366558884eaf8a5d92a4 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 16652a30add4295246c43d6886dd9d369d35f3fb..e8c0083eaeec4c029a0bb1c7d45f14c490a83649 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 e02189afe3b96c0d77f30ccaf0585b50fdbe3f5b..74d268a3b9c0fb5fb5fd1de118fb85c132ac84fc 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 75897609e12078916c09b0f2be03c7f283f0a39e..13241004907714e7f2af5ef683391b7583165e95 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);
 				}