//
// cocos2d::CCTileMapAtlas::calculateItemsToRender from 0x10022cc80 to 0x10022cd66 (230 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 __fastcall cocos2d::CCTileMapAtlas::calculateItemsToRender(cocos2d::CCTileMapAtlas *a1)
{
cocos2d::sImageTGA *m_pTGAInfo; // rdx
__int64 width; // rax
__int64 height; // rcx
unsigned __int8 *imageData; // rdx
int v5; // r10d
unsigned __int8 *v6; // r11
__int64 i; // rbx
__int64 v8; // r14
unsigned __int8 *v9; // r15
a1->m_nItemsToRender = 0;
m_pTGAInfo = a1->m_pTGAInfo;
width = m_pTGAInfo->width;
if ( width > 0 )
{
height = m_pTGAInfo->height;
if ( height > 0 )
{
imageData = m_pTGAInfo->imageData;
v5 = 0;
v6 = imageData;
for ( i = 0; i != width; ++i )
{
if ( (_WORD)height == 1 )
{
v8 = 0;
}
else
{
v9 = v6;
v8 = 0;
do
{
if ( *v9 )
a1->m_nItemsToRender = ++v5;
if ( v9[3 * width] )
a1->m_nItemsToRender = ++v5;
v8 += 2;
v9 += 6 * width;
}
while ( (height & 0x7FFE) != v8 );
}
if ( (height & 1) != 0 )
{
if ( imageData[3 * i + 3 * width * v8] )
a1->m_nItemsToRender = ++v5;
}
v6 += 3;
}
}
}
}