As I couldn't get AOE casting to work with CTM I tried my luck with something else... As of 3.3.3a this istypedef bool (*fp_Spell_C__HandleTerrainClick) (TerrainClickStruct*) __attribute__((cdecl));Code:004DDCF0 Spell_C__HandleTerrainClick
"TerrainClickStruct":
Using 0 for the unknown 8 bytes worked perfectly for me. I'm not sure about their meaning but WoW seemed to set them to 0, at least when I checked them with a breakpoint in Spell_C__HandleTerrainClick.Code:typedef struct { uint32_t unknown0, unknown1; float x, y, z; } TerrainClickStruct;
Decompiled function:
Even though this works very well, I'd still like to know how it's done with CTM, just out of curiosity.Code:bool __cdecl Spell_C__HandleTerrainClick(TerrainClickStruct *tc) { bool result; // eax@1 int v2; // edx@3 int v3; // edx@4 float v4; // ecx@4 float v5; // ecx@6 result = dword_AF6940; if ( !dword_AF6940 ) { LOBYTE(result) = 0; return result; } v2 = dword_AF693C; if ( dword_AF693C & 0x20 ) { *(_DWORD *)(dword_AF6940 + 72) = tc->unknown0; *(_DWORD *)(result + 76) = tc->unknown1; *(_DWORD *)(result + 88) = LODWORD(tc->x); *(_DWORD *)(result + 92) = LODWORD(tc->y); v4 = tc->z; *(_DWORD *)(result + 40) |= 0x20u; *(_DWORD *)(result + 96) = LODWORD(v4); v3 = v2 & 0xFFFFFFDF; } else { if ( !(dword_AF693C & 0x40) ) { LOBYTE(result) = 0; return result; } *(_DWORD *)(dword_AF6940 + 80) = tc->unknown0; *(_DWORD *)(result + 84) = tc->unknown1; *(_DWORD *)(result + 100) = LODWORD(tc->x); *(_DWORD *)(result + 104) = LODWORD(tc->y); v5 = tc->z; *(_DWORD *)(result + 40) |= 0x40u; *(_DWORD *)(result + 108) = LODWORD(v5); v3 = v2 & 0xFFFFFFBF; } dword_AF693C = v3; if ( !v3 ) result = SendCast(0); LOBYTE(result) = 1; return result; }