//
// PlayLayer::optimizeColorGroups from 0x408cc4 to 0x408d90 (204 bytes)
//
// 1 xrefs:
// > PlayLayer::setupHasCompleted @ 0x409f9a
//
// 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:47:30 +0000
//
int __fastcall PlayLayer::optimizeColorGroups(cocos2d::CCArray **this)
{
unsigned int v2; // r4
int v3; // r0
int *i; // r4
int v5; // r10
cocos2d::CCArray *Group; // r11
unsigned int j; // r5
GameObject *v8; // r0
int v10; // [sp+4h] [bp-10h] BYREF
_BYTE v11[8]; // [sp+8h] [bp-Ch] BYREF
int *v12; // [sp+10h] [bp-4h] BYREF
_DWORD v13[2]; // [sp+14h] [bp+0h] BYREF
v2 = 0;
v13[0] = 0;
v13[1] = 0;
v12 = v13;
while ( v2 < cocos2d::CCArray::count(*(this + 522)) )
{
v3 = cocos2d::CCArray::objectAtIndex(*(this + 522), v2);
if ( *(_DWORD *)(v3 + 892) == 1006 )
{
v10 = *(_DWORD *)(v3 + 1284);
std::__tree::__emplace_unique_key_args((int)v11, &v12, &v10, &v10);
}
++v2;
}
GJBaseGameLayer::addRemapTargets(this, &v12);
for ( i = v12; i != v13; i = std::__tree_next *>(i) )
{
v5 = i[4];
Group = (cocos2d::CCArray *)GJBaseGameLayer::getGroup((GJBaseGameLayer *)this, v5);
for ( j = 0; j < cocos2d::CCArray::count(Group); ++j )
{
v8 = (GameObject *)cocos2d::CCArray::objectAtIndex(Group, j);
GameObject::addToColorGroup(v8, v5);
}
}
return std::__tree::~__tree((int)&v12);
}