Hey, I messed around with those today, basically this way lets you get the current chunk and height of terrain by just providing game coords:
Code:
CMap::LinkStaticEntityGetChunk - 0x7342A0, not rebased
Btw: HexRays is failing there, this function is a __thiscall and you need to call it like this:
Code:
float fUnknown = 100000.0f; // always 100000...
DWORD_PTR dwChunk = 0; // out chunk offset
DWORD_PTR dwMapBasePtr = *reinterpret_cast<DWORD_PTR*>( 0xE71E90 );
DWORD_PTR dwChunkPtr = reinterpret_cast<DWORD_PTR (__thiscall*)( DWORD_PTR, CVec3* )>( 0x731540 )( dwMapBasePtr, &loc );
// Get the terrain height and current chunk base!
float fTerrainHeight = reinterpret_cast<float (__thiscall*)( DWORD_PTR, CVec3*, float*, DWORD_PTR* )>( 0x7342A0 )( dwChunkPtr, &loc, &fUnknown, &dwChunk );
// Set the chunk height to += 5
*reinterpret_cast<float*>( dwChunk + 0xB4 ) += 5;
The code here get the chunk for the provided game location (C3Vector) and sets the base chunk height to += 5. Note that you will probably need a /console GxRestart unless you call the terrain update function / patch some gxrestart variables.
If you look into that function you will see that it calls CMap::GetHeightTerrain which indexes the triangles of the current chunk to get the exact terrain height.
Now I wonder if anyone messed with those structures, seems quite hard to reverse this :c
EDIT: Screenie
