//
// cocos2d::CCSpriteBatchNode::atlasIndexForChild from 0x5e7f32 to 0x5e7fdc (170 bytes)
//
// 2 xrefs:
// > cocos2d::CCSpriteBatchNode::insertChild @ 0x5e80f6
// > cocos2d::CCSpriteBatchNode::insertChild @ 0x5e8172
//
// 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::CCNode *v6; // r0
cocos2d::CCArray *v7; // r6
cocos2d::CCObject *v8; // r2
int v9; // r4
cocos2d::CCSpriteBatchNode *v10; // r9
cocos2d::CCSprite *v11; // r6
cocos2d::CCSpriteBatchNode *v12; // r0
unsigned int result; // r0
v6 = a2->getParent(a2);
v7 = v6->getChildren(v6);
v9 = cocos2d::CCArray::indexOfObject(v7, (cocos2d::_ccArray *)a2, v8);
v10 = (cocos2d::CCSpriteBatchNode *)a2->getParent(a2);
if ( (unsigned int)(v9 - 1) > 0xFFFFFFFD )
v11 = nullptr;
else
v11 = (cocos2d::CCSprite *)cocos2d::CCArray::objectAtIndex(v7, v9 - 1);
if ( v10 == a1 )
{
if ( !v9 )
return 0;
v12 = v10;
LABEL_17:
result = cocos2d::CCSpriteBatchNode::highestAtlasIndexInChild(v12, v11);
goto LABEL_19;
}
if ( v9 )
{
if ( (v11->getZOrder(v11) >= 0 || a3 >= 0) && (v11->getZOrder(v11) < 0 || a3 < 0) )
{
result = a2->getParent(a2)[1].m_eObjType;
goto LABEL_19;
}
v12 = a1;
goto LABEL_17;
}
result = a2->getParent(a2)[1].m_eObjType;
if ( a3 >= 0 )
LABEL_19:
++result;
return result;
}