Skip to content

Commit

Permalink
Fix origin-only position reading
Browse files Browse the repository at this point in the history
  • Loading branch information
tfarley committed Jan 22, 2017
1 parent 6817147 commit a347583
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 8 additions & 6 deletions aclogview/CM_Movement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions aclogview/Packets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit a347583

Please sign in to comment.