//
// GJBaseGameLayer::positionUIObjects from 0x10011c5a0 to 0x10011cae7 (1351 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::updateSpecialGroupData @ 0x1001173f1
//
// 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 GJBaseGameLayer::positionUIObjects(GJBaseGameLayer *a1)
{
intptr_t v2; // rsi
cocos2d::CCDictionary *m_parentGroupsDict; // rdi
cocos2d::CCArray *m_objects; // rax
cocos2d::ccArray *data; // rax
__int64 num; // rcx
cocos2d::CCObject **arr; // r13
cocos2d::CCObject *v8; // rax
cocos2d::CCObject *v9; // rbx
int m_uID; // eax
intptr_t v11; // r14
cocos2d::CCObject *v12; // r12
std::__vector_base::pointer begin; // rax
cocos2d::CCObject *v14; // rax
intptr_t m_nLuaID; // r12
cocos2d::CCObject *v16; // r14
cocos2d::CCArray *v17; // r14
cocos2d::CCDictionary *v18; // rbx
cocos2d::CCDirector *v19; // r12
cocos2d::CCDictElement *m_pElements; // rax
__int64 v21; // rcx
cocos2d::CCObject *v22; // rbx
GameObject **v23; // rax
unsigned __int64 v24; // rcx
GameObject *v25; // r14
int m_nZOrder; // ecx
int m_uOrderOfArrival; // esi
int v28; // eax
float v29; // xmm2_4
float v30; // xmm2_4
float v31; // xmm2_4
float v32; // xmm0_4
float v33; // xmm0_4
float v34; // xmm0_4
double v35; // xmm0_8
cocos2d::ccArray *v36; // rax
GameObject **v37; // rbx
unsigned __int64 v38; // r15
GameObject *v39; // r14
char v40[8]; // [rsp+0h] [rbp-C0h] BYREF
char v41[8]; // [rsp+8h] [rbp-B8h] BYREF
char v42[8]; // [rsp+10h] [rbp-B0h] BYREF
GameObject **v43; // [rsp+18h] [rbp-A8h]
unsigned __int64 v44; // [rsp+20h] [rbp-A0h]
cocos2d::CCObject **v45; // [rsp+28h] [rbp-98h]
cocos2d::CCObject **v46; // [rsp+30h] [rbp-90h]
__int64 v47; // [rsp+38h] [rbp-88h]
float v48; // [rsp+40h] [rbp-80h] BYREF
float v49; // [rsp+44h] [rbp-7Ch]
char v50[8]; // [rsp+48h] [rbp-78h] BYREF
GJBaseGameLayer *v51; // [rsp+50h] [rbp-70h]
float v52; // [rsp+58h] [rbp-68h] BYREF
float v53; // [rsp+5Ch] [rbp-64h]
cocos2d::CCObject *v54; // [rsp+60h] [rbp-60h]
cocos2d::CCArray *v55; // [rsp+68h] [rbp-58h]
float v56; // [rsp+70h] [rbp-50h]
float v57; // [rsp+74h] [rbp-4Ch]
GameObject *v58; // [rsp+78h] [rbp-48h]
float v59; // [rsp+80h] [rbp-40h] BYREF
float v60; // [rsp+84h] [rbp-3Ch]
_DWORD v61[2]; // [rsp+88h] [rbp-38h] BYREF
float v62; // [rsp+90h] [rbp-30h]
float v63; // [rsp+94h] [rbp-2Ch]
v2 = (intptr_t)cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v59);
m_parentGroupsDict = (cocos2d::CCDictionary *)v40;
sub_10028CBE0(v40, v59 * 0.5, v60 * 0.5);
v57 = v59 * 0.5;
v56 = 0.5 * v60;
v47 = sub_10071F9E0(v40, v2);
m_objects = a1->m_objects;
if ( m_objects )
{
data = m_objects->data;
num = data->num;
if ( data->num )
{
v62 = v57 / 240.0;
v63 = v56 / 160.0;
arr = data->arr;
v45 = &arr[num - 1];
v51 = a1;
while ( 1 )
{
v8 = *arr;
if ( !*arr )
return;
v54 = *arr;
if ( v8[18].m_uReference != 3613 )
goto LABEL_4;
v9 = v54;
m_uID = v54[26].m_uID;
v11 = 9999;
if ( m_uID < 9999 )
v11 = (unsigned int)m_uID;
if ( (int)v11 <= 0 )
v11 = 0;
v55 = a1->m_groups.__begin_[v11];
if ( !v55 )
{
v12 = (cocos2d::CCObject *)sub_10071F9E0(m_parentGroupsDict, v2);
cocos2d::CCDictionary::setObject(a1->m_groupDict, v12, v11);
begin = a1->m_groups.__begin_;
v55 = (cocos2d::CCArray *)v12;
begin[v11] = (cocos2d::CCArray *)v12;
m_uID = v9[26].m_uID;
}
m_parentGroupsDict = a1->m_parentGroupsDict;
v2 = m_uID;
v14 = cocos2d::CCDictionary::objectForKey(m_parentGroupsDict, m_uID);
m_nLuaID = v9[26].m_nLuaID;
v58 = (GameObject *)v14;
if ( m_nLuaID <= 0 )
break;
m_parentGroupsDict = a1->m_parentGroupsDict;
v2 = m_nLuaID;
v16 = cocos2d::CCDictionary::objectForKey(m_parentGroupsDict, m_nLuaID);
v14 = v58;
if ( v16 )
goto LABEL_22;
if ( (unsigned int)m_nLuaID >= 0x270F )
m_nLuaID = 9999;
v17 = a1->m_groups.__begin_[m_nLuaID];
if ( (v17
|| (v17 = (cocos2d::CCArray *)sub_10071F9E0(m_parentGroupsDict, v2),
m_parentGroupsDict = a1->m_groupDict,
v2 = (intptr_t)v17,
cocos2d::CCDictionary::setObject(m_parentGroupsDict, v17, m_nLuaID),
(a1->m_groups.__begin_[m_nLuaID] = v17) != nullptr))
&& (m_parentGroupsDict = (cocos2d::CCDictionary *)v17, (unsigned int)sub_100720070(v17) == 1) )
{
m_parentGroupsDict = (cocos2d::CCDictionary *)v17;
v2 = 0;
v16 = (cocos2d::CCObject *)sub_1007200C0(v17, 0);
}
else
{
v16 = nullptr;
}
v14 = v58;
v18 = (cocos2d::CCDictionary *)v55;
if ( v58 )
{
LABEL_23:
v19 = (cocos2d::CCDirector *)v14;
v18 = (cocos2d::CCDictionary *)v47;
sub_100720270(v47);
m_parentGroupsDict = v18;
v2 = (intptr_t)v19;
sub_10071FCD0(v18, v19);
}
LABEL_24:
if ( v16 )
{
if ( v18 )
{
m_parentGroupsDict = (cocos2d::CCDictionary *)&v48;
v2 = (intptr_t)v16;
((void (__fastcall *)(float *, cocos2d::CCObject *))v16->__vftable[22].update)(&v48, v16);
m_pElements = v18->m_pElements;
v21 = *(unsigned int *)m_pElements->m_szKey;
v22 = v54;
if ( *(_DWORD *)m_pElements->m_szKey )
{
v23 = *(GameObject ***)&m_pElements->m_szKey[16];
v24 = (unsigned __int64)&v23[v21 - 1];
v46 = arr;
v44 = v24;
while ( 1 )
{
v25 = *v23;
if ( !*v23 )
goto LABEL_4;
if ( !v25->m_isUIObject )
break;
LABEL_30:
if ( (unsigned __int64)++v23 > v24 )
goto LABEL_4;
}
v43 = v23;
GJBaseGameLayer::addUIObject(a1, v25);
((void (__fastcall *)(float *, GameObject *))v25->getStartPos)(&v52, v25);
sub_10028CC60(v61);
m_nZOrder = (v48 <= v52) + 3;
if ( v22[32].m_nZOrder >= 2u )
m_nZOrder = v22[32].m_nZOrder;
m_uOrderOfArrival = v22[32].m_uOrderOfArrival;
v28 = m_uOrderOfArrival;
if ( !m_uOrderOfArrival )
v28 = (v49 <= v53) + 7;
if ( m_uOrderOfArrival == 5 )
v28 = (v49 <= v53) + 7;
switch ( m_nZOrder )
{
case 4:
v31 = v52 - (float)(v48 + 240.0);
if ( LOBYTE(v22[32].m_unknown5) )
v31 = v31 * v62;
v30 = v31 + v59;
break;
case 3:
v30 = v52 - (float)(v48 + -240.0);
if ( LOBYTE(v22[32].m_unknown5) )
v30 = v30 * v62;
break;
case 2:
v29 = v52 - v48;
if ( LOBYTE(v22[32].m_unknown5) )
v29 = v29 * v62;
v30 = v29 + v57;
break;
default:
LABEL_51:
switch ( v28 )
{
case 8:
v34 = v53 - (float)(v49 + 160.0);
if ( BYTE1(v22[32].m_unknown5) )
v34 = v34 * v63;
v33 = v34 + v60;
break;
case 7:
v33 = v53 - (float)(v49 + -160.0);
if ( BYTE1(v22[32].m_unknown5) )
v33 = v33 * v63;
break;
case 6:
v32 = v53 - v49;
if ( BYTE1(v22[32].m_unknown5) )
v32 = v32 * v63;
v33 = v32 + v56;
break;
default:
LABEL_63:
v35 = sub_10028CC60(v50);
m_parentGroupsDict = (cocos2d::CCDictionary *)v25;
v2 = (intptr_t)v50;
((void (__fastcall *)(GameObject *, char *, double))v25->setStartPos)(v25, v50, v35);
if ( v55 && v25 == v58 )
{
m_parentGroupsDict = (cocos2d::CCDictionary *)v50;
v2 = (intptr_t)v61;
sub_10028CD00(v50, v61, &v52);
v36 = v55->data;
if ( v36->num )
{
v37 = (GameObject **)v36->arr;
v38 = (unsigned __int64)&v37[v36->num - 1];
do
{
v39 = *v37;
if ( !*v37 )
break;
if ( !v39->m_isUIObject )
{
GJBaseGameLayer::addUIObject(v51, *v37);
((void (__fastcall *)(char *, GameObject *))v39->getStartPos)(v42, v39);
sub_10028CCE0(v41, v42);
m_parentGroupsDict = (cocos2d::CCDictionary *)v39;
v2 = (intptr_t)v41;
((void (__fastcall *)(GameObject *, char *))v39->setStartPos)(v39, v41);
}
++v37;
}
while ( (unsigned __int64)v37 <= v38 );
}
a1 = v51;
arr = v46;
}
v22 = v54;
v23 = v43;
v24 = v44;
goto LABEL_30;
}
*(float *)&v61[1] = v33;
goto LABEL_63;
}
*(float *)v61 = v30;
goto LABEL_51;
}
}
}
LABEL_4:
if ( ++arr > v45 )
return;
}
v16 = nullptr;
LABEL_22:
v18 = (cocos2d::CCDictionary *)v55;
if ( v14 )
goto LABEL_23;
goto LABEL_24;
}
}
}