mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-29 18:32:55 +08:00
Changed entity hash generation method to real one used in RAGE
This commit is contained in:
parent
6f1d148875
commit
44c71139f1
@ -1385,6 +1385,7 @@ namespace CodeWalker.GameFiles
|
|||||||
|
|
||||||
UpdateWidgetPosition();
|
UpdateWidgetPosition();
|
||||||
UpdateWidgetOrientation();
|
UpdateWidgetOrientation();
|
||||||
|
UpdateEntityHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1515,26 +1516,10 @@ namespace CodeWalker.GameFiles
|
|||||||
|
|
||||||
public void UpdateEntityHash()
|
public void UpdateEntityHash()
|
||||||
{
|
{
|
||||||
unchecked
|
uint xhash = (uint)Math.Floor(Position.X * 100);
|
||||||
{
|
uint yhash = (uint)Math.Floor(Position.Y * 100);
|
||||||
var ints = new int[4];
|
uint zhash = (uint)Math.Floor(Position.Z * 100);
|
||||||
var pv = Position;
|
EntityHash = _CEntityDef.archetypeName.Hash ^ xhash ^ yhash ^ zhash & 0xffffffff;
|
||||||
ints[0] = (int)pv.X;
|
|
||||||
ints[1] = (int)pv.Y;
|
|
||||||
ints[2] = (int)pv.Z;
|
|
||||||
ints[3] = (int)_CEntityDef.archetypeName.Hash;
|
|
||||||
var bytes = new byte[16];
|
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
{
|
|
||||||
var ib = i * 4;
|
|
||||||
var b = BitConverter.GetBytes(ints[i]);
|
|
||||||
bytes[ib + 0] = b[0];
|
|
||||||
bytes[ib + 1] = b[1];
|
|
||||||
bytes[ib + 2] = b[2];
|
|
||||||
bytes[ib + 3] = b[3];
|
|
||||||
}
|
|
||||||
EntityHash = JenkHash.GenHash(bytes);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetOrientation(Quaternion ori, bool inverse = false)
|
public void SetOrientation(Quaternion ori, bool inverse = false)
|
||||||
|
@ -864,6 +864,7 @@ namespace CodeWalker.GameFiles
|
|||||||
e.Orientation = Quaternion.Multiply(Owner.Orientation, e.MloRefOrientation);
|
e.Orientation = Quaternion.Multiply(Owner.Orientation, e.MloRefOrientation);
|
||||||
e.UpdateWidgetPosition();
|
e.UpdateWidgetPosition();
|
||||||
e.UpdateWidgetOrientation();
|
e.UpdateWidgetOrientation();
|
||||||
|
e.UpdateEntityHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddEntity(YmapEntityDef e)
|
public void AddEntity(YmapEntityDef e)
|
||||||
|
Loading…
Reference in New Issue
Block a user