//
// cocos2d::CCSpriteBatchNode::atlasIndexForChild from 0x18008e100 to 0x18008e24e (334 bytes)
//
// 4 xrefs:
// > cocos2d::CCSpriteBatchNode::insertChild @ 0x18008e95e
// > cocos2d::CCSpriteBatchNode::insertChild @ 0x18008ea0a
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b5f88
//
// 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::atlasIndexForChild(
cocos2d::CCSpriteBatchNode *this,
struct cocos2d::CCSprite *a2,
int a3)
{
__int64 v6; // rax
cocos2d::CCArray *v7; // r15
int v8; // r14d
struct cocos2d::CCSprite *v9; // rbx
cocos2d::CCSpriteBatchNode *v10; // r12
__int64 result; // rax
unsigned int v12; // eax
unsigned int v13; // ecx
cocos2d::CCArray *v14; // rax
cocos2d::CCArray *v15; // rdi
struct cocos2d::CCSprite *Object; // rax
v6 = ((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getParent)(a2);
v7 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v6 + 464LL))(v6);
v8 = cocos2d::CCArray::indexOfObject(v7, a2);
v9 = nullptr;
v10 = (cocos2d::CCSpriteBatchNode *)((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getParent)(a2);
if ( (unsigned int)(v8 - 1) <= 0xFFFFFFFD )
v9 = (struct cocos2d::CCSprite *)cocos2d::CCArray::stringAtIndex(v7, v8 - 1);
if ( v10 == this )
{
if ( !v8 )
return 0;
v12 = cocos2d::CCSpriteBatchNode::highestAtlasIndexInChild(this, v9);
return v12 + 1;
}
if ( v8 )
{
if ( (((int (__fastcall *)(struct cocos2d::CCSprite *))v9->getZOrder)(v9) >= 0 || a3 >= 0)
&& (((int (__fastcall *)(struct cocos2d::CCSprite *))v9->getZOrder)(v9) < 0 || a3 < 0) )
{
v12 = *(_DWORD *)(((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getParent)(a2) + 360);
return v12 + 1;
}
v14 = (cocos2d::CCArray *)((__int64 (__fastcall *)(struct cocos2d::CCSprite *))v9->getChildren)(v9);
v15 = v14;
if ( v14 && (unsigned int)cocos2d::CCArray::count(v14) )
{
Object = (struct cocos2d::CCSprite *)cocos2d::CCArray::lastObject(v15);
return cocos2d::CCSpriteBatchNode::highestAtlasIndexInChild(this, Object) + 1;
}
else
{
return v9->m_uAtlasIndex + 1;
}
}
else
{
v13 = *(_DWORD *)(((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getParent)(a2) + 360);
result = v13 + 1;
if ( a3 < 0 )
return v13;
}
return result;
}