//
// EditorUI::addObjectsToSmartTemplate from 0x100041320 to 0x100042806 (5350 bytes)
//
// 1 xrefs:
// > SetupSmartBlockLayer::onCreateTemplate @ 0x1004e6e58
//
// 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::addObjectsToSmartTemplate(EditorUI *a1, GJSmartTemplate *a2, cocos2d::CCArray *a3)
{
unsigned int v4; // ebx
__int64 v5; // rax
__int64 v6; // r14
intptr_t v7; // rdx
__int64 v8; // rbx
__int64 v9; // rax
SmartGameObject *v10; // r14
cocos2d::CCPoint v11; // xmm0_8
__int64 v12; // rsi
SmartGameObject_vtbl *v13; // rax
__int64 v14; // rsi
__m128 v15; // xmm1
int v16; // eax
__int64 v17; // rbx
int v18; // eax
int m_uniqueID; // r14d
double v20; // xmm0_8
double v21; // xmm1_8
unsigned int v22; // ebx
double v23; // xmm0_8
int v24; // r14d
double v25; // xmm0_8
double v26; // xmm1_8
unsigned int v27; // ebx
double v28; // xmm0_8
int v29; // r14d
double v30; // xmm0_8
double v31; // xmm1_8
unsigned int v32; // ebx
double v33; // xmm0_8
int v34; // r14d
double v35; // xmm0_8
double v36; // xmm1_8
unsigned int v37; // ebx
double v38; // xmm0_8
int v39; // r14d
double v40; // xmm0_8
double v41; // xmm1_8
unsigned int v42; // ebx
double v43; // xmm0_8
int v44; // r15d
double v45; // xmm0_8
double v46; // xmm1_8
unsigned int v47; // r14d
__int64 v48; // rbx
double v49; // xmm0_8
int v50; // r15d
double v51; // xmm0_8
double v52; // xmm1_8
unsigned int v53; // r14d
__int64 v54; // r13
double v55; // xmm0_8
double v56; // xmm0_8
double v57; // xmm1_8
unsigned int v58; // r15d
__int64 v59; // r14
double v60; // xmm0_8
_DWORD *v61; // rax
_DWORD *v62; // rax
_DWORD *v63; // rax
_DWORD *v64; // rax
__int64 v65; // xmm0_8
LevelEditorLayer *m_editorLayer; // r15
cocos2d::CCArray *v68; // rax
int m_linkedGroup; // esi
cocos2d::CCArray *StickyGroup; // rbx
unsigned int i; // r14d
__int64 v72; // r15
unsigned int v73; // ebx
__int64 v74; // rax
cocos2d::CCObject *v75; // r14
intptr_t m_uIndexInArray; // rsi
int m_objectID; // ebx
LevelEditorLayer *v78; // r14
cocos2d::CCPoint m_pixelScaleX_low; // xmm0_8
GameObject *Object; // rax
GameObject *v81; // rbx
unsigned __int8 v82; // al
unsigned __int8 v83; // al
EditorUI *v84; // r14
char v85[16]; // [rsp+30h] [rbp-190h] BYREF
void *v86; // [rsp+40h] [rbp-180h]
__int64 v87; // [rsp+48h] [rbp-178h]
__int128 v88; // [rsp+50h] [rbp-170h] BYREF
void *data; // [rsp+60h] [rbp-160h]
unsigned __int64 v90; // [rsp+70h] [rbp-150h] BYREF
__int64 v91; // [rsp+78h] [rbp-148h]
void *size; // [rsp+80h] [rbp-140h]
cocos2d::CCDictionary *v93; // [rsp+88h] [rbp-138h]
cocos2d::CCDictionary *v94; // [rsp+90h] [rbp-130h]
GJSmartTemplate *v95; // [rsp+98h] [rbp-128h]
void *v96[2]; // [rsp+A0h] [rbp-120h] BYREF
void *v97; // [rsp+B0h] [rbp-110h]
cocos2d::CCPoint v98; // [rsp+B8h] [rbp-108h] BYREF
EditorUI *v99; // [rsp+C0h] [rbp-100h]
int v100; // [rsp+C8h] [rbp-F8h]
__int16 v101; // [rsp+CCh] [rbp-F4h]
int v102; // [rsp+D0h] [rbp-F0h]
int v103; // [rsp+D4h] [rbp-ECh]
int v104; // [rsp+D8h] [rbp-E8h]
int v105; // [rsp+DCh] [rbp-E4h]
int v106; // [rsp+E0h] [rbp-E0h]
int v107; // [rsp+E4h] [rbp-DCh]
_DWORD *v108; // [rsp+E8h] [rbp-D8h]
_DWORD *v109; // [rsp+F0h] [rbp-D0h]
_DWORD *v110; // [rsp+F8h] [rbp-C8h]
_DWORD *v111; // [rsp+100h] [rbp-C0h]
std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610 v112; // [rsp+108h] [rbp-B8h]
void *__p; // [rsp+110h] [rbp-B0h]
float v114; // [rsp+118h] [rbp-A8h] BYREF
float v115; // [rsp+11Ch] [rbp-A4h]
int v116; // [rsp+120h] [rbp-A0h]
int v117; // [rsp+124h] [rbp-9Ch]
int v118; // [rsp+128h] [rbp-98h]
cocos2d::CCPoint v119; // [rsp+12Ch] [rbp-94h] BYREF
int v120; // [rsp+134h] [rbp-8Ch]
cocos2d::CCArray *v121; // [rsp+138h] [rbp-88h]
char v122; // [rsp+147h] [rbp-79h]
char v123; // [rsp+148h] [rbp-78h]
char v124; // [rsp+149h] [rbp-77h]
char v125; // [rsp+14Ah] [rbp-76h]
char v126; // [rsp+14Bh] [rbp-75h]
char v127; // [rsp+14Ch] [rbp-74h]
char v128; // [rsp+14Dh] [rbp-73h]
char v129; // [rsp+14Eh] [rbp-72h]
bool v130; // [rsp+14Fh] [rbp-71h]
char v131[8]; // [rsp+150h] [rbp-70h] BYREF
__int64 v132; // [rsp+158h] [rbp-68h]
SmartGameObject *v133; // [rsp+160h] [rbp-60h]
std::string v134; // [rsp+168h] [rbp-58h] BYREF
cocos2d::CCPoint v135; // [rsp+180h] [rbp-40h] BYREF
float v136; // [rsp+188h] [rbp-38h]
float v137; // [rsp+18Ch] [rbp-34h]
float v138; // [rsp+190h] [rbp-30h] BYREF
float v139; // [rsp+194h] [rbp-2Ch]
double v140; // 0:xmm0_8.8
cocos2d::CCRect v141; // 0:xmm0_8.8,8:xmm1_8.8
v99 = a1;
v95 = a2;
if ( !a2 )
return;
v93 = cocos2d::CCDictionary::create();
v94 = cocos2d::CCDictionary::create();
if ( (unsigned int)sub_100720070(a3) )
{
v4 = 0;
do
{
v5 = sub_1007200C0(a3, v4);
if ( *(_DWORD *)(v5 + 1248) == 5 )
{
if ( (*(_DWORD *)(v5 + 1028) & 0xFFFFFFFE) == 0xB50 )
{
v6 = v5;
GameObject::determineSlopeDirection((GameObject *)v5);
v5 = v6;
}
v7 = *(int *)(v5 + 872);
if ( v7 > 0 )
cocos2d::CCDictionary::setObject(v94, (cocos2d::CCObject *)v5, v7);
++v4;
}
else
{
sub_100720230(a3, v4, 1);
}
}
while ( v4 < (unsigned int)sub_100720070(a3) );
}
if ( !(unsigned int)sub_100720070(a3) )
goto LABEL_179;
v8 = 0;
while ( 2 )
{
v87 = v8;
v9 = sub_1007200C0(a3, (unsigned int)v8);
if ( *(_BYTE *)(v9 + 1347) )
goto LABEL_14;
v10 = (SmartGameObject *)v9;
*(double *)&v11 = sub_10028CC60(&v134);
v12 = (unsigned int)GJSmartTemplate::smartObjectToType(v10, v11);
*(cocos2d::CCPoint *)&v140 = GJSmartTemplate::offsetForType((SmartBlockType)&v90);
v13 = v10->GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v133 = v10;
v14 = ((__int64 (__fastcall *)(SmartGameObject *, __int64, double))v13->getPosition)(v10, v12, v140);
sub_10028CCE0(&v119, v14);
sub_10028CC30(&v98);
v15 = _mm_cmpneq_ps((__m128)(unsigned __int64)qword_10099EC08, (__m128)v90);
v16 = _mm_movemask_pd((__m128d)_mm_unpacklo_ps(v15, v15));
v107 = 1;
v130 = v16 != 0;
if ( v16 )
{
v17 = ((__int64 (__fastcall *)(SmartGameObject *))v133->getPosition)(v133);
sub_10028CD20(&v135, &v90);
sub_10028CCE0(&v134, v17);
sub_10028CC90();
v107 = 2;
}
v91 = 0;
v112 = 0;
v121 = nullptr;
v18 = 0;
do
{
v102 = v18;
sub_10028CC60(&v114);
sub_10028CC60(v131);
m_uniqueID = v133->m_uniqueID;
GJSmartTemplate::offsetForDir((GJSmartDirection)&v134, 1);
sub_10028CCE0(&v138, v131);
*(_QWORD *)&v20 = LODWORD(v138);
*(float *)&v20 = v138 + -1.0;
*(_QWORD *)&v21 = LODWORD(v139);
*(float *)&v21 = v139 + -1.0;
sub_10028CC00(&v134, v20, v21, 2.0, 2.0);
if ( !(unsigned int)sub_100720070(a3) )
goto LABEL_28;
v22 = 0;
while ( 1 )
{
v132 = sub_1007200C0(a3, v22);
if ( *(_DWORD *)(v132 + 916) != m_uniqueID )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v132 + 1312LL))(v132);
v23 = sub_10028D180(&v135);
if ( (unsigned __int8)sub_10028D320(&v134, &v135, v23) )
break;
}
if ( ++v22 >= (unsigned int)sub_100720070(a3) )
goto LABEL_28;
}
if ( *(_DWORD *)(v132 + 1248) != 5 )
LABEL_28:
v132 = 0;
sub_10028CC60(v131);
v24 = v133->m_uniqueID;
GJSmartTemplate::offsetForDir((GJSmartDirection)&v134, 2);
sub_10028CCE0(&v138, v131);
*(_QWORD *)&v25 = LODWORD(v138);
*(float *)&v25 = v138 + -1.0;
*(_QWORD *)&v26 = LODWORD(v139);
*(float *)&v26 = v139 + -1.0;
sub_10028CC00(&v134, v25, v26, 2.0, 2.0);
if ( !(unsigned int)sub_100720070(a3) )
goto LABEL_36;
v27 = 0;
while ( 1 )
{
v108 = (_DWORD *)sub_1007200C0(a3, v27);
if ( v108[229] != v24 )
{
(*(void (__fastcall **)(_DWORD *))(*(_QWORD *)v108 + 1312LL))(v108);
v28 = sub_10028D180(&v135);
if ( (unsigned __int8)sub_10028D320(&v134, &v135, v28) )
break;
}
if ( ++v27 >= (unsigned int)sub_100720070(a3) )
goto LABEL_36;
}
if ( v108[312] != 5 )
LABEL_36:
v108 = nullptr;
sub_10028CC60(v131);
v29 = v133->m_uniqueID;
GJSmartTemplate::offsetForDir((GJSmartDirection)&v134, 3);
sub_10028CCE0(&v138, v131);
*(_QWORD *)&v30 = LODWORD(v138);
*(float *)&v30 = v138 + -1.0;
*(_QWORD *)&v31 = LODWORD(v139);
*(float *)&v31 = v139 + -1.0;
sub_10028CC00(&v134, v30, v31, 2.0, 2.0);
if ( !(unsigned int)sub_100720070(a3) )
goto LABEL_44;
v32 = 0;
while ( 1 )
{
v109 = (_DWORD *)sub_1007200C0(a3, v32);
if ( v109[229] != v29 )
{
(*(void (__fastcall **)(_DWORD *))(*(_QWORD *)v109 + 1312LL))(v109);
v33 = sub_10028D180(&v135);
if ( (unsigned __int8)sub_10028D320(&v134, &v135, v33) )
break;
}
if ( ++v32 >= (unsigned int)sub_100720070(a3) )
goto LABEL_44;
}
if ( v109[312] != 5 )
LABEL_44:
v109 = nullptr;
sub_10028CC60(v131);
v34 = v133->m_uniqueID;
GJSmartTemplate::offsetForDir((GJSmartDirection)&v134, 4);
sub_10028CCE0(&v138, v131);
*(_QWORD *)&v35 = LODWORD(v138);
*(float *)&v35 = v138 + -1.0;
*(_QWORD *)&v36 = LODWORD(v139);
*(float *)&v36 = v139 + -1.0;
sub_10028CC00(&v134, v35, v36, 2.0, 2.0);
if ( !(unsigned int)sub_100720070(a3) )
goto LABEL_52;
v37 = 0;
while ( 1 )
{
v110 = (_DWORD *)sub_1007200C0(a3, v37);
if ( v110[229] != v34 )
{
(*(void (__fastcall **)(_DWORD *))(*(_QWORD *)v110 + 1312LL))(v110);
v38 = sub_10028D180(&v135);
if ( (unsigned __int8)sub_10028D320(&v134, &v135, v38) )
break;
}
if ( ++v37 >= (unsigned int)sub_100720070(a3) )
goto LABEL_52;
}
if ( v110[312] != 5 )
LABEL_52:
v110 = nullptr;
sub_10028CC60(v131);
v39 = v133->m_uniqueID;
GJSmartTemplate::offsetForDir((GJSmartDirection)&v134, 5);
sub_10028CCE0(&v138, v131);
*(_QWORD *)&v40 = LODWORD(v138);
*(float *)&v40 = v138 + -1.0;
*(_QWORD *)&v41 = LODWORD(v139);
*(float *)&v41 = v139 + -1.0;
sub_10028CC00(&v134, v40, v41, 2.0, 2.0);
if ( !(unsigned int)sub_100720070(a3) )
goto LABEL_60;
v42 = 0;
while ( 1 )
{
v111 = (_DWORD *)sub_1007200C0(a3, v42);
if ( v111[229] != v39 )
{
(*(void (__fastcall **)(_DWORD *))(*(_QWORD *)v111 + 1312LL))(v111);
v43 = sub_10028D180(&v135);
if ( (unsigned __int8)sub_10028D320(&v134, &v135, v43) )
break;
}
if ( ++v42 >= (unsigned int)sub_100720070(a3) )
goto LABEL_60;
}
if ( v111[312] != 5 )
LABEL_60:
v111 = nullptr;
sub_10028CC60(v131);
v44 = v133->m_uniqueID;
GJSmartTemplate::offsetForDir((GJSmartDirection)&v134, 6);
sub_10028CCE0(&v138, v131);
*(_QWORD *)&v45 = LODWORD(v138);
*(float *)&v45 = v138 + -1.0;
*(_QWORD *)&v46 = LODWORD(v139);
*(float *)&v46 = v139 + -1.0;
sub_10028CC00(&v134, v45, v46, 2.0, 2.0);
if ( !(unsigned int)sub_100720070(a3) )
goto LABEL_68;
v47 = 0;
while ( 1 )
{
v48 = sub_1007200C0(a3, v47);
if ( *(_DWORD *)(v48 + 916) != v44 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v48 + 1312LL))(v48);
v49 = sub_10028D180(&v135);
if ( (unsigned __int8)sub_10028D320(&v134, &v135, v49) )
break;
}
if ( ++v47 >= (unsigned int)sub_100720070(a3) )
goto LABEL_68;
}
if ( *(_DWORD *)(v48 + 1248) != 5 )
LABEL_68:
v48 = 0;
sub_10028CC60(v131);
v50 = v133->m_uniqueID;
GJSmartTemplate::offsetForDir((GJSmartDirection)&v134, 7);
sub_10028CCE0(&v138, v131);
*(_QWORD *)&v51 = LODWORD(v138);
*(float *)&v51 = v138 + -1.0;
*(_QWORD *)&v52 = LODWORD(v139);
*(float *)&v52 = v139 + -1.0;
sub_10028CC00(&v134, v51, v52, 2.0, 2.0);
if ( !(unsigned int)sub_100720070(a3) )
goto LABEL_76;
v53 = 0;
while ( 1 )
{
v54 = sub_1007200C0(a3, v53);
if ( *(_DWORD *)(v54 + 916) != v50 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v54 + 1312LL))(v54);
v55 = sub_10028D180(&v135);
if ( (unsigned __int8)sub_10028D320(&v134, &v135, v55) )
break;
}
if ( ++v53 >= (unsigned int)sub_100720070(a3) )
goto LABEL_76;
}
if ( *(_DWORD *)(v54 + 1248) != 5 )
LABEL_76:
v54 = 0;
sub_10028CC60(v131);
v120 = v133->m_uniqueID;
GJSmartTemplate::offsetForDir((GJSmartDirection)&v134, 8);
sub_10028CCE0(&v138, v131);
*(_QWORD *)&v56 = LODWORD(v138);
*(float *)&v56 = v138 + -1.0;
*(_QWORD *)&v57 = LODWORD(v139);
*(float *)&v57 = v139 + -1.0;
sub_10028CC00(&v134, v56, v57, 2.0, 2.0);
if ( !(unsigned int)sub_100720070(a3) )
goto LABEL_84;
v58 = 0;
while ( 1 )
{
v59 = sub_1007200C0(a3, v58);
if ( *(_DWORD *)(v59 + 916) != v120 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v59 + 1312LL))(v59);
v60 = sub_10028D180(&v135);
if ( (unsigned __int8)sub_10028D320(&v134, &v135, v60) )
break;
}
if ( ++v58 >= (unsigned int)sub_100720070(a3) )
goto LABEL_84;
}
if ( *(_DWORD *)(v59 + 1248) != 5 )
LABEL_84:
v59 = 0;
if ( v132 )
{
v120 = *(_BYTE *)(v132 + 1347) ^ 1;
v61 = v108;
if ( v108 )
goto LABEL_87;
}
else
{
v120 = 0;
v61 = v108;
if ( v108 )
{
LABEL_87:
v116 = *((_BYTE *)v61 + 1347) ^ 1;
v62 = v109;
if ( v109 )
goto LABEL_88;
goto LABEL_96;
}
}
v116 = 0;
v62 = v109;
if ( v109 )
{
LABEL_88:
v117 = *((_BYTE *)v62 + 1347) ^ 1;
v63 = v110;
if ( v110 )
goto LABEL_89;
goto LABEL_97;
}
LABEL_96:
v117 = 0;
v63 = v110;
if ( v110 )
{
LABEL_89:
v118 = *((_BYTE *)v63 + 1347) ^ 1;
v64 = v111;
if ( v111 )
goto LABEL_90;
goto LABEL_98;
}
LABEL_97:
v118 = 0;
v64 = v111;
if ( v111 )
{
LABEL_90:
v103 = *((_BYTE *)v64 + 1347) ^ 1;
if ( v48 )
goto LABEL_91;
goto LABEL_99;
}
LABEL_98:
v103 = 0;
if ( v48 )
{
LABEL_91:
v104 = *(_BYTE *)(v48 + 1347) ^ 1;
if ( v54 )
goto LABEL_92;
goto LABEL_100;
}
LABEL_99:
v104 = 0;
if ( v54 )
{
LABEL_92:
v105 = *(_BYTE *)(v54 + 1347) ^ 1;
if ( v59 )
goto LABEL_93;
goto LABEL_101;
}
LABEL_100:
v105 = 0;
if ( v59 )
{
LABEL_93:
v106 = *(_BYTE *)(v59 + 1347) ^ 1;
goto LABEL_102;
}
LABEL_101:
v106 = 0;
LABEL_102:
v65 = LODWORD(v114);
v141.origin.x = v114 + -14.0;
v141.size = (cocos2d::CCSize)LODWORD(v115);
v141.size.width = v115 + -14.0;
sub_10028CC00(&v135, *(double *)&v141.origin, *(double *)&v141.size, 28.0, 28.0);
if ( (_BYTE)v120 )
{
if ( (_BYTE)v116 )
goto LABEL_104;
}
else
{
v137 = v137 + 14.0;
if ( (_BYTE)v116 )
{
LABEL_104:
if ( (_BYTE)v117 )
goto LABEL_105;
goto LABEL_114;
}
}
v141.size = (cocos2d::CCSize)LODWORD(v137);
v141.size.width = v137 + 14.0;
v137 = v137 + 14.0;
v135.y = v135.y + -14.0;
if ( (_BYTE)v117 )
{
LABEL_105:
if ( (_BYTE)v118 )
goto LABEL_107;
LABEL_106:
v136 = v136 + 14.0;
goto LABEL_107;
}
LABEL_114:
v141.size = (cocos2d::CCSize)LODWORD(v136);
v141.size.width = v136 + 14.0;
v136 = v136 + 14.0;
v135.x = v135.x + -14.0;
if ( !(_BYTE)v118 )
goto LABEL_106;
LABEL_107:
m_editorLayer = v99->m_editorLayer;
*(double *)&v141.origin = sub_10028D180(&v134);
v68 = LevelEditorLayer::objectsInRect(m_editorLayer, v141, (bool)&v134);
if ( !v121 )
{
v121 = v68;
if ( v102 )
goto LABEL_20;
LABEL_117:
*(double *)&v141.origin = sub_10028CC60(&v138);
GJSmartTemplate::keyFromNeighbors(
(unsigned int)&v134,
(unsigned int)&v138,
(_DWORD)v133,
v132,
(_DWORD)v108,
(_DWORD)v109,
(__int64)v110,
(__int64)v111,
v48,
v54,
v59);
if ( (*(_BYTE *)&v112 & 1) != 0 )
operator delete(__p);
v112 = (std::string::__long::$5C0822F47C3855276CFDD0C01D0AA610)*(_BYTE *)&v134.__r_.__value_.__l.0;
v91 = (unsigned __int8)v134.__r_.__value_.__s.__data_[0];
v100 = *(_DWORD *)&v134.__r_.__value_.__s.__data_[1];
v101 = HIWORD(v134.__r_.__value_.__r.__words[0]);
__p = v134.__r_.__value_.__l.__data_;
size = (void *)v134.__r_.__value_.__l.__size_;
v129 = v106;
v128 = v105;
v127 = v104;
v126 = v103;
v125 = v118;
v124 = v117;
v123 = v116;
v122 = v120;
goto LABEL_20;
}
if ( v68 )
sub_100720050(v121, v68);
if ( !v102 )
goto LABEL_117;
LABEL_20:
v18 = v102 + 1;
}
while ( v102 + 1 != v107 );
m_linkedGroup = v133->m_linkedGroup;
if ( m_linkedGroup > 0 )
{
StickyGroup = GJBaseGameLayer::getStickyGroup(v99->m_editorLayer, m_linkedGroup);
if ( StickyGroup )
{
for ( i = 0; i < (unsigned int)sub_100720070(StickyGroup); ++i )
{
v72 = sub_1007200C0(StickyGroup, i);
if ( !(unsigned __int8)sub_100720160(v121, v72) )
sub_10071FCD0(v121, v72);
}
}
}
if ( !v121 )
goto LABEL_174;
v73 = 0;
while ( 2 )
{
if ( v73 < (unsigned int)sub_100720070(v121) )
{
v74 = sub_1007200C0(v121, v73);
v75 = (cocos2d::CCObject *)v74;
if ( *(_DWORD *)(v74 + 1248) == 5 || cocos2d::CCDictionary::objectForKey(v93, *(unsigned int *)(v74 + 916)) )
goto LABEL_128;
((void (__fastcall *)(cocos2d::CCObject *, double))v75->__vftable[2].acceptVisitor)(
v75,
*(double *)&v141.origin);
*(double *)&v141.origin = sub_10028CC60(&v134);
v141.origin.x = cocos2d::ccpDistance(&v119, (const cocos2d::CCPoint *)&v134);
*(float *)&v132 = v141.origin.x;
if ( v130 )
{
v141.origin.x = cocos2d::ccpDistance(&v98, (const cocos2d::CCPoint *)&v134);
if ( *(float *)&v132 > v141.origin.x )
{
v141.origin.x = cocos2d::ccpDistance(&v98, (const cocos2d::CCPoint *)&v134);
*(float *)&v132 = v141.origin.x;
}
}
m_uIndexInArray = v75[15].m_uIndexInArray;
if ( m_uIndexInArray <= 0 )
{
LABEL_139:
if ( !(_DWORD)m_uIndexInArray || (_DWORD)m_uIndexInArray != v133->m_linkedGroup )
{
if ( (v122 & 1) != 0 )
{
v141.origin.y = GJSmartTemplate::offsetForDir((GJSmartDirection)&v138, 1).y;
sub_10028CCE0(&v135, &v119);
v141.origin.x = cocos2d::ccpDistance((const cocos2d::CCPoint *)&v134, &v135);
if ( *(float *)&v132 > v141.origin.x )
goto LABEL_128;
}
if ( (v123 & 1) != 0 )
{
v141.origin.y = GJSmartTemplate::offsetForDir((GJSmartDirection)&v138, 2).y;
sub_10028CCE0(&v135, &v119);
v141.origin.x = cocos2d::ccpDistance((const cocos2d::CCPoint *)&v134, &v135);
if ( *(float *)&v132 > v141.origin.x )
goto LABEL_128;
}
if ( (v124 & 1) != 0 )
{
v141.origin.y = GJSmartTemplate::offsetForDir((GJSmartDirection)&v138, 3).y;
sub_10028CCE0(&v135, &v119);
v141.origin.x = cocos2d::ccpDistance((const cocos2d::CCPoint *)&v134, &v135);
if ( *(float *)&v132 > v141.origin.x )
goto LABEL_128;
}
if ( (v125 & 1) != 0 )
{
v141.origin.y = GJSmartTemplate::offsetForDir((GJSmartDirection)&v138, 4).y;
sub_10028CCE0(&v135, &v119);
v141.origin.x = cocos2d::ccpDistance((const cocos2d::CCPoint *)&v134, &v135);
if ( *(float *)&v132 > v141.origin.x )
goto LABEL_128;
}
if ( (v126 & 1) != 0 )
{
v141.origin.y = GJSmartTemplate::offsetForDir((GJSmartDirection)&v138, 5).y;
sub_10028CCE0(&v135, &v119);
v141.origin.x = cocos2d::ccpDistance((const cocos2d::CCPoint *)&v134, &v135);
if ( *(float *)&v132 > v141.origin.x )
goto LABEL_128;
}
if ( (v127 & 1) != 0 )
{
v141.origin.y = GJSmartTemplate::offsetForDir((GJSmartDirection)&v138, 6).y;
sub_10028CCE0(&v135, &v119);
v141.origin.x = cocos2d::ccpDistance((const cocos2d::CCPoint *)&v134, &v135);
if ( *(float *)&v132 > v141.origin.x )
goto LABEL_128;
}
if ( (v128 & 1) != 0
&& (v141.origin.y = GJSmartTemplate::offsetForDir((GJSmartDirection)&v138, 7).y,
sub_10028CCE0(&v135, &v119),
v141.origin.x = cocos2d::ccpDistance((const cocos2d::CCPoint *)&v134, &v135),
*(float *)&v132 > v141.origin.x)
|| (v129 & 1) != 0
&& (v141.origin.y = GJSmartTemplate::offsetForDir((GJSmartDirection)&v138, 8).y,
sub_10028CCE0(&v135, &v119),
v141.origin.x = cocos2d::ccpDistance((const cocos2d::CCPoint *)&v134, &v135),
*(float *)&v132 > v141.origin.x) )
{
LABEL_128:
sub_100720230(v121, v73, 1);
continue;
}
}
}
else if ( (_DWORD)m_uIndexInArray != v133->m_linkedGroup )
{
if ( cocos2d::CCDictionary::objectForKey(v94, m_uIndexInArray) )
goto LABEL_128;
LODWORD(m_uIndexInArray) = v75[15].m_uIndexInArray;
goto LABEL_139;
}
cocos2d::CCDictionary::setObject(v93, v75, v75[16].m_uReference);
++v73;
continue;
}
break;
}
if ( !(unsigned int)sub_100720070(v121) )
goto LABEL_174;
m_objectID = v133->m_objectID;
((void (__fastcall *)(cocos2d::CCPoint *, double))v133->getRealPosition)(&v135, *(double *)&v141.origin);
v78 = v99->m_editorLayer;
*(double *)&m_pixelScaleX_low = sub_10028CC60(&v134);
Object = LevelEditorLayer::createObject(v78, m_objectID, m_pixelScaleX_low, (bool)&v134);
v81 = Object;
if ( Object )
{
m_pixelScaleX_low = (cocos2d::CCPoint)LODWORD(Object->m_pixelScaleX);
if ( m_pixelScaleX_low.x != 1.0 || Object->m_pixelScaleY != 1.0 )
{
GameObject::updateCustomScaleX(Object, m_pixelScaleX_low.x);
m_pixelScaleX_low = (cocos2d::CCPoint)LODWORD(v81->m_pixelScaleY);
GameObject::updateCustomScaleY(v81, m_pixelScaleX_low.x);
}
}
sub_10071FCD0(v121, v81);
((void (__fastcall *)(SmartGameObject *))v133->getRotation)(v133);
((void (__fastcall *)(GameObject *))v81->setRotation)(v81);
v82 = ((__int64 (__fastcall *)(SmartGameObject *))v133->isFlipX)(v133);
((void (__fastcall *)(GameObject *, _QWORD))v81->setFlipX)(v81, v82);
v83 = ((__int64 (__fastcall *)(SmartGameObject *))v133->isFlipY)(v133);
((void (__fastcall *)(GameObject *, _QWORD))v81->setFlipY)(v81, v83);
v81->m_hasGroupParent = 1;
qsort(v121->data->arr, v121->data->num, 8u, (int (__cdecl *)(const void *, const void *))sub_100008BD0);
v84 = v99;
EditorUI::copyObjectsDetailed(&v134, (__int64)v99, (__int64)v121);
v81->m_hasGroupParent = 0;
EditorUI::deleteObject(v84, v81, 1);
if ( (*(_BYTE *)&v112 & 1) != 0 )
{
sub_100006B70(v96, __p, (unsigned __int64)size, *(double *)&m_pixelScaleX_low);
}
else
{
LOBYTE(v96[0]) = v112;
BYTE1(v96[0]) = v91;
HIWORD(v96[0]) = v101;
*(_DWORD *)((char *)v96 + 2) = v100;
v96[1] = size;
v97 = __p;
}
if ( (*(_BYTE *)&v134.__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&v88, v134.__r_.__value_.__l.__data_, v134.__r_.__value_.__l.__size_, *(double *)&m_pixelScaleX_low);
}
else
{
data = v134.__r_.__value_.__l.__data_;
v88 = *(_OWORD *)&v134.__r_.__value_.__l.0;
}
GJSmartTemplate::savePrefab(v95, v96, &v88);
if ( (v88 & 1) == 0 )
{
if ( ((__int64)v96[0] & 1) == 0 )
goto LABEL_172;
LABEL_177:
operator delete(v97);
if ( (*(_BYTE *)&v134.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_174;
LABEL_173:
operator delete(v134.__r_.__value_.__l.__data_);
goto LABEL_174;
}
operator delete(data);
if ( ((__int64)v96[0] & 1) != 0 )
goto LABEL_177;
LABEL_172:
if ( (*(_BYTE *)&v134.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_173;
LABEL_174:
if ( (*(_BYTE *)&v112 & 1) != 0 )
operator delete(__p);
LABEL_14:
v8 = (unsigned int)(v87 + 1);
if ( (unsigned int)v8 < (unsigned int)sub_100720070(a3) )
continue;
break;
}
LABEL_179:
GJSmartTemplate::logTemplateStatus(v85, v95, 1);
if ( (v85[0] & 1) != 0 )
operator delete(v86);
}