//
// GJBaseGameLayer::sortStickyGroups from 0x8605cc to 0x860700 (308 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::init @ 0x67cae0
// > GJBaseGameLayer::updateSpecialGroupData @ 0x897fa4
// > ??> @ 0xc1ae8
//
// 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; // w19
cocos2d::CCDictionary *v3; // x23
bool v4; // cf
unsigned int v5; // w1
cocos2d::CCObject *v6; // x20
intptr_t m_nTag; // x1
cocos2d::CCArray *v8; // x22
cocos2d::CCDictElement *m_pElements; // x1
cocos2d::CCDictElement *next; // x22
int m_lastUsedLinkedID; // w0
cocos2d::CCArray *m_pObject; // x20
unsigned int v13; // w19
unsigned int v14; // w1
v2 = 0;
v3 = cocos2d::CCDictionary::create();
while ( 1 )
{
v4 = v2 >= (unsigned int)cocos2d::CCArray::count(a1->m_objects);
v5 = v2++;
if ( v4 )
break;
while ( 1 )
{
v6 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(a1->m_objects, v5);
m_nTag = v6[15].m_nTag;
if ( (int)m_nTag <= 0 )
break;
v8 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v3, m_nTag);
if ( !v8 )
{
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr);
cocos2d::CCDictionary::setObject(v3, v8, v6[15].m_nTag);
}
cocos2d::CCArray::addObject(v8, v6);
v4 = v2 >= (unsigned int)cocos2d::CCArray::count(a1->m_objects);
v5 = v2++;
if ( v4 )
goto LABEL_8;
}
}
LABEL_8:
a1->m_lastUsedLinkedID = 0;
if ( v3 )
{
m_pElements = v3->m_pElements;
if ( m_pElements )
{
next = (cocos2d::CCDictElement *)m_pElements->hh.next;
m_lastUsedLinkedID = 0;
while ( 1 )
{
m_pObject = (cocos2d::CCArray *)m_pElements->m_pObject;
v13 = 0;
for ( a1->m_lastUsedLinkedID = m_lastUsedLinkedID + 1;
;
*(_DWORD *)(cocos2d::CCArray::objectAtIndex(m_pObject, v14) + 856) = a1->m_lastUsedLinkedID )
{
v4 = v13 >= (unsigned int)cocos2d::CCArray::count(m_pObject);
v14 = v13++;
if ( v4 )
break;
}
cocos2d::CCDictionary::setObject(a1->m_linkedGroupDict, m_pObject, (unsigned int)a1->m_lastUsedLinkedID);
if ( !next )
break;
m_pElements = next;
m_lastUsedLinkedID = a1->m_lastUsedLinkedID;
next = (cocos2d::CCDictElement *)next->hh.next;
}
}
}
}