//
// GJBaseGameLayer::moveObjectToStaticGroup from 0x140231410 to 0x140231587 (375 bytes)
//
// 5 xrefs:
// > GJBaseGameLayer::optimizeMoveGroups @ 0x14023125a
// > GJBaseGameLayer::optimizeMoveGroups @ 0x14023135b
// > ??> @ 0x140680ee0
// > ??> @ 0x140680f24
// > ??> @ 0x1406cde84
//
// 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 GJBaseGameLayer::moveObjectToStaticGroup(GJBaseGameLayer *a1, GameObject *a2)
{
int v4; // r13d
__int64 v5; // r12
unsigned __int64 i; // r15
std::array *m_groups; // rax
__int64 v8; // rbx
int v9; // eax
__int64 v10; // r14
std::_Simple_types::value_type v11; // rsi
__int64 v12; // r14
std::_Simple_types::value_type v13; // rbx
if ( a2->m_isDecoration2 )
{
v4 = 0;
a2->m_isDecoration2 = 0;
if ( a2->m_groupCount > 0 )
{
v5 = 0;
for ( i = 0; i <= 9; ++i )
{
m_groups = a2->m_groups;
if ( !m_groups )
break;
v8 = (unsigned int)m_groups->_Elems[v5];
if ( (int)v8 > 9999 )
v8 = 9999;
if ( (int)v8 >= 0 )
goto LABEL_11;
v9 = 0;
LABEL_12:
v10 = v9;
v11 = a1->m_staticGroups._Mypair._Myval2._Myfirst[v9];
if ( !v11 )
{
v11 = (std::_Simple_types::value_type)cocos2d::CCArray::create(0);
cocos2d::CCDictionary::setObject(a1->m_staticGroupDict, v11, v10);
a1->m_staticGroups._Mypair._Myval2._Myfirst[v10] = v11;
}
if ( (int)v8 < 0 )
v8 = 0;
v12 = (unsigned int)v8;
v13 = a1->m_optimizedGroups._Mypair._Myval2._Myfirst[v8];
if ( !v13 )
{
v13 = (std::_Simple_types::value_type)cocos2d::CCArray::create(0);
cocos2d::CCDictionary::setObject(a1->m_optimizedGroupDict, v13, (unsigned int)v12);
a1->m_optimizedGroups._Mypair._Myval2._Myfirst[v12] = v13;
}
if ( !cocos2d::CCArray::containsObject(v11, a2) )
cocos2d::CCArray::addObject(v11, a2);
cocos2d::CCArray::removeObject(v13, a2, 1);
++v4;
++v5;
if ( v4 >= a2->m_groupCount )
return;
}
v8 = 0;
LABEL_11:
v9 = v8;
goto LABEL_12;
}
}
}