//
// cocos2d::CCTiledGrid3D::calculateVertexPoints from 0x5c6b24 to 0x5c6cf2 (462 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void cocos2d::CCTiledGrid3D::calculateVertexPoints(cocos2d::CCTiledGrid3D *a1)
{
float v2; // s16
float v3; // s17
const cocos2d::CCSize *ContentSizeInPixels; // r0
int v5; // r6
float height; // s18
void *m_uID; // r0
void *m_nLuaID; // r0
cocos2d::CCTiledGrid3D_vtbl *v9; // r0
void *m_nTag; // r0
char *v11; // r8
void *v12; // r0
void *v13; // r9
cocos2d::CCTiledGrid3D_vtbl *v14; // r0
cocos2d::CCTiledGrid3D_vtbl *v15; // r5
_WORD *v16; // r0
float width; // s9
char *v18; // r1
int v19; // r12
float v20; // s11
__int16 v21; // r3
int v22; // r2
float v23; // s10
char *v24; // r3
int (__fastcall **p_getTag)(const cocos2d::CCObject *__hidden); // r5
int v26; // r10
float x; // s13
_BOOL4 m_bIsTextureFlipped; // r2
float y; // s14
float v30; // s12
float v31; // s15
float v32; // s13
float v33; // s14
float v34; // s12
float v35; // s15
float v36; // s13
float v37; // s14
v2 = (float)a1->m_pTexture->getPixelsWide(a1->m_pTexture);
v3 = (float)a1->m_pTexture->getPixelsHigh(a1->m_pTexture);
ContentSizeInPixels = cocos2d::CCTexture2D::getContentSizeInPixels(a1->m_pTexture);
v5 = (int)(float)(a1->m_sGridSize.width * a1->m_sGridSize.height);
height = ContentSizeInPixels->height;
m_uID = (void *)a1[1].m_uID;
if ( m_uID )
{
free(m_uID);
a1[1].m_uID = 0;
}
m_nLuaID = (void *)a1[1].m_nLuaID;
if ( m_nLuaID )
{
free(m_nLuaID);
a1[1].m_nLuaID = 0;
}
v9 = a1[1].__vftable;
if ( v9 )
{
free(v9);
a1[1].__vftable = nullptr;
}
m_nTag = (void *)a1[1].m_nTag;
if ( m_nTag )
free(m_nTag);
v11 = (char *)malloc(48 * v5);
a1[1].m_uID = (unsigned int)v11;
v12 = malloc(48 * v5);
a1[1].m_nLuaID = (int)v12;
v13 = v12;
v14 = (cocos2d::CCTiledGrid3D_vtbl *)malloc(32 * v5);
a1[1].__vftable = v14;
v15 = v14;
v16 = malloc(12 * v5);
width = a1->m_sGridSize.width;
v18 = v11;
v19 = 0;
a1[1].m_nTag = (int)v16;
while ( 1 )
{
v20 = (float)v19;
if ( (float)v19 >= width )
break;
v23 = a1->m_sGridSize.height;
v24 = v18 + 48;
p_getTag = &v15->getTag;
v26 = 0;
while ( 1 )
{
v18 = v24 - 48;
if ( (float)v26 >= v23 )
break;
x = a1->m_obStep.x;
m_bIsTextureFlipped = a1->m_bIsTextureFlipped;
*((_DWORD *)v24 - 10) = 0;
y = a1->m_obStep.y;
*((_DWORD *)v24 - 7) = 0;
*((_DWORD *)v24 - 4) = 0;
v30 = v20 * x;
*((_DWORD *)v24 - 1) = 0;
v31 = (float)v26 * y;
*((float *)v24 - 12) = v20 * x;
*((float *)v24 - 6) = v20 * x;
v32 = (float)(v20 * x) + x;
*((float *)v24 - 11) = v31;
*((float *)v24 - 8) = v31;
v33 = v31 + y;
*((float *)v24 - 9) = v32;
*((float *)v24 - 3) = v32;
*((float *)v24 - 5) = v33;
*((float *)v24 - 2) = v33;
if ( m_bIsTextureFlipped )
{
v31 = height - v31;
v33 = height - v33;
}
++v26;
v24 += 48;
p_getTag += 8;
v34 = v30 / v2;
v35 = v31 / v3;
*((float *)p_getTag - 16) = v34;
*((float *)p_getTag - 12) = v34;
v36 = v32 / v2;
*((float *)p_getTag - 15) = v35;
*((float *)p_getTag - 13) = v35;
v37 = v33 / v3;
*((float *)p_getTag - 14) = v36;
*((float *)p_getTag - 10) = v36;
*((float *)p_getTag - 11) = v37;
*((float *)p_getTag - 9) = v37;
}
v15 = (cocos2d::CCTiledGrid3D_vtbl *)(p_getTag - 8);
++v19;
}
v21 = 1;
v22 = 0;
while ( 1 )
{
v16 += 6;
if ( v22 >= v5 )
break;
*(v16 - 6) = 4 * v22;
*(v16 - 5) = v21;
*(v16 - 3) = v21;
++v22;
*(v16 - 4) = v21 + 1;
*(v16 - 2) = v21 + 1;
*(v16 - 1) = v21 + 2;
v21 += 4;
}
j_memcpy(v13, v11, 48 * v5);
}