+rep ty bananenbrot!
Do you know where .029999999 comes from? A similar functino w/in the snippets I'm reversing basically has the exact same as the above, but changes .001875 to .029999
Snippet:
Code:
v2 = (__m128)*(_DWORD *)(PositionPtr + 4); // yPosition
v2.m128_f32[0] = v2.m128_f32[0] - 17066.666;
v3 = (signed int)ffloor(COERCE_FLOAT(_mm_xor_ps(v2, (__m128)xmmword_8F6F60)) * 0.029999999);
v4 = (__m128)*(_DWORD *)PositionPtr; // xPosition
v4.m128_f32[0] = v4.m128_f32[0] - 17066.666;
v5 = (signed int)ffloor(COERCE_FLOAT(_mm_xor_ps(v4, (__m128)xmmword_8F6F60)) * 0.029999999);
Edit: I'm basically trying to reverse CMap::QueryAreaIdTerrain and all it's sub functions
Edit 2: And based on what you just taught me, I believe the above in this post would translate to:
Code:
const float AdtWidth = 1600.0f / 3.0f;
const float MapOrigin = 32 * AdtWidth; // == 17066.66666666f
float yPosition = Memory.ReadFloat((uint)PositionPtr + 4); // yPosition
v3 = (int)Math.Floor((MapOrigin - yPosition) * 0.029999999);
//v3 = (signed int)ffloor(COERCE_FLOAT(_mm_xor_ps(v2, (__m128)xmmword_8F6F60)) * 0.029999999);
float xPosition = Memory.ReadFloat((uint)PositionPtr); // xPosition
v5 = (int)Math.Floor((MapOrigin - xPosition) * 0.029999999);
//v5 = (signed int)ffloor(COERCE_FLOAT(_mm_xor_ps(v4, (__m128)xmmword_8F6F60)) * 0.029999999);