//
// GameObject::addToGroup from 0x10025d390 to 0x10025d43c (172 bytes)
//
// 48 xrefs:
// > TeleportPortalObject::addToGroup2 @ 0x100387bbc
// > TeleportPortalObject::addToGroup @ 0x100387c08
// > ??> @ 0x1007c41e8
// > ??> @ 0x1007cfeb8
// > ??> @ 0x1007d06a0
// > ??> @ 0x1007d0eb0
// > ??> @ 0x1007f5720
// > ??> @ 0x1007f5f58
// > ??> @ 0x1007f6750
// > ??> @ 0x1007f6f48
// > ??> @ 0x1007f7740
// > ??> @ 0x1007f7f38
// > ??> @ 0x1007f8730
// > ??> @ 0x1007f8f28
// > ??> @ 0x1007f9710
// > ??> @ 0x1007f9f20
// > ??> @ 0x1007fa788
// > ??> @ 0x1007faf98
// > ??> @ 0x1007fb7a8
// > ??> @ 0x1007fbfb8
// > ??> @ 0x1007fc7c8
// > ??> @ 0x1007fcfd8
// > ??> @ 0x1007fd7e8
// > ??> @ 0x1007fdff8
// > ??> @ 0x1007fe808
// > ??> @ 0x1007ff018
// > ??> @ 0x100800098
// > ??> @ 0x1008008c0
// > ??> @ 0x1008010e8
// > ??> @ 0x100801910
// > ??> @ 0x100802138
// > ??> @ 0x100802948
// > ??> @ 0x100803158
// > ??> @ 0x100803968
// > ??> @ 0x100804178
// > ??> @ 0x100804988
// > ??> @ 0x100805198
// > ??> @ 0x1008059a8
// > ??> @ 0x1008061b8
// > ??> @ 0x1008069c8
// > ??> @ 0x1008071d8
// > ??> @ 0x1008079e8
// > ??> @ 0x1008081f8
// > ??> @ 0x100808a08
// > ??> @ 0x100809218
// > ??> @ 0x100809a28
// > ??> @ 0x10080a238
// > ??> @ 0x100816558
//
// 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; // x21
std::array *m_groups; // x0
__int64 v8; // x8
std::array *v9; // x9
int v10; // t1
if ( (unsigned int)(a2 - 10000) < 0xFFFFD8F1 || a1->m_groupCount > 9 )
return 0;
m_groupCount = a1->m_groupCount;
m_groups = a1->m_groups;
if ( !m_groups )
{
m_groups = (std::array *)operator new[](0x14u);
a1->m_groups = m_groups;
*(_QWORD *)m_groups->__elems_ = 0;
*(_QWORD *)&m_groups->__elems_[4] = 0;
*(_DWORD *)&m_groups->__elems_[8] = 0;
}
if ( (int)m_groupCount < 1 )
{
LABEL_12:
m_groups->__elems_[m_groupCount] = a2;
++a1->m_groupCount;
return 1;
}
else
{
v8 = m_groupCount;
v9 = m_groups;
while ( 1 )
{
v10 = v9->__elems_[0];
v9 = (std::array *)((char *)v9 + 2);
if ( v10 == a2 )
return -1;
if ( !--v8 )
goto LABEL_12;
}
}
}