//
// cocos2d::CCSpriteBatchNode::rebuildIndexInOrder from 0x18008ec20 to 0x18008ed43 (291 bytes)
//
// 6 xrefs:
// > cocos2d::CCSpriteBatchNode::rebuildIndexInOrder @ 0x18008ec9e
// > cocos2d::CCSpriteBatchNode::rebuildIndexInOrder @ 0x18008ed1e
// > ??> @ 0x18013d844
// > ??> @ 0x18013d878
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b6054
//
// 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
//
__int64 __fastcall cocos2d::CCSpriteBatchNode::rebuildIndexInOrder(
cocos2d::CCSpriteBatchNode *this,
struct cocos2d::CCSprite *a2,
unsigned int a3)
{
cocos2d::CCArray *v6; // rax
cocos2d::CCArray *v7; // rbp
cocos2d::ccArray *data; // rbx
__int64 num; // rax
struct cocos2d::CCSprite **arr; // rbx
struct cocos2d::CCSprite **i; // r14
struct cocos2d::CCSprite *v12; // rsi
cocos2d::ccArray *v13; // rbx
__int64 v14; // rax
struct cocos2d::CCSprite **v15; // rbx
struct cocos2d::CCSprite **j; // rbp
struct cocos2d::CCSprite *v17; // rsi
v6 = (cocos2d::CCArray *)((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getChildren)(a2);
v7 = v6;
if ( v6 )
{
if ( (unsigned int)cocos2d::CCArray::count(v6) )
{
data = v7->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (struct cocos2d::CCSprite **)data->arr;
for ( i = &arr[num - 1]; arr <= i; ++arr )
{
v12 = *arr;
if ( !*arr )
break;
if ( ((int (__fastcall *)(struct cocos2d::CCSprite *))v12->getZOrder)(*arr) < 0 )
a3 = cocos2d::CCSpriteBatchNode::rebuildIndexInOrder(this, v12, a3);
}
}
}
}
if ( !((unsigned __int8 (__fastcall *)(struct cocos2d::CCSprite *, cocos2d::CCSpriteBatchNode *))a2->isEqual)(
a2,
this) )
a2->m_uAtlasIndex = a3++;
if ( v7 )
{
if ( (unsigned int)cocos2d::CCArray::count(v7) )
{
v13 = v7->data;
v14 = v13->num;
if ( (_DWORD)v14 )
{
v15 = (struct cocos2d::CCSprite **)v13->arr;
for ( j = &v15[v14 - 1]; v15 <= j; ++v15 )
{
v17 = *v15;
if ( !*v15 )
break;
if ( ((int (__fastcall *)(struct cocos2d::CCSprite *))v17->getZOrder)(*v15) >= 0 )
a3 = cocos2d::CCSpriteBatchNode::rebuildIndexInOrder(this, v17, a3);
}
}
}
}
return a3;
}