diff --git a/aclogview/CM_Movement.cs b/aclogview/CM_Movement.cs index b5e1eec..d291f3c 100644 --- a/aclogview/CM_Movement.cs +++ b/aclogview/CM_Movement.cs @@ -213,7 +213,7 @@ public class UpdatePosition : Message { public uint object_id; public uint flags; public Position position; - public Vector3 velocity = new Vector3(); + public Vector3 velocity; public uint placement_id; public bool has_contact; public ushort instance_timestamp; @@ -243,9 +243,7 @@ public static UpdatePosition read(BinaryReader binaryReader) { newObj.position.frame.cache(); if ((newObj.flags & 0x1) != 0) { - newObj.velocity.x = binaryReader.ReadSingle(); - newObj.velocity.y = binaryReader.ReadSingle(); - newObj.velocity.z = binaryReader.ReadSingle(); + newObj.velocity = Vector3.read(binaryReader); } if ((newObj.flags & 0x2) != 0) { @@ -269,8 +267,12 @@ public override void contributeToTreeView(TreeView treeView) { rootNode.Nodes.Add("flags = " + flags); TreeNode positionNode = rootNode.Nodes.Add("position = "); position.contributeToTreeNode(positionNode); - rootNode.Nodes.Add("velocity = " + velocity); - rootNode.Nodes.Add("placement_id = " + placement_id); + if ((flags & 0x1) != 0) { + rootNode.Nodes.Add("velocity = " + velocity); + } + if ((flags & 0x2) != 0) { + rootNode.Nodes.Add("placement_id = " + placement_id); + } rootNode.Nodes.Add("has_contact = " + has_contact); rootNode.Nodes.Add("instance_timestamp = " + instance_timestamp); rootNode.Nodes.Add("position_timestamp = " + position_timestamp); diff --git a/aclogview/Packets.cs b/aclogview/Packets.cs index 5ccb030..7d51179 100644 --- a/aclogview/Packets.cs +++ b/aclogview/Packets.cs @@ -358,9 +358,7 @@ public static Position read(BinaryReader binaryReader) { public static Position readOrigin(BinaryReader binaryReader) { Position newObj = new Position(); newObj.objcell_id = binaryReader.ReadUInt32(); - newObj.frame.m_fOrigin.x = binaryReader.ReadSingle(); - newObj.frame.m_fOrigin.y = binaryReader.ReadSingle(); - newObj.frame.m_fOrigin.z = binaryReader.ReadSingle(); + newObj.frame.m_fOrigin = Vector3.read(binaryReader); return newObj; }