//
// cocos2d::CCSpriteBatchNode::atlasIndexForChild from 0xb179d0 to 0xb17b24 (340 bytes)
//
// 3 xrefs:
// > cocos2d::CCSpriteBatchNode::insertChild @ 0xb17d04
// > cocos2d::CCSpriteBatchNode::insertChild @ 0xb17dfc
// > ??> @ 0x5f040
//
// 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
//
unsigned int cocos2d::CCSpriteBatchNode::atlasIndexForChild(
cocos2d::CCSpriteBatchNode *a1,
cocos2d::CCSprite *a2,
int a3)
{
cocos2d::CCSprite *v6; // x20
cocos2d::CCNode *v7; // x0
cocos2d::CCArray *v8; // x25
cocos2d::CCObject *v9; // x2
int v10; // w21
cocos2d::CCSpriteBatchNode *v11; // x0
cocos2d::CCSpriteBatchNode *v12; // x23
unsigned int result; // w0
v6 = nullptr;
v7 = a2->getParent(a2);
v8 = v7->getChildren(v7);
v10 = cocos2d::CCArray::indexOfObject(v8, (cocos2d::_ccArray *)a2, v9);
v11 = (cocos2d::CCSpriteBatchNode *)a2->getParent(a2);
v12 = v11;
if ( (unsigned int)(v10 - 1) <= 0xFFFFFFFD )
{
v6 = (cocos2d::CCSprite *)cocos2d::CCArray::objectAtIndex(v8, v10 - 1);
if ( v12 != a1 )
goto LABEL_3;
LABEL_13:
result = 0;
if ( v10 )
return cocos2d::CCSpriteBatchNode::highestAtlasIndexInChild(v12, v6) + 1;
return result;
}
if ( v11 == a1 )
goto LABEL_13;
LABEL_3:
if ( v10 )
{
if ( (((__int64 (__fastcall *)(cocos2d::CCSprite *))v6->getZOrder)(v6) & 0x80000000) != 0 && a3 < 0
|| (((__int64 (__fastcall *)(cocos2d::CCSprite *))v6->getZOrder)(v6) & 0x80000000) == 0 && (a3 & 0x80000000) == 0 )
{
return cocos2d::CCSpriteBatchNode::highestAtlasIndexInChild(a1, v6) + 1;
}
result = a2->getParent(a2)[1].m_unknown2;
}
else
{
result = a2->getParent(a2)[1].m_unknown2;
if ( a3 < 0 )
return result;
}
return ++result;
}