//
// EditorUI::assignNewGroups from 0x1003f338c to 0x1003f34c0 (308 bytes)
//
// 2 xrefs:
// > EditorPauseLayer::onNewGroupX @ 0x10039e0cc
// > EditorPauseLayer::onNewGroupY @ 0x10039e0dc
//
// 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 EditorUI::assignNewGroups(EditorUI *a1, bool a2)
{
_BOOL4 v2; // w20
cocos2d::CCObject *v4; // x0
cocos2d::CCObject *v5; // x21
int (__cdecl *v6)(const void *, const void *); // x3
cocos2d::CCObject_vtbl *v7; // x9
__int64 copyWithZone_low; // x8
void (__cdecl *v9)(cocos2d::CCObject *__hidden); // x22
unsigned __int64 v10; // x23
__int64 v11; // x20
LevelEditorLayer *m_editorLayer; // x0
__int64 NextFreeGroupID; // x21
std::unordered_set v14; // [xsp+0h] [xbp-60h] BYREF
v2 = a2;
if ( a1->m_selectedObject || (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
{
v4 = sub_10024A15C();
v5 = v4;
if ( a1->m_selectedObject )
sub_10024A2D0((__int64)v4);
else
sub_10024A360((__int64)v4, (__int64)a1->m_selectedObjects);
if ( v2 )
v6 = (int (__cdecl *)(const void *, const void *))sub_1003C4ADC;
else
v6 = (int (__cdecl *)(const void *, const void *))sub_1003C4A78;
qsort(v5[1].~CCObject_0, (size_t)v5[1].copyWithZone, 8u, v6);
v7 = v5[1].__vftable;
copyWithZone_low = LODWORD(v7->copyWithZone);
if ( (_DWORD)copyWithZone_low )
{
v9 = v7->~CCObject_0;
v10 = (unsigned __int64)v9 + 8 * copyWithZone_low - 8;
do
{
v11 = *(_QWORD *)v9;
if ( !*(_QWORD *)v9 )
break;
m_editorLayer = a1->m_editorLayer;
memset(&v14, 0, 32);
v14.__table_.__p3_.__value_ = 1.0;
NextFreeGroupID = LevelEditorLayer::getNextFreeGroupID(m_editorLayer, &v14);
sub_100017A98((__int64)&v14);
if ( (*(unsigned int (__fastcall **)(__int64, __int64))(*(_QWORD *)v11 + 1584LL))(v11, NextFreeGroupID) == 1 )
((void (__fastcall *)(LevelEditorLayer *, __int64, __int64, _QWORD))a1->m_editorLayer->addToGroup)(
a1->m_editorLayer,
v11,
NextFreeGroupID,
0);
v9 = (void (__cdecl *)(cocos2d::CCObject *__hidden))((char *)v9 + 8);
}
while ( (unsigned __int64)v9 <= v10 );
}
EditorUI::updateObjectInfoLabel(a1);
}
}