//
// GJBaseGameLayer::sortStickyGroups from 0x473034 to 0x4730f0 (188 bytes)
//
// 2 xrefs:
// > LevelEditorLayer::init @ 0x376c38
// > GJBaseGameLayer::updateSpecialGroupData @ 0x4952e6
//
// 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 GJBaseGameLayer::sortStickyGroups(GJBaseGameLayer *a1)
{
unsigned int v2; // r6
cocos2d::CCDictionary *v3; // r5
cocos2d::CCObject *v4; // r0
intptr_t m_uID; // r1
cocos2d::CCObject *v6; // r8
cocos2d::CCArray *v7; // r7
cocos2d::CCDictElement *m_pElements; // r3
cocos2d::CCDictElement *next; // r5
cocos2d::CCDictElement *v10; // r2
cocos2d::CCArray *m_pObject; // r7
unsigned int v12; // r6
int v13; // r0
v2 = 0;
v3 = cocos2d::CCDictionary::create();
while ( v2 < cocos2d::CCArray::count(a1->m_objects) )
{
v4 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(a1->m_objects, v2);
m_uID = v4[14].m_uID;
v6 = v4;
if ( m_uID > 0 )
{
v7 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v3, m_uID);
if ( !v7 )
{
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr);
cocos2d::CCDictionary::setObject(v3, v7, v6[14].m_uID);
}
cocos2d::CCArray::addObject(v7, v6);
}
++v2;
}
a1->m_lastUsedLinkedID = 0;
if ( v3 )
{
m_pElements = v3->m_pElements;
if ( m_pElements )
next = (cocos2d::CCDictElement *)m_pElements->hh.next;
else
next = nullptr;
while ( m_pElements )
{
m_pObject = (cocos2d::CCArray *)m_pElements->m_pObject;
v12 = 0;
++a1->m_lastUsedLinkedID;
while ( v12 < cocos2d::CCArray::count(m_pObject) )
{
v13 = cocos2d::CCArray::objectAtIndex(m_pObject, v12++);
*(_DWORD *)(v13 + 732) = a1->m_lastUsedLinkedID;
}
cocos2d::CCDictionary::setObject(a1->m_linkedGroupDict, m_pObject, a1->m_lastUsedLinkedID);
if ( next )
v10 = (cocos2d::CCDictElement *)next->hh.next;
else
v10 = nullptr;
m_pElements = next;
next = v10;
}
}
}