//
// cocos2d::CCTiledGrid3D::calculateVertexPoints from 0x180022e30 to 0x18002313d (781 bytes)
//
// 6 xrefs:
// > ??> @ 0x1800e72f0
// > ??> @ 0x1801340ac
// > ??> @ 0x1801340e0
// > ??> @ 0x1801340f0
// > ??> @ 0x1801438a8
// > ??> @ 0x1801aefc8
//
// 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 __fastcall cocos2d::CCTiledGrid3D::calculateVertexPoints(cocos2d::CCTiledGrid3D *this)
{
float v2; // xmm8_4
float v3; // xmm9_4
const struct cocos2d::CCSize *ContentSizeInPixels; // rax
int v5; // esi
void *v6; // rcx
float height; // xmm6_4
int v8; // r14d
void *v9; // rcx
void *v10; // rcx
void *v11; // rcx
__int64 v12; // rdi
char *v13; // rax
float width; // xmm0_4
__int64 v15; // rcx
char *v16; // r9
float *v17; // rdx
int v18; // r8d
float v19; // xmm7_4
int v20; // eax
float v21; // xmm1_4
float x; // xmm5_4
float v23; // xmm2_4
float v24; // xmm4_4
float v25; // xmm3_4
float v26; // xmm5_4
float v27; // xmm4_4
float v28; // xmm2_4
float v29; // xmm5_4
float v30; // xmm3_4
char *v31; // r8
__int16 v32; // dx
v2 = (float)((int (__fastcall *)(cocos2d::CCTexture2D *))this->m_pTexture->getPixelsWide)(this->m_pTexture);
v3 = (float)((int (__fastcall *)(cocos2d::CCTexture2D *))this->m_pTexture->getPixelsHigh)(this->m_pTexture);
ContentSizeInPixels = cocos2d::CCTexture2D::getContentSizeInPixels(this->m_pTexture);
v5 = 0;
v6 = *((void **)this + 16);
height = ContentSizeInPixels->height;
v8 = (int)(float)(this->m_sGridSize.width * this->m_sGridSize.height);
if ( v6 )
{
free(v6);
*((_QWORD *)this + 16) = 0;
}
v9 = *((void **)this + 17);
if ( v9 )
{
free(v9);
*((_QWORD *)this + 17) = 0;
}
v10 = *((void **)this + 15);
if ( v10 )
{
free(v10);
*((_QWORD *)this + 15) = 0;
}
v11 = *((void **)this + 18);
if ( v11 )
{
free(v11);
*((_QWORD *)this + 18) = 0;
}
v12 = 4 * v8;
*((_QWORD *)this + 16) = malloc(12 * v12);
*((_QWORD *)this + 17) = malloc(12 * v12);
*((_QWORD *)this + 15) = malloc(8 * v12);
v13 = (char *)malloc(12LL * v8);
width = this->m_sGridSize.width;
v15 = *((_QWORD *)this + 16);
v16 = v13;
v17 = *((float **)this + 15);
v18 = 0;
*((_QWORD *)this + 18) = v13;
if ( width > 0.0 )
{
v19 = 0.0;
do
{
v20 = 0;
if ( this->m_sGridSize.height > 0.0 )
{
v21 = 0.0;
do
{
x = this->m_obStep.x;
v23 = this->m_obStep.y * v21;
v24 = v19 * x;
v25 = this->m_obStep.y + v23;
*(float *)v15 = v19 * x;
v26 = x + (float)(v19 * x);
*(float *)(v15 + 4) = v23;
*(float *)(v15 + 16) = v23;
*(float *)(v15 + 28) = v25;
*(float *)(v15 + 40) = v25;
*(float *)(v15 + 12) = v26;
*(float *)(v15 + 24) = v24;
*(float *)(v15 + 36) = v26;
*(_DWORD *)(v15 + 8) = 0;
*(_DWORD *)(v15 + 20) = 0;
*(_DWORD *)(v15 + 32) = 0;
*(_DWORD *)(v15 + 44) = 0;
v15 += 48;
if ( this->m_bIsTextureFlipped )
{
v23 = height - v23;
v25 = height - v25;
}
v27 = v24 / v2;
++v20;
v28 = v23 / v3;
*v17 = v27;
v29 = v26 / v2;
v30 = v25 / v3;
v17[1] = v28;
v17[2] = v29;
v17[3] = v28;
v17[4] = v27;
v17[5] = v30;
v17[6] = v29;
v17[7] = v30;
v17 += 8;
v21 = (float)v20;
}
while ( this->m_sGridSize.height > (float)v20 );
}
v19 = (float)++v18;
}
while ( this->m_sGridSize.width > (float)v18 );
}
if ( v8 > 0 )
{
v31 = v16 + 4;
do
{
v31 += 12;
v32 = 4 * v5++;
*((_WORD *)v31 - 8) = v32;
*((_WORD *)v31 - 7) = v32 + 1;
*((_WORD *)v31 - 6) = v32 + 2;
*((_WORD *)v31 - 3) = v32 + 3;
*((_WORD *)v31 - 5) = v32 + 1;
*((_WORD *)v31 - 4) = v32 + 2;
}
while ( v5 < v8 );
}
memcpy(*((void **)this + 17), *((const void **)this + 16), 48LL * v8);
}