Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bierdosenhalter committed Nov 6, 2024
2 parents e17212f + 2d27ed2 commit c1db728
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Client/Entity/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,9 @@ private void UpdateVisualPropertyPos(uint gameCycle, long prop, uint predictedIn
}

// Convert Database into a Position
var x = (float)(Convert.ToDouble(prop) / 1000.0f);
var y = nodeY.GetValue64() / 1000.0f;
var z = nodeZ.GetValue64() / 1000.0f;
var x = Convert.ToSingle(prop) / 1000.0f;
var y = Convert.ToSingle(nodeY.GetValue64()) / 1000.0f;
var z = Convert.ToSingle(nodeZ.GetValue64()) / 1000.0f;

Pos = new Vector3(x, y, z);

Expand Down
2 changes: 1 addition & 1 deletion Client/Network/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ internal void ImpulseTp(BitMemoryStream impulse, bool hasSeason)
}

// Compute the destination.
var dest = new Vector3((float)x / 1000f, (float)y / 1000f, (float)z / 1000f);
var dest = new Vector3(x / 1000f, y / 1000f, z / 1000f);

// Update the position for the vision.
_client.GetNetworkManager().SetReferencePosition(dest);
Expand Down
1 change: 1 addition & 0 deletions Client/Property/PropertyDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ internal void Receive(int _, ActionPosition action)
// Absolute position
//nlinfo( "RefPos: %d %d %d RefBits: %hd %hd %hd", _RefPosX, _RefPosY, _RefPosZ, _RefBitsX, _RefBitsY, _RefBitsZ );
DecodeAbsPos2D(ref act.Position[0], ref act.Position[1], act.Position16[0], act.Position16[1]);

act.Position[2] = (short)act.Position16[2] << 4;
if (act.Interior)
{
Expand Down
6 changes: 5 additions & 1 deletion Client/Stream/BitMemoryStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,13 @@ public void Serial(ref int obj)
/// </summary>
public void Serial(ref float obj)
{
if (Constants.BitMemoryStreamDebugEnabled) _debugData.Add(new BitMemoryStreamSerialInfo(_bitPos, 32, BitMemoryStreamSerialInfo.SerialType.Buffer, new StackTrace(true)));

Check warning on line 149 in Client/Stream/BitMemoryStream.cs

View workflow job for this annotation

GitHub Actions / publish

Unreachable code detected

Check warning on line 149 in Client/Stream/BitMemoryStream.cs

View workflow job for this annotation

GitHub Actions / publish

Unreachable code detected

if (IsReading())
{
throw new NotImplementedException();
var newBits = ReadFromArray(32);
var reversed = ConvertBoolArrayToByteArray(newBits).Reverse().ToArray();
obj = BitConverter.ToSingle(reversed);
}
else
{
Expand Down

0 comments on commit c1db728

Please sign in to comment.