diff --git a/Source/Core/Controls/ButtonsNumericTextbox.cs b/Source/Core/Controls/ButtonsNumericTextbox.cs
index 0b298b3ff972cba69bbae163d174c2d3fd71475c..0e0d911903faed4c16b69d52547ebd937df01126 100755
--- a/Source/Core/Controls/ButtonsNumericTextbox.cs
+++ b/Source/Core/Controls/ButtonsNumericTextbox.cs
@@ -213,13 +213,13 @@ namespace CodeImp.DoomBuilder.Controls
 		}
 		
 		// This determines the result value
-		public float GetResultFloat(float original)
+		public double GetResultFloat(double original)
 		{
 			return textbox.GetResultFloat(original);
 		}
 
 		//mxd. This determines the result value at given inremental step
-		public float GetResultFloat(float original, int step)
+		public double GetResultFloat(double original, int step)
 		{
 			return textbox.GetResultFloat(original, step);
 		}
diff --git a/Source/Core/Controls/NumericTextbox.cs b/Source/Core/Controls/NumericTextbox.cs
index 6174cd954f7c70731a9e7ef9f084966afc939848..27332d47f7af97ed445c798ca70e25f7b76b22a0 100755
--- a/Source/Core/Controls/NumericTextbox.cs
+++ b/Source/Core/Controls/NumericTextbox.cs
@@ -283,13 +283,13 @@ namespace CodeImp.DoomBuilder.Controls
 		}
 
 		//mxd. This determines the result value
-		public float GetResultFloat(float original)
+		public double GetResultFloat(double original)
 		{
 			return GetResultFloat(original, incrementstep++);
 		}
 
 		// This determines the result value
-		public float GetResultFloat(float original, int step)
+		public double GetResultFloat(double original, int step)
 		{
 			// Strip prefixes
 			string textpart = StripPrefixes(this.Text);
@@ -297,7 +297,7 @@ namespace CodeImp.DoomBuilder.Controls
 			// Any numbers left?
 			if(textpart.Length > 0)
 			{
-				float result;
+				double result;
 				if(allowrelative)
 				{
 					//mxd. Prefixed with +++?
@@ -317,7 +317,7 @@ namespace CodeImp.DoomBuilder.Controls
 						// Subtract number from original
 						if(TryGetResultValue(textpart, out result))
 						{
-							float newvalue = original - result * step;
+							double newvalue = original - result * step;
 							return (!allownegative && (newvalue < 0)) ? original : newvalue;
 						}
 
@@ -342,7 +342,7 @@ namespace CodeImp.DoomBuilder.Controls
 						// Subtract number from original
 						if(TryGetResultValue(textpart, out result))
 						{
-							float newvalue = original - result;
+							double newvalue = original - result;
 							return (!allownegative && (newvalue < 0)) ? original : newvalue;
 						}
 
@@ -356,7 +356,7 @@ namespace CodeImp.DoomBuilder.Controls
 						// Multiply original by number
 						if(TryGetResultValue(textpart, out result))
 						{
-							float newvalue = (float)Math.Round(original * result, ROUNDING_PRECISION);
+							double newvalue = Math.Round(original * result, ROUNDING_PRECISION);
 							return (!allownegative && (newvalue < 0f)) ? original : newvalue;
 						}
 
@@ -371,7 +371,7 @@ namespace CodeImp.DoomBuilder.Controls
 						if(TryGetResultValue(textpart, out result))
 						{
 							if(result == 0.0f) return original;
-							float newvalue = (float)Math.Round(original / result, ROUNDING_PRECISION);
+							double newvalue = Math.Round(original / result, ROUNDING_PRECISION);
 							return (!allownegative && (newvalue < 0f)) ? original : newvalue;
 						}
 
@@ -392,12 +392,12 @@ namespace CodeImp.DoomBuilder.Controls
 		//mxd
 		private bool IsValidResult(string expression)
 		{
-			float unused;
+			double unused;
 			return TryGetResultValue(expression, out unused);
 		}
 
 		//mxd
-		private bool TryGetResultValue(string expression, out float value)
+		private bool TryGetResultValue(string expression, out double value)
 		{
 			//Compute expression
 			if(allowexpressions)
@@ -411,7 +411,7 @@ namespace CodeImp.DoomBuilder.Controls
 			}
 
 			// Parse result
-			return float.TryParse(expression, NumberStyles.Float, CultureInfo.InvariantCulture, out value);
+			return double.TryParse(expression, NumberStyles.Float, CultureInfo.InvariantCulture, out value);
 		}
 
 		//mxd
diff --git a/Source/Core/Controls/SectorSlopeControl.cs b/Source/Core/Controls/SectorSlopeControl.cs
index 46573f67e70fa24680b0a331d719eb25f8d33197..e2fd3a7d5123483c0f615a1699f644a506741ed0 100755
--- a/Source/Core/Controls/SectorSlopeControl.cs
+++ b/Source/Core/Controls/SectorSlopeControl.cs
@@ -73,17 +73,17 @@ namespace CodeImp.DoomBuilder.Controls
 
 		#region ================== Property accessors
 
-		public float GetAngleXY(float defaultvalue) 
+		public double GetAngleXY(double defaultvalue) 
 		{
 			return sloperotation.GetResultFloat(defaultvalue);
 		}
 
-		public float GetAngleZ(float defaultvalue) 
+		public double GetAngleZ(double defaultvalue) 
 		{
 			return slopeangle.GetResultFloat(defaultvalue);
 		}
 
-		public float GetOffset(float defaultvalue) 
+		public double GetOffset(double defaultvalue) 
 		{
 			return slopeoffset.GetResultFloat(defaultvalue);
 		}
diff --git a/Source/Core/Editing/ClassicMode.cs b/Source/Core/Editing/ClassicMode.cs
index 013d652a065f2a6a424c5fff8122ab1022e1180d..e9bbf13f7ca1dc3fdec82502c7e9c5c33c05174f 100755
--- a/Source/Core/Editing/ClassicMode.cs
+++ b/Source/Core/Editing/ClassicMode.cs
@@ -207,7 +207,7 @@ namespace CodeImp.DoomBuilder.Editing
 		}
 
 		// This scrolls anywhere
-		private void ScrollBy(float deltax, float deltay)
+		private void ScrollBy(double deltax, double deltay)
 		{
 			//mxd. Don't stroll too far from map boundaries
 			Vector2D offset = ClampViewOffset(renderer2d.OffsetX + deltax, renderer2d.OffsetY + deltay);
@@ -287,7 +287,7 @@ namespace CodeImp.DoomBuilder.Editing
 		}
 
 		//mxd. Makes sure given offset stays within map boundaries
-		private static Vector2D ClampViewOffset(float x, float y)
+		private static Vector2D ClampViewOffset(double x, double y)
 		{
 			Vector2D diff = new Vector2D(x, y);
 			Vector2D safediff = new Vector2D(General.Clamp(diff.x, General.Map.Config.LeftBoundary, General.Map.Config.RightBoundary),
@@ -851,7 +851,7 @@ namespace CodeImp.DoomBuilder.Editing
 		{
 			selecting = true;
 			selectstart = mousedownmappos;
-			selectionrect = new RectangleF(selectstart.x, selectstart.y, 0, 0);
+			selectionrect = new RectangleF((float)selectstart.x, (float)selectstart.y, 0, 0);
 
 			//mxd
 			General.Hints.ShowHints(this.GetType(), HintsManager.MULTISELECTION);
@@ -864,10 +864,10 @@ namespace CodeImp.DoomBuilder.Editing
 		{
 			marqueSelectionMode = GetMultiSelectionMode(); //mxd
 			
-			selectionrect.X = selectstart.x;
-			selectionrect.Y = selectstart.y;
-			selectionrect.Width = mousemappos.x - selectstart.x;
-			selectionrect.Height = mousemappos.y - selectstart.y;
+			selectionrect.X = (float)selectstart.x;
+			selectionrect.Y = (float)selectstart.y;
+			selectionrect.Width = (float)(mousemappos.x - selectstart.x);
+			selectionrect.Height = (float)(mousemappos.y - selectstart.y);
 			
 			if(selectionrect.Width < 0f)
 			{
@@ -926,7 +926,7 @@ namespace CodeImp.DoomBuilder.Editing
 		{
 			// We can only drag the map when the mouse pointer is inside
 			// otherwise we don't have coordinates where to drag the map to
-			if(mouseinside && !float.IsNaN(mouselastpos.x) && !float.IsNaN(mouselastpos.y))
+			if(mouseinside && !double.IsNaN(mouselastpos.x) && !double.IsNaN(mouselastpos.y))
 			{
 				// Get the map coordinates of the last mouse posision (before it moved)
 				Vector2D lastmappos = renderer2d.DisplayToMap(mouselastpos);
diff --git a/Source/Core/General/General.cs b/Source/Core/General/General.cs
index 06fb28f877db93121e2cd90deb1d3ec7518c54a6..4e137b412b6f23a1319e6291826a56f02e4ff189 100755
--- a/Source/Core/General/General.cs
+++ b/Source/Core/General/General.cs
@@ -1721,6 +1721,12 @@ namespace CodeImp.DoomBuilder
 			return Math.Min(Math.Max(min, value), max);
 		}
 
+		// This clamps a value
+		public static double Clamp(double value, double min, double max)
+		{
+			return Math.Min(Math.Max(min, value), max);
+		}
+
 		// This clamps a value
 		public static int Clamp(int value, int min, int max)
 		{
@@ -1749,6 +1755,14 @@ namespace CodeImp.DoomBuilder
 			return angle;
 		}
 
+		// This clamps angle between 0 and 359
+		public static double ClampAngle(double angle)
+		{
+			angle %= 360;
+			if (angle < 0) angle += 360;
+			return angle;
+		}
+
 		//mxd
 		public static int Random(int min, int max) 
 		{
diff --git a/Source/Core/Geometry/Angle2D.cs b/Source/Core/Geometry/Angle2D.cs
index 15b9541962e20385b0340a1022424b5e7a756803..539a6bfaae133df72e9869f2bd2dada944b1ca41 100755
--- a/Source/Core/Geometry/Angle2D.cs
+++ b/Source/Core/Geometry/Angle2D.cs
@@ -26,42 +26,42 @@ namespace CodeImp.DoomBuilder.Geometry
 	{
 		#region ================== Constants
 
-		public const float PI = (float)Math.PI;
-		public const float PIHALF = (float)Math.PI * 0.5f;
-		public const float PI2 = (float)Math.PI * 2f;
-		public const float PIDEG = 57.295779513082320876798154814105f;
-		public const float SQRT2 = 1.4142135623730950488016887242097f;
+		public const double PI = Math.PI;
+		public const double PIHALF = Math.PI * 0.5f;
+		public const double PI2 = Math.PI * 2f;
+		public const double PIDEG = 57.295779513082320876798154814105f;
+		public const double SQRT2 = 1.4142135623730950488016887242097f;
 		
 		#endregion
 
 		#region ================== Methods
 
 		// This converts doom angle to real angle
-		public static float DoomToReal(int doomangle)
+		public static double DoomToReal(int doomangle)
 		{
-			return (float)Math.Round(Normalized(DegToRad((doomangle + 90))), 4);
+			return Math.Round(Normalized(DegToRad((doomangle + 90))), 4);
 		}
 
 		// This converts real angle to doom angle
-		public static int RealToDoom(float realangle)
+		public static int RealToDoom(double realangle)
 		{
 			return (int)Math.Round(RadToDeg(Normalized(realangle - PIHALF)));
 		}
 
 		// This converts degrees to radians
-		public static float DegToRad(float deg)
+		public static double DegToRad(double deg)
 		{
 			return deg / PIDEG;
 		}
 
 		// This converts radians to degrees
-		public static float RadToDeg(float rad)
+		public static double RadToDeg(double rad)
 		{
 			return rad * PIDEG;
 		}
 
 		// This normalizes an angle
-		public static float Normalized(float a)
+		public static double Normalized(double a)
 		{
 			while(a < 0f) a += PI2;
 			while(a >= PI2) a -= PI2;
@@ -69,10 +69,10 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This returns the difference between two angles
-		public static float Difference(float a, float b)
+		public static double Difference(double a, double b)
 		{
 			// Calculate delta angle
-			float d = Normalized(a) - Normalized(b);
+			double d = Normalized(a) - Normalized(b);
 
 			// Make corrections for zero barrier
 			if(d < 0f) d += PI2;
@@ -84,7 +84,7 @@ namespace CodeImp.DoomBuilder.Geometry
 
 		//mxd. Slade 3 MathStuff::angle2DRad ripoff...
 		//Returns the angle between the 2d points [p1], [p2] and [p3]
-		public static float GetAngle(Vector2D p1, Vector2D p2, Vector2D p3)
+		public static double GetAngle(Vector2D p1, Vector2D p2, Vector2D p3)
 		{
 			// From: http://stackoverflow.com/questions/3486172/angle-between-3-points
 			// modified not to bother converting to degrees
@@ -92,27 +92,27 @@ namespace CodeImp.DoomBuilder.Geometry
 			Vector2D cb = new Vector2D(p2.x - p3.x, p2.y - p3.y);
 
 			// dot product
-			float dot = (ab.x * cb.x + ab.y * cb.y);
+			double dot = (ab.x * cb.x + ab.y * cb.y);
 
 			// length square of both vectors
-			float abSqr = ab.x * ab.x + ab.y * ab.y;
-			float cbSqr = cb.x * cb.x + cb.y * cb.y;
+			double abSqr = ab.x * ab.x + ab.y * ab.y;
+			double cbSqr = cb.x * cb.x + cb.y * cb.y;
 
 			// square of cosine of the needed angle
-			float cosSqr = dot * dot / abSqr / cbSqr;
+			double cosSqr = dot * dot / abSqr / cbSqr;
 
 			// this is a known trigonometric equality:
 			// cos(alpha * 2) = [ cos(alpha) ]^2 * 2 - 1
-			float cos2 = 2.0f * cosSqr - 1.0f;
+			double cos2 = 2.0f * cosSqr - 1.0f;
 
 			// Here's the only invocation of the heavy function.
 			// It's a good idea to check explicitly if cos2 is within [-1 .. 1] range
-			float alpha2 =
+			double alpha2 =
 				(cos2 <= -1) ? PI :
 				(cos2 >= 1) ? 0.0f :
-				(float)Math.Acos(cos2);
+				Math.Acos(cos2);
 
-			float rs = alpha2 * 0.5f;
+			double rs = alpha2 * 0.5f;
 
 			// Now revolve the ambiguities.
 			// 1. If dot product of two vectors is negative - the angle is definitely
@@ -123,7 +123,7 @@ namespace CodeImp.DoomBuilder.Geometry
 			if(dot < 0) rs = PI - rs;
 
 			// 2. Determine the sign. For this we'll use the Determinant of two vectors.
-			float det = (ab.x * cb.y - ab.y * cb.x);
+			double det = (ab.x * cb.y - ab.y * cb.x);
 			if(det < 0) rs = (2.0f * PI) - rs;
 
 			return rs;
diff --git a/Source/Core/Geometry/Line2D.cs b/Source/Core/Geometry/Line2D.cs
index 0aaddabc1641508875844f1a7caeb5aadb7a1c20..b8cb9b67bd66c233f28e77d548f39771fd51cd19 100755
--- a/Source/Core/Geometry/Line2D.cs
+++ b/Source/Core/Geometry/Line2D.cs
@@ -49,21 +49,21 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 		
 		// Constructor
-		public Line2D(Vector2D v1, float x2, float y2)
+		public Line2D(Vector2D v1, double x2, double y2)
 		{
 			this.v1 = v1;
 			this.v2 = new Vector2D(x2, y2);
 		}
 
 		// Constructor
-		public Line2D(float x1, float y1, Vector2D v2)
+		public Line2D(double x1, double y1, Vector2D v2)
 		{
 			this.v1 = new Vector2D(x1, y1);
 			this.v2 = v2;
 		}
 		
 		// Constructor
-		public Line2D(float x1, float y1, float x2, float y2)
+		public Line2D(double x1, double y1, double x2, double y2)
 		{
 			this.v1 = new Vector2D(x1, y1);
 			this.v2 = new Vector2D(x2, y2);
@@ -81,21 +81,21 @@ namespace CodeImp.DoomBuilder.Geometry
 		#region ================== Statics
 
 		// This calculates the length
-		public static float GetLength(float dx, float dy)
+		public static double GetLength(double dx, double dy)
 		{
 			// Calculate and return the length
-			return (float)Math.Sqrt(GetLengthSq(dx, dy));
+			return Math.Sqrt(GetLengthSq(dx, dy));
 		}
 
 		// This calculates the square of the length
-		public static float GetLengthSq(float dx, float dy)
+		public static double GetLengthSq(double dx, double dy)
 		{
 			// Calculate and return the length
 			return dx * dx + dy * dy;
 		}
 
 		// This calculates the normal of a line
-		public static Vector2D GetNormal(float dx, float dy)
+		public static Vector2D GetNormal(double dx, double dy)
 		{
 			return new Vector2D(dx, dy).GetNormal();
 		}
@@ -107,48 +107,48 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This tests if the line intersects with the given line coordinates
-		public static bool GetIntersection(Vector2D v1, Vector2D v2, float x3, float y3, float x4, float y4)
+		public static bool GetIntersection(Vector2D v1, Vector2D v2, double x3, double y3, double x4, double y4)
 		{
-			float u_ray, u_line;
+			double u_ray, u_line;
 			return GetIntersection(v1, v2, x3, y3, x4, y4, out u_ray, out u_line);
 		}
 
 		// This tests if the line intersects with the given line coordinates
-		public static bool GetIntersection(Vector2D v1, Vector2D v2, float x3, float y3, float x4, float y4, out float u_ray)
+		public static bool GetIntersection(Vector2D v1, Vector2D v2, double x3, double y3, double x4, double y4, out double u_ray)
 		{
-			float u_line;
+			double u_line;
 			return GetIntersection(v1, v2, x3, y3, x4, y4, out u_ray, out u_line, true);
 		}
 
 		//mxd. This tests if the line intersects with the given line coordinates
-		public static bool GetIntersection(Vector2D v1, Vector2D v2, float x3, float y3, float x4, float y4, out float u_ray, bool bounded)
+		public static bool GetIntersection(Vector2D v1, Vector2D v2, double x3, double y3, double x4, double y4, out double u_ray, bool bounded)
 		{
-			float u_line;
+			double u_line;
 			return GetIntersection(v1, v2, x3, y3, x4, y4, out u_ray, out u_line, bounded);
 		}
 
 		//mxd. Gets intersection point between given lines
 		public static Vector2D GetIntersectionPoint(Line2D line1, Line2D line2, bool bounded)
 		{
-			float u_ray, u_line;
+			double u_ray, u_line;
 			if(GetIntersection(line1.v1, line1.v2, line2.v1.x, line2.v1.y, line2.v2.x, line2.v2.y, out u_ray, out u_line, bounded))
 				return GetCoordinatesAt(line2.v1, line2.v2, u_ray);
 
 			// No dice...
-			return new Vector2D(float.NaN, float.NaN);
+			return new Vector2D(double.NaN, double.NaN);
 		}
 
 		// This tests if the line intersects with the given line coordinates
-		public static bool GetIntersection(Vector2D v1, Vector2D v2, float x3, float y3, float x4, float y4, out float u_ray, out float u_line)
+		public static bool GetIntersection(Vector2D v1, Vector2D v2, double x3, double y3, double x4, double y4, out double u_ray, out double u_line)
 		{
 			return GetIntersection(v1, v2, x3, y3, x4, y4, out u_ray, out u_line, true);
 		}
 
 		// This tests if the line intersects with the given line coordinates
-		public static bool GetIntersection(Vector2D v1, Vector2D v2, float x3, float y3, float x4, float y4, out float u_ray, out float u_line, bool bounded)
+		public static bool GetIntersection(Vector2D v1, Vector2D v2, double x3, double y3, double x4, double y4, out double u_ray, out double u_line, bool bounded)
 		{
 			// Calculate divider
-			float div = (y4 - y3) * (v2.x - v1.x) - (x4 - x3) * (v2.y - v1.y);
+			double div = (y4 - y3) * (v2.x - v1.x) - (x4 - x3) * (v2.y - v1.y);
 
 			// Can this be tested?
 			if(div != 0.0f)
@@ -165,30 +165,30 @@ namespace CodeImp.DoomBuilder.Geometry
 			}
 
 			// Unable to detect intersection
-			u_line = float.NaN;
-			u_ray = float.NaN;
+			u_line = double.NaN;
+			u_ray = double.NaN;
 			return false;
 		}
 
 		// This tests on which side of the line the given coordinates are
 		// returns < 0 for front (right) side, > 0 for back (left) side and 0 if on the line
-		public static float GetSideOfLine(Vector2D v1, Vector2D v2, Vector2D p)
+		public static double GetSideOfLine(Vector2D v1, Vector2D v2, Vector2D p)
 		{
 			// Calculate and return side information
 			return (p.y - v1.y) * (v2.x - v1.x) - (p.x - v1.x) * (v2.y - v1.y);
 		}
 
 		// This returns the shortest distance from given coordinates to line
-		public static float GetDistanceToLine(Vector2D v1, Vector2D v2, Vector2D p, bool bounded)
+		public static double GetDistanceToLine(Vector2D v1, Vector2D v2, Vector2D p, bool bounded)
 		{
-			return (float)Math.Sqrt(GetDistanceToLineSq(v1, v2, p, bounded));
+			return Math.Sqrt(GetDistanceToLineSq(v1, v2, p, bounded));
 		}
 
 		// This returns the shortest distance from given coordinates to line
-		public static float GetDistanceToLineSq(Vector2D v1, Vector2D v2, Vector2D p, bool bounded)
+		public static double GetDistanceToLineSq(Vector2D v1, Vector2D v2, Vector2D p, bool bounded)
 		{
 			// Calculate intersection offset
-			float u = ((p.x - v1.x) * (v2.x - v1.x) + (p.y - v1.y) * (v2.y - v1.y)) / GetLengthSq(v2.x - v1.x, v2.y - v1.y);
+			double u = ((p.x - v1.x) * (v2.x - v1.x) + (p.y - v1.y) * (v2.y - v1.y)) / GetLengthSq(v2.x - v1.x, v2.y - v1.y);
 
 			if(bounded)
 			{
@@ -207,26 +207,26 @@ namespace CodeImp.DoomBuilder.Geometry
 
 			// Return distance between intersection and point
 			// which is the shortest distance to the line
-			float ldx = p.x - i.x;
-			float ldy = p.y - i.y;
+			double ldx = p.x - i.x;
+			double ldy = p.y - i.y;
 			return ldx * ldx + ldy * ldy;
 		}
 
 		// This returns the offset coordinates on the line nearest to the given coordinates
-		public static float GetNearestOnLine(Vector2D v1, Vector2D v2, Vector2D p)
+		public static double GetNearestOnLine(Vector2D v1, Vector2D v2, Vector2D p)
 		{
 			// Calculate and return intersection offset
 			return ((p.x - v1.x) * (v2.x - v1.x) + (p.y - v1.y) * (v2.y - v1.y)) / GetLengthSq(v2.x - v1.x, v2.y - v1.y);
 		}
 
 		// This returns the coordinates at a specific position on the line
-		public static Vector2D GetCoordinatesAt(Vector2D v1, Vector2D v2, float u)
+		public static Vector2D GetCoordinatesAt(Vector2D v1, Vector2D v2, double u)
 		{
 			// Calculate and return intersection offset
 			return new Vector2D(v1.x + u * (v2.x - v1.x), v1.y + u * (v2.y - v1.y));
 		}
 
-        private static bool IsEqualFloat(float a, float b)
+        private static bool IsEqualFloat(double a, double b)
         {
             return Math.Abs(a - b) < 0.0001f;
         }
@@ -234,16 +234,16 @@ namespace CodeImp.DoomBuilder.Geometry
         // Some random self-written aglrithm instead of Cohen-Sutherland algorithm which used to hang up randomly
         public static Line2D ClipToRectangle(Line2D line, RectangleF rect, out bool intersects)
 		{
-            float rateXY = 0f;
+            double rateXY = 0f;
             if (line.v2.y != line.v1.y)
             {
-                float dx = line.v2.x - line.v1.x;
-                float dy = line.v2.y - line.v1.y;
+                double dx = line.v2.x - line.v1.x;
+                double dy = line.v2.y - line.v1.y;
                 rateXY = dx / dy;
             }
 
-            float x1 = line.v1.x, y1 = line.v1.y;
-            float x2 = line.v2.x, y2 = line.v2.y;
+            double x1 = line.v1.x, y1 = line.v1.y;
+            double x2 = line.v2.x, y2 = line.v2.y;
 
             for (int i = 0; i < 2; i++)
             {
@@ -316,17 +316,17 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This calculates the angle
-		public float GetAngle()
+		public double GetAngle()
 		{
 			// Calculate and return the angle
 			Vector2D d = GetDelta();
-			return -(float)Math.Atan2(-d.y, d.x) + Angle2D.PIHALF;
+			return -Math.Atan2(-d.y, d.x) + Angle2D.PIHALF;
 		}
 		
 		public Vector2D GetDelta() { return v2 - v1; }
 		
-		public float GetLength() { return Line2D.GetLength(v2.x - v1.x, v2.y - v1.y); }
-		public float GetLengthSq() { return Line2D.GetLengthSq(v2.x - v1.x, v2.y - v1.y); }
+		public double GetLength() { return Line2D.GetLength(v2.x - v1.x, v2.y - v1.y); }
+		public double GetLengthSq() { return Line2D.GetLengthSq(v2.x - v1.x, v2.y - v1.y); }
 
 		// Output
 		public override string ToString()
@@ -334,22 +334,22 @@ namespace CodeImp.DoomBuilder.Geometry
 			return "(" + v1 + ") - (" + v2 + ")";
 		}
 		
-		public bool GetIntersection(float x3, float y3, float x4, float y4)
+		public bool GetIntersection(double x3, double y3, double x4, double y4)
 		{
 			return Line2D.GetIntersection(v1, v2, x3, y3, x4, y4);
 		}
 
-		public bool GetIntersection(float x3, float y3, float x4, float y4, out float u_ray)
+		public bool GetIntersection(double x3, double y3, double x4, double y4, out double u_ray)
 		{
 			return Line2D.GetIntersection(v1, v2, x3, y3, x4, y4, out u_ray, true);
 		}
 
-		public bool GetIntersection(float x3, float y3, float x4, float y4, out float u_ray, bool bounded)
+		public bool GetIntersection(double x3, double y3, double x4, double y4, out double u_ray, bool bounded)
 		{
 			return Line2D.GetIntersection(v1, v2, x3, y3, x4, y4, out u_ray, bounded);
 		}
 
-		public bool GetIntersection(float x3, float y3, float x4, float y4, out float u_ray, out float u_line)
+		public bool GetIntersection(double x3, double y3, double x4, double y4, out double u_ray, out double u_line)
 		{
 			return Line2D.GetIntersection(v1, v2, x3, y3, x4, y4, out u_ray, out u_line);
 		}
@@ -359,54 +359,54 @@ namespace CodeImp.DoomBuilder.Geometry
 			return Line2D.GetIntersection(v1, v2, ray.v1.x, ray.v1.y, ray.v2.x, ray.v2.y);
 		}
 
-		public bool GetIntersection(Line2D ray, out float u_ray)
+		public bool GetIntersection(Line2D ray, out double u_ray)
 		{
 			return Line2D.GetIntersection(v1, v2, ray.v1.x, ray.v1.y, ray.v2.x, ray.v2.y, out u_ray, true);
 		}
 
-		public bool GetIntersection(Line2D ray, out float u_ray, bool bounded)
+		public bool GetIntersection(Line2D ray, out double u_ray, bool bounded)
 		{
 			return Line2D.GetIntersection(v1, v2, ray.v1.x, ray.v1.y, ray.v2.x, ray.v2.y, out u_ray, bounded);
 		}
 
-		public bool GetIntersection(Line2D ray, out float u_ray, out float u_line)
+		public bool GetIntersection(Line2D ray, out double u_ray, out double u_line)
 		{
 			return Line2D.GetIntersection(v1, v2, ray.v1.x, ray.v1.y, ray.v2.x, ray.v2.y, out u_ray, out u_line);
 		}
 
-		public float GetSideOfLine(Vector2D p)
+		public double GetSideOfLine(Vector2D p)
 		{
 			return Line2D.GetSideOfLine(v1, v2, p);
 		}
 
-		public float GetDistanceToLine(Vector2D p, bool bounded)
+		public double GetDistanceToLine(Vector2D p, bool bounded)
 		{
 			return Line2D.GetDistanceToLine(v1, v2, p, bounded);
 		}
 
-		public float GetDistanceToLineSq(Vector2D p, bool bounded)
+		public double GetDistanceToLineSq(Vector2D p, bool bounded)
 		{
 			return Line2D.GetDistanceToLineSq(v1, v2, p, bounded);
 		}
 
-		public float GetNearestOnLine(Vector2D p)
+		public double GetNearestOnLine(Vector2D p)
 		{
 			return Line2D.GetNearestOnLine(v1, v2, p);
 		}
 
-		public Vector2D GetCoordinatesAt(float u)
+		public Vector2D GetCoordinatesAt(double u)
 		{
 			return Line2D.GetCoordinatesAt(v1, v2, u);
 		}
 
-		public Line2D GetTransformed(float offsetx, float offsety, float scalex, float scaley)
+		public Line2D GetTransformed(double offsetx, double offsety, double scalex, double scaley)
 		{
 			return new Line2D(v1.GetTransformed(offsetx, offsety, scalex, scaley),
 				v2.GetTransformed(offsetx, offsety, scalex, scaley));
 		}
 
 		// Inverse Transform
-		public Line2D GetInvTransformed(float invoffsetx, float invoffsety, float invscalex, float invscaley)
+		public Line2D GetInvTransformed(double invoffsetx, double invoffsety, double invscalex, double invscaley)
 		{
 			return new Line2D(v1.GetInvTransformed(invoffsetx, invoffsety, invscalex, invscaley), 
 				v2.GetInvTransformed(invoffsetx, invoffsety, invscalex, invscaley));
diff --git a/Source/Core/Geometry/Line3D.cs b/Source/Core/Geometry/Line3D.cs
index 776d14a841bf0796aa8d367a6d83189ead780203..458936edac05c706b54d68e44b57c5307d8621f1 100755
--- a/Source/Core/Geometry/Line3D.cs
+++ b/Source/Core/Geometry/Line3D.cs
@@ -60,11 +60,11 @@ namespace CodeImp.DoomBuilder.Geometry
 		public Vector3D GetDelta() { return End - Start; }
 
 		// This calculates the angle
-		public float GetAngle() 
+		public double GetAngle() 
 		{
 			// Calculate and return the angle
 			Vector2D d = GetDelta();
-			return -(float)Math.Atan2(-d.y, d.x) + Angle2D.PIHALF;
+			return -Math.Atan2(-d.y, d.x) + Angle2D.PIHALF;
 		}
 	}
 }
diff --git a/Source/Core/Geometry/Plane.cs b/Source/Core/Geometry/Plane.cs
index 9d91bde5a6e60c8f7e0f97acfadf7d3fd3b1d44a..60008b24d1bfd5bda5fd1c458ed60f335d9aa1b6 100755
--- a/Source/Core/Geometry/Plane.cs
+++ b/Source/Core/Geometry/Plane.cs
@@ -38,25 +38,25 @@ namespace CodeImp.DoomBuilder.Geometry
 		// D is the offset along the normal (negative)
 		//
 		private Vector3D normal;
-		private float offset;
+		private double offset;
 		
 		#endregion
 		
 		#region ================== Properties
 		
 		public Vector3D Normal { get { return normal; } }
-		public float Offset { get { return offset; } set { offset = value; } }
-		public float a { get { return normal.x; } }
-		public float b { get { return normal.y; } }
-		public float c { get { return normal.z; } }
-		public float d { get { return offset; } set { offset = value; } }
+		public double Offset { get { return offset; } set { offset = value; } }
+		public double a { get { return normal.x; } }
+		public double b { get { return normal.y; } }
+		public double c { get { return normal.z; } }
+		public double d { get { return offset; } set { offset = value; } }
 		
 		#endregion
 		
 		#region ================== Constructors
 		
 		/// <summary></summary>
-		public Plane(Vector3D normal, float offset)
+		public Plane(Vector3D normal, double offset)
 		{
 			#if DEBUG
 				if(!normal.IsNormalized())
@@ -89,13 +89,13 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		/// <summary></summary>
-		public Plane(Vector3D center, float anglexy, float anglez, bool up) //mxd
+		public Plane(Vector3D center, double anglexy, double anglez, bool up) //mxd
 		{
-			Vector2D point = new Vector2D(center.x + (float)Math.Cos(anglexy) * (float)Math.Sin(anglez), center.y + (float)Math.Sin(anglexy) * (float)Math.Sin(anglez));
+			Vector2D point = new Vector2D(center.x + Math.Cos(anglexy) * Math.Sin(anglez), center.y + Math.Sin(anglexy) * Math.Sin(anglez));
 			Vector2D perpendicular = new Line2D(center, point).GetPerpendicular();
 
-			Vector3D p2 = new Vector3D(point.x + perpendicular.x, point.y + perpendicular.y, center.z + (float)Math.Cos(anglez));
-			Vector3D p3 = new Vector3D(point.x - perpendicular.x, point.y - perpendicular.y, center.z + (float)Math.Cos(anglez));
+			Vector3D p2 = new Vector3D(point.x + perpendicular.x, point.y + perpendicular.y, center.z + Math.Cos(anglez));
+			Vector3D p3 = new Vector3D(point.x - perpendicular.x, point.y - perpendicular.y, center.z + Math.Cos(anglez));
 
 			this.normal = Vector3D.CrossProduct(p2 - center, p3 - center).GetNormal();
 
@@ -113,12 +113,12 @@ namespace CodeImp.DoomBuilder.Geometry
 		/// This tests for intersection with a line.
 		/// See http://local.wasp.uwa.edu.au/~pbourke/geometry/planeline/
 		/// </summary>
-		public bool GetIntersection(Vector3D from, Vector3D to, ref float u_ray)
+		public bool GetIntersection(Vector3D from, Vector3D to, ref double u_ray)
 		{
-			float w = Vector3D.DotProduct(normal, from - to);
+			double w = Vector3D.DotProduct(normal, from - to);
 			if(w != 0.0f)
 			{
-				float v = Vector3D.DotProduct(normal, from);
+				double v = Vector3D.DotProduct(normal, from);
 				u_ray = (offset + v) / w;
 				return true;
 			}
@@ -134,7 +134,7 @@ namespace CodeImp.DoomBuilder.Geometry
 		/// Less than 0 means the point lies behind the plane
 		/// See http://mathworld.wolfram.com/Point-PlaneDistance.html
 		/// </summary>
-		public float Distance(Vector3D p)
+		public double Distance(Vector3D p)
 		{
 			return Vector3D.DotProduct(normal, p) + offset;
 		}
@@ -150,7 +150,7 @@ namespace CodeImp.DoomBuilder.Geometry
 		/// <summary>
 		/// This returns Z on the plane at X, Y
 		/// </summary>
-		public float GetZ(Vector2D pos)
+		public double GetZ(Vector2D pos)
 		{
 			return (-offset - Vector2D.DotProduct(normal, pos)) / normal.z;
 		}
@@ -158,7 +158,7 @@ namespace CodeImp.DoomBuilder.Geometry
 		/// <summary>
 		/// This returns Z on the plane at X, Y
 		/// </summary>
-		public float GetZ(float x, float y)
+		public double GetZ(double x, double y)
 		{
 			return (-offset - (normal.x * x + normal.y * y)) / normal.z;
 		}
diff --git a/Source/Core/Geometry/Tools.cs b/Source/Core/Geometry/Tools.cs
index 796875898d3498c6853c299c278e07d95ef3921f..4f95ca31a755330c661c30e4d65aa309c32a2376 100755
--- a/Source/Core/Geometry/Tools.cs
+++ b/Source/Core/Geometry/Tools.cs
@@ -295,10 +295,10 @@ namespace CodeImp.DoomBuilder.Geometry
 						//mxd. Intersection test is bounded, so extend end position x to the right map boundary
 						Line2D testline = new Line2D(foundv.Position, new Vector2D(General.Map.Config.RightBoundary, foundv.Position.y));
 						scanline = null;
-						float foundu = float.MaxValue;
+						double foundu = double.MaxValue;
 
-						float px = foundv.Position.x; //mxd
-						float py = foundv.Position.y; //mxd
+						double px = foundv.Position.x; //mxd
+						double py = foundv.Position.y; //mxd
 
 						foreach(Linedef ld in General.Map.Map.Linedefs) 
 						{
@@ -308,11 +308,11 @@ namespace CodeImp.DoomBuilder.Geometry
 								// Line intersecting the y axis?
 								if((ld.Start.Position.y >= py && ld.End.Position.y <= py) 
 									|| (ld.Start.Position.y <= py && ld.End.Position.y >= py)) //mxd
-								{ 
+								{
 									// Check if this linedef intersects our test line at a closer range
-									float thisu;
+									double thisu;
 									ld.Line.GetIntersection(testline, out thisu);
-									if(!float.IsNaN(thisu) && (thisu > 0.00001f))
+									if(!double.IsNaN(thisu) && (thisu > 0.00001f))
 									{
 										if(thisu < foundu)
 										{
@@ -1026,7 +1026,7 @@ namespace CodeImp.DoomBuilder.Geometry
 									if(processed.Contains(side.Line)) continue;
 									if(side.Line == ld) continue;
 
-									float u;
+									double u;
 									if(side.Line.Line.GetIntersection(measureline, out u)) 
 									{
 										if(float.IsNaN(u) || (u <= 0.0f) || (u >= 1.0f)) continue;
diff --git a/Source/Core/Geometry/Vector2D.cs b/Source/Core/Geometry/Vector2D.cs
index f9279056e87ffaa8c1b7fd60c6a6bcea98c8289b..631558293f88c9323f9b76816e3e65789f594eb4 100755
--- a/Source/Core/Geometry/Vector2D.cs
+++ b/Source/Core/Geometry/Vector2D.cs
@@ -26,22 +26,22 @@ namespace CodeImp.DoomBuilder.Geometry
 	{
 		#region ================== Constants
 
-		private const float TINY_VALUE = 0.0000000001f;
+		private const double TINY_VALUE = 0.0000000001f;
 
 		#endregion
 
 		#region ================== Variables
 
 		// Coordinates
-		public float x;
-		public float y;
+		public double x;
+		public double y;
 		
 		#endregion
 		
 		#region ================== Constructors
 
 		// Constructor
-		public Vector2D(float x, float y)
+		public Vector2D(double x, double y)
 		{
 			this.x = x;
 			this.y = y;
@@ -71,13 +71,13 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This adds to a vector
-		public static Vector2D operator +(float a, Vector2D b)
+		public static Vector2D operator +(double a, Vector2D b)
 		{
 			return new Vector2D(a + b.x, a + b.y);
 		}
 
 		// This adds to a vector
-		public static Vector2D operator +(Vector2D a, float b)
+		public static Vector2D operator +(Vector2D a, double b)
 		{
 			return new Vector2D(a.x + b, a.y + b);
 		}
@@ -89,13 +89,13 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This subtracts from a vector
-		public static Vector2D operator -(Vector2D a, float b)
+		public static Vector2D operator -(Vector2D a, double b)
 		{
 			return new Vector2D(a.x - b, a.y - b);
 		}
 
 		// This subtracts from a vector
-		public static Vector2D operator -(float a, Vector2D b)
+		public static Vector2D operator -(double a, Vector2D b)
 		{
 			return new Vector2D(a - b.x, a - b.y);
 		}
@@ -107,13 +107,13 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This scales a vector
-		public static Vector2D operator *(float s, Vector2D a)
+		public static Vector2D operator *(double s, Vector2D a)
 		{
 			return new Vector2D(a.x * s, a.y * s);
 		}
 
 		// This scales a vector
-		public static Vector2D operator *(Vector2D a, float s)
+		public static Vector2D operator *(Vector2D a, double s)
 		{
 			return new Vector2D(a.x * s, a.y * s);
 		}
@@ -125,13 +125,13 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This scales a vector
-		public static Vector2D operator /(float s, Vector2D a)
+		public static Vector2D operator /(double s, Vector2D a)
 		{
 			return new Vector2D(a.x / s, a.y / s);
 		}
 
 		// This scales a vector
-		public static Vector2D operator /(Vector2D a, float s)
+		public static Vector2D operator /(Vector2D a, double s)
 		{
 			return new Vector2D(a.x / s, a.y / s);
 		}
@@ -143,7 +143,7 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This calculates the dot product
-		public static float DotProduct(Vector2D a, Vector2D b)
+		public static double DotProduct(Vector2D a, Vector2D b)
 		{
 			// Calculate and return the dot product
 			return a.x * b.x + a.y * b.y;
@@ -178,7 +178,7 @@ namespace CodeImp.DoomBuilder.Geometry
 		public static Vector2D Reflect(Vector2D v, Vector2D m)
 		{
 			// Get the dot product of v and m
-			float dp = Vector2D.DotProduct(m, v);
+			double dp = Vector2D.DotProduct(m, v);
 
 			// Make the reflected vector
 			Vector2D mv = new Vector2D();
@@ -197,42 +197,42 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This returns a vector from an angle
-		public static Vector2D FromAngle(float angle)
+		public static Vector2D FromAngle(double angle)
 		{
 			// Return vector from angle
-			return new Vector2D((float)Math.Sin(angle), -(float)Math.Cos(angle));
+			return new Vector2D(Math.Sin(angle), -Math.Cos(angle));
 		}
 
 		// This returns a vector from an angle with a given legnth
-		public static Vector2D FromAngle(float angle, float length)
+		public static Vector2D FromAngle(double angle, double length)
 		{
 			// Return vector from angle
 			return FromAngle(angle) * length;
 		}
 
 		// This calculates the angle
-		public static float GetAngle(Vector2D a, Vector2D b)
+		public static double GetAngle(Vector2D a, Vector2D b)
 		{
 			// Calculate and return the angle
-			return -(float)Math.Atan2(-(a.y - b.y), (a.x - b.x)) + Angle2D.PIHALF;//mxd //(float)Math.PI * 0.5f;
+			return -Math.Atan2(-(a.y - b.y), (a.x - b.x)) + Angle2D.PIHALF;//mxd //(float)Math.PI * 0.5f;
 		}
 
 		// This returns the square distance between two points
-		public static float DistanceSq(Vector2D a, Vector2D b)
+		public static double DistanceSq(Vector2D a, Vector2D b)
 		{
 			Vector2D d = a - b;
 			return d.GetLengthSq();
 		}
 
 		// This returns the distance between two points
-		public static float Distance(Vector2D a, Vector2D b)
+		public static double Distance(Vector2D a, Vector2D b)
 		{
 			Vector2D d = a - b;
 			return d.GetLength();
 		}
 
 		// This returns the manhattan distance between two points
-		public static float ManhattanDistance(Vector2D a, Vector2D b)
+		public static double ManhattanDistance(Vector2D a, Vector2D b)
 		{
 			Vector2D d = a - b;
 			return Math.Abs(d.x) + Math.Abs(d.y);
@@ -255,30 +255,30 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 		
 		// This calculates the angle
-		public float GetAngle()
+		public double GetAngle()
 		{
 			//mxd. Let's make sure the angle is in [0 .. PI2] range...
-			float angle = -(float)Math.Atan2(-y, x) + Angle2D.PIHALF;
+			double angle = -Math.Atan2(-y, x) + Angle2D.PIHALF;
 			if(angle < 0f) angle += Angle2D.PI2;
 			return angle;
 		}
 
 		// This calculates the length
-		public float GetLength()
+		public double GetLength()
 		{
 			// Calculate and return the length
-			return (float)Math.Sqrt(x * x + y * y);
+			return Math.Sqrt(x * x + y * y);
 		}
 
 		// This calculates the square length
-		public float GetLengthSq()
+		public double GetLengthSq()
 		{
 			// Calculate and return the square length
 			return x * x + y * y;
 		}
 
 		// This calculates the length
-		public float GetManhattanLength()
+		public double GetManhattanLength()
 		{
 			// Calculate and return the length
 			return Math.Abs(x) + Math.Abs(y);
@@ -287,11 +287,11 @@ namespace CodeImp.DoomBuilder.Geometry
 		// This returns a normalized vector
 		public Vector2D GetNormal()
 		{
-			float lensq = this.GetLengthSq();
+			double lensq = this.GetLengthSq();
 			if(lensq > TINY_VALUE)
 			{
 				// Divide each element by the length
-				float mul = 1f / (float)Math.Sqrt(lensq);
+				double mul = 1f / Math.Sqrt(lensq);
 				return new Vector2D(x * mul, y * mul);
 			}
 			else
@@ -302,14 +302,14 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This scales the vector
-		public Vector2D GetScaled(float s)
+		public Vector2D GetScaled(double s)
 		{
 			// Scale the vector
 			return new Vector2D(x * s, y * s);
 		}
 
 		// This changes the vector length
-		public Vector2D GetFixedLength(float l)
+		public Vector2D GetFixedLength(double l)
 		{
 			// Normalize, then scale
 			return this.GetNormal().GetScaled(l);
@@ -322,31 +322,31 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// Transform
-		public Vector2D GetTransformed(float offsetx, float offsety, float scalex, float scaley)
+		public Vector2D GetTransformed(double offsetx, double offsety, double scalex, double scaley)
 		{
 			return new Vector2D((x + offsetx) * scalex, (y + offsety) * scaley);
 		}
 
 		// Inverse Transform
-		public Vector2D GetInvTransformed(float invoffsetx, float invoffsety, float invscalex, float invscaley)
+		public Vector2D GetInvTransformed(double invoffsetx, double invoffsety, double invscalex, double invscaley)
 		{
 			return new Vector2D((x * invscalex) + invoffsetx, (y * invscaley) + invoffsety);
 		}
 		
 		// Rotate (Added by Anders Åstrand 2008-05-18)
-		public Vector2D GetRotated(float theta)
+		public Vector2D GetRotated(double theta)
 		{
-			float cos = (float)Math.Cos(theta);
-			float sin = (float)Math.Sin(theta);
-			float rx = cos * x - sin * y;
-			float ry = sin * x + cos * y;
+			double cos = Math.Cos(theta);
+			double sin = Math.Sin(theta);
+			double rx = cos * x - sin * y;
+			double ry = sin * x + cos * y;
 			return new Vector2D(rx, ry);
 		}
 
 		// Checks if the Vector has valid values for x and y
 		public bool IsFinite()
 		{
-			return !float.IsNaN(x) && !float.IsNaN(y) && !float.IsInfinity(x) && !float.IsInfinity(y);
+			return !double.IsNaN(x) && !double.IsNaN(y) && !double.IsInfinity(x) && !double.IsInfinity(y);
 		}
 
 		//mxd. Addeed to make compiler a bit more happy...
diff --git a/Source/Core/Geometry/Vector3D.cs b/Source/Core/Geometry/Vector3D.cs
index ce7288980d092e767af416c5e230bebcc889d9e5..55b86a39667ccfa49b74fb0ef74bb2e683ebf59b 100755
--- a/Source/Core/Geometry/Vector3D.cs
+++ b/Source/Core/Geometry/Vector3D.cs
@@ -27,23 +27,23 @@ namespace CodeImp.DoomBuilder.Geometry
 	{
 		#region ================== Constants
 
-		private const float TINY_VALUE = 0.0000000001f;
+		private const double TINY_VALUE = 0.0000000001f;
 		
 		#endregion
 
 		#region ================== Variables
 
 		// Coordinates
-		public float x;
-		public float y;
-		public float z;
+		public double x;
+		public double y;
+		public double z;
 
 		#endregion
 
 		#region ================== Constructors
 
 		// Constructor
-		public Vector3D(float x, float y, float z)
+		public Vector3D(double x, double y, double z)
 		{
 			this.x = x;
 			this.y = y;
@@ -59,7 +59,7 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// Constructor (mxd)
-		public Vector3D(Vector2D v, float z) 
+		public Vector3D(Vector2D v, double z) 
 		{
 			this.x = v.x;
 			this.y = v.y;
@@ -83,13 +83,13 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This adds to all dimensions
-		public static Vector3D operator +(Vector3D a, float b)
+		public static Vector3D operator +(Vector3D a, double b)
 		{
 			return new Vector3D(a.x + b, a.y + b, a.z + b);
 		}
 
 		// This adds to all dimensions
-		public static Vector3D operator +(float b, Vector3D a)
+		public static Vector3D operator +(double b, Vector3D a)
 		{
 			return new Vector3D(a.x + b, a.y + b, a.z + b);
 		}
@@ -101,13 +101,13 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This subtracts from all dimensions
-		public static Vector3D operator -(Vector3D a, float b)
+		public static Vector3D operator -(Vector3D a, double b)
 		{
 			return new Vector3D(a.x - b, a.y - b, a.z - b);
 		}
 
 		// This subtracts from all dimensions
-		public static Vector3D operator -(float a, Vector3D b)
+		public static Vector3D operator -(double a, Vector3D b)
 		{
 			return new Vector3D(a - b.x, a - b.y, a - b.z);
 		}
@@ -119,13 +119,13 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This scales a vector
-		public static Vector3D operator *(float s, Vector3D a)
+		public static Vector3D operator *(double s, Vector3D a)
 		{
 			return new Vector3D(a.x * s, a.y * s, a.z * s);
 		}
 
 		// This scales a vector
-		public static Vector3D operator *(Vector3D a, float s)
+		public static Vector3D operator *(Vector3D a, double s)
 		{
 			return new Vector3D(a.x * s, a.y * s, a.z * s);
 		}
@@ -137,13 +137,13 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 		
 		// This scales a vector
-		public static Vector3D operator /(float s, Vector3D a)
+		public static Vector3D operator /(double s, Vector3D a)
 		{
 			return new Vector3D(a.x / s, a.y / s, a.z / s);
 		}
 
 		// This scales a vector
-		public static Vector3D operator /(Vector3D a, float s)
+		public static Vector3D operator /(Vector3D a, double s)
 		{
 			return new Vector3D(a.x / s, a.y / s, a.z / s);
 		}
@@ -179,7 +179,7 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This calculates the dot product
-		public static float DotProduct(Vector3D a, Vector3D b)
+		public static double DotProduct(Vector3D a, Vector3D b)
 		{
 			// Calculate and return the dot product
 			return a.x * b.x + a.y * b.y + a.z * b.z;
@@ -190,7 +190,7 @@ namespace CodeImp.DoomBuilder.Geometry
 		public static Vector3D Reflect(Vector3D v, Vector3D m)
 		{
 			// Get the dot product of v and m
-			float dp = Vector3D.DotProduct(v, m);
+			double dp = Vector3D.DotProduct(v, m);
 
 			// Make the reflected vector
 			Vector3D mv = new Vector3D();
@@ -210,26 +210,26 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This returns a vector from an angle
-		public static Vector3D FromAngleXY(float angle)
+		public static Vector3D FromAngleXY(double angle)
 		{
 			// Return vector from angle
-			return new Vector3D((float)Math.Sin(angle), -(float)Math.Cos(angle), 0f);
+			return new Vector3D(Math.Sin(angle), -Math.Cos(angle), 0f);
 		}
 		
 		// This returns a vector from an angle with a given legnth
-		public static Vector3D FromAngleXY(float angle, float length)
+		public static Vector3D FromAngleXY(double angle, double length)
 		{
 			// Return vector from angle
 			return FromAngleXY(angle) * length;
 		}
 
 		// This returns a vector from an angle with a given legnth
-		public static Vector3D FromAngleXYZ(float anglexy, float anglez)
+		public static Vector3D FromAngleXYZ(double anglexy, double anglez)
 		{
 			// Calculate x y and z
-			float ax = (float)Math.Sin(anglexy) * (float)Math.Cos(anglez);
-			float ay = -(float)Math.Cos(anglexy) * (float)Math.Cos(anglez);
-			float az = (float)Math.Sin(anglez);
+			double ax = Math.Sin(anglexy) * Math.Cos(anglez);
+			double ay = -Math.Cos(anglexy) * Math.Cos(anglez);
+			double az = Math.Sin(anglez);
 
 			// Return vector
 			return new Vector3D(ax, ay, az);
@@ -247,7 +247,7 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		//mxd
-		public static Vector3D Transform(float x, float y, float z, Matrix m)
+		public static Vector3D Transform(double x, double y, double z, Matrix m)
 		{
 			return new Vector3D
 			{
@@ -262,37 +262,37 @@ namespace CodeImp.DoomBuilder.Geometry
 		#region ================== Methods
 
 		// This calculates the angle
-		public float GetAngleXY()
+		public double GetAngleXY()
 		{
 			// Calculate and return the angle
-			return -(float)Math.Atan2(-y, x) + Angle2D.PIHALF;//mxd // (float)Math.PI * 0.5f;
+			return -Math.Atan2(-y, x) + Angle2D.PIHALF;//mxd // (float)Math.PI * 0.5f;
 		}
 
 		// This calculates the angle
-		public float GetAngleZ()
+		public double GetAngleZ()
 		{
 			Vector2D xy = new Vector2D(x, y);
 
 			// Calculate and return the angle
-			return (float)Math.Atan2(xy.GetLength(), z) + Angle2D.PIHALF;//mxd // (float)Math.PI * 0.5f;
+			return Math.Atan2(xy.GetLength(), z) + Angle2D.PIHALF;//mxd // (float)Math.PI * 0.5f;
 		}
 
 		// This calculates the length
-		public float GetLength()
+		public double GetLength()
 		{
 			// Calculate and return the length
-			return (float)Math.Sqrt(x * x + y * y + z * z);
+			return Math.Sqrt(x * x + y * y + z * z);
 		}
 
 		// This calculates the squared length
-		public float GetLengthSq()
+		public double GetLengthSq()
 		{
 			// Calculate and return the length
 			return x * x + y * y + z * z;
 		}
 
 		// This calculates the length
-		public float GetManhattanLength()
+		public double GetManhattanLength()
 		{
 			// Calculate and return the length
 			return Math.Abs(x) + Math.Abs(y) + Math.Abs(z);
@@ -301,11 +301,11 @@ namespace CodeImp.DoomBuilder.Geometry
 		// This normalizes the vector
 		public Vector3D GetNormal()
 		{
-			float lensq = this.GetLengthSq();
+			double lensq = this.GetLengthSq();
 			if(lensq > TINY_VALUE)
 			{
 				// Divide each element by the length
-				float mul = 1f / (float)Math.Sqrt(lensq);
+				double mul = 1f / Math.Sqrt(lensq);
 				return new Vector3D(x * mul, y * mul, z * mul);
 			}
 			else
@@ -316,14 +316,14 @@ namespace CodeImp.DoomBuilder.Geometry
 		}
 
 		// This scales the vector
-		public Vector3D GetScaled(float s)
+		public Vector3D GetScaled(double s)
 		{
 			// Scale the vector
 			return new Vector3D(x * s, y * s, z * s);
 		}
 
 		// This changes the vector length
-		public Vector3D GetFixedLength(float l)
+		public Vector3D GetFixedLength(double l)
 		{
 			// Normalize, then scale
 			return this.GetNormal().GetScaled(l);
@@ -344,7 +344,7 @@ namespace CodeImp.DoomBuilder.Geometry
 		// Checks if the Vector has valid values for x, y and z
 		public bool IsFinite()
 		{
-			return !float.IsNaN(x) && !float.IsNaN(y) && !float.IsNaN(z) && !float.IsInfinity(x) && !float.IsInfinity(y) && !float.IsInfinity(z);
+			return !double.IsNaN(x) && !double.IsNaN(y) && !double.IsNaN(z) && !double.IsInfinity(x) && !double.IsInfinity(y) && !double.IsInfinity(z);
 		}
 
 		//mxd. Addeed to make compiler a bit more happy...
diff --git a/Source/Core/IO/DeserializerStream.cs b/Source/Core/IO/DeserializerStream.cs
index 1b7a29490f6d45c70056e35caede66d46c6b9c67..8a661a15f838b4354b311a5504b827c0a973e64f 100755
--- a/Source/Core/IO/DeserializerStream.cs
+++ b/Source/Core/IO/DeserializerStream.cs
@@ -124,6 +124,8 @@ namespace CodeImp.DoomBuilder.IO
 
 		public void rwFloat(ref float v) { v = reader.ReadSingle(); }
 
+		public void rwDouble(ref double v) { v = reader.ReadDouble(); }
+
 		public void rwBool(ref bool v) { v = reader.ReadBoolean(); }
 
 		public void rwVector2D(ref Vector2D v)
@@ -158,6 +160,8 @@ namespace CodeImp.DoomBuilder.IO
 
 		public void wFloat(float v) { General.Fail("Write-only is not supported on deserialization stream. Consider passing the element by reference for bidirectional support."); }
 
+		public void wDouble(double v) { General.Fail("Write-only is not supported on deserialization stream. Consider passing the element by reference for bidirectional support."); }
+
 		public void wBool(bool v) { General.Fail("Write-only is not supported on deserialization stream. Consider passing the element by reference for bidirectional support."); }
 
 		public void wVector2D(Vector2D v)
@@ -193,6 +197,8 @@ namespace CodeImp.DoomBuilder.IO
 
 		public void rFloat(out float v) { v = reader.ReadSingle(); }
 
+		public void rDouble(out double v) { v = reader.ReadDouble(); }
+
 		public void rBool(out bool v) { v = reader.ReadBoolean(); }
 
 		public void rVector2D(out Vector2D v)
diff --git a/Source/Core/IO/IReadWriteStream.cs b/Source/Core/IO/IReadWriteStream.cs
index de63c3cec62d032e8744bd635e26b75497fb0ca6..8c6bcb20d774b455ac2d0bc844d47f85144da670 100755
--- a/Source/Core/IO/IReadWriteStream.cs
+++ b/Source/Core/IO/IReadWriteStream.cs
@@ -41,6 +41,7 @@ namespace CodeImp.DoomBuilder.IO
 		void rwUShort(ref ushort v);
 		void rwULong(ref ulong v);
 		void rwFloat(ref float v);
+		void rwDouble(ref double v);
 		void rwVector2D(ref Vector2D v);
 		void rwVector3D(ref Vector3D v);
 		void rwBool(ref bool v);
@@ -55,6 +56,7 @@ namespace CodeImp.DoomBuilder.IO
 		void wUShort(ushort v);
 		void wULong(ulong v);
 		void wFloat(float v);
+		void wDouble(double v);
 		void wVector2D(Vector2D v);
 		void wVector3D(Vector3D v);
 		void wBool(bool v);
@@ -69,6 +71,7 @@ namespace CodeImp.DoomBuilder.IO
 		void rUShort(out ushort v);
 		void rULong(out ulong v);
 		void rFloat(out float v);
+		void rDouble(out double v);
 		void rVector2D(out Vector2D v);
 		void rVector3D(out Vector3D v);
 		void rBool(out bool v);
diff --git a/Source/Core/IO/SerializerStream.cs b/Source/Core/IO/SerializerStream.cs
index c792334f94891d810d4b766b37650b13e40e52f9..091c6769523acad7419f335982bbfe2623e15926 100755
--- a/Source/Core/IO/SerializerStream.cs
+++ b/Source/Core/IO/SerializerStream.cs
@@ -120,6 +120,8 @@ namespace CodeImp.DoomBuilder.IO
 
 		public void rwFloat(ref float v) { writer.Write(v); }
 
+		public void rwDouble(ref double v) { writer.Write(v); }
+
 		public void rwBool(ref bool v) { writer.Write(v); }
 
 		public void rwVector2D(ref Vector2D v)
@@ -162,6 +164,8 @@ namespace CodeImp.DoomBuilder.IO
 
 		public void wFloat(float v) { writer.Write(v); }
 
+		public void wDouble(double v) { writer.Write(v); }
+
 		public void wBool(bool v) { writer.Write(v); }
 
 		public void wVector2D(Vector2D v)
@@ -196,6 +200,8 @@ namespace CodeImp.DoomBuilder.IO
 
 		public void rFloat(out float v) { v = 0; General.Fail("Read-only is not supported on serialization stream. Consider passing the element by reference for bidirectional support."); }
 
+		public void rDouble(out double v) { v = 0; General.Fail("Read-only is not supported on serialization stream. Consider passing the element by reference for bidirectional support."); }
+
 		public void rBool(out bool v) { v = false; General.Fail("Read-only is not supported on serialization stream. Consider passing the element by reference for bidirectional support."); }
 
 		public void rVector2D(out Vector2D v)
diff --git a/Source/Core/IO/UniversalStreamWriter.cs b/Source/Core/IO/UniversalStreamWriter.cs
index e9a3016ed30493c0f72a016a9669db7a38089b13..63d90f1ee9feaabab094005caf6829052a9dec71 100755
--- a/Source/Core/IO/UniversalStreamWriter.cs
+++ b/Source/Core/IO/UniversalStreamWriter.cs
@@ -302,7 +302,7 @@ namespace CodeImp.DoomBuilder.IO
 					coll.Add("floorplane_b", Math.Round(s.FloorSlope.y, Sector.SLOPE_DECIMALS));
 					coll.Add("floorplane_c", Math.Round(s.FloorSlope.z, Sector.SLOPE_DECIMALS));
 					coll.Add("floorplane_d",
-						(float.IsNaN(s.FloorSlopeOffset) ? 0f : Math.Round(s.FloorSlopeOffset, Sector.SLOPE_DECIMALS)));
+						(double.IsNaN(s.FloorSlopeOffset) ? 0f : Math.Round(s.FloorSlopeOffset, Sector.SLOPE_DECIMALS)));
 				}
 
 				if(s.CeilSlope.GetLengthSq() > 0) 
@@ -311,7 +311,7 @@ namespace CodeImp.DoomBuilder.IO
 					coll.Add("ceilingplane_b", Math.Round(s.CeilSlope.y, Sector.SLOPE_DECIMALS));
 					coll.Add("ceilingplane_c", Math.Round(s.CeilSlope.z, Sector.SLOPE_DECIMALS));
 					coll.Add("ceilingplane_d",
-						(float.IsNaN(s.CeilSlopeOffset) ? 0f : Math.Round(s.CeilSlopeOffset, Sector.SLOPE_DECIMALS)));
+						(double.IsNaN(s.CeilSlopeOffset) ? 0f : Math.Round(s.CeilSlopeOffset, Sector.SLOPE_DECIMALS)));
 				}
 
 				//mxd. Flags
diff --git a/Source/Core/Map/MapSet.cs b/Source/Core/Map/MapSet.cs
index 9dd2bfe2519adf0037de2eb348d1a71eabd5e5dd..e9993bca4dc35c15e83d6a6eecd76aac91e77382 100755
--- a/Source/Core/Map/MapSet.cs
+++ b/Source/Core/Map/MapSet.cs
@@ -1859,10 +1859,10 @@ namespace CodeImp.DoomBuilder.Map
 		/// <summary>This creates an area from vertices.</summary>
 		public static RectangleF CreateArea(ICollection<Vertex> verts)
 		{
-			float l = float.MaxValue;
-			float t = float.MaxValue;
-			float r = float.MinValue;
-			float b = float.MinValue;
+			double l = double.MaxValue;
+			double t = double.MaxValue;
+			double r = double.MinValue;
+			double b = double.MinValue;
 
 			// Go for all vertices
 			foreach(Vertex v in verts)
@@ -1875,16 +1875,16 @@ namespace CodeImp.DoomBuilder.Map
 			}
 
 			// Return a rect
-			return new RectangleF(l, t, r - l, b - t);
+			return new RectangleF((float)l, (float)t, (float)(r - l), (float)(b - t));
 		}
 
 		/// <summary>This increases and existing area with the given vertices.</summary>
 		public static RectangleF IncreaseArea(RectangleF area, ICollection<Vertex> verts)
 		{
-			float l = area.Left;
-			float t = area.Top;
-			float r = area.Right;
-			float b = area.Bottom;
+			double l = area.Left;
+			double t = area.Top;
+			double r = area.Right;
+			double b = area.Bottom;
 			
 			// Go for all vertices
 			foreach(Vertex v in verts)
@@ -1897,16 +1897,16 @@ namespace CodeImp.DoomBuilder.Map
 			}
 			
 			// Return a rect
-			return new RectangleF(l, t, r - l, b - t);
+			return new RectangleF((float)l, (float)t, (float)(r - l), (float)(b - t));
 		}
 
 		/// <summary>This increases and existing area with the given things.</summary>
 		public static RectangleF IncreaseArea(RectangleF area, ICollection<Thing> things)
 		{
-			float l = area.Left;
-			float t = area.Top;
-			float r = area.Right;
-			float b = area.Bottom;
+			double l = area.Left;
+			double t = area.Top;
+			double r = area.Right;
+			double b = area.Bottom;
 			
 			// Go for all vertices
 			foreach(Thing th in things)
@@ -1919,16 +1919,16 @@ namespace CodeImp.DoomBuilder.Map
 			}
 			
 			// Return a rect
-			return new RectangleF(l, t, r - l, b - t);
+			return new RectangleF((float)l, (float)t, (float)(r - l), (float)(b - t));
 		}
 
 		/// <summary>This increases and existing area with the given vertices.</summary>
 		public static RectangleF IncreaseArea(RectangleF area, ICollection<Vector2D> verts)
 		{
-			float l = area.Left;
-			float t = area.Top;
-			float r = area.Right;
-			float b = area.Bottom;
+			double l = area.Left;
+			double t = area.Top;
+			double r = area.Right;
+			double b = area.Bottom;
 			
 			// Go for all vertices
 			foreach(Vector2D v in verts)
@@ -1941,34 +1941,34 @@ namespace CodeImp.DoomBuilder.Map
 			}
 			
 			// Return a rect
-			return new RectangleF(l, t, r - l, b - t);
+			return new RectangleF((float)l, (float)t, (float)(r - l), (float)(b - t));
 		}
 
 		/// <summary>This increases and existing area with the given vertex.</summary>
 		public static RectangleF IncreaseArea(RectangleF area, Vector2D vert)
 		{
-			float l = area.Left;
-			float t = area.Top;
-			float r = area.Right;
-			float b = area.Bottom;
+			double l = area.Left;
+			double t = area.Top;
+			double r = area.Right;
+			double b = area.Bottom;
 			
 			// Adjust boundaries by vertices
 			if(vert.x < l) l = vert.x;
 			if(vert.x > r) r = vert.x;
 			if(vert.y < t) t = vert.y;
 			if(vert.y > b) b = vert.y;
-			
+
 			// Return a rect
-			return new RectangleF(l, t, r - l, b - t);
+			return new RectangleF((float)l, (float)t, (float)(r - l), (float)(b - t));
 		}
 
 		/// <summary>This creates an area from linedefs.</summary>
 		public static RectangleF CreateArea(ICollection<Linedef> lines)
 		{
-			float l = float.MaxValue;
-			float t = float.MaxValue;
-			float r = float.MinValue;
-			float b = float.MinValue;
+			double l = double.MaxValue;
+			double t = double.MaxValue;
+			double r = double.MinValue;
+			double b = double.MinValue;
 
 			// Go for all linedefs
 			foreach(Linedef ld in lines)
@@ -1985,16 +1985,16 @@ namespace CodeImp.DoomBuilder.Map
 			}
 
 			// Return a rect
-			return new RectangleF(l, t, r - l, b - t);
+			return new RectangleF((float)l, (float)t, (float)(r - l), (float)(b - t));
 		}
 
 		/// <summary>This increases and existing area with the given linedefs.</summary>
 		public static RectangleF IncreaseArea(RectangleF area, ICollection<Linedef> lines) //mxd
 		{
-			float l = area.Left;
-			float t = area.Top;
-			float r = area.Right;
-			float b = area.Bottom;
+			double l = area.Left;
+			double t = area.Top;
+			double r = area.Right;
+			double b = area.Bottom;
 
 			// Go for all vertices
 			foreach(Linedef ld in lines)
@@ -2011,7 +2011,7 @@ namespace CodeImp.DoomBuilder.Map
 			}
 
 			// Return a rect
-			return new RectangleF(l, t, r - l, b - t);
+			return new RectangleF((float)l, (float)t, (float)(r - l), (float)(b - t));
 		}
 
 		/// <summary>This filters lines by a rectangular area.</summary>
@@ -3152,7 +3152,7 @@ namespace CodeImp.DoomBuilder.Map
 
 							// Check for intersection
 							Vector2D intersection = Line2D.GetIntersectionPoint(new Line2D(l1), new Line2D(l2), true);
-							if(!float.IsNaN(intersection.x))
+							if(!double.IsNaN(intersection.x))
 							{
 								//mxd. Round to map format precision
 								intersection.x = (float)Math.Round(intersection.x, General.Map.FormatInterface.VertexDecimals);
@@ -3461,13 +3461,13 @@ namespace CodeImp.DoomBuilder.Map
 		public static Vertex NearestVertex(ICollection<Vertex> selection, Vector2D pos)
 		{
 			Vertex closest = null;
-			float distance = float.MaxValue;
+			double distance = double.MaxValue;
 
 			// Go for all vertices in selection
 			foreach(Vertex v in selection)
 			{
 				// Calculate distance and check if closer than previous find
-				float d = v.DistanceToSq(pos);
+				double d = v.DistanceToSq(pos);
 				if(d < distance)
 				{
 					// This one is closer
@@ -3484,13 +3484,13 @@ namespace CodeImp.DoomBuilder.Map
 		public static Thing NearestThing(ICollection<Thing> selection, Vector2D pos)
 		{
 			Thing closest = null;
-			float distance = float.MaxValue;
+			double distance = double.MaxValue;
 
 			// Go for all things in selection
 			foreach(Thing t in selection)
 			{
 				// Calculate distance and check if closer than previous find
-				float d = t.DistanceToSq(pos);
+				double d = t.DistanceToSq(pos);
 				if(d < distance)
 				{
 					// This one is closer
@@ -3507,7 +3507,7 @@ namespace CodeImp.DoomBuilder.Map
 		public static Thing NearestThing(ICollection<Thing> selection, Thing thing) 
 		{
 			Thing closest = null;
-			float distance = float.MaxValue;
+			double distance = double.MaxValue;
 
 			// Go for all things in selection
 			foreach(Thing t in selection) 
@@ -3515,7 +3515,7 @@ namespace CodeImp.DoomBuilder.Map
 				if(t == thing) continue;
 
 				// Calculate distance and check if closer than previous find
-				float d = t.DistanceToSq(thing.Position);
+				double d = t.DistanceToSq(thing.Position);
 				if(d < distance) 
 				{
 					// This one is closer
@@ -3529,17 +3529,17 @@ namespace CodeImp.DoomBuilder.Map
 		}
 
 		/// <summary>This finds the vertex closest to the specified position.</summary>
-		public static Vertex NearestVertexSquareRange(ICollection<Vertex> selection, Vector2D pos, float maxrange)
+		public static Vertex NearestVertexSquareRange(ICollection<Vertex> selection, Vector2D pos, double maxrange)
 		{
-			RectangleF range = RectangleF.FromLTRB(pos.x - maxrange, pos.y - maxrange, pos.x + maxrange, pos.y + maxrange);
+			RectangleF range = RectangleF.FromLTRB((float)(pos.x - maxrange), (float)(pos.y - maxrange), (float)(pos.x + maxrange), (float)(pos.y + maxrange));
 			Vertex closest = null;
-			float distance = float.MaxValue;
+			double distance = double.MaxValue;
 
 			// Go for all vertices in selection
 			foreach(Vertex v in selection)
 			{
-				float px = v.Position.x;
-				float py = v.Position.y;
+				double px = v.Position.x;
+				double py = v.Position.y;
 				
 				//mxd. Within range?
 				if((v.Position.x < range.Left) || (v.Position.x > range.Right) 
@@ -3547,7 +3547,7 @@ namespace CodeImp.DoomBuilder.Map
 					continue;
 
 				// Close than previous find?
-				float d = Math.Abs(px - pos.x) + Math.Abs(py - pos.y);
+				double d = Math.Abs(px - pos.x) + Math.Abs(py - pos.y);
 				if(d < distance) 
 				{
 					// This one is closer
@@ -3563,19 +3563,19 @@ namespace CodeImp.DoomBuilder.Map
 		/// <summary>This finds the thing closest to the specified position.</summary>
 		public static Thing NearestThingSquareRange(ICollection<Thing> selection, Vector2D pos, float maxrange)
 		{
-			RectangleF range = RectangleF.FromLTRB(pos.x - maxrange, pos.y - maxrange, pos.x + maxrange, pos.y + maxrange);
+			RectangleF range = RectangleF.FromLTRB((float)(pos.x - maxrange), (float)(pos.y - maxrange), (float)(pos.x + maxrange), (float)(pos.y + maxrange));
 			Thing closest = null;
-			float distance = float.MaxValue;
-			float size = float.MaxValue; //mxd
+			double distance = double.MaxValue;
+			double size = double.MaxValue; //mxd
 
 			// Go for all things in selection
 			foreach(Thing t in selection)
 			{
-				float px = t.Position.x;
-				float py = t.Position.y;
+				double px = t.Position.x;
+				double py = t.Position.y;
 
 				//mxd. Determine displayed size
-				float ts;
+				double ts;
 				if(t.FixedSize && General.Map.Renderer2D.Scale > 1.0f)
 					ts = t.Size / General.Map.Renderer2D.Scale;
 				else if(General.Settings.FixedThingsScale && t.Size * General.Map.Renderer2D.Scale > Renderer2D.FIXED_THING_SIZE)
@@ -3587,7 +3587,7 @@ namespace CodeImp.DoomBuilder.Map
 				if(px < range.Left - ts || px > range.Right + ts || py < range.Top - ts || py > range.Bottom + ts) continue;
 
 				// Closer than previous find? mxd. Or smaller when distance is the same?
-				float d = Math.Abs(px - pos.x) + Math.Abs(py - pos.y);
+				double d = Math.Abs(px - pos.x) + Math.Abs(py - pos.y);
 				if(d < distance || (d == distance && ts < size))
 				{
 					// This one is closer
diff --git a/Source/Core/Map/Sector.cs b/Source/Core/Map/Sector.cs
index 0a197f8735f5fb7e3c144647dec4ce5424a97a1b..b7b35a50b5ba60df731c64f85c7c4b05ec7163bb 100755
--- a/Source/Core/Map/Sector.cs
+++ b/Source/Core/Map/Sector.cs
@@ -91,9 +91,9 @@ namespace CodeImp.DoomBuilder.Map
 
 		//mxd. Slopes
 		private Vector3D floorslope;
-		private float flooroffset;
+		private double flooroffset;
 		private Vector3D ceilslope;
-		private float ceiloffset;
+		private double ceiloffset;
 		
 		#endregion
 
@@ -140,9 +140,9 @@ namespace CodeImp.DoomBuilder.Map
 
 		//mxd. Slopes
 		public Vector3D FloorSlope { get { return floorslope; } set { BeforePropsChange(); floorslope = value; updateneeded = true; } }
-		public float FloorSlopeOffset { get { return flooroffset; } set { BeforePropsChange(); flooroffset = value; updateneeded = true; } }
+		public double FloorSlopeOffset { get { return flooroffset; } set { BeforePropsChange(); flooroffset = value; updateneeded = true; } }
 		public Vector3D CeilSlope { get { return ceilslope; } set { BeforePropsChange(); ceilslope = value; updateneeded = true; } }
-		public float CeilSlopeOffset { get { return ceiloffset; } set { BeforePropsChange(); ceiloffset = value; updateneeded = true; } }
+		public double CeilSlopeOffset { get { return ceiloffset; } set { BeforePropsChange(); ceiloffset = value; updateneeded = true; } }
         internal int LastProcessed { get { return lastProcessed; } set { lastProcessed = value; } }
 
 		#endregion
@@ -292,9 +292,9 @@ namespace CodeImp.DoomBuilder.Map
 			}
 
 			//mxd. Slopes
-			s.rwFloat(ref flooroffset);
+			s.rwDouble(ref flooroffset);
 			s.rwVector3D(ref floorslope);
-			s.rwFloat(ref ceiloffset);
+			s.rwDouble(ref ceiloffset);
 			s.rwVector3D(ref ceilslope);
 		}
 		
@@ -393,8 +393,8 @@ namespace CodeImp.DoomBuilder.Map
 				flatvertices = new FlatVertex[triangles.Vertices.Count];
 				for(int i = 0; i < triangles.Vertices.Count; i++)
 				{
-					flatvertices[i].x = triangles.Vertices[i].x;
-					flatvertices[i].y = triangles.Vertices[i].y;
+					flatvertices[i].x = (float)triangles.Vertices[i].x;
+					flatvertices[i].y = (float)triangles.Vertices[i].y;
 					flatvertices[i].z = 1.0f;
 					flatvertices[i].c = brightint;
                     flatvertices[i].u = flatvertices[i].x;
@@ -584,10 +584,10 @@ namespace CodeImp.DoomBuilder.Map
 			if(sidedefs.Count == 0) return new RectangleF(); //mxd
 			
 			// Setup
-			float left = float.MaxValue;
-			float top = float.MaxValue;
-			float right = float.MinValue;
-			float bottom = float.MinValue;
+			double left = double.MaxValue;
+			double top = double.MaxValue;
+			double right = double.MinValue;
+			double bottom = double.MinValue;
 
 			HashSet<Vertex> processed = new HashSet<Vertex>(); //mxd
 
@@ -615,7 +615,7 @@ namespace CodeImp.DoomBuilder.Map
 			}
 			
 			// Return rectangle
-			return new RectangleF(left, top, right - left, bottom - top);
+			return new RectangleF((float)left, (float)top, (float)(right - left), (float)(bottom - top));
 		}
 
 		//mxd
@@ -652,7 +652,7 @@ namespace CodeImp.DoomBuilder.Map
 			if(General.Map.UDMF)
 			{
 				// UDMF Sector slope?
-				if(s.FloorSlope.GetLengthSq() > 0 && !float.IsNaN(s.FloorSlopeOffset / s.FloorSlope.z)) 
+				if(s.FloorSlope.GetLengthSq() > 0 && !double.IsNaN(s.FloorSlopeOffset / s.FloorSlope.z)) 
 					return new Geometry.Plane(s.FloorSlope, s.FloorSlopeOffset);
 
 				if(s.sidedefs.Count == 3)
@@ -671,7 +671,7 @@ namespace CodeImp.DoomBuilder.Map
 						verts[index] = new Vector3D(v.Position);
 
 						// Check floor
-						if(!float.IsNaN(v.ZFloor)) 
+						if(!double.IsNaN(v.ZFloor)) 
 						{
 							//vertex offset is absolute
 							verts[index].z = v.ZFloor;
@@ -732,7 +732,7 @@ namespace CodeImp.DoomBuilder.Map
 			if(General.Map.UDMF) 
 			{
 				// UDMF Sector slope?
-				if(s.CeilSlope.GetLengthSq() > 0 && !float.IsNaN(s.CeilSlopeOffset / s.CeilSlope.z))
+				if(s.CeilSlope.GetLengthSq() > 0 && !double.IsNaN(s.CeilSlopeOffset / s.CeilSlope.z))
 					return new Geometry.Plane(s.CeilSlope, s.CeilSlopeOffset);
 
 				if(s.sidedefs.Count == 3) 
diff --git a/Source/Core/Map/Thing.cs b/Source/Core/Map/Thing.cs
index b174a0bfae6aa65fac11a6ed1bd70fb10f40681c..d0069a0612c7ae7571d283626133d3dac7bdb4e0 100755
--- a/Source/Core/Map/Thing.cs
+++ b/Source/Core/Map/Thing.cs
@@ -60,7 +60,7 @@ namespace CodeImp.DoomBuilder.Map
         private GZGeneral.LightData dynamiclighttype;
 		private Vector3D pos;
 		private int angledoom;		// Angle as entered / stored in file
-		private float anglerad;		// Angle in radians
+		private double anglerad;		// Angle in radians
 		private Dictionary<string, bool> flags;
 		private int tag;
 		private int action;
@@ -70,8 +70,8 @@ namespace CodeImp.DoomBuilder.Map
 		private SizeF spritescale; //mxd
 		private int pitch; //mxd. Used in model rendering
 		private int roll; //mxd. Used in model rendering
-		private float pitchrad; //mxd
-		private float rollrad; //mxd
+		private double pitchrad; //mxd
+		private double rollrad; //mxd
 		private bool highlighted; //mxd
 
 		//mxd. GZDoom rendering properties
@@ -100,11 +100,11 @@ namespace CodeImp.DoomBuilder.Map
 		public float ScaleX { get { return scaleX; } } //mxd. This is UDMF property, not actual scale!
 		public float ScaleY { get { return scaleY; } } //mxd. This is UDMF property, not actual scale!
 		public int Pitch { get { return pitch; } } //mxd
-		public float PitchRad { get { return pitchrad; } }
+		public double PitchRad { get { return pitchrad; } }
 		public int Roll { get { return roll; } } //mxd
-		public float RollRad { get { return rollrad; } }
+		public double RollRad { get { return rollrad; } }
 		public SizeF ActorScale { get { return spritescale; } } //mxd. Actor scale set in DECORATE
-		public float Angle { get { return anglerad; } }
+		public double Angle { get { return anglerad; } }
 		public int AngleDoom { get { return angledoom; } }
 		internal Dictionary<string, bool> Flags { get { return flags; } }
 		public int Action { get { return action; } set { BeforePropsChange(); action = value; } }
@@ -399,7 +399,7 @@ namespace CodeImp.DoomBuilder.Map
 
 		// This moves the thing
 		// NOTE: This does not update sector! (call DetermineSector)
-		public void Move(float x, float y, float zoffset)
+		public void Move(double x, double y, double zoffset)
 		{
 			BeforePropsChange();
 			
@@ -411,7 +411,7 @@ namespace CodeImp.DoomBuilder.Map
 		}
 		
 		// This rotates the thing
-		public void Rotate(float newangle)
+		public void Rotate(double newangle)
 		{
 			BeforePropsChange();
 			
@@ -446,7 +446,7 @@ namespace CodeImp.DoomBuilder.Map
             switch (rendermode)
 			{
 				case ThingRenderMode.MODEL:
-                    float pmult = General.Map.Config.BuggyModelDefPitch ? 1 : -1;
+					double pmult = General.Map.Config.BuggyModelDefPitch ? 1 : -1;
                     ModelData md = General.Map.Data.ModeldefEntries[type];
                     if (md.InheritActorPitch || md.UseActorPitch)
                         pitchrad = Angle2D.DegToRad(pmult * (md.InheritActorPitch ? -pitch : pitch));
@@ -680,13 +680,13 @@ namespace CodeImp.DoomBuilder.Map
 		}
 		
 		// This returns the distance from given coordinates
-		public float DistanceToSq(Vector2D p)
+		public double DistanceToSq(Vector2D p)
 		{
 			return Vector2D.DistanceSq(p, pos);
 		}
 
 		// This returns the distance from given coordinates
-		public float DistanceTo(Vector2D p)
+		public double DistanceTo(Vector2D p)
 		{
 			return Vector2D.Distance(p, pos);
 		}
diff --git a/Source/Core/Map/Vertex.cs b/Source/Core/Map/Vertex.cs
index e2f4e5aff97fd5b369cbf6ace182b4a3e5bec525..cb957ee0131cbea095f5bc00a49960bad2ffae7c 100755
--- a/Source/Core/Map/Vertex.cs
+++ b/Source/Core/Map/Vertex.cs
@@ -95,8 +95,8 @@ namespace CodeImp.DoomBuilder.Map
 		{
             // [ZZ] Check coordinates
             //      Something in GZDB creates vertices with NaN coordinates. This needs to be found.
-            if (float.IsNaN(pos.x) ||
-                float.IsNaN(pos.y))
+            if (double.IsNaN(pos.x) ||
+				double.IsNaN(pos.y))
             {
                 throw new Exception("Tried to create a vertex at coordinates NaN,NaN");
             }
@@ -241,13 +241,13 @@ namespace CodeImp.DoomBuilder.Map
 		}
 		
 		// This returns the distance from given coordinates
-		public float DistanceToSq(Vector2D p)
+		public double DistanceToSq(Vector2D p)
 		{
 			return (p.x - pos.x) * (p.x - pos.x) + (p.y - pos.y) * (p.y - pos.y);
 		}
 		
 		// This returns the distance from given coordinates
-		public float DistanceTo(Vector2D p)
+		public double DistanceTo(Vector2D p)
 		{
 			return Vector2D.Distance(p, pos);
 		}
@@ -267,8 +267,8 @@ namespace CodeImp.DoomBuilder.Map
 				pos = newpos;
 
 				#if DEBUG
-				if(float.IsNaN(pos.x) || float.IsNaN(pos.y) ||
-				   float.IsInfinity(pos.x) || float.IsInfinity(pos.y))
+				if(double.IsNaN(pos.x) || double.IsNaN(pos.y) ||
+				   double.IsInfinity(pos.x) || double.IsInfinity(pos.y))
 				{
 					General.Fail("Invalid vertex position! The given vertex coordinates cannot be NaN or Infinite.");
 				}
diff --git a/Source/Core/Rendering/RenderDevice.cs b/Source/Core/Rendering/RenderDevice.cs
index 134a7ec74d70a9ff774b80ef918a4cf04cffa3db..bb64ecfa5a64204dbfe67444adb9744664d52c2e 100755
--- a/Source/Core/Rendering/RenderDevice.cs
+++ b/Source/Core/Rendering/RenderDevice.cs
@@ -688,7 +688,7 @@ namespace CodeImp.DoomBuilder.Rendering
 		// This makes a Vector3 from Vector3D
 		public static Vector3f V3(Vector3D v3d)
 		{
-			return new Vector3f(v3d.x, v3d.y, v3d.z);
+			return new Vector3f((float)v3d.x, (float)v3d.y, (float)v3d.z);
 		}
 
 		// This makes a Vector3D from Vector3
@@ -700,7 +700,7 @@ namespace CodeImp.DoomBuilder.Rendering
 		// This makes a Vector2 from Vector2D
 		public static Vector2f V2(Vector2D v2d)
 		{
-			return new Vector2f(v2d.x, v2d.y);
+			return new Vector2f((float)v2d.x, (float)v2d.y);
 		}
 
 		// This makes a Vector2D from Vector2
diff --git a/Source/Core/Rendering/Renderer2D.cs b/Source/Core/Rendering/Renderer2D.cs
index 65cbcfddf6ebf90221b85b27950810fd1a538fdf..8db8938fece3a3c6fd04034637f2d3d92c921662 100755
--- a/Source/Core/Rendering/Renderer2D.cs
+++ b/Source/Core/Rendering/Renderer2D.cs
@@ -430,7 +430,7 @@ namespace CodeImp.DoomBuilder.Rendering
 		}
 		
 		// This changes view position
-		public void PositionView(float x, float y)
+		public void PositionView(double x, double y)
 		{
 			// Change position in world coordinates
 			offsetx = x;
@@ -466,8 +466,8 @@ namespace CodeImp.DoomBuilder.Rendering
             viewmatrix = Matrix.Scaling(2.0f / windowsize.Width, -2.0f / windowsize.Height, 1.0f) * Matrix.Translation(-1.0f, 1.0f, 0.0f);
 			Vector2D lt = DisplayToMap(new Vector2D(0.0f, 0.0f));
 			Vector2D rb = DisplayToMap(new Vector2D(windowsize.Width, windowsize.Height));
-			viewport = new RectangleF(lt.x, lt.y, rb.x - lt.x, rb.y - lt.y);
-			yviewport = new RectangleF(lt.x, rb.y, rb.x - lt.x, lt.y - rb.y);
+			viewport = new RectangleF((float)lt.x, (float)lt.y, (float)(rb.x - lt.x), (float)(rb.y - lt.y));
+			yviewport = new RectangleF((float)lt.x, (float)rb.y, (float)(rb.x - lt.x), (float)(lt.y - rb.y));
 		}
 
 		// This sets the world matrix for transformation
@@ -886,8 +886,8 @@ namespace CodeImp.DoomBuilder.Rendering
 			Vector2D dx = new Vector2D((float)Math.Cos(angle), (float)Math.Sin(angle));
 			Vector2D dy = new Vector2D((float)-Math.Sin(angle), (float)Math.Cos(angle));
 
-			float maxextent = Math.Max(mapsize.x, mapsize.y);
-			RectangleF bounds = new RectangleF(tlb.x, tlb.y, rbb.x - tlb.x, rbb.y - tlb.y);
+			double maxextent = Math.Max(mapsize.x, mapsize.y);
+			RectangleF bounds = new RectangleF((float)tlb.x, (float)tlb.y, (float)(rbb.x - tlb.x), (float)(rbb.y - tlb.y));
 			bounds.Intersect(new RectangleF(0, 0, windowsize.Width, windowsize.Height));
 
 			bool xminintersect = true, xmaxintersect = true, yminintersect = true, ymaxintersect = true;
@@ -1500,8 +1500,8 @@ 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 position = Matrix.Translation(screenpos.x, screenpos.y, 0.0f);
+							Matrix rotation = Matrix.RotationY((float)-t.RollRad) * Matrix.RotationX((float)-t.PitchRad) * Matrix.RotationZ((float)t.Angle);
+							Matrix position = Matrix.Translation((float)screenpos.x, (float)screenpos.y, 0.0f);
 							Matrix world = General.Map.Data.ModeldefEntries[t.Type].Transform * modelscale * rotation * viewscale * position;
 
 							SetThings2DTransformSettings(world);
@@ -2038,7 +2038,7 @@ namespace CodeImp.DoomBuilder.Rendering
             return new Vector2D(v.x, TransformY(v.y));
         }
 
-        private float TransformY(float y)
+        private double TransformY(double y)
         {
             return windowsize.Height - y;
         }
@@ -2054,9 +2054,9 @@ namespace CodeImp.DoomBuilder.Rendering
 			// Transform vertex coordinates
 			Vector2D v1 = l.Start.Position.GetTransformed(translatex, translatey, scale, -scale);
 			Vector2D v2 = l.End.Position.GetTransformed(translatex, translatey, scale, -scale);
-			
+
 			//mxd. Should we bother?
-			float lengthsq = (v2 - v1).GetLengthSq();
+			double lengthsq = (v2 - v1).GetLengthSq();
 			if(lengthsq < minlinelength) return; //mxd
 
 			// Draw line. mxd: added 3d-floor indication
@@ -2069,8 +2069,8 @@ namespace CodeImp.DoomBuilder.Rendering
 			if(lengthsq < minlinenormallength) return; //mxd
 
 			// Calculate normal indicator
-			float mx = (v2.x - v1.x) * 0.5f;
-			float my = (v2.y - v1.y) * 0.5f;
+			double mx = (v2.x - v1.x) * 0.5f;
+			double my = (v2.y - v1.y) * 0.5f;
 
 			// Draw normal indicator
 			plotter.DrawLineSolid((int)(v1.x + mx), TransformY((int)(v1.y + my)),
@@ -2089,7 +2089,7 @@ namespace CodeImp.DoomBuilder.Rendering
 				Vector2D v2 = l.End.Position.GetTransformed(translatex, translatey, scale, -scale);
 
 				//mxd. Should we bother?
-				float lengthsq = (v2 - v1).GetLengthSq();
+				double lengthsq = (v2 - v1).GetLengthSq();
 				if(lengthsq < minlinelength) continue; //mxd
 
 				// Determine color
@@ -2105,8 +2105,8 @@ namespace CodeImp.DoomBuilder.Rendering
 				if(lengthsq < minlinenormallength) continue; //mxd
 
 				// Calculate normal indicator
-				float mx = (v2.x - v1.x) * 0.5f;
-				float my = (v2.y - v1.y) * 0.5f;
+				double mx = (v2.x - v1.x) * 0.5f;
+				double my = (v2.y - v1.y) * 0.5f;
 
 				// Draw normal indicator
 				plotter.DrawLineSolid((int)(v1.x + mx), TransformY((int)(v1.y + my)),
diff --git a/Source/Core/Rendering/Renderer3D.cs b/Source/Core/Rendering/Renderer3D.cs
index f8e868400f5d1472f3b9b7940cd6a16d41b6a7b6..a95a214182a1b7b6d1694f6a7c3c35bdaddd2e58 100755
--- a/Source/Core/Rendering/Renderer3D.cs
+++ b/Source/Core/Rendering/Renderer3D.cs
@@ -280,18 +280,18 @@ namespace CodeImp.DoomBuilder.Rendering
 			cameraposition = pos;
             Vector3D delta = lookat - pos;
             cameravector = delta.GetNormal();
-            float anglexy = delta.GetAngleXY();
-			float anglez = delta.GetAngleZ();
+			double anglexy = delta.GetAngleXY();
+			double anglez = delta.GetAngleZ();
 
 			// Create frustum
-			frustum = new ProjectedFrustum2D(pos, anglexy, anglez, PROJ_NEAR_PLANE,
-				General.Settings.ViewDistance, Angle2D.DegToRad(General.Settings.VisualFOV));
+			frustum = new ProjectedFrustum2D(pos, (float)anglexy, (float)anglez, PROJ_NEAR_PLANE,
+				General.Settings.ViewDistance, (float)Angle2D.DegToRad(General.Settings.VisualFOV));
 
             // Make the view matrix
             view3d = Matrix.LookAt(RenderDevice.V3(pos), RenderDevice.V3(lookat), new Vector3f(0f, 0f, 1f));
 			
 			// Make the billboard matrix
-			billboard = Matrix.RotationZ(anglexy + Angle2D.PI);
+			billboard = Matrix.RotationZ((float)(anglexy + Angle2D.PI));
 		}
 		
 		// This creates 2D view matrix
@@ -889,7 +889,7 @@ namespace CodeImp.DoomBuilder.Rendering
 						//mxd. Set variables for fog rendering?
 						if(wantedshaderpass > ShaderName.world3d_p7)
 						{
-							graphics.SetUniform(UniformName.campos, new Vector4f(cameraposition.x, cameraposition.y, cameraposition.z, g.FogFactor));
+							graphics.SetUniform(UniformName.campos, new Vector4f((float)cameraposition.x, (float)cameraposition.y, (float)cameraposition.z, g.FogFactor));
 							graphics.SetUniform(UniformName.sectorfogcolor, sector.Sector.FogColor);
 						}
                         
@@ -981,7 +981,7 @@ namespace CodeImp.DoomBuilder.Rendering
 							if(wantedshaderpass > ShaderName.world3d_p7)
 							{
                                 graphics.SetUniform(UniformName.modelnormal, Matrix.Identity);
-                                graphics.SetUniform(UniformName.campos, new Vector4f(cameraposition.x, cameraposition.y, cameraposition.z, t.FogFactor));
+                                graphics.SetUniform(UniformName.campos, new Vector4f((float)cameraposition.x, (float)cameraposition.y, (float)cameraposition.z, t.FogFactor));
 							}
 
 							// Set the colors to use
@@ -1199,7 +1199,7 @@ namespace CodeImp.DoomBuilder.Rendering
                     // Set variables for fog rendering?
                     if (wantedshaderpass > ShaderName.world3d_p7 && g.FogFactor != fogfactor)
                     {
-                        graphics.SetUniform(UniformName.campos, new Vector4f(cameraposition.x, cameraposition.y, cameraposition.z, g.FogFactor));
+                        graphics.SetUniform(UniformName.campos, new Vector4f((float)cameraposition.x, (float)cameraposition.y, (float)cameraposition.z, g.FogFactor));
                         fogfactor = g.FogFactor;
                     }
 
@@ -1326,7 +1326,7 @@ namespace CodeImp.DoomBuilder.Rendering
                             graphics.SetUniform(UniformName.modelnormal, Matrix.Identity);
                             if (t.FogFactor != fogfactor)
 							{
-                                graphics.SetUniform(UniformName.campos, new Vector4f(cameraposition.x, cameraposition.y, cameraposition.z, t.FogFactor));
+                                graphics.SetUniform(UniformName.campos, new Vector4f((float)cameraposition.x, (float)cameraposition.y, (float)cameraposition.z, t.FogFactor));
 								fogfactor = t.FogFactor;
 							}
 						}
@@ -1381,7 +1381,7 @@ namespace CodeImp.DoomBuilder.Rendering
 					if(t.Info.XYBillboard) // Apply billboarding?
 					{
 						return Matrix.Translation(0f, 0f, -t.LocalCenterZ)
-							* Matrix.RotationX(Angle2D.PI - General.Map.VisualCamera.AngleZ)
+							* Matrix.RotationX((float)(Angle2D.PI - General.Map.VisualCamera.AngleZ))
 							* Matrix.Translation(0f, 0f, t.LocalCenterZ)
 							* billboard
 							* t.Position;
@@ -1499,7 +1499,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((float)-t.Thing.RollRad) * Matrix.RotationX((float)-t.Thing.PitchRad) * Matrix.RotationZ((float)t.Thing.Angle);
 
 				world = General.Map.Data.ModeldefEntries[t.Thing.Type].Transform * modelscale * modelrotation * t.Position;
                 graphics.SetUniform(UniformName.world, world);
@@ -1510,7 +1510,7 @@ namespace CodeImp.DoomBuilder.Rendering
                     // this is not right...
                     graphics.SetUniform(UniformName.modelnormal, General.Map.Data.ModeldefEntries[t.Thing.Type].TransformRotation * modelrotation);
                     if (t.Thing.Sector != null) graphics.SetUniform(UniformName.sectorfogcolor, t.Thing.Sector.FogColor);
-                    graphics.SetUniform(UniformName.campos, new Vector4f(cameraposition.x, cameraposition.y, cameraposition.z, t.FogFactor));
+                    graphics.SetUniform(UniformName.campos, new Vector4f((float)cameraposition.x, (float)cameraposition.y, (float)cameraposition.z, t.FogFactor));
 				}
 
                 if (t.Thing.Sector != null)
@@ -1586,7 +1586,7 @@ namespace CodeImp.DoomBuilder.Rendering
 			// Set render settings
 			graphics.SetShader(ShaderName.world3d_skybox);
             graphics.SetTexture(General.Map.Data.SkyBox);
-			graphics.SetUniform(UniformName.campos, new Vector4f(cameraposition.x, cameraposition.y, cameraposition.z, 0f));
+			graphics.SetUniform(UniformName.campos, new Vector4f((float)cameraposition.x, (float)cameraposition.y, (float)cameraposition.z, 0f));
 
 			foreach(VisualGeometry g in geo)
 			{
diff --git a/Source/Core/VisualModes/VisualCamera.cs b/Source/Core/VisualModes/VisualCamera.cs
index e9bf06c60120f52ddbefbf68858e05e67d2b03be..4748d76adea72417bd04ff351d951a99aa9a3c80 100755
--- a/Source/Core/VisualModes/VisualCamera.cs
+++ b/Source/Core/VisualModes/VisualCamera.cs
@@ -14,10 +14,10 @@ namespace CodeImp.DoomBuilder.VisualModes
 	{
 		#region ================== Constants
 
-		private const float ANGLE_FROM_MOUSE = 0.0001f;
-		public const float MAX_ANGLEZ_LOW = 91f / Angle2D.PIDEG;
-		public const float MAX_ANGLEZ_HIGH = (360f - 91f) / Angle2D.PIDEG;
-		public const float THING_Z_OFFSET = 41.0f;
+		private const double ANGLE_FROM_MOUSE = 0.0001f;
+		public const double MAX_ANGLEZ_LOW = 91f / Angle2D.PIDEG;
+		public const double MAX_ANGLEZ_HIGH = (360f - 91f) / Angle2D.PIDEG;
+		public const double THING_Z_OFFSET = 41.0f;
 		
 		#endregion
 
@@ -27,7 +27,7 @@ namespace CodeImp.DoomBuilder.VisualModes
 		private Vector3D position;
 		private Vector3D target;
 		private Vector3D movemultiplier;
-		private float anglexy, anglez;
+		private double anglexy, anglez;
 		private Sector sector;
 		private float gravity = 1.0f; //mxd
 		
@@ -37,8 +37,8 @@ namespace CodeImp.DoomBuilder.VisualModes
 
 		public Vector3D Position { get { return position; } set { position = value; } }
 		public Vector3D Target { get { return target; } }
-		public float AngleXY { get { return anglexy; } set { anglexy = value; } }
-		public float AngleZ { get { return anglez; } set { anglez = value; } }
+		public double AngleXY { get { return anglexy; } set { anglexy = value; } }
+		public double AngleZ { get { return anglez; } set { anglez = value; } }
 		public Sector Sector { get { return sector; } internal set { sector = value; UpdateGravity(); } } //mxd
 		public Vector3D MoveMultiplier { get { return movemultiplier; } set { movemultiplier = value; } }
 		public float Gravity { get { return gravity; } } //mxd
@@ -116,16 +116,16 @@ namespace CodeImp.DoomBuilder.VisualModes
 			if(modething != null)
 			{
 				modething.DetermineSector();
-				float z = modething.Position.z;
+				double z = modething.Position.z;
 				if(modething.Sector != null) z += modething.Sector.FloorHeight;
 				
 				// Position camera here
 				Vector3D wantedposition = new Vector3D(modething.Position.x, modething.Position.y, z + THING_Z_OFFSET);
 				Vector3D delta = position - wantedposition;
 				if(delta.GetLength() > 1.0f) position = wantedposition;
-				
+
 				// Change angle
-				float wantedanglexy = modething.Angle + Angle2D.PI;
+				double wantedanglexy = modething.Angle + Angle2D.PI;
 				if(anglexy != wantedanglexy)
 				{
 					anglexy = wantedanglexy;
diff --git a/Source/Core/VisualModes/VisualMode.cs b/Source/Core/VisualModes/VisualMode.cs
index 9bb71f8bef2156d394d17e97cb0f7e94d411f088..bb828d74447864658e87aa78048729cfda07819e 100755
--- a/Source/Core/VisualModes/VisualMode.cs
+++ b/Source/Core/VisualModes/VisualMode.cs
@@ -749,9 +749,9 @@ namespace CodeImp.DoomBuilder.VisualModes
 					if(!lines.ContainsKey(ld))
 					{
 						lines.Add(ld, ld);
-						
+
 						// Intersecting?
-						float u;
+						double u;
 						if(ld.Line.GetIntersection(ray2d, out u))
 						{
 							// Check on which side we are
diff --git a/Source/Core/Windows/SectorEditFormUDMF.cs b/Source/Core/Windows/SectorEditFormUDMF.cs
index 956004532f91a81c2dfa5a398461d0ec60ddfc0d..ce19fc42207ba95906002b88bfdd6021c13e2ffa 100755
--- a/Source/Core/Windows/SectorEditFormUDMF.cs
+++ b/Source/Core/Windows/SectorEditFormUDMF.cs
@@ -88,12 +88,12 @@ namespace CodeImp.DoomBuilder.Windows
 			//UDMF slopes. Angles are in degrees
 			public readonly Vector3D FloorSlope;
 			public readonly Vector3D CeilSlope;
-			public readonly float FloorSlopeAngleXY;
-			public readonly float FloorSlopeAngleZ;
-			public readonly float FloorSlopeOffset;
-			public readonly float CeilSlopeAngleXY;
-			public readonly float CeilSlopeAngleZ;
-			public readonly float CeilSlopeOffset;
+			public readonly double FloorSlopeAngleXY;
+			public readonly double FloorSlopeAngleZ;
+			public readonly double FloorSlopeOffset;
+			public readonly double CeilSlopeAngleXY;
+			public readonly double CeilSlopeAngleZ;
+			public readonly double CeilSlopeOffset;
 
             //[ZZ] UDMF Doom64 sector colors
             public readonly int D64ColorCeiling;
@@ -143,8 +143,8 @@ namespace CodeImp.DoomBuilder.Windows
 				if(s.FloorSlope.GetLengthSq() > 0)
 				{
 					FloorSlopeAngleXY = General.ClampAngle((float)Math.Round(Angle2D.RadToDeg(s.FloorSlope.GetAngleXY()) - 180, 1));
-					FloorSlopeAngleZ = -(float)Math.Round(Angle2D.RadToDeg(s.FloorSlope.GetAngleZ()) - 90, 1);
-					FloorSlopeOffset = (float.IsNaN(s.FloorSlopeOffset) ? s.FloorHeight : s.FloorSlopeOffset);
+					FloorSlopeAngleZ = -Math.Round(Angle2D.RadToDeg(s.FloorSlope.GetAngleZ()) - 90, 1);
+					FloorSlopeOffset = (double.IsNaN(s.FloorSlopeOffset) ? s.FloorHeight : s.FloorSlopeOffset);
 				} 
 				else 
 				{
@@ -157,8 +157,8 @@ namespace CodeImp.DoomBuilder.Windows
 				if(s.CeilSlope.GetLengthSq() > 0)
 				{
 					CeilSlopeAngleXY = General.ClampAngle((float)Math.Round(Angle2D.RadToDeg(s.CeilSlope.GetAngleXY()) - 180, 1));
-					CeilSlopeAngleZ = -(float)Math.Round(270 - Angle2D.RadToDeg(s.CeilSlope.GetAngleZ()), 1);
-					CeilSlopeOffset = (float.IsNaN(s.CeilSlopeOffset) ? s.CeilHeight : s.CeilSlopeOffset);
+					CeilSlopeAngleZ = -Math.Round(270 - Angle2D.RadToDeg(s.CeilSlope.GetAngleZ()), 1);
+					CeilSlopeOffset = (double.IsNaN(s.CeilSlopeOffset) ? s.CeilHeight : s.CeilSlopeOffset);
 				} 
 				else 
 				{
@@ -1766,8 +1766,8 @@ namespace CodeImp.DoomBuilder.Windows
 			//Set or restore values
 			foreach(Sector s in sectors) 
 			{
-				float anglexy = General.ClampAngle(ceilingslopecontrol.GetAngleXY(sectorprops[s].CeilSlopeAngleXY) + 270);
-				float anglez = -(ceilingslopecontrol.GetAngleZ(sectorprops[s].CeilSlopeAngleZ) + 90);
+				double anglexy = General.ClampAngle(ceilingslopecontrol.GetAngleXY(sectorprops[s].CeilSlopeAngleXY) + 270);
+				double anglez = -(ceilingslopecontrol.GetAngleZ(sectorprops[s].CeilSlopeAngleZ) + 90);
 
 				float virtualoffset = GetInitialVirtualSlopeOffset(s, ceilingslopecontrol.PivotMode, false);
 				Vector3D center = GetSectorCenter(s, ceilingslopecontrol.GetOffset(virtualoffset), ceilingslopecontrol.PivotMode);
diff --git a/Source/Core/ZDoom/VoxeldefParser.cs b/Source/Core/ZDoom/VoxeldefParser.cs
index 36c7f214974b58e5dd2ffd1763f441c40e1cbd79..ca61db0ce0beb1d97ff86917e8ba1f6c1376fc34 100755
--- a/Source/Core/ZDoom/VoxeldefParser.cs
+++ b/Source/Core/ZDoom/VoxeldefParser.cs
@@ -78,7 +78,7 @@ namespace CodeImp.DoomBuilder.ZDoom
 							if(!string.IsNullOrEmpty(modelName) && spriteNames.Count > 0) 
 							{
 								mde.ModelNames.Add(modelName);
-								mde.SetTransform(Matrix.RotationZ(Angle2D.DegToRad(mde.AngleOffset)), Matrix.Identity, new Vector3f(scale));
+								mde.SetTransform(Matrix.RotationZ((float)Angle2D.DegToRad(mde.AngleOffset)), Matrix.Identity, new Vector3f(scale));
 
 								foreach(string s in spriteNames)
 								{
diff --git a/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs b/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs
index 176d74bf99760ea4c7b55c0af251a871a802d8f6..38d13ad830866b33b4ff1da4606f42c5d85af18a 100755
--- a/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs
+++ b/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs
@@ -124,7 +124,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			public Vector2D Offset;
 			public Vector2D Scale;
 			public Size TextureSize;
-			public float Rotation;
+			public double Rotation;
 			public string Part;
 		}
 
@@ -166,13 +166,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		private ICollection<Linedef> selectedlines;
 		private List<Vector2D> vertexpos;
 		private List<Vector2D> thingpos;
-		private List<float> thingangle;
+		private List<double> thingangle;
 		private ICollection<Vertex> unselectedvertices;
 		private ICollection<Linedef> unselectedlines;
 		private ICollection<Linedef> unstablelines; //mxd
 
 		// Modification
-		private float rotation;
+		private double rotation;
 		private Vector2D offset;
 		private Vector2D size;
 		private Vector2D scale = new Vector2D(1.0f, 1.0f); //mxd
@@ -199,7 +199,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		private Vector2D edgevector;
 		private Line2D resizeaxis;
 		private int stickcorner;
-		private float rotategripangle;
+		private double rotategripangle;
 		private bool autopanning;
 		
 		// Rectangle components
@@ -275,55 +275,55 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		
 		// The following functions set different properties and update
 		
-		public void SetAbsPosX(float posx)
+		public void SetAbsPosX(double posx)
 		{
 			offset.x = posx;
 			UpdateAllChanges();
 		}
 		
-		public void SetAbsPosY(float posy)
+		public void SetAbsPosY(double posy)
 		{
 			offset.y = posy;
 			UpdateAllChanges();
 		}
 		
-		public void SetRelPosX(float posx)
+		public void SetRelPosX(double posx)
 		{
 			offset.x = posx + baseoffset.x;
 			UpdateAllChanges();
 		}
 		
-		public void SetRelPosY(float posy)
+		public void SetRelPosY(double posy)
 		{
 			offset.y = posy + baseoffset.y;
 			UpdateAllChanges();
 		}
 		
-		public void SetAbsSizeX(float sizex)
+		public void SetAbsSizeX(double sizex)
 		{
 			size.x = sizex;
 			UpdateAllChanges();
 		}
 		
-		public void SetAbsSizeY(float sizey)
+		public void SetAbsSizeY(double sizey)
 		{
 			size.y = sizey;
 			UpdateAllChanges();
 		}
 		
-		public void SetRelSizeX(float sizex)
+		public void SetRelSizeX(double sizex)
 		{
 			size.x = basesize.x * (sizex / 100.0f);
 			UpdateAllChanges();
 		}
 		
-		public void SetRelSizeY(float sizey)
+		public void SetRelSizeY(double sizey)
 		{
 			size.y = basesize.y * (sizey / 100.0f);
 			UpdateAllChanges();
 		}
 
-		public void SetAbsRotation(float absrot)
+		public void SetAbsRotation(double absrot)
 		{
 			rotation = absrot;
 			UpdateAllChanges();
@@ -451,7 +451,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 					case Grip.SizeW:
 					case Grip.SizeN:
 						// Pick the best matching cursor depending on rotation and side
-						float resizeangle = rotation;
+						double resizeangle = rotation;
 						if((mousegrip == Grip.SizeE) || (mousegrip == Grip.SizeW)) resizeangle += Angle2D.PIHALF;
 						resizeangle = Angle2D.Normalized(resizeangle);
 						if(resizeangle > Angle2D.PI) resizeangle -= Angle2D.PI;
@@ -493,7 +493,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 						// Snap to nearest vertex?
 						if(snaptonearest && (highlighted != null))
 						{
-							float vrange = BuilderPlug.Me.StitchRange / renderer.Scale;
+							double vrange = BuilderPlug.Me.StitchRange / renderer.Scale;
 
 							// Try the nearest vertex
 							Vertex nv = MapSet.NearestVertexSquareRange(unselectedvertices, transformedpos, vrange);
@@ -514,10 +514,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
 									{
 										// Get grid intersection coordinates
 										List<Vector2D> coords = nl.GetGridIntersections();
-										
+
 										// Find nearest grid intersection
-										float found_distance = float.MaxValue;
-										Vector2D found_pos = new Vector2D(float.NaN, float.NaN);
+										double found_distance = double.MaxValue;
+										Vector2D found_pos = new Vector2D(double.NaN, double.NaN);
 										foreach(Vector2D v in coords)
 										{
 											Vector2D dist = transformedpos - v;
@@ -533,7 +533,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 										}
 
 										// Found something?
-										if(!float.IsNaN(found_pos.x))
+										if(!double.IsNaN(found_pos.x))
 										{
 											// Change offset to snap to target
 											offset += found_pos - transformedpos;
@@ -586,17 +586,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
 						
 						// Keep corner position
 						Vector2D oldcorner = corners[stickcorner];
-						
+
 						// Change size with the scale from the ruler
-						float newscale = resizeaxis.GetNearestOnLine(snappedmappos);
+						double newscale = resizeaxis.GetNearestOnLine(snappedmappos);
 						size = (basesize * resizefilter) * newscale + size * (1.0f - resizefilter);
 
 						//mxd. Update scale
 						newscale = 1f / newscale;
-						if(float.IsInfinity(newscale) || float.IsNaN(newscale)) newscale = 99999f;
+						if(double.IsInfinity(newscale) || double.IsNaN(newscale)) newscale = 99999f;
 						scale = (newscale * resizefilter) + scale * (1.0f - resizefilter);
-						if(float.IsInfinity(scale.x) || float.IsNaN(scale.x)) scale.x = 99999f;
-						if(float.IsInfinity(scale.y) || float.IsNaN(scale.y)) scale.y = 99999f;
+						if(double.IsInfinity(scale.x) || double.IsNaN(scale.x)) scale.x = 99999f;
+						if(double.IsInfinity(scale.y) || double.IsNaN(scale.y)) scale.y = 99999f;
 						
 						// Adjust corner position
 						Vector2D newcorner = TransformedPoint(originalcorners[stickcorner]);
@@ -604,9 +604,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
 						
 						// Show the extension line so that the user knows what it is aligning to
 						Vector2D sizefiltered = (size * resizefilter);
-						float sizelength = sizefiltered.x + sizefiltered.y;
+						double sizelength = sizefiltered.x + sizefiltered.y;
 						Line2D edgeline = new Line2D(resizeaxis.v1 + resizevector * sizelength, resizeaxis.v1 + resizevector * sizelength - edgevector);
-						float nearestonedge = edgeline.GetNearestOnLine(snappedmappos);
+						double nearestonedge = edgeline.GetNearestOnLine(snappedmappos);
 						if(nearestonedge > 0.5f)
 							extensionline = new Line2D(edgeline.v1, snappedmappos);
 						else
@@ -629,18 +629,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
 						if(dosnaptogrid)
 						{
 							// We make 24 vectors that the rotation can snap to
-							float founddistance = float.MaxValue;
-							float foundrotation = rotation;
+							double founddistance = double.MaxValue;
+							double foundrotation = rotation;
 							Vector3D rotvec = Vector2D.FromAngle(rotation);
 							
 							for(int i = 0; i < 24; i++)
 							{
 								// Make the vectors
-								float angle = i * Angle2D.PI * 0.08333333333f; //mxd. 15-degree increments
+								double angle = i * Angle2D.PI * 0.08333333333f; //mxd. 15-degree increments
 								Vector2D gridvec = Vector2D.FromAngle(angle);
-								
+
 								// Check distance
-								float dist = 2.0f - Vector2D.DotProduct(gridvec, rotvec);
+								double dist = 2.0f - Vector2D.DotProduct(gridvec, rotvec);
 								if(dist < founddistance)
 								{
 									foundrotation = angle;
@@ -747,7 +747,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		// This moves all things and vertices to match the current transformation
 		private void UpdateGeometry()
 		{
-			float[] newthingangle = thingangle.ToArray();
+			double[] newthingangle = thingangle.ToArray();
 			int index;
 
 			// Flip things horizontally
@@ -890,12 +890,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		private void UpdateTextureTransform(UniFields fields, SurfaceTextureInfo si, bool transformoffsets, bool rotateoffsets, bool scaleoffsets)
 		{
 			// Get offset-ready values
-			float texrotation = Angle2D.PI2 - rotation;
+			double texrotation = Angle2D.PI2 - rotation;
 
 			// Update texture offsets
 			if (transformoffsets)
 			{
-				float trotation = rotateoffsets ? (si.Rotation + texrotation) : (si.Rotation);
+				double trotation = rotateoffsets ? (si.Rotation + texrotation) : (si.Rotation);
 				Vector2D offset = selectioncenter.GetRotated(trotation);
 
 				fields["xpanning" + si.Part] = new UniValue(UniversalType.Float, (float)Math.Round(-offset.x, General.Map.FormatInterface.VertexDecimals));
@@ -983,18 +983,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
 				cornerverts[i].z = 1.0f;
 				cornerverts[i].c = rectcolor.ToInt();
 			}
-			cornerverts[0].x = corners[0].x;
-			cornerverts[0].y = corners[0].y;
-			cornerverts[1].x = corners[1].x;
-			cornerverts[1].y = corners[1].y;
-			cornerverts[2].x = corners[2].x;
-			cornerverts[2].y = corners[2].y;
-			cornerverts[3].x = corners[0].x;
-			cornerverts[3].y = corners[0].y;
-			cornerverts[4].x = corners[2].x;
-			cornerverts[4].y = corners[2].y;
-			cornerverts[5].x = corners[3].x;
-			cornerverts[5].y = corners[3].y;
+			cornerverts[0].x = (float)corners[0].x;
+			cornerverts[0].y = (float)corners[0].y;
+			cornerverts[1].x = (float)corners[1].x;
+			cornerverts[1].y = (float)corners[1].y;
+			cornerverts[2].x = (float)corners[2].x;
+			cornerverts[2].y = (float)corners[2].y;
+			cornerverts[3].x = (float)corners[0].x;
+			cornerverts[3].y = (float)corners[0].y;
+			cornerverts[4].x = (float)corners[2].x;
+			cornerverts[4].y = (float)corners[2].y;
+			cornerverts[5].x = (float)corners[3].x;
+			cornerverts[5].y = (float)corners[3].y;
 			
 			// Middle points between corners
 			Vector2D middle01 = corners[0] + (corners[1] - corners[0]) * 0.5f;
@@ -1004,32 +1004,32 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			
 			// Resize grips
 			resizegrips = new RectangleF[4];
-			resizegrips[0] = new RectangleF(middle01.x - gripsize * 0.5f,
-											middle01.y - gripsize * 0.5f,
+			resizegrips[0] = new RectangleF((float)(middle01.x - gripsize * 0.5f),
+											(float)(middle01.y - gripsize * 0.5f),
 											gripsize, gripsize);
-			resizegrips[1] = new RectangleF(middle12.x - gripsize * 0.5f,
-											middle12.y - gripsize * 0.5f,
+			resizegrips[1] = new RectangleF((float)(middle12.x - gripsize * 0.5f),
+											(float)(middle12.y - gripsize * 0.5f),
 											gripsize, gripsize);
-			resizegrips[2] = new RectangleF(middle23.x - gripsize * 0.5f,
-											middle23.y - gripsize * 0.5f,
+			resizegrips[2] = new RectangleF((float)(middle23.x - gripsize * 0.5f),
+											(float)(middle23.y - gripsize * 0.5f),
 											gripsize, gripsize);
-			resizegrips[3] = new RectangleF(middle30.x - gripsize * 0.5f,
-											middle30.y - gripsize * 0.5f,
+			resizegrips[3] = new RectangleF((float)(middle30.x - gripsize * 0.5f),
+											(float)(middle30.y - gripsize * 0.5f),
 											gripsize, gripsize);
 
 			// Rotate grips
 			rotategrips = new RectangleF[4];
-			rotategrips[0] = new RectangleF(corners[0].x - gripsize * 0.5f,
-											corners[0].y - gripsize * 0.5f,
+			rotategrips[0] = new RectangleF((float)(corners[0].x - gripsize * 0.5f),
+											(float)(corners[0].y - gripsize * 0.5f),
 											gripsize, gripsize);
-			rotategrips[1] = new RectangleF(corners[1].x - gripsize * 0.5f,
-											corners[1].y - gripsize * 0.5f,
+			rotategrips[1] = new RectangleF((float)(corners[1].x - gripsize * 0.5f),
+											(float)(corners[1].y - gripsize * 0.5f),
 											gripsize, gripsize);
-			rotategrips[2] = new RectangleF(corners[2].x - gripsize * 0.5f,
-											corners[2].y - gripsize * 0.5f,
+			rotategrips[2] = new RectangleF((float)(corners[2].x - gripsize * 0.5f),
+											(float)(corners[2].y - gripsize * 0.5f),
 											gripsize, gripsize);
-			rotategrips[3] = new RectangleF(corners[3].x - gripsize * 0.5f,
-											corners[3].y - gripsize * 0.5f,
+			rotategrips[3] = new RectangleF((float)(corners[3].x - gripsize * 0.5f),
+											(float)(corners[3].y - gripsize * 0.5f),
 											gripsize, gripsize);
 
 			//mxd. Update selection center
@@ -1181,9 +1181,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
 				if(General.Map.UDMF)
 				{
 					// Adjust slope height?
-					if(s.FloorSlope.GetLengthSq() > 0 && !float.IsNaN(s.FloorSlopeOffset / s.FloorSlope.z))
+					if(s.FloorSlope.GetLengthSq() > 0 && !double.IsNaN(s.FloorSlopeOffset / s.FloorSlope.z))
 					{
-						s.FloorSlopeOffset -= flooroffset * (float)Math.Sin(s.FloorSlope.GetAngleZ());
+						s.FloorSlopeOffset -= flooroffset * Math.Sin(s.FloorSlope.GetAngleZ());
 					}
 					// Adjust vertex height?
 					else if(s.Sidedefs.Count == 3)
@@ -1214,9 +1214,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
 				if(General.Map.UDMF)
 				{
 					// Adjust slope height?
-					if(s.CeilSlope.GetLengthSq() > 0 && !float.IsNaN(s.CeilSlopeOffset / s.CeilSlope.z))
+					if(s.CeilSlope.GetLengthSq() > 0 && !double.IsNaN(s.CeilSlopeOffset / s.CeilSlope.z))
 					{
-						s.CeilSlopeOffset -= ceiloffset * (float)Math.Sin(s.CeilSlope.GetAngleZ());
+						s.CeilSlopeOffset -= ceiloffset * Math.Sin(s.CeilSlope.GetAngleZ());
 					}
 					// Adjust vertex height?
 					else if(s.Sidedefs.Count == 3)
@@ -1317,7 +1317,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// Array to keep original coordinates
 			vertexpos = new List<Vector2D>(selectedvertices.Count);
 			thingpos = new List<Vector2D>(selectedthings.Count);
-			thingangle = new List<float>(selectedthings.Count);
+			thingangle = new List<double>(selectedthings.Count);
 			fixedrotationthingtypes = new List<int>(); //mxd
 
 			// A selection must be made!
@@ -1599,7 +1599,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 							Sector cs = ld.Front.Sector;
 
 							// Skip sectors that don't have a slope
-							if ((cs.FloorSlope.GetLengthSq() <= 0 || float.IsNaN(cs.FloorSlopeOffset / cs.FloorSlope.z)) && (cs.CeilSlope.GetLengthSq() <= 0 || float.IsNaN(cs.CeilSlopeOffset / cs.CeilSlope.z)))
+							if ((cs.FloorSlope.GetLengthSq() <= 0 || double.IsNaN(cs.FloorSlopeOffset / cs.FloorSlope.z)) && (cs.CeilSlope.GetLengthSq() <= 0 || double.IsNaN(cs.CeilSlopeOffset / cs.CeilSlope.z)))
 								continue;
 
 							foreach (Sector s in selectedsectors.Keys)
@@ -1621,14 +1621,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
 						s.UpdateBBox();
 
 						// Update floor slope?
-						if (s.FloorSlope.GetLengthSq() > 0 && !float.IsNaN(s.FloorSlopeOffset / s.FloorSlope.z))
+						if (s.FloorSlope.GetLengthSq() > 0 && !double.IsNaN(s.FloorSlopeOffset / s.FloorSlope.z))
 						{
 							// Flip the plane normal if necessary
 							Vector3D normal = s.FloorSlope;
 							if (size.x < 0.0f) normal.x *= -1;
 							if (size.y < 0.0f) normal.y *= -1;
 
-							float angle = normal.GetAngleXY() + rotation + Angle2D.PIHALF;
+							double angle = normal.GetAngleXY() + rotation + Angle2D.PIHALF;
 
 							// Get the center of the *new* sector position. Use the z value of the center *old* sector position
 							Vector2D originalcenter = new Vector2D(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2);
@@ -1645,7 +1645,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 						{
 							foreach (Sector cs in controlsectors[s])
 							{
-								if (cs.FloorSlope.GetLengthSq() <= 0 || float.IsNaN(cs.FloorSlopeOffset / cs.FloorSlope.z))
+								if (cs.FloorSlope.GetLengthSq() <= 0 || double.IsNaN(cs.FloorSlopeOffset / cs.FloorSlope.z))
 									continue;
 
 								// Flip the plane normal if necessary
@@ -1653,7 +1653,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 								if (size.x < 0.0f) normal.x *= -1;
 								if (size.y < 0.0f) normal.y *= -1;
 
-								float angle = normal.GetAngleXY() + rotation + Angle2D.PIHALF;
+								double angle = normal.GetAngleXY() + rotation + Angle2D.PIHALF;
 
 								// Get the center of the *new* tagged sector position. Use the z value of the center *old* tagged sector position
 								Vector2D originalcenter = new Vector2D(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2);
@@ -1667,14 +1667,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
 						}
 
 						// Update ceiling slope?
-						if (s.CeilSlope.GetLengthSq() > 0 && !float.IsNaN(s.CeilSlopeOffset / s.CeilSlope.z))
+						if (s.CeilSlope.GetLengthSq() > 0 && !double.IsNaN(s.CeilSlopeOffset / s.CeilSlope.z))
 						{
 							// Flip the plane normal if necessary
 							Vector3D normal = s.CeilSlope;
 							if (size.x < 0.0f) normal.x *= -1;
 							if (size.y < 0.0f) normal.y *= -1;
 
-							float angle = normal.GetAngleXY() + rotation + Angle2D.PIHALF;
+							double angle = normal.GetAngleXY() + rotation + Angle2D.PIHALF;
 
 							// Get the center of the *new* sector position. Use the z value of the center *old* sector position
 							Vector2D originalcenter = new Vector2D(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2);
@@ -1691,7 +1691,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 						{
 							foreach (Sector cs in controlsectors[s])
 							{
-								if (cs.CeilSlope.GetLengthSq() <= 0 || float.IsNaN(cs.CeilSlopeOffset / cs.CeilSlope.z))
+								if (cs.CeilSlope.GetLengthSq() <= 0 || double.IsNaN(cs.CeilSlopeOffset / cs.CeilSlope.z))
 									continue;
 
 								// Flip the plane normal if necessary
@@ -1699,7 +1699,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 								if (size.x < 0.0f) normal.x *= -1;
 								if (size.y < 0.0f) normal.y *= -1;
 
-								float angle = normal.GetAngleXY() + rotation + Angle2D.PIHALF;
+								double angle = normal.GetAngleXY() + rotation + Angle2D.PIHALF;
 
 								// Get the center of the *new* tagged sector position. Use the z value of the center *old* tagged sector position
 								Vector2D originalcenter = new Vector2D(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2);
diff --git a/Source/Plugins/BuilderModes/Interface/EditSelectionPanel.cs b/Source/Plugins/BuilderModes/Interface/EditSelectionPanel.cs
index 6f12af9f391ed8be7bf9115baba4f90c274ce8d2..e1da91b726460b544773d40ccc2817d120b4236a 100755
--- a/Source/Plugins/BuilderModes/Interface/EditSelectionPanel.cs
+++ b/Source/Plugins/BuilderModes/Interface/EditSelectionPanel.cs
@@ -46,7 +46,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		private Vector2D relpos;
 		private Vector2D abssize;
 		private Vector2D relsize;
-		private float absrotate;
+		private double absrotate;
 		
 		#endregion
 		
@@ -96,7 +96,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		}
 		
 		// This sets the dynamic values
-		public void ShowCurrentValues(Vector2D pos, Vector2D relpos, Vector2D size, Vector2D relsize, float rotation)
+		public void ShowCurrentValues(Vector2D pos, Vector2D relpos, Vector2D size, Vector2D relsize, double rotation)
 		{
 			// Set values
 			this.abspos = pos;
@@ -246,7 +246,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		{
 			if(userinput)
 			{
-				float rad = Angle2D.DegToRad(absrot.GetResultFloat(this.absrotate));
+				double rad = Angle2D.DegToRad(absrot.GetResultFloat(this.absrotate));
 				mode.SetAbsRotation(rad);
 			}
 		}