//
// GameObject::addToColorGroup from 0x44dc64 to 0x44dcac (72 bytes)
//
// 2 xrefs:
// > PlayLayer::optimizeColorGroups @ 0x408d5a
// > GJBaseGameLayer::calculateColorGroups @ 0x5a680a
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:48:35 +0000
//
int __fastcall GameObject::addToColorGroup(int this, int a2)
{
int v2; // r4
int v4; // r1
int i; // r3
int v6; // r2
v2 = this;
if ( *(__int16 *)(this + 1028) <= 9 && (unsigned int)(a2 - 1) <= 0x270E )
{
this = GameObject::createColorGroupContainer(this, 0xAu);
v4 = *(__int16 *)(v2 + 1028);
for ( i = 0; ; ++i )
{
v6 = *(_DWORD *)(v2 + 1024);
if ( i >= v4 )
break;
if ( *(__int16 *)(v6 + 2 * i) == a2 )
return this;
}
*(_WORD *)(v6 + 2 * v4) = a2;
++*(_WORD *)(v2 + 1028);
}
return this;
}