From c737a55e7b66238e3a99eb30203ce1ef809f3aac Mon Sep 17 00:00:00 2001 From: spherallic <spherallic@gmail.com> Date: Tue, 28 May 2024 14:39:51 +0200 Subject: [PATCH] Snap vertex and thing positions to integer positions --- Source/Core/Map/MapSet.cs | 8 ++++++-- Source/Core/Map/Thing.cs | 2 +- Source/Core/Map/Vertex.cs | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Source/Core/Map/MapSet.cs b/Source/Core/Map/MapSet.cs index 502d17229..2324dea69 100755 --- a/Source/Core/Map/MapSet.cs +++ b/Source/Core/Map/MapSet.cs @@ -3761,8 +3761,12 @@ namespace CodeImp.DoomBuilder.Map /// <summary>This snaps all vertices to the map format accuracy. Call this to ensure the vertices are at valid coordinates.</summary> public void SnapAllToAccuracy(bool usepreciseposition) { - foreach(Vertex v in vertices) v.SnapToAccuracy(usepreciseposition); - foreach(Thing t in things) t.SnapToAccuracy(usepreciseposition); + // SRB2 doesn't support decimals for X/Y position, but does still require VertexDecimals for other float fields/values... + if (General.Map.Config.EngineName == "srb2") + usepreciseposition = false; + + foreach (Vertex v in vertices) v.SnapToAccuracy(usepreciseposition); + foreach (Thing t in things) t.SnapToAccuracy(usepreciseposition); } /// <summary>This returns the next unused tag number.</summary> diff --git a/Source/Core/Map/Thing.cs b/Source/Core/Map/Thing.cs index f78f6f8a9..c29922c56 100755 --- a/Source/Core/Map/Thing.cs +++ b/Source/Core/Map/Thing.cs @@ -726,7 +726,7 @@ namespace CodeImp.DoomBuilder.Map // This snaps the vertex to the map format accuracy public void SnapToAccuracy() { - SnapToAccuracy(true); + SnapToAccuracy(!(General.Map.Config.EngineName == "srb2")); } // This snaps the vertex to the map format accuracy diff --git a/Source/Core/Map/Vertex.cs b/Source/Core/Map/Vertex.cs index 145b0f2d0..3e3042d70 100755 --- a/Source/Core/Map/Vertex.cs +++ b/Source/Core/Map/Vertex.cs @@ -283,7 +283,7 @@ namespace CodeImp.DoomBuilder.Map // This snaps the vertex to the map format accuracy public void SnapToAccuracy() { - SnapToAccuracy(true); + SnapToAccuracy(!(General.Map.Config.EngineName == "srb2")); } // This snaps the vertex to the map format accuracy -- GitLab