//
// EditorUI::createLoop from 0x1003f3694 to 0x1003f3b94 (1280 bytes)
//
// 1 xrefs:
// > EditorPauseLayer::onCreateLoop @ 0x10039e018
//
// 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 EditorUI::createLoop(EditorUI *a1)
{
cocos2d::CCObject *v2; // x0
__int64 v3; // x21
__int64 v4; // x20
GameObject *v5; // x0
cocos2d::CCObject *v6; // x28
unsigned int v7; // w22
float v8; // s8
float v9; // s9
__int64 v10; // x0
__n128 v11; // q0
_BYTE *v12; // x23
__int64 v15; // x24
__int64 v16; // x0
float v17; // s12
cocos2d::CCObject *v18; // x24
__int64 v19; // x0
LevelEditorLayer *m_editorLayer; // x0
unsigned int NextFreeGroupID; // w20
__n128 v22; // q1
__n128 v23; // q0
EffectGameObject *Object; // x22
LevelEditorLayer *v25; // x22
float v26; // s10
__n128 v27; // q1
__n128 v28; // q0
float v29; // s8
cocos2d::CCObject *v30; // x22
unsigned int v31; // w23
float v32; // s9
__int64 v33; // x24
float v34; // s11
int v35; // w27
__int64 v36; // x25
float v37; // s12
__int64 v38; // x0
__int64 v39; // x0
__n128 v40; // q0
LevelEditorLayer *v41; // x26
__n128 v42; // q1
unsigned int v43; // w26
int v44; // w21
__int64 v45; // x27
GameObject *v46; // x28
LevelEditorLayer *v47; // x0
__n128 v48; // q0
__n128 v49; // q1
EffectGameObject *v50; // x28
__int64 v51; // [xsp+8h] [xbp-D8h]
__int64 v52; // [xsp+18h] [xbp-C8h] BYREF
std::unordered_set v53; // [xsp+20h] [xbp-C0h] BYREF
__int64 v54; // [xsp+50h] [xbp-90h] BYREF
__int64 v55; // [xsp+58h] [xbp-88h] BYREF
cocos2d::CCPoint v56; // 0:s0.4,4:s1.4
cocos2d::CCPoint v57; // 0:s0.4,4:s1.4
if ( a1->m_selectedObject || (unsigned int)sub_10024A36C((__int64)a1->m_selectedObjects) )
{
v2 = sub_10024A15C();
v3 = (__int64)v2;
if ( a1->m_selectedObject )
sub_10024A2D0((__int64)v2);
else
sub_10024A360((__int64)v2, (__int64)a1->m_selectedObjects);
if ( (unsigned int)sub_10024A36C(v3) )
{
v4 = 0;
do
{
v5 = (GameObject *)sub_10024A388(v3, v4);
if ( GameObject::isSpawnableTrigger(v5) )
v4 = (unsigned int)(v4 + 1);
else
sub_10024A44C(v3, v4, 1);
}
while ( (unsigned int)v4 < (unsigned int)sub_10024A36C(v3) );
}
qsort(
*(void **)(*(_QWORD *)(v3 + 56) + 16LL),
**(unsigned int **)(v3 + 56),
8u,
(int (__cdecl *)(const void *, const void *))sub_1003C4A78);
v6 = sub_10024A15C();
sub_1000229B0(&v55);
if ( (unsigned int)sub_10024A36C(v3) )
{
v7 = 0;
v8 = 0.0;
v9 = 0.0;
do
{
v10 = sub_10024A388(v3, v7);
v12 = (_BYTE *)v10;
if ( !v7 )
{
(*(void (__fastcall **)(std::unordered_set *__return_ptr, __int64))(*(_QWORD *)v10 + 1344LL))(&v53, v10);
v11.n128_f64[0] = sub_1000229D0(&v55, (double *)&v53);
}
v12[1473] = 1;
v12[1664] = 1;
(*(void (__fastcall **)(std::unordered_set *__return_ptr, _BYTE *, __n128))(*(_QWORD *)v12 + 1344LL))(
&v53,
v12,
v11);
if ( *(float *)&v53.__table_.__bucket_list_.__ptr_.__value_ < v8 || v8 == 0.0 )
v8 = *(float *)&v53.__table_.__bucket_list_.__ptr_.__value_;
if ( *((float *)&v53.__table_.__bucket_list_.__ptr_.__value_ + 1) > v9 || v9 == 0.0 )
v9 = *((float *)&v53.__table_.__bucket_list_.__ptr_.__value_ + 1);
if ( (unsigned int)sub_10024A36C((__int64)v6)
&& (v15 = sub_10024A398((__int64)v6),
v16 = sub_10024A388(v15, 0),
v17 = *(float *)&v53.__table_.__bucket_list_.__ptr_.__value_,
(*(void (__fastcall **)(__int64 *__return_ptr))(*(_QWORD *)v16 + 1344LL))(&v54),
(float)(v17 - *(float *)&v54) <= 0.1) )
{
v19 = v15;
}
else
{
v18 = sub_10024A15C();
sub_10024A2D0((__int64)v18);
v19 = (__int64)v6;
}
sub_10024A2D0(v19);
++v7;
}
while ( v7 < (unsigned int)sub_10024A36C(v3) );
}
else
{
v9 = 0.0;
v8 = 0.0;
}
m_editorLayer = a1->m_editorLayer;
memset(&v53, 0, 32);
v53.__table_.__p3_.__value_ = 1.0;
NextFreeGroupID = LevelEditorLayer::getNextFreeGroupID(m_editorLayer, &v53);
sub_100017A98((__int64)&v53);
v22.n128_f32[0] = v9 + 90.0;
v23.n128_f32[0] = v8;
sub_100022980(v23, v22, &v53);
Object = (EffectGameObject *)EditorUI::createObject(a1, 1268, v56);
EffectGameObject::setTargetID(Object, NextFreeGroupID);
LevelEditorLayer::refreshSpecial(a1->m_editorLayer, Object);
v25 = a1->m_editorLayer;
v26 = 0.0;
v27.n128_u32[0] = 0;
v28.n128_f32[0] = v8;
sub_100022980(v28, v27, &v53);
v29 = ((float (__fastcall *)(LevelEditorLayer *, std::unordered_set *, _QWORD, _QWORD, _QWORD, _QWORD))v25->timeForPos)(
v25,
&v53,
0,
0,
0,
0);
sub_1000229B0(&v54);
rand();
v30 = sub_10024A15C();
if ( (unsigned int)sub_10024A36C((__int64)v6) )
{
v31 = 0;
v32 = v9 + 60.0;
v33 = NextFreeGroupID;
v34 = 0.0;
v51 = (__int64)v6;
do
{
v35 = sub_10024A36C((__int64)v6);
v36 = sub_10024A388((__int64)v6, v31);
v37 = v26;
if ( v31 < (unsigned int)sub_10024A36C((__int64)v6) - 1 )
{
v38 = sub_10024A388((__int64)v6, v31 + 1);
v39 = sub_10024A388(v38, 0);
(*(void (__fastcall **)(std::unordered_set *__return_ptr))(*(_QWORD *)v39 + 1344LL))(&v53);
v40.n128_u32[0] = (unsigned __int32)v53.__table_.__bucket_list_.__ptr_.__value_;
v41 = a1->m_editorLayer;
v42.n128_u32[0] = 0;
sub_100022980(v40, v42, &v53);
v37 = ((float (__fastcall *)(LevelEditorLayer *, std::unordered_set *, _QWORD, _QWORD, _QWORD, _QWORD))v41->timeForPos)(
v41,
&v53,
0,
0,
0,
0)
- v29;
}
if ( (unsigned int)sub_10024A36C(v36) )
{
v43 = 0;
v44 = v35 - 1;
v45 = v33;
do
{
v46 = (GameObject *)sub_10024A388(v36, v43);
LevelEditorLayer::addObjectToGroup(a1->m_editorLayer, v46, v33);
if ( !v43 )
{
v45 = NextFreeGroupID;
if ( v31 == v44 )
{
v26 = v37;
}
else
{
v47 = a1->m_editorLayer;
memset(&v53, 0, 32);
v53.__table_.__p3_.__value_ = 1.0;
v45 = LevelEditorLayer::getNextFreeGroupID(v47, &v53);
sub_100017A98((__int64)&v53);
v26 = v37 - v34;
}
((void (__fastcall *)(__int64 *__return_ptr, GameObject *))v46->getRealPosition)(&v52, v46);
v48.n128_u32[0] = v52;
v49.n128_f32[0] = v32;
sub_100022980(v48, v49, &v53);
sub_1000229D0(&v54, (double *)&v53);
v57.x = sub_1000229B8((__int64 *)&v53, &v54);
v50 = (EffectGameObject *)EditorUI::createObject(a1, 1268, v57);
sub_10024A2D0((__int64)v30);
LevelEditorLayer::addObjectToGroup(a1->m_editorLayer, v50, v33);
EffectGameObject::setTargetID(v50, v45);
v50[1].m_fScaleX = v26;
v50->m_isSpawnTriggered = 1;
v50->m_isMultiTriggered = 1;
LevelEditorLayer::refreshSpecial(a1->m_editorLayer, v50);
v34 = v34 + v26;
}
++v43;
}
while ( v43 < (unsigned int)sub_10024A36C(v36) );
}
else
{
v45 = v33;
}
++v31;
v6 = (cocos2d::CCObject *)v51;
v33 = v45;
}
while ( v31 < (unsigned int)sub_10024A36C(v51) );
}
LevelEditorLayer::dirtifyTriggers(a1->m_editorLayer);
}
}