diff --git a/project/code/LGS/Database/Chunks/Property.cs b/project/code/LGS/Database/Chunks/Property.cs index 37c0596..f288778 100644 --- a/project/code/LGS/Database/Chunks/Property.cs +++ b/project/code/LGS/Database/Chunks/Property.cs @@ -502,3 +502,27 @@ public class PropSpotlightAndAmbient : Property writer.Write(SpotBrightness); } } + +public class PropJointPos : Property +{ + public float[] Positions; + + public override void Read(BinaryReader reader) + { + base.Read(reader); + Positions = new float[6]; + for (var i = 0; i < 6; i++) + { + Positions[i] = reader.ReadSingle(); + } + } + + public override void Write(BinaryWriter writer) + { + base.Write(writer); + foreach (var position in Positions) + { + writer.Write(position); + } + } +} diff --git a/project/code/LGS/Database/File.cs b/project/code/LGS/Database/File.cs index 8abbb63..2b7b43d 100644 --- a/project/code/LGS/Database/File.cs +++ b/project/code/LGS/Database/File.cs @@ -158,6 +158,7 @@ public class DbFile "P$ModelName" => new PropertyChunk(), "P$Scale" => new PropertyChunk(), "P$RenderTyp" => new PropertyChunk(), + "P$JointPos" => new PropertyChunk(), "P$OTxtRepr0" => new PropertyChunk(), "P$OTxtRepr1" => new PropertyChunk(), "P$OTxtRepr2" => new PropertyChunk(), diff --git a/project/code/LGS/Database/ObjectHierarchy.cs b/project/code/LGS/Database/ObjectHierarchy.cs index f5935df..e8ae175 100644 --- a/project/code/LGS/Database/ObjectHierarchy.cs +++ b/project/code/LGS/Database/ObjectHierarchy.cs @@ -93,6 +93,7 @@ public class ObjectHierarchy AddProp("P$ModelName"); AddProp("P$Scale"); AddProp("P$RenderTyp"); + AddProp("P$JointPos"); AddProp("P$OTxtRepr0"); AddProp("P$OTxtRepr1"); AddProp("P$OTxtRepr2"); diff --git a/project/code/TMV/Mission.cs b/project/code/TMV/Mission.cs index e14d673..f755e73 100644 --- a/project/code/TMV/Mission.cs +++ b/project/code/TMV/Mission.cs @@ -244,6 +244,7 @@ public partial class Mission : Node3D var modelNameProp = objHierarchy.GetProperty(id, "P$ModelName"); var scaleProp = objHierarchy.GetProperty(id, "P$Scale"); var renderTypeProp = objHierarchy.GetProperty(id, "P$RenderTyp"); + var jointPosProp = objHierarchy.GetProperty(id, "P$JointPos"); var txtRepl0 = objHierarchy.GetProperty(id, "P$OTxtRepr0"); var txtRepl1 = objHierarchy.GetProperty(id, "P$OTxtRepr1"); var txtRepl2 = objHierarchy.GetProperty(id, "P$OTxtRepr2"); @@ -269,8 +270,8 @@ public partial class Mission : Node3D model.RotationDegrees = rot; model.Scale = scale; - // TODO: Apply real joints - var meshes = ModelLoader.TransformMeshes([45, 180, 0, 0, 0, 0], meshDetails); + var joints = jointPosProp != null ? jointPosProp.Positions : [0, 0, 0, 0, 0, 0]; + var meshes = ModelLoader.TransformMeshes(joints, meshDetails); bool GetTextReplPath(PropString prop, out string path) {