Skip to content

Commit

Permalink
Add ReadVector helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
RedBigz committed Dec 23, 2024
1 parent 7df318a commit 0a22a52
Showing 1 changed file with 9 additions and 34 deletions.
43 changes: 9 additions & 34 deletions TABGVR/Patches/Networking/NetworkEventPatch.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.IO;
using HarmonyLib;
using Landfall.Network;
Expand Down Expand Up @@ -38,41 +39,15 @@ public static bool Prefix(ClientPackage clientPackage)

var store = NetworkStoreList.NetworkStores[playerIndex];

store.HmdPosition = new Vector3(
(float)reader.ReadDouble(),
(float)reader.ReadDouble(),
(float)reader.ReadDouble()
);
Vector3 ReadVector() => new((float)reader.ReadDouble(), (float)reader.ReadDouble(),
(float)reader.ReadDouble());

store.HmdRotation = new Vector3(
(float)reader.ReadDouble(),
(float)reader.ReadDouble(),
(float)reader.ReadDouble()
);

store.LeftHandPosition = new Vector3(
(float)reader.ReadDouble(),
(float)reader.ReadDouble(),
(float)reader.ReadDouble()
);

store.LeftHandRotation = new Vector3(
(float)reader.ReadDouble(),
(float)reader.ReadDouble(),
(float)reader.ReadDouble()
);

store.RightHandPosition = new Vector3(
(float)reader.ReadDouble(),
(float)reader.ReadDouble(),
(float)reader.ReadDouble()
);

store.RightHandRotation = new Vector3(
(float)reader.ReadDouble(),
(float)reader.ReadDouble(),
(float)reader.ReadDouble()
);
store.HmdPosition = ReadVector();
store.HmdRotation = ReadVector();
store.LeftHandPosition = ReadVector();
store.LeftHandRotation = ReadVector();
store.RightHandPosition = ReadVector();
store.RightHandRotation = ReadVector();
}
}

Expand Down

0 comments on commit 0a22a52

Please sign in to comment.