//
// SetGroupIDLayer::onAddGroup from 0x1403fca90 to 0x1403fcbfd (365 bytes)
//
// 2 xrefs:
// > SetGroupIDLayer::init @ 0x1403f93b7
// > ??> @ 0x1406d84e0
//
// 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
//
// Hidden C++ exception states: #wind=2
void SetGroupIDLayer::onAddGroup(SetGroupIDLayer *a1, cocos2d::CCObject *a2)
{
unsigned int m_groupIDValue; // ebp
GameObject *m_targetObject; // rcx
__int64 v5; // rcx
unsigned int i; // ebx
struct cocos2d::CCObject *v7; // rsi
__int64 v8; // rcx
void *v9; // [rsp+30h] [rbp+8h]
void *v10; // [rsp+30h] [rbp+8h]
m_groupIDValue = a1->m_groupIDValue;
a1->m_addedGroup = 1;
m_targetObject = a1->m_targetObject;
if ( m_targetObject )
{
if ( m_targetObject->addToGroup(m_targetObject, m_groupIDValue) == 1 )
{
v5 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v9 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v9);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = qword_1406C2ED8;
}
(*(void (__fastcall **)(_QWORD, GameObject *, _QWORD, _QWORD))(**(_QWORD **)(v5 + 528) + 1152LL))(
*(_QWORD *)(v5 + 528),
a1->m_targetObject,
m_groupIDValue,
0);
}
}
else
{
for ( i = 0; i < cocos2d::CCArray::count(a1->m_targetObjects); ++i )
{
v7 = cocos2d::CCArray::objectAtIndex(a1->m_targetObjects, i);
if ( ((unsigned int (__fastcall *)(struct cocos2d::CCObject *, _QWORD))v7->__vftable[19].setTag)(
v7,
m_groupIDValue) == 1 )
{
v8 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v10 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v8 = qword_1406C2ED8;
}
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *, _QWORD, _QWORD))(**(_QWORD **)(v8 + 528) + 1152LL))(
*(_QWORD *)(v8 + 528),
v7,
m_groupIDValue,
0);
}
}
}
SetGroupIDLayer::updateGroupIDButtons(a1);
}