/Base = BaseofTable (ptr to data)
+0x8 = calculated size (XY)
+0x10 = int X (size in X)
+0x14 = int Y (size in Y)/
int SetMapFlags(DWORD64 MainPtr, DWORD Offset4, bool Enabled)
{
//DWORD Enable = 0x04000400; // 0x400 is no fog on terrain, 0x04000000 is visible units and minimap i thnk
DWORD Enable = 0x04000400;
DWORD Disable = 0x00000000;
DWORD64 Table =(DWORD64)(MainPtr + Offset4);
DWORD EAX =(DWORD)(Table+0x10);
DWORD EAXMUL =(DWORD)(Table+0x14);
DWORD NewEax = EAX EAXMUL;
if (!NewEax) return 0;
DWORD64 TableIndex = 0;
for (DWORD Counter = 0; Counter <= NewEax; Counter++) // counter = r8
{
// lea r9, [r9+4] actually does r9 = 4, or even r9 = r9+4;, so it will increment by 4 on this instruction
TableIndex = (DWORD64)(Table);
if(Enabled) (DWORD)((DWORD64)TableIndex + (Counter * 0x4)) |= Enable;
else (DWORD)((DWORD64)TableIndex + (Counter * 0x4)) &= ~Enable; // this should be most correct tho actually too but does the same thing
//else (DWORD)((DWORD64)TableIndex + (Counter * 0x4)) = Disable;
// not sure why this is -recalled so many times, its just the number of map tiles (does not change)
//EAX = (DWORD)Table;
//EAXMUL = (DWORD)(Table + 4);
//NewEax = EAX * EAXMUL;
}
return 1;
}
Table Data Struct (updated):
int32* TileData[SizeX*SizeY]; //ptr->data
int64 CalculatedSizeXTimesSizeY; // 0x5100
int32 SizeX; // =0x90
int32 SizeY; // =0x90