diff --git a/project/code/LGS/Database/Chunks/BrList.cs b/project/code/LGS/Database/Chunks/BrList.cs index 6d41e45..5d65316 100644 --- a/project/code/LGS/Database/Chunks/BrList.cs +++ b/project/code/LGS/Database/Chunks/BrList.cs @@ -79,11 +79,11 @@ public class BrList : IChunk flags = reader.ReadSByte(); position = reader.ReadVec3(); size = reader.ReadVec3(); - angle = new Vector3(reader.ReadUInt16(), reader.ReadUInt16(), reader.ReadUInt16()); + angle = reader.ReadRotation(); currentFaceIndex = reader.ReadInt16(); gridLineSpacing = reader.ReadSingle(); gridPhaseShift = reader.ReadVec3(); - gridOrientation = new Vector3(reader.ReadUInt16(), reader.ReadUInt16(), reader.ReadUInt16()); + gridOrientation = reader.ReadRotation(); gridEnabled = reader.ReadBoolean(); numFaces = reader.ReadByte(); edgeSelected = reader.ReadSByte(); diff --git a/project/code/LGS/Extensions.cs b/project/code/LGS/Extensions.cs index 313dd6b..078e5a9 100644 --- a/project/code/LGS/Extensions.cs +++ b/project/code/LGS/Extensions.cs @@ -6,6 +6,12 @@ namespace KeepersCompound.LGS; public static class Extensions { + public static Vector3 ReadRotation(this BinaryReader reader) + { + var raw = new Vector3(reader.ReadUInt16(), reader.ReadUInt16(), reader.ReadUInt16()); + return raw * 360 / (ushort.MaxValue + 1); + } + public static Vector3 ReadVec3(this BinaryReader reader) { return new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); diff --git a/project/code/TMV/Mission.cs b/project/code/TMV/Mission.cs index 1716487..1b472f4 100644 --- a/project/code/TMV/Mission.cs +++ b/project/code/TMV/Mission.cs @@ -264,8 +264,7 @@ public partial class Mission : Node3D // Let's try and place an object :) var modelName = modelNameProp.value + ".bin"; var pos = brush.position.ToGodotVec3(); - var rawRot = brush.angle; - var rot = new Vector3(rawRot.Y, rawRot.Z, rawRot.X) * 360 / (ushort.MaxValue + 1); + var rot = brush.angle.ToGodotVec3(false); var scale = scaleProp == null ? Vector3.One : scaleProp.value.ToGodotVec3(false); var model = Timing.TimeStage("Get Models", () => {