//
// GameObject::addToGroup from 0x14019c790 to 0x14019c8b0 (288 bytes)
//
// 52 xrefs:
// > TeleportPortalObject::addToGroup2 @ 0x1404b25b0
// > TeleportPortalObject::addToGroup @ 0x1404b264b
// > ??> @ 0x140556948
// > ??> @ 0x1405570b8
// > ??> @ 0x14055e0f0
// > ??> @ 0x14055e770
// > ??> @ 0x1405c8808
// > ??> @ 0x14060d998
// > ??> @ 0x14060e2e8
// > ??> @ 0x14060ea08
// > ??> @ 0x14060f240
// > ??> @ 0x14060f8e8
// > ??> @ 0x14060ffb8
// > ??> @ 0x140610670
// > ??> @ 0x140610db8
// > ??> @ 0x140611d50
// > ??> @ 0x140612538
// > ??> @ 0x140612be0
// > ??> @ 0x140613288
// > ??> @ 0x1406139f8
// > ??> @ 0x1406140a0
// > ??> @ 0x140614888
// > ??> @ 0x1406150c0
// > ??> @ 0x140615808
// > ??> @ 0x140615eb0
// > ??> @ 0x1406165f8
// > ??> @ 0x140616db8
// > ??> @ 0x140617460
// > ??> @ 0x140617b08
// > ??> @ 0x140618278
// > ??> @ 0x140618920
// > ??> @ 0x140619068
// > ??> @ 0x140619b08
// > ??> @ 0x14061a1b0
// > ??> @ 0x14061a858
// > ??> @ 0x14061af78
// > ??> @ 0x14061b620
// > ??> @ 0x14061bd68
// > ??> @ 0x14061c500
// > ??> @ 0x14061cba8
// > ??> @ 0x14061d250
// > ??> @ 0x14061d8f8
// > ??> @ 0x14061dfa0
// > ??> @ 0x14061e648
// > ??> @ 0x14061ecf0
// > ??> @ 0x14061f500
// > ??> @ 0x14061fc98
// > ??> @ 0x140679240
// > ??> @ 0x140679254
// > ??> @ 0x140679264
// > ??> @ 0x1406cbda8
// > ??> @ 0x1406cbdb4
//
// 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
//
int GameObject::addToGroup(GameObject *a1, int a2)
{
int v4; // ebx
std::array *v5; // rax
__int64 m_groupCount; // r8
std::array *m_groups; // rcx
if ( a1->m_groupCount >= 10 || (unsigned int)(a2 - 1) > 0x270E )
return 0;
v4 = 0;
if ( !a1->m_groups )
{
v5 = (std::array *)operator new(0x14u);
a1->m_groups = v5;
v5->_Elems[0] = 0;
a1->m_groups->_Elems[1] = 0;
a1->m_groups->_Elems[2] = 0;
a1->m_groups->_Elems[3] = 0;
a1->m_groups->_Elems[4] = 0;
a1->m_groups->_Elems[5] = 0;
a1->m_groups->_Elems[6] = 0;
a1->m_groups->_Elems[7] = 0;
a1->m_groups->_Elems[8] = 0;
a1->m_groups->_Elems[9] = 0;
}
m_groupCount = a1->m_groupCount;
if ( (int)m_groupCount <= 0 )
{
LABEL_9:
a1->m_groups->_Elems[m_groupCount] = a2;
++a1->m_groupCount;
return 1;
}
else
{
m_groups = a1->m_groups;
while ( m_groups->_Elems[0] != a2 )
{
++v4;
m_groups = (std::array *)((char *)m_groups + 2);
if ( v4 >= (int)m_groupCount )
goto LABEL_9;
}
return -1;
}
}