//
// GJBaseGameLayer::setGroupParent from 0x140224680 to 0x140224790 (272 bytes)
//
// 6 xrefs:
// > GJBaseGameLayer::loadGroupParentsFromString @ 0x140224982
// > LevelEditorLayer::addSpecial @ 0x1402d81c2
// > SetGroupIDLayer::onAddGroupParent @ 0x1403fccdf
// > ??> @ 0x140680054
// > ??> @ 0x140680064
// > ??> @ 0x1406cd704
//
// 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::setGroupParent(GJBaseGameLayer *a1, GameObject *a2, int a3)
{
__int64 v3; // rsi
GameObject *v6; // rax
__int64 v7; // rcx
cocos2d::CCArray *v8; // rdi
unsigned int v9; // ebx
struct cocos2d::CCInteger *v10; // rax
if ( a3 > 0 )
{
v3 = a3;
if ( a2 )
{
v6 = (GameObject *)cocos2d::CCDictionary::objectForKey(a1->m_parentGroupsDict, a3);
if ( v6 != a2 && (!v6 || !a1->m_keepGroupParents) )
{
GJBaseGameLayer::removeGroupParent(a1, v3);
cocos2d::CCDictionary::setObject(a1->m_parentGroupsDict, a2, v3);
v8 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(a1->m_parentGroupIDs, (unsigned int)a2->m_uniqueID);
if ( !v8 )
{
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
cocos2d::CCDictionary::setObject(a1->m_parentGroupIDs, v8, (unsigned int)a2->m_uniqueID);
}
v9 = 0;
if ( cocos2d::CCArray::count(v8) )
{
while ( LODWORD(cocos2d::CCArray::objectAtIndex(v8, v9)[1].__vftable) != (_DWORD)v3 )
{
if ( ++v9 >= cocos2d::CCArray::count(v8) )
goto LABEL_11;
}
}
else
{
LABEL_11:
v10 = cocos2d::CCInteger::create(v3);
cocos2d::CCArray::addObject(v8, v10);
}
a2->m_hasGroupParentsString = 1;
}
}
}
}