//
// cocos2d::CCParticleBatchNode::reorderChild from 0x180061af0 to 0x180061d04 (532 bytes)
//
// 5 xrefs:
// > ??> @ 0x1800fa2c8
// > ??> @ 0x180139978
// > ??> @ 0x1801399c0
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b36d8
//
// 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 __fastcall cocos2d::CCParticleBatchNode::reorderChild(
cocos2d::CCParticleBatchNode *this,
struct cocos2d::CCString *a2,
int a3)
{
unsigned int v5; // ebx
char v6; // bp
char v7; // r12
unsigned int v8; // r14d
unsigned int v9; // r15d
unsigned int v10; // r13d
struct cocos2d::CCNode *v11; // r14
__int64 v12; // r8
float v13; // r14d
float v14; // ebp
int v15; // ebx
unsigned int v16; // eax
unsigned int v17; // [rsp+70h] [rbp+8h]
int v18; // [rsp+78h] [rbp+10h]
v5 = 0;
_RTDynamicCast(a2, 0, &cocos2d::CCNode `RTTI Type Descriptor', &cocos2d::CCParticleSystem `RTTI Type Descriptor', 0);
cocos2d::CCArray::containsObject(this->m_pChildren, a2);
if ( a3 != ((unsigned int (__fastcall *)(struct cocos2d::CCString *))a2->__vftable[1].acceptVisitor)(a2) )
{
if ( (unsigned int)cocos2d::CCArray::count(this->m_pChildren) > 1 )
{
v6 = 0;
v7 = 0;
v8 = 0;
v9 = 0;
v17 = 0;
v18 = 0;
v10 = cocos2d::CCArray::count(this->m_pChildren);
if ( v10 )
{
do
{
v11 = (struct cocos2d::CCNode *)cocos2d::CCArray::stringAtIndex(this->m_pChildren, v5);
if ( ((int (__fastcall *)(struct cocos2d::CCNode *))v11->getZOrder)(v11) > a3 && !v6 )
{
v9 = v5;
v6 = 1;
if ( v7 )
{
v8 = v17;
goto LABEL_15;
}
}
if ( a2 == (struct cocos2d::CCString *)v11 )
{
v17 = v5;
v7 = 1;
if ( v6 )
{
v8 = v5;
goto LABEL_15;
}
v18 = -1;
}
++v5;
}
while ( v5 < v10 );
v8 = v17;
if ( v6 )
goto LABEL_15;
}
v9 = v10;
LABEL_15:
if ( v8 != v18 + v9 )
{
cocos2d::CCObject::retain(a2);
LOBYTE(v12) = 1;
cocos2d::CCArray::removeObjectAtIndex(this->m_pChildren, v8, v12);
cocos2d::CCArray::insertObject(this->m_pChildren, a2);
cocos2d::CCObject::release(a2);
v13 = *(float *)&a2[5].m_uID;
cocos2d::CCParticleBatchNode::updateAllAtlasIndexes(this);
v14 = 0.0;
v15 = 0;
if ( (unsigned int)cocos2d::CCArray::count(this->m_pChildren) )
{
while ( cocos2d::CCArray::stringAtIndex(this->m_pChildren, v15) != a2 )
{
if ( ++v15 >= (unsigned int)cocos2d::CCArray::count(this->m_pChildren) )
goto LABEL_21;
}
v14 = *(float *)&a2[5].m_uID;
}
LABEL_21:
v16 = ((__int64 (__fastcall *)(struct cocos2d::CCString *))a2->__vftable[20].update)(a2);
cocos2d::CCTextureAtlas::moveQuadsFromIndex(this->m_pTextureAtlas, LODWORD(v13), v16, LODWORD(v14));
((void (__fastcall *)(struct cocos2d::CCString *))a2->__vftable[21].setTag)(a2);
}
}
((void (__fastcall *)(struct cocos2d::CCString *, _QWORD))a2->__vftable[1].isEqual)(a2, (unsigned int)a3);
}
}