//
// SetGroupIDLayer::updateGroupIDButtons from 0x10003dee0 to 0x10003e35c (1148 bytes)
//
// 6 xrefs:
// > SetGroupIDLayer::init @ 0x10003c2ec
// > SetGroupIDLayer::onAddGroupParent @ 0x10003d558
// > SetGroupIDLayer::onPaste @ 0x10003e3e4
// > SetGroupIDLayer::callRemoveFromGroup @ 0x10003ef18
// > SetGroupIDLayer::removeGroupID @ 0x10003f004
// > SetGroupIDLayer::addGroupID @ 0x10003f0e8
//
// 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 __fastcall SetGroupIDLayer::updateGroupIDButtons(SetGroupIDLayer *a1)
{
__int64 v2; // x20
__int64 v3; // x0
cocos2d::CCDictionary *v4; // x20
GameObject *m_targetObject; // x0
int v6; // w21
int GroupID; // w23
cocos2d::CCNode *v8; // x22
GameManager *v9; // x0
GameObject *GroupParent; // x8
int v11; // w26
__int64 v12; // x21
__int64 v13; // x0
GameObject *v14; // x22
int v15; // w23
intptr_t v16; // x25
cocos2d::CCNode *v17; // x24
GameManager *v18; // x0
int v19; // w0
_BOOL4 v20; // w23
unsigned int v21; // w24
float v22; // s8
cocos2d::CCDirector *v23; // x0
__n128 v24; // q0
__n128 v25; // q1
cocos2d::CCMenu *m_buttonMenu; // x21
float v27; // s3
cocos2d::CCArray *v28; // x21
__int64 v29; // x22
int v30; // w23
intptr_t v31; // x27
cocos2d::CCObject *v32; // x0
const char *v33; // x28
unsigned int v34; // w28
cocos2d::CCString *v35; // x0
const char *CString; // x0
ButtonSprite *v37; // x0
CCMenuItemSpriteExtra *v38; // x28
__n128 v39; // q0
__n128 v40; // q1
double v41; // d0
unsigned int v42; // w0
float32x2_t v43; // [xsp+10h] [xbp-80h] BYREF
float32x2_t v44; // [xsp+18h] [xbp-78h] BYREF
float32x2_t v45; // [xsp+20h] [xbp-70h] BYREF
float v46; // [xsp+28h] [xbp-68h]
float v47; // [xsp+2Ch] [xbp-64h]
cocos2d::SEL_MenuHandler v48; // 0:x3.16
if ( (unsigned int)sub_10024A36C(a1->m_groupIDObjects) )
{
v2 = 0;
do
{
v3 = sub_10024A388(a1->m_groupIDObjects, v2);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v3 + 504LL))(v3);
v2 = (unsigned int)(v2 + 1);
}
while ( (unsigned int)v2 < (unsigned int)sub_10024A36C(a1->m_groupIDObjects) );
}
sub_10024A45C(a1->m_groupIDObjects);
cocos2d::CCDictionary::removeAllObjects(a1->m_parentGroups);
v4 = cocos2d::CCDictionary::create();
m_targetObject = a1->m_targetObject;
if ( m_targetObject )
{
if ( m_targetObject->m_groupCount >= 1 )
{
v6 = 0;
do
{
GroupID = GameObject::getGroupID(m_targetObject, v6);
v8 = cocos2d::CCNode::create();
cocos2d::CCDictionary::setObject(v4, v8, GroupID);
m_targetObject = a1->m_targetObject;
if ( m_targetObject->m_hasGroupParentsString )
{
v9 = GameManager::sharedState();
GroupParent = GJBaseGameLayer::getGroupParent(v9->m_levelEditorLayer, GroupID);
m_targetObject = a1->m_targetObject;
if ( m_targetObject == GroupParent )
{
cocos2d::CCDictionary::setObject(a1->m_parentGroups, v8, GroupID);
m_targetObject = a1->m_targetObject;
}
}
++v6;
}
while ( v6 < m_targetObject->m_groupCount );
}
goto LABEL_29;
}
if ( !(unsigned int)sub_10024A36C(a1->m_targetObjects) )
{
LABEL_29:
v20 = 0;
v21 = 5;
v22 = 58.0;
goto LABEL_30;
}
v11 = 0;
v12 = 0;
do
{
v13 = sub_10024A388(a1->m_targetObjects, v12);
if ( *(__int16 *)(v13 + 1168) >= 1 )
{
v14 = (GameObject *)v13;
v15 = 0;
do
{
v16 = GameObject::getGroupID(v14, v15);
v17 = (cocos2d::CCNode *)cocos2d::CCDictionary::objectForKey(v4, v16);
if ( !cocos2d::CCDictionary::objectForKey(v4, v16) )
{
v17 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, _QWORD))v17->setTag)(v17, 0);
cocos2d::CCDictionary::setObject(v4, v17, v16);
++v11;
}
if ( v14->m_hasGroupParentsString )
{
v18 = GameManager::sharedState();
if ( v14 == GJBaseGameLayer::getGroupParent(v18->m_levelEditorLayer, v16) )
cocos2d::CCDictionary::setObject(a1->m_parentGroups, v17, v16);
}
v19 = ((__int64 (__fastcall *)(cocos2d::CCNode *))v17->getTag)(v17);
((void (__fastcall *)(cocos2d::CCNode *, _QWORD))v17->setTag)(v17, (unsigned int)(v19 + 1));
++v15;
}
while ( v15 < v14->m_groupCount );
}
v12 = (unsigned int)(v12 + 1);
}
while ( (unsigned int)v12 < (unsigned int)sub_10024A36C(a1->m_targetObjects) );
v20 = v11 > 10;
if ( v11 <= 10 )
v21 = 5;
else
v21 = 10;
if ( v11 <= 10 )
v22 = 58.0;
else
v22 = 35.0;
LABEL_30:
v23 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v23);
m_buttonMenu = a1->m_buttonMenu;
v27 = -2.0;
if ( v20 )
v27 = -4.5;
v24.n128_f32[0] = (float)(v46 * 0.5) + (float)(v27 * v22);
v25.n128_f32[0] = (float)(v47 * 0.5) + -1.0;
sub_100022980(v24, v25, &v44);
cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, (const cocos2d::CCPoint *)&v44);
v28 = cocos2d::CCDictionary::allKeys(v4);
qsort(v28->data->arr, v28->data->num, 8u, (int (__cdecl *)(const void *, const void *))sub_10003AD90);
if ( (unsigned int)sub_10024A36C(v28) )
{
v29 = 0;
if ( v20 )
v30 = 15;
else
v30 = 30;
do
{
v31 = *(int *)(sub_10024A388(v28, v29) + 56);
v32 = cocos2d::CCDictionary::objectForKey(v4, v31);
v33 = "GJ_button_04.png";
if ( !a1->m_targetObject )
{
v34 = ((__int64 (__fastcall *)(cocos2d::CCObject *))v32->getTag)(v32);
if ( v34 >= (unsigned int)sub_10024A36C(a1->m_targetObjects) )
v33 = "GJ_button_04.png";
else
v33 = "GJ_button_05.png";
}
if ( cocos2d::CCDictionary::objectForKey(a1->m_parentGroups, v31) )
v33 = "GJ_button_03.png";
v35 = (cocos2d::CCString *)sub_100268F4C("%i", v31);
CString = cocos2d::CCString::getCString(v35);
v37 = ButtonSprite::create_1(CString, v30, 0, 0.5, 1, "goldFont.fnt", v33, 20.0);
v48.ptr = (void (__cdecl *)(cocos2d::CCObject *))SetGroupIDLayer::onRemoveFromGroup;
v48.adj = 0;
v38 = CCMenuItemSpriteExtra::create(v37, nullptr, a1, v48);
((void (__fastcall *)(CCMenuItemSpriteExtra *, intptr_t))v38->setTag)(v38, v31);
v39 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v38);
v39.n128_f32[0] = v22 * (float)((unsigned int)v29 % v21);
v40.n128_f32[0] = (float)(int)(-30 * ((unsigned int)v29 / v21));
sub_100022980(v39, v40, &v43);
*(float32x2_t *)&v41 = sub_1000229DC(&v45, &v43, &v44);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v38->setPosition)(v38, &v44, v41);
sub_10024A2D0(a1->m_groupIDObjects, v38);
v42 = sub_10024A36C(v28);
if ( (unsigned int)v29 > 0x12 )
break;
v29 = (unsigned int)(v29 + 1);
}
while ( (unsigned int)v29 < v42 );
}
}