//
// cocos2d::CCTiledGrid3D::calculateVertexPoints from 0xd4e248 to 0xd4e4b4 (620 bytes)
//
// 2 xrefs:
// > ??> @ 0x719c8
// > ??> @ 0x1517080
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:07:39 +0000
//
void *__fastcall cocos2d::CCTiledGrid3D::calculateVertexPoints(cocos2d::CCTiledGrid3D *this)
{
float v2; // s10
float v3; // s8
float v4; // s9
int v5; // w20
void *v6; // x0
void *v7; // x0
void *v8; // x0
__int64 v9; // x19
size_t v10; // x21
float *v11; // x0
void *v12; // x22
float *v13; // x19
_WORD *v14; // x0
float v15; // s18
float v16; // s4
float *v17; // x3
float v18; // s17
int v19; // w2
float v20; // s5
int v21; // w5
float v22; // s16
int v23; // w4
float v24; // s4
float v25; // s3
float v26; // s5
float v27; // s7
float v28; // s6
float v29; // s0
float v30; // s1
float v31; // s0
float v32; // s1
__int16 v33; // w3
_WORD *v34; // x2
__int16 v35; // w6
float *v37; // [xsp+58h] [xbp+58h]
v2 = (float)(*(unsigned int (__fastcall **)(_QWORD))(**((_QWORD **)this + 9) + 88LL))(*((_QWORD *)this + 9));
v3 = (float)(*(unsigned int (__fastcall **)(_QWORD))(**((_QWORD **)this + 9) + 96LL))(*((_QWORD *)this + 9));
v4 = *(float *)(cocos2d::CCTexture2D::getContentSizeInPixels(*((cocos2d::CCTexture2D **)this + 9)) + 4);
v5 = (int)(float)(*((float *)this + 16) * *((float *)this + 17));
if ( *((_QWORD *)this + 16) )
{
free(*((void **)this + 16));
*((_QWORD *)this + 16) = 0;
}
v6 = *((void **)this + 17);
if ( v6 )
{
free(v6);
*((_QWORD *)this + 17) = 0;
}
v7 = *((void **)this + 15);
if ( v7 )
{
free(v7);
*((_QWORD *)this + 15) = 0;
}
v8 = *((void **)this + 18);
if ( v8 )
free(v8);
v9 = 4 * v5;
v10 = 12 * v9;
v11 = (float *)malloc(12 * v9);
*((_QWORD *)this + 16) = v11;
v37 = v11;
v12 = malloc(12 * v9);
*((_QWORD *)this + 17) = v12;
v13 = (float *)malloc(8 * v9);
*((_QWORD *)this + 15) = v13;
v14 = malloc(12LL * v5);
*((_QWORD *)this + 18) = v14;
v15 = *((float *)this + 16);
if ( v15 > 0.0 )
{
v16 = 0.0;
v17 = v37;
v18 = *((float *)this + 17);
v19 = 0;
do
{
if ( v18 > 0.0 )
{
v20 = *((float *)this + 20);
v21 = *((unsigned __int8 *)this + 96);
v22 = *((float *)this + 21);
v23 = 0;
v24 = v16 * v20;
v25 = 0.0;
v26 = v20 + v24;
v27 = v24 / v2;
v28 = v26 / v2;
do
{
v29 = v25 * v22;
++v23;
*v17 = v24;
v17 += 12;
v25 = (float)v23;
*(v17 - 10) = 0.0;
v30 = v29 + v22;
*(v17 - 11) = v29;
*(v17 - 8) = v29;
*(v17 - 9) = v26;
*(v17 - 5) = v29 + v22;
*(v17 - 2) = v29 + v22;
*(v17 - 7) = 0.0;
*(v17 - 6) = v24;
*(v17 - 4) = 0.0;
*(v17 - 3) = v26;
*(v17 - 1) = 0.0;
if ( v21 )
{
v29 = v4 - v29;
v30 = v4 - v30;
}
v31 = v29 / v3;
v13 += 8;
*(v13 - 8) = v27;
*(v13 - 6) = v28;
*(v13 - 4) = v27;
*(v13 - 2) = v28;
v32 = v30 / v3;
*(v13 - 7) = v31;
*(v13 - 5) = v31;
*(v13 - 3) = v32;
*(v13 - 1) = v32;
}
while ( (float)v23 < v18 );
}
v16 = (float)++v19;
}
while ( (float)v19 < v15 );
}
if ( v5 > 0 )
{
v33 = 0;
v34 = &v14[6 * (v5 - 1) + 6];
do
{
*v14 = v33;
v14 += 6;
*(v14 - 5) = v33 + 1;
v35 = v33 + 3;
*(v14 - 4) = v33 + 2;
*(v14 - 3) = v33 + 1;
*(v14 - 2) = v33 + 2;
v33 += 4;
*(v14 - 1) = v35;
}
while ( v14 != v34 );
}
return memcpy(v12, v37, v10);
}