//
// GameObject::addToGroup from 0x1005be4f0 to 0x1005be593 (163 bytes)
//
// 48 xrefs:
// > TeleportPortalObject::addToGroup2 @ 0x1001be005
// > TeleportPortalObject::addToGroup @ 0x1001be04e
// > ??> @ 0x1008c4698
// > ??> @ 0x1008c4ed0
// > ??> @ 0x1008c56c8
// > ??> @ 0x1008c5ec0
// > ??> @ 0x1008c66b8
// > ??> @ 0x1008c6eb0
// > ??> @ 0x1008c76a8
// > ??> @ 0x1008c7ea0
// > ??> @ 0x1008c8688
// > ??> @ 0x1008c8e98
// > ??> @ 0x1008c9710
// > ??> @ 0x1008c9f20
// > ??> @ 0x1008ca730
// > ??> @ 0x1008caf40
// > ??> @ 0x1008cb750
// > ??> @ 0x1008cbf60
// > ??> @ 0x1008cc770
// > ??> @ 0x1008ccf80
// > ??> @ 0x1008cd790
// > ??> @ 0x1008cdfa0
// > ??> @ 0x1008cf020
// > ??> @ 0x1008cf848
// > ??> @ 0x1008d0070
// > ??> @ 0x1008d0898
// > ??> @ 0x1008d10c0
// > ??> @ 0x1008d18d0
// > ??> @ 0x1008d20e0
// > ??> @ 0x1008d28f0
// > ??> @ 0x1008d3100
// > ??> @ 0x1008d3910
// > ??> @ 0x1008d4120
// > ??> @ 0x1008d4930
// > ??> @ 0x1008d5140
// > ??> @ 0x1008d5950
// > ??> @ 0x1008d6160
// > ??> @ 0x1008d6970
// > ??> @ 0x1008d7180
// > ??> @ 0x1008d7990
// > ??> @ 0x1008d81a0
// > ??> @ 0x1008d89b0
// > ??> @ 0x1008d91c0
// > ??> @ 0x100923968
// > ??> @ 0x100933d30
// > ??> @ 0x100971a18
// > ??> @ 0x100972200
// > ??> @ 0x100972a10
//
// 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 __fastcall GameObject::addToGroup(GameObject *a1, int a2)
{
__int64 m_groupCount; // r14
int result; // eax
std::array *m_groups; // rax
__int64 v5; // rcx
m_groupCount = a1->m_groupCount;
result = 0;
if ( m_groupCount < 10 && (unsigned int)(a2 - 10000) >= 0xFFFFD8F1 )
{
m_groups = a1->m_groups;
if ( m_groups )
{
if ( (__int16)m_groupCount <= 0 )
goto LABEL_9;
}
else
{
m_groups = (std::array *)operator new[](0x14u);
a1->m_groups = m_groups;
*(_OWORD *)m_groups->__elems_ = 0;
*(_DWORD *)&m_groups->__elems_[8] = 0;
if ( (__int16)m_groupCount <= 0 )
{
LABEL_9:
m_groups->__elems_[m_groupCount] = a2;
++a1->m_groupCount;
return 1;
}
}
v5 = 0;
while ( m_groups->__elems_[v5] != a2 )
{
if ( m_groupCount == ++v5 )
goto LABEL_9;
}
return -1;
}
return result;
}