//
// GJBaseGameLayer::addToGroup from 0x10013cfa0 to 0x10013d0a3 (259 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::addToGroup @ 0x1000f0caa
// > ??> @ 0x1008b7360
// > ??> @ 0x1008c18e0
//
// 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 GJBaseGameLayer::addToGroup(GJBaseGameLayer *a1, GameObject *a2, int a3, bool a4)
{
intptr_t v5; // r14
cocos2d::CCArray *v6; // rdi
cocos2d::CCArray *v7; // rdi
__int64 v8; // r13
cocos2d::CCArray *v9; // r12
cocos2d::CCObject *v10; // r12
std::vector *p_m_optimizedGroups; // [rsp-38h] [rbp-38h]
if ( a3 <= 9999 )
{
v5 = 0;
if ( a3 > 0 )
v5 = (unsigned int)a3;
v6 = a1->m_groups.__begin_[v5];
if ( v6 )
{
sub_10071FCD0(v6, a2);
if ( a2->m_isDecoration2 )
goto LABEL_6;
}
else
{
v9 = (cocos2d::CCArray *)sub_10071F9E0(0, a2);
cocos2d::CCDictionary::setObject(a1->m_groupDict, v9, v5);
a1->m_groups.__begin_[v5] = v9;
sub_10071FCD0(v9, a2);
if ( a2->m_isDecoration2 )
{
LABEL_6:
v7 = a1->m_optimizedGroups.__begin_[v5];
if ( !v7 )
{
p_m_optimizedGroups = &a1->m_optimizedGroups;
v8 = 3576;
LABEL_11:
v10 = (cocos2d::CCObject *)sub_10071F9E0(0, a2);
cocos2d::CCDictionary::setObject(
*(cocos2d::CCDictionary **)((char *)&a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable
+ v8),
v10,
v5);
v7 = (cocos2d::CCArray *)v10;
p_m_optimizedGroups->__begin_[v5] = (cocos2d::CCArray *)v10;
goto LABEL_12;
}
goto LABEL_12;
}
}
v7 = a1->m_staticGroups.__begin_[v5];
if ( !v7 )
{
p_m_optimizedGroups = &a1->m_staticGroups;
v8 = 3568;
goto LABEL_11;
}
LABEL_12:
sub_10071FCD0(v7, a2);
}
}