//
// cocos2d::CCSpriteBatchNode::updateAtlasIndex from 0x5e7be2 to 0x5e7cee (268 bytes)
//
// 3 xrefs:
// > cocos2d::CCSpriteBatchNode::updateAtlasIndex @ 0x5e7c26
// > cocos2d::CCSpriteBatchNode::updateAtlasIndex @ 0x5e7ce4
// > cocos2d::CCSpriteBatchNode::sortAllChildren @ 0x5e7d90
//
// 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::CCSpriteBatchNode::updateAtlasIndex(cocos2d::CCSpriteBatchNode *a1, cocos2d::CCSprite *a2, int *a3)
{
cocos2d::CCArray *v6; // r0
cocos2d::CCArray *v7; // r8
cocos2d::ccArray *data; // r1
cocos2d::CCObject **arr; // r6
cocos2d::CCObject **v10; // r5
cocos2d::CCSprite *v11; // r1
cocos2d::CCSprite *v12; // t1
unsigned int m_uAtlasIndex; // r1
int v14; // r9
cocos2d::ccArray *v15; // r2
cocos2d::CCSprite **v16; // r6
cocos2d::CCSprite **v17; // r8
cocos2d::CCSprite *v18; // r10
cocos2d::CCSprite *v19; // t1
unsigned int v20; // r1
unsigned int v21; // r1
v6 = a2->getChildren(a2);
v7 = v6;
if ( !v6 || (data = v6->data, !data->num) )
{
if ( a2->m_bDontDraw )
return;
goto LABEL_21;
}
arr = data->arr;
if ( a2->m_bDontDraw )
{
v10 = &arr[data->num] + 0x3FFFFFFF;
while ( arr <= v10 )
{
v12 = (cocos2d::CCSprite *)*arr++;
v11 = v12;
if ( !v12 )
break;
cocos2d::CCSpriteBatchNode::updateAtlasIndex(a1, v11, a3);
}
}
else
{
if ( ((int (__fastcall *)(cocos2d::CCObject *))(*arr)->__vftable[1].isEqual)(*arr) < 0 )
{
v14 = 1;
}
else
{
m_uAtlasIndex = a2->m_uAtlasIndex;
a2->m_uAtlasIndex = *a3;
if ( m_uAtlasIndex != *a3 )
cocos2d::CCSpriteBatchNode::swap(a1, m_uAtlasIndex, *a3);
v14 = 0;
++*a3;
}
v15 = v7->data;
if ( v15->num )
{
v16 = (cocos2d::CCSprite **)v15->arr;
v17 = &v16[v15->num] + 0x3FFFFFFF;
while ( v16 <= v17 )
{
v19 = *v16++;
v18 = v19;
if ( !v19 )
break;
if ( v14 && v18->getZOrder(v18) >= 0 )
{
v21 = a2->m_uAtlasIndex;
a2->m_uAtlasIndex = *a3;
if ( v21 != *a3 )
cocos2d::CCSpriteBatchNode::swap(a1, v21, *a3);
v14 = 0;
++*a3;
}
cocos2d::CCSpriteBatchNode::updateAtlasIndex(a1, v18, a3);
}
}
if ( v14 )
{
LABEL_21:
v20 = a2->m_uAtlasIndex;
a2->m_uAtlasIndex = *a3;
if ( v20 != *a3 )
cocos2d::CCSpriteBatchNode::swap(a1, v20, *a3);
++*a3;
}
}
}