//
// GameObject::addToGroup from 0x35648a to 0x3564de (84 bytes)
//
// 2 xrefs:
// > TeleportPortalObject::addToGroup2 @ 0x3e116a
// > TeleportPortalObject::addToGroup @ 0x3e53f6
//
// 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; // r1
int i; // r3
std::array *m_groups; // r2
if ( a1->m_groupCount > 9 || (unsigned int)(a2 - 1) > 0x270E )
return 0;
GameObject::createGroupContainer(a1, 10);
m_groupCount = a1->m_groupCount;
for ( i = 0; ; ++i )
{
m_groups = a1->m_groups;
if ( i >= m_groupCount )
{
m_groups->__elems_[m_groupCount] = a2;
++a1->m_groupCount;
return 1;
}
if ( m_groups->__elems_[i] == a2 )
break;
}
return -1;
}