//
// GameObject::addToGroup from 0x646ab8 to 0x646b80 (200 bytes)
//
// 49 xrefs:
// > TeleportPortalObject::addToGroup2 @ 0x74b23c
// > TeleportPortalObject::addToGroup @ 0x750978
// > ??> @ 0x36e28
// > ??> @ 0x1152d10
// > ??> @ 0x1153ae0
// > ??> @ 0x11542b0
// > ??> @ 0x1154ab0
// > ??> @ 0x1162460
// > ??> @ 0x1162c60
// > ??> @ 0x1163460
// > ??> @ 0x1163c60
// > ??> @ 0x1164460
// > ??> @ 0x1164c60
// > ??> @ 0x1165460
// > ??> @ 0x1165c60
// > ??> @ 0x1166430
// > ??> @ 0x1166c30
// > ??> @ 0x1167430
// > ??> @ 0x1167c30
// > ??> @ 0x1168430
// > ??> @ 0x1168c70
// > ??> @ 0x1169470
// > ??> @ 0x1169c70
// > ??> @ 0x116a470
// > ??> @ 0x116b480
// > ??> @ 0x116bc80
// > ??> @ 0x116c480
// > ??> @ 0x116cc80
// > ??> @ 0x116d480
// > ??> @ 0x116dc80
// > ??> @ 0x116e480
// > ??> @ 0x116ec80
// > ??> @ 0x116f480
// > ??> @ 0x116fc80
// > ??> @ 0x1170480
// > ??> @ 0x1170c80
// > ??> @ 0x1171480
// > ??> @ 0x1171c80
// > ??> @ 0x1172480
// > ??> @ 0x1172c80
// > ??> @ 0x1173480
// > ??> @ 0x1173c80
// > ??> @ 0x1174480
// > ??> @ 0x1174c80
// > ??> @ 0x1175480
// > ??> @ 0x1175c80
// > ??> @ 0x1176480
// > ??> @ 0x1176c80
// > ??> @ 0x11774a0
//
// 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 m_groupCount; // w4
std::array *m_groups; // x3
__int16 *i; // x0
int v8; // t1
if ( a1->m_groupCount > 9 || (unsigned int)(a2 - 1) > 0x270E )
return 0;
GameObject::createGroupContainer(a1, 10);
m_groupCount = a1->m_groupCount;
m_groups = a1->m_groups;
if ( m_groupCount <= 0 )
goto LABEL_9;
if ( a2 != m_groups->__elems_[0] )
{
for ( i = &m_groups->__elems_[1]; i != &m_groups->__elems_[m_groupCount - 1 + 1]; ++i )
{
v8 = *i;
if ( a2 == v8 )
return -1;
}
LABEL_9:
m_groups->__elems_[a1->m_groupCount++] = a2;
return 1;
}
return -1;
}