//
// EditorUI::selectObjects from 0x140110820 to 0x140110e7f (1631 bytes)
//
// 14 xrefs:
// > EditorUI::selectObject @ 0x1401105bd
// > EditorUI::processSelectObjects @ 0x1401117f2
// > EditorUI::createSmartObjectsFromTemplate @ 0x14011784c
// > EditorUI::createSmartObjectsFromType @ 0x1401183e2
// > EditorUI::createNewKeyframeAnim @ 0x14011961c
// > EditorUI::ccTouchEnded @ 0x140124f2d
// > EditorUI::ccTouchEnded @ 0x1401251a0
// > LevelEditorLayer::handleAction @ 0x1402d6638
// > LevelEditorLayer::handleAction @ 0x1402d67c2
// > LevelEditorLayer::handleAction @ 0x1402d6ae5
// > LevelEditorLayer::breakApartTextObject @ 0x1402df85d
// > SetupKeyframePopup::onCustomButton @ 0x1404268c3
// > SetupKeyframePopup::onCustomButton @ 0x140426abc
// > ??> @ 0x1406c8f10
//
// 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
//
// Hidden C++ exception states: #wind=5
void EditorUI::selectObjects(EditorUI *a1, cocos2d::CCArray *a2, bool a3)
{
GameManager *v6; // rcx
GameManager *v7; // rcx
GameManager *v8; // rcx
int IntGameVariable; // esi
unsigned int v10; // edi
GameManager *v11; // rcx
int v12; // eax
int v13; // esi
unsigned int v14; // edi
struct cocos2d::CCObject *v15; // rax
__int64 v16; // rdx
__int16 *v17; // rcx
GameManager *v18; // rcx
int v19; // eax
int v20; // esi
unsigned int v21; // edi
struct cocos2d::CCObject *v22; // rax
int *v23; // rcx
int v24; // edx
int v25; // ecx
int *v26; // rax
int v27; // ecx
int v28; // eax
GameObject *m_selectedObject; // rdx
unsigned int v30; // eax
GameObject *v31; // rdx
cocos2d::CCDictionary *v32; // rsi
struct cocos2d::CCObject *v33; // r15
unsigned int i; // r14d
struct cocos2d::CCObject *v35; // rdi
struct cocos2d::CCObject *v36; // rax
bool v37; // r8
GameObject *v38; // rbx
__int64 m_unknown2; // rax
cocos2d::CCArray *v40; // rax
cocos2d::CCArray *v41; // r15
unsigned int j; // r14d
struct cocos2d::CCObject *v43; // rax
cocos2d::CCArray *v44; // rax
cocos2d::CCArray *v45; // rsi
unsigned int v46; // ebx
struct cocos2d::CCObject *v47; // rdi
__int16 v48; // [rsp+20h] [rbp-28h] BYREF
char v49; // [rsp+22h] [rbp-26h]
void *v50; // [rsp+58h] [rbp+10h]
void *v51; // [rsp+58h] [rbp+10h]
void *v52; // [rsp+58h] [rbp+10h]
void *v53; // [rsp+58h] [rbp+10h]
void *v54; // [rsp+58h] [rbp+10h]
if ( a2 && cocos2d::CCArray::count(a2) )
{
if ( a3 )
goto LABEL_18;
v6 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v50 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v50);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getGameVariable(v6, "0064") )
goto LABEL_18;
v7 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v51 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v51);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v7 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getIntGameVariable(v7, "0005") != 3 )
goto LABEL_18;
v8 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v52 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v52);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v8 = (GameManager *)qword_1406C2ED8;
}
IntGameVariable = GameManager::getIntGameVariable(v8, "0006");
v10 = 0;
while ( v10 < cocos2d::CCArray::count(a2) )
{
if ( cocos2d::CCArray::objectAtIndex(a2, v10)[18].m_eObjType == IntGameVariable )
++v10;
else
cocos2d::CCArray::removeObjectAtIndex(a2, v10, 1);
}
if ( cocos2d::CCArray::count(a2) )
{
LABEL_18:
v11 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v53 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v53);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v11 = (GameManager *)qword_1406C2ED8;
}
v12 = GameManager::getIntGameVariable(v11, "0133");
v13 = v12;
if ( a3 || !v12 )
goto LABEL_30;
v14 = 0;
while ( v14 < cocos2d::CCArray::count(a2) )
{
v15 = cocos2d::CCArray::objectAtIndex(a2, v14);
if ( SLOWORD(v15[21].__vftable) <= 0 )
{
LABEL_27:
cocos2d::CCArray::removeObjectAtIndex(a2, v14, 1);
}
else
{
v16 = 0;
v17 = *(__int16 **)&v15[20].m_uOrderOfArrival;
while ( *v17 != v13 )
{
++v16;
++v17;
if ( v16 >= SLOWORD(v15[21].__vftable) )
goto LABEL_27;
}
++v14;
}
}
if ( cocos2d::CCArray::count(a2) )
{
LABEL_30:
v18 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v54 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v54);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v18 = (GameManager *)qword_1406C2ED8;
}
v19 = GameManager::getIntGameVariable(v18, "0139");
v20 = v19;
if ( a3 || !v19 )
goto LABEL_50;
v21 = 0;
while ( v21 < cocos2d::CCArray::count(a2) )
{
v22 = cocos2d::CCArray::objectAtIndex(a2, v21);
v23 = *(int **)&v22[19].m_unknown2;
if ( v23 )
{
v24 = v23[1];
v25 = *v23;
if ( v24 == v25 || !v25 )
v25 = v24;
if ( v25 == v20 )
goto LABEL_45;
}
v26 = *(int **)&v22[19].m_uOrderOfArrival;
if ( !v26 )
goto LABEL_47;
v27 = v26[1];
v28 = *v26;
if ( v27 == v28 || !v28 )
v28 = v27;
if ( v28 == v20 )
LABEL_45:
++v21;
else
LABEL_47:
cocos2d::CCArray::removeObjectAtIndex(a2, v21, 1);
}
if ( cocos2d::CCArray::count(a2) )
{
LABEL_50:
cocos2d::CCNode::stopActionByTag(a1, 124);
m_selectedObject = a1->m_selectedObject;
if ( m_selectedObject && !cocos2d::CCArray::containsObject(a2, m_selectedObject) )
{
v30 = cocos2d::CCArray::count(a1->m_selectedObjects);
v31 = a1->m_selectedObject;
if ( v30 )
{
cocos2d::CCArray::addObject(a2, v31);
}
else
{
cocos2d::CCArray::addObject(a1->m_selectedObjects, v31);
v48 = -256;
v49 = 0;
a1->m_selectedObject->selectObject(a1->m_selectedObject, (cocos2d::ccColor3B *)&v48);
}
a1->m_canActivateControls = 1;
}
a1->m_selectedObject = nullptr;
v32 = nullptr;
v33 = nullptr;
for ( i = 0; i < cocos2d::CCArray::count(a2); ++i )
{
v35 = cocos2d::CCArray::objectAtIndex(a2, i);
if ( !cocos2d::CCArray::containsObject(a1->m_selectedObjects, v35) )
{
cocos2d::CCArray::addObject(a1->m_selectedObjects, v35);
v48 = -256;
v49 = 0;
v35->__vftable[18].setTag(v35, (int)&v48);
a1->m_canActivateControls = 1;
if ( a1->m_stickyControlsEnabled && !a1->m_linkControlsDisabled && v35[15].m_unknown2 > 0 )
{
if ( !v32 )
{
v32 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create();
v33 = (struct cocos2d::CCObject *)cocos2d::CCNode::create();
}
cocos2d::CCDictionary::setObject(v32, v33, v35[15].m_unknown2);
}
}
}
if ( cocos2d::CCArray::count(a2) == 1 && cocos2d::CCArray::count(a1->m_selectedObjects) == 1 )
{
v36 = cocos2d::CCArray::objectAtIndex(a2, 0);
v38 = (GameObject *)v36;
if ( !a1->m_stickyControlsEnabled
|| a1->m_linkControlsDisabled
|| (m_unknown2 = v36[15].m_unknown2, (int)m_unknown2 <= 0)
|| (v40 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(
a1->m_editorLayer->m_linkedGroupDict,
m_unknown2)) == nullptr
|| cocos2d::CCArray::count(v40) <= 1 )
{
EditorUI::selectObject(a1, v38, v37);
}
}
if ( cocos2d::CCArray::count(a1->m_selectedObjects) )
{
if ( v32 )
{
a1->m_findSnap = 1;
v41 = cocos2d::CCDictionary::allKeys(v32);
for ( j = 0; j < cocos2d::CCArray::count(v41); ++j )
{
v43 = cocos2d::CCArray::objectAtIndex(v41, j);
v44 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(
a1->m_editorLayer->m_linkedGroupDict,
SLODWORD(v43[1].__vftable));
v45 = v44;
if ( v44 )
{
v46 = 0;
if ( cocos2d::CCArray::count(v44) )
{
do
{
v47 = cocos2d::CCArray::objectAtIndex(v45, v46);
if ( !cocos2d::CCArray::containsObject(a1->m_selectedObjects, v47) )
{
cocos2d::CCArray::addObject(a1->m_selectedObjects, v47);
v48 = -256;
v49 = 0;
v47->__vftable[18].setTag(v47, (int)&v48);
}
++v46;
}
while ( v46 < cocos2d::CCArray::count(v45) );
}
}
}
}
}
EditorUI::checkLiveColorSelect(a1);
}
}
}
}
}