//
// LevelEditorLayer::addToGroup from 0x1402dea00 to 0x1402deb55 (341 bytes)
//
// 4 xrefs:
// > ??> @ 0x140586380
// > ??> @ 0x14068eb60
// > ??> @ 0x14068eb94
// > ??> @ 0x1406d3464
//
// 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 LevelEditorLayer::addToGroup(LevelEditorLayer *a1, GameObject *a2, int a3, bool a4)
{
__int64 v4; // rbp
cocos2d::CCArray *Group; // rax
__int64 v9; // rcx
int v10; // eax
__int64 v11; // r14
std::_Simple_types::value_type v12; // rsi
std::_Vector_val>::pointer Myfirst; // rax
__int64 v14; // rcx
cocos2d::CCArray *v15; // rsi
v4 = a3;
if ( a3 > 9999 )
return;
Group = GJBaseGameLayer::getGroup(a1, a3);
cocos2d::CCArray::addObject(Group, a2);
v10 = 0;
if ( a2->m_isDecoration2 )
{
if ( (int)v4 >= 0 )
v10 = v4;
v11 = v10;
v12 = a1->m_optimizedGroups._Mypair._Myval2._Myfirst[v10];
if ( v12 )
goto LABEL_12;
v12 = (std::_Simple_types::value_type)cocos2d::CCArray::create(v9);
cocos2d::CCDictionary::setObject(a1->m_optimizedGroupDict, v12, v11);
Myfirst = a1->m_optimizedGroups._Mypair._Myval2._Myfirst;
}
else
{
if ( (int)v4 >= 0 )
v10 = v4;
v11 = v10;
v12 = a1->m_staticGroups._Mypair._Myval2._Myfirst[v10];
if ( v12 )
goto LABEL_12;
v12 = (std::_Simple_types::value_type)cocos2d::CCArray::create(v9);
cocos2d::CCDictionary::setObject(a1->m_staticGroupDict, v12, v11);
Myfirst = a1->m_staticGroups._Mypair._Myval2._Myfirst;
}
Myfirst[v11] = v12;
LABEL_12:
cocos2d::CCArray::addObject(v12, a2);
if ( a2->m_isSpawnOrderTrigger )
{
v15 = a1->m_triggerGroups._Mypair._Myval2._Myfirst[v4];
if ( !v15 )
{
v15 = (cocos2d::CCArray *)cocos2d::CCArray::create(v14);
a1->m_triggerGroups._Mypair._Myval2._Myfirst[v4] = v15;
cocos2d::CCDictionary::setObject(a1->m_triggerGroupsDict, v15, v4);
}
if ( a4 || !cocos2d::CCArray::containsObject(v15, a2) )
cocos2d::CCArray::addObject(v15, a2);
}
a1->m_unk3b22 = 1;
}