//
// PlayLayer::optimizeColorGroups from 0x316348 to 0x316418 (208 bytes)
//
// 1 xrefs:
// > PlayLayer::setupHasCompleted @ 0x31bb82
//
// 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
//
void PlayLayer::optimizeColorGroups(PlayLayer *a1)
{
unsigned int v2; // r4
int v3; // r0
std::set *i; // r4
int M_right; // r10
cocos2d::CCArray *Group; // r11
unsigned int j; // r5
GameObject *v8; // r0
int v9; // [sp+0h] [bp-10h] BYREF
_BYTE v10[8]; // [sp+4h] [bp-Ch] BYREF
std::set v11; // [sp+Ch] [bp-4h] BYREF
v2 = 0;
memset(&v11._M_t._M_impl._M_header, 0, 20);
v11._M_t._M_impl._M_header._M_left = &v11._M_t._M_impl._M_header;
v11._M_t._M_impl._M_header._M_right = &v11._M_t._M_impl._M_header;
while ( v2 < cocos2d::CCArray::count(a1->m_objects) )
{
v3 = cocos2d::CCArray::objectAtIndex(a1->m_objects, v2);
if ( *(_DWORD *)(v3 + 884) == 1006 )
{
v9 = *(_DWORD *)(v3 + 1276);
std::set::insert((int)v10, &v11, &v9);
}
++v2;
}
GJBaseGameLayer::addRemapTargets(a1, &v11);
for ( i = (std::set *)v11._M_t._M_impl._M_header._M_left;
i != (std::set *)&v11._M_t._M_impl._M_header;
i = (std::set *)sub_761FE0(i) )
{
M_right = (int)i->_M_t._M_impl._M_header._M_right;
Group = GJBaseGameLayer::getGroup(a1, M_right);
for ( j = 0; j < cocos2d::CCArray::count(Group); ++j )
{
v8 = (GameObject *)cocos2d::CCArray::objectAtIndex(Group, j);
GameObject::addToColorGroup(v8, M_right);
}
}
std::_Rb_tree,std::less,std::allocator>::~_Rb_tree((int)&v11);
}