mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 23:12:59 +08:00
Merge pull request #94 from emcifuntik/master
Changed entity hash generation method to real one used in RAGE
This commit is contained in:
commit
b20af501e0
@ -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)(Position.X * 100);
|
||||||
{
|
uint yhash = (uint)(Position.Y * 100);
|
||||||
var ints = new int[4];
|
uint zhash = (uint)(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