//
// EditLevelLayer::init from 0x1401784a0 to 0x140179b31 (5777 bytes)
//
// 2 xrefs:
// > EditLevelLayer::scene @ 0x14017844a
// > ??> @ 0x1409186b0
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:27:34 +0000
//
// Hidden C++ exception states: #wind=7
bool __fastcall EditLevelLayer::init(__int64 a1, __int64 a2)
{
bool result; // al
bool v5; // bl
void **v6; // rcx
void **v7; // rdx
__int64 v8; // rdx
__int64 v9; // rdx
__int64 v10; // rcx
__int64 v11; // rax
struct cocos2d::CCSprite *v12; // rdi
__int64 v13; // rbx
__int64 v14; // rax
__int64 v15; // rbx
__int64 v16; // rax
struct cocos2d::CCSprite *v17; // rdi
__int64 v18; // rbx
__int64 v19; // rax
__int64 v20; // rbx
__int64 v21; // rcx
cocos2d::CCDirector *v22; // rax
float v23; // xmm6_4
__int64 v24; // rcx
cocos2d::CCDirector *v25; // rax
float v26; // xmm0_4
__int64 v27; // rax
struct cocos2d::CCSprite *v28; // rdi
__int64 v29; // rbx
__int64 v30; // rax
__int64 v31; // rbx
__int64 v32; // rcx
cocos2d::CCDirector *v33; // rax
float v34; // xmm6_4
__int64 v35; // rcx
cocos2d::CCDirector *v36; // rax
float v37; // xmm0_4
__int64 v38; // rax
__int64 v39; // rcx
cocos2d::CCObject *v40; // rax
__int64 v41; // rcx
cocos2d::CCDirector *v42; // rax
float v43; // xmm0_4
__int64 v44; // rax
_QWORD *v45; // rbx
__int64 v46; // rdx
size_t v47; // rsi
__int64 v48; // rcx
__int64 v49; // rdx
char *v50; // rbx
__int64 v51; // r12
void **v52; // rcx
__int64 v53; // r14
size_t v54; // r8
int v55; // edi
void **v56; // rdx
size_t v57; // r8
const char *p_Buf2; // rcx
struct cocos2d::CCLabelBMFont *v59; // rbx
__int64 v60; // rax
_QWORD *v61; // rbx
__int64 v62; // rdx
__int64 v63; // rax
__int64 v64; // rdx
__int64 v65; // rcx
char *v66; // r14
__int64 v67; // rdx
__int64 v68; // rcx
__int64 v69; // r8
__int64 v70; // rdx
__int64 v71; // rcx
__int64 v72; // r8
const struct cocos2d::CCPoint *v73; // rax
char *v74; // rax
_BYTE *v75; // rax
size_t v76; // r8
__int64 v77; // rdx
__int64 v78; // r8
__int64 v79; // rax
_QWORD *v80; // rbx
void *v81; // r8
cocos2d::CCObject *v82; // rax
struct cocos2d::CCMenu *v83; // rdi
__int64 v84; // rbx
__int64 v85; // rax
size_t v86; // rbx
unsigned __int64 v87; // rdi
__int64 v88; // rax
void **v89; // rcx
void **v90; // r12
size_t v91; // r8
__int64 v92; // rcx
void **v93; // rdx
__int64 v94; // rax
int v95; // eax
cocos2d::CCObject *v96; // rax
struct cocos2d::CCSprite *v97; // r13
cocos2d::CCObject *v98; // rax
int v99; // eax
cocos2d::CCObject *v100; // rax
__int64 *v101; // rcx
__int64 v102; // rdi
float v103; // xmm6_4
float *v104; // rax
__int64 v105; // rbx
__int64 v106; // rax
__int64 v107; // rcx
__int64 v108; // r12
__int64 v109; // rcx
cocos2d::CCDirector *v110; // rax
float v111; // xmm6_4
__int64 v112; // rcx
cocos2d::CCDirector *v113; // rax
float v114; // xmm0_4
int v115; // eax
cocos2d::CCObject *v116; // rdi
__int64 v117; // rbx
__int64 v118; // rax
__int64 v119; // rcx
cocos2d::CCDirector *v120; // rax
float v121; // xmm6_4
struct cocos2d::CCSprite *v122; // rbx
cocos2d::CCObject *v123; // r14
__int64 v124; // rbx
__int64 v125; // rax
__int64 v126; // rax
cocos2d::CCSprite *v127; // rbx
cocos2d::CCObject *v128; // rdi
__int64 v129; // rax
__int64 v130; // rbx
__int64 v131; // rax
struct cocos2d::CCSprite *v132; // rsi
cocos2d::CCString *v133; // rax
const char *CString; // rax
struct cocos2d::CCLabelBMFont *v135; // rax
__int64 v136; // rdi
float v137; // xmm6_4
float *v138; // rax
__int64 v139; // rbx
__int64 v140; // rax
cocos2d::CCObject *v141; // rdi
__int64 v142; // rax
__int64 v143; // rbx
__int64 v144; // rax
__int64 v145; // rcx
cocos2d::CCDirector *v146; // rax
float v147; // xmm8_4
__int64 v148; // rcx
cocos2d::CCArray *v149; // r14
struct cocos2d::CCSprite *v150; // rbx
struct cocos2d::CCObject *v151; // rax
struct cocos2d::CCSprite *v152; // rsi
__int64 v153; // rdi
struct cocos2d::CCObject *v154; // rax
struct cocos2d::CCSprite *v155; // rsi
__int64 v156; // rdi
struct cocos2d::CCObject *v157; // rax
int v158; // eax
struct cocos2d::CCObject *v159; // rax
int v160; // eax
struct cocos2d::CCObject *v161; // rax
int v162; // eax
struct cocos2d::CCObject *v163; // rax
unsigned int v164; // eax
float v165; // xmm6_4
unsigned int i; // esi
struct cocos2d::CCObject *v167; // rdi
__int64 v168; // rbx
__int64 v169; // rax
__int64 v170; // rax
__int64 *v171; // rbx
cocos2d::CCObject *v172; // rsi
struct cocos2d::CCMenu *v173; // rdi
__int64 v174; // rbx
__int64 v175; // rcx
cocos2d::CCDirector *v176; // rax
float v177; // xmm6_4
__int64 v178; // rcx
cocos2d::CCDirector *v179; // rax
float v180; // xmm0_4
__int64 v181; // rax
__int64 v182; // rcx
__int64 v183; // rdi
__int64 *v184; // r14
__int64 v185; // rbx
__int64 v186; // rbx
__int64 v187; // rcx
cocos2d::CCDirector *v188; // rax
float v189; // xmm6_4
__int64 v190; // rcx
cocos2d::CCDirector *v191; // rax
float v192; // xmm0_4
__int64 v193; // rax
__int64 v194; // rcx
struct cocos2d::CCSprite *v195; // rdi
__int64 v196; // rbx
float v197; // xmm6_4
float *v198; // rax
__int64 v199; // rax
void **v200; // [rsp+40h] [rbp-C0h] BYREF
float v201; // [rsp+48h] [rbp-B8h] BYREF
float v202; // [rsp+4Ch] [rbp-B4h]
float v203[2]; // [rsp+50h] [rbp-B0h] BYREF
char v204[8]; // [rsp+58h] [rbp-A8h] BYREF
char v205[8]; // [rsp+60h] [rbp-A0h] BYREF
void *Src[4]; // [rsp+68h] [rbp-98h] BYREF
char v207[8]; // [rsp+88h] [rbp-78h] BYREF
_BYTE v208[16]; // [rsp+90h] [rbp-70h] BYREF
__int128 Buf2; // [rsp+A0h] [rbp-60h] BYREF
__int64 v210; // [rsp+B0h] [rbp-50h]
unsigned __int64 v211; // [rsp+B8h] [rbp-48h]
void *Buf1[2]; // [rsp+C0h] [rbp-40h] BYREF
__int64 v213; // [rsp+D0h] [rbp-30h]
unsigned __int64 v214; // [rsp+D8h] [rbp-28h]
void *v215[2]; // [rsp+E0h] [rbp-20h] BYREF
size_t v216; // [rsp+F0h] [rbp-10h]
__int64 v217; // [rsp+F8h] [rbp-8h]
result = cocos2d::CCLayer::init((cocos2d::CCLayer *)a1);
if ( !result )
return result;
*(_QWORD *)(a1 + 472) = a2;
cocos2d::CCObject::retain((cocos2d::CCObject *)a2);
sub_14003F4F0((__int64)&Buf2, *(_QWORD *)(a1 + 472) + 344LL);
v5 = v210 != 0;
sub_14003D310((__int64)&Buf2);
if ( v5 )
{
sub_14003F4F0((__int64)Src, *(_QWORD *)(a1 + 472) + 344LL);
v200 = Src;
v6 = (void **)(*(_QWORD *)(a1 + 472) + 1232LL);
if ( v6 != Src )
{
v7 = Src;
if ( Src[3] > (void *)0xF )
v7 = (void **)Src[0];
sub_1400405A0(v6, v7, (size_t)Src[2]);
}
sub_14003D310((__int64)Src);
}
sub_14003F4F0((__int64)&Buf2, *(_QWORD *)(a1 + 472) + 344LL);
sub_140059C40(a1 + 504, (__int64)&Buf2);
sub_14003D310((__int64)&Buf2);
*(_DWORD *)(a1 + 500) = *(_DWORD *)(a2 + 1220);
v8 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v200 = (void **)operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v200);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v8 = qword_14090BFD0;
}
*(_DWORD *)(v8 + 996) = *(_DWORD *)(*(_QWORD *)(a1 + 472) + 1224LL);
LOBYTE(v8) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 992LL))(a1, v8);
LOBYTE(v9) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1008LL))(a1, v9);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, &v201);
v12 = cocos2d::CCSprite::create("GJ_gradientBG.png");
v13 = *(_QWORD *)v12;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v200, 0.0, 0.0);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v13 + 288))(v12, v14);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v12, 4294967294LL);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v12 + 120LL))(v12);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v12 + 136LL))(v12);
v15 = *(_QWORD *)v12;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v200, -5.0, -5.0);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v15 + 184))(v12, v16);
LOWORD(v200) = 26112;
BYTE2(v200) = -1;
(**((void (__fastcall ***)(__int64, void ***))v12 + 40))((__int64)v12 + 320, &v200);
v17 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
v18 = *(_QWORD *)v17;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v200, 0.0, 0.0);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v18 + 288))(v17, v19);
v20 = *(_QWORD *)v17;
v22 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v21);
v23 = cocos2d::CCDirector::getScreenBottom(v22) - 1.0;
v25 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v24);
v26 = cocos2d::CCDirector::getScreenLeft(v25) - 1.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v200, v26, v23);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v20 + 184))(v17, v27);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v17, 1);
v28 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
v29 = *(_QWORD *)v28;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v200, 1.0, 0.0);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v29 + 288))(v28, v30);
v31 = *(_QWORD *)v28;
v33 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v32);
v34 = cocos2d::CCDirector::getScreenBottom(v33) - 1.0;
v36 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v35);
v37 = cocos2d::CCDirector::getScreenRight(v36) + 1.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v200, v37, v34);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v31 + 184))(v28, v38);
cocos2d::CCSprite::setFlipX(v28, 1);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSprite *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v28, 1);
v40 = (cocos2d::CCObject *)cocos2d::CCArray::create(v39);
*(_QWORD *)(a1 + 480) = v40;
cocos2d::CCObject::retain(v40);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v208, 0.0, 0.0, 80.0, 80.0);
v42 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v41);
v43 = cocos2d::CCDirector::getScreenTop(v42) - 30.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v204, v201 * 0.5, v43);
v44 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)Buf1, (const struct cocos2d::CCRect *)v208);
v45 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v44);
LOBYTE(v46) = -1;
(*(void (__fastcall **)(_QWORD *, __int64))(v45[40] + 40LL))(v45 + 40, v46);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v205, 365.0, 40.0);
(*(void (__fastcall **)(_QWORD *, char *))(*v45 + 312LL))(v45, v205);
v47 = -1;
(*(void (__fastcall **)(__int64, _QWORD *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v45, 0xFFFFFFFFLL);
(*(void (__fastcall **)(_QWORD *, char *))(*v45 + 184LL))(v45, v204);
LOWORD(v200) = 14336;
BYTE2(v200) = -115;
(*(void (__fastcall **)(_QWORD *, void ***))v45[40])(v45 + 40, &v200);
v49 = *(_QWORD *)(a1 + 472);
if ( *(int *)(v49 + 860) > 1 || *(_BYTE *)(v49 + 857) )
{
sub_14003F4F0((__int64)&Buf2, v49 + 344);
p_Buf2 = (const char *)&Buf2;
if ( v211 > 0xF )
p_Buf2 = (const char *)Buf2;
v59 = cocos2d::CCLabelBMFont::create(p_Buf2, "goldFont.fnt");
sub_14003D310((__int64)&Buf2);
(*(void (__fastcall **)(__int64, struct cocos2d::CCLabelBMFont *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v59, 20);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, char *))(*(_QWORD *)v59 + 184LL))(v59, v204);
v51 = a1 + 408;
}
else
{
v50 = CCTextInputNode::create(v48, v49, (__int64)"Level Name");
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v50, 18);
v51 = a1 + 408;
*((_QWORD *)v50 + 75) = a1 + 408;
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v50 + 64LL))(v50, 1);
(*(void (__fastcall **)(char *, char *))(*(_QWORD *)v50 + 184LL))(v50, v204);
*((_DWORD *)v50 + 152) = 20;
v50[624] = 1;
Buf2 = 0;
v210 = 0;
v211 = 15;
LOBYTE(Buf2) = 0;
sub_14003F4F0((__int64)Buf1, *(_QWORD *)(a1 + 472) + 344LL);
v52 = Buf1;
if ( v214 > 0xF )
v52 = (void **)Buf1[0];
v53 = v213;
v54 = v213;
if ( v213 )
v54 = 0;
v55 = memcmp(v52, &Buf2, v54);
if ( !v55 )
v55 = v53 != 0;
sub_14003D310((__int64)Buf1);
sub_14003D310((__int64)&Buf2);
if ( v55 )
{
sub_14003F4F0((__int64)Buf1, a2 + 344);
v56 = Buf1;
if ( v214 > 0xF )
v56 = (void **)Buf1[0];
Buf2 = 0;
v210 = 0;
v211 = 0;
v57 = -1;
do
++v57;
while ( *((_BYTE *)v56 + v57) );
sub_14003D230(&Buf2, v56, v57);
CCTextInputNode::setString(v50, &Buf2);
sub_14003D310((__int64)Buf1);
}
LOWORD(v200) = -21896;
*((_WORD *)v50 + 286) = -21896;
v50[574] = -16;
CCTextInputNode::refreshLabel((__int64)v50);
*((_DWORD *)v50 + 142) = 1060320051;
CCTextInputNode::refreshLabel((__int64)v50);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 480), (struct cocos2d::CCObject *)v50);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v203, v201 * 0.5, (float)(v202 * 0.5) + 65.0);
v60 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)Buf1, (const struct cocos2d::CCRect *)v208);
v61 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v60);
LOBYTE(v62) = -1;
(*(void (__fastcall **)(_QWORD *, __int64))(v61[40] + 40LL))(v61 + 40, v62);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v200, 365.0, 60.0);
cocos2d::CCSize::operator=(v205, v63);
(*(void (__fastcall **)(_QWORD *, char *))(*v61 + 312LL))(v61, v205);
(*(void (__fastcall **)(__int64, _QWORD *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v61, 0xFFFFFFFFLL);
(*(void (__fastcall **)(_QWORD *, float *))(*v61 + 184LL))(v61, v203);
LOWORD(v200) = 14336;
BYTE2(v200) = -115;
(*(void (__fastcall **)(_QWORD *, void ***))v61[40])(v61 + 40, &v200);
v66 = CCTextInputNode::create(v65, v64, (__int64)"Description [Optional]");
v66[624] = 0;
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v66, 20);
*((_QWORD *)v66 + 75) = v51;
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v66 + 64LL))(v66, 2);
(*(void (__fastcall **)(char *, float *))(*(_QWORD *)v66 + 184LL))(v66, v203);
*(_OWORD *)Buf1 = 0;
v213 = 0;
v214 = 0;
Buf1[0] = sub_14003D460(0x70u);
v213 = 97;
v214 = 111;
strcpy(
(char *)Buf1[0],
" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,-!?:;)(/\\\"'`*=+-_%[]<>|@&^#{}%$~");
CCTextInputNode::setAllowedChars((__int64)v66, Buf1);
v66[641] = 1;
sub_1400405A0((void **)v66 + 60, &byte_1406ED6E0, 0);
ensureEmotesAreLoaded(v68, v67, v69, COERCE_DOUBLE(1117782016));
*((_DWORD *)v66 + 152) = 17 * dword_1408FE3A4 + 180;
ensureEmotesAreLoaded(v71, v70, v72, COERCE_DOUBLE(1117782016));
CCTextInputNode::setParseEmotes((__int64)v66, dword_1408FE3A4);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 480), (struct cocos2d::CCObject *)v66);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)v66 + 74) + 336LL))(*((_QWORD *)v66 + 74), 0);
v200 = (void **)&Buf2;
Buf2 = 0;
v210 = 0;
v211 = 15;
LOBYTE(Buf2) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Buf1, 0.5, 0.5);
v74 = TextArea::create((__int64)&Buf2, "chatFont.fnt", 1.0, 346.5, v73, 1101004800, 1, 0);
CCTextInputNode::addTextArea((__int64)v66, (__int64)v74);
*((_DWORD *)v66 + 167) = 1113063424;
v75 = (_BYTE *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*((_QWORD *)v66 + 74) + 600LL) + 8LL))(*((_QWORD *)v66 + 74) + 600LL);
Buf2 = 0;
v210 = 0;
v211 = 0;
v76 = -1;
do
++v76;
while ( v75[v76] );
sub_14003D230(&Buf2, v75, v76);
CCTextInputNode::updateLabel((__int64)v66, (__int64 *)&Buf2);
LOWORD(v200) = -21896;
*((_WORD *)v66 + 286) = -21896;
v66[574] = -16;
CCTextInputNode::refreshLabel((__int64)v66);
*(_OWORD *)Buf1 = 0;
v213 = 4;
v214 = 15;
strcpy((char *)Buf1, "easy");
v79 = EmoteSprite::defForName((__int64)Buf1, v77, v78, COERCE_DOUBLE(1135427584));
if ( v79 )
v80 = EmoteSprite::createWithDef(v79);
else
v80 = nullptr;
if ( v214 > 0xF )
{
v81 = Buf1[0];
if ( v214 + 1 >= 0x1000 )
{
v81 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v81 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v81);
}
EmoteSprite::fitToHeight(v80, 18.0, 0.0);
v82 = CCMenuItemSpriteExtra::create((int)v80, 0, a1, (__int64)EditLevelLayer::onEmotes);
*(_QWORD *)(a1 + 552) = v82;
*((_DWORD *)v82 + 93) = 1069547520;
v83 = cocos2d::CCMenu::create(*(struct cocos2d::CCMenuItem **)(a1 + 552), 0);
v84 = *(_QWORD *)v83;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Buf1, (float)(v203[0] + 182.5) + 17.0, v203[1]);
(*(void (__fastcall **)(struct cocos2d::CCMenu *, __int64))(v84 + 184))(v83, v85);
(*(void (__fastcall **)(__int64, struct cocos2d::CCMenu *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v83, 25);
if ( *(_QWORD *)(a2 + 392) )
{
v88 = sub_14003F4F0((__int64)&Buf2, a2 + 376);
LevelTools::base64DecodeString(v215, v88);
v87 = v217;
v86 = v216;
}
else
{
*(_OWORD *)v215 = 0;
v86 = 0;
v216 = 0;
v87 = 15;
v217 = 15;
LOBYTE(v215[0]) = 0;
}
Buf2 = 0;
v210 = 0;
v211 = 15;
LOBYTE(Buf2) = 0;
v89 = v215;
v90 = (void **)v215[0];
if ( v87 > 0xF )
v89 = (void **)v215[0];
v91 = v86;
if ( v86 )
v91 = 0;
if ( memcmp(v89, &Buf2, v91) || v86 )
{
v93 = v215;
if ( v87 > 0xF )
v93 = v90;
Buf2 = 0;
v210 = 0;
v211 = 0;
do
++v47;
while ( *((_BYTE *)v93 + v47) );
sub_14003D230(&Buf2, v93, v47);
CCTextInputNode::setString(v66, &Buf2);
}
v94 = cocos2d::CCMenu::create(v92);
*(_QWORD *)(a1 + 464) = v94;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v94);
v95 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("GJ_editBtn_001.png");
v96 = CCMenuItemSpriteExtra::create(v95, 0, a1, (__int64)EditLevelLayer::onEdit);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 464) + 464LL))(*(_QWORD *)(a1 + 464), v96);
v97 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_playBtn2_001.png");
v98 = CCMenuItemSpriteExtra::create((int)v97, 0, a1, (__int64)EditLevelLayer::onPlay);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 464) + 464LL))(*(_QWORD *)(a1 + 464), v98);
v99 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("GJ_shareBtn_001.png");
v100 = CCMenuItemSpriteExtra::create(v99, 0, a1, (__int64)EditLevelLayer::onShare);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 464) + 464LL))(*(_QWORD *)(a1 + 464), v100);
cocos2d::CCMenu::alignItemsHorizontallyWithPadding(*(cocos2d::CCMenu **)(a1 + 464), 20.0);
v101 = *(__int64 **)(a1 + 464);
v102 = *v101;
v103 = (float)(v202 * 0.5) - 25.0;
v104 = (float *)(*(__int64 (__fastcall **)(__int64 *))(*v101 + 200))(v101);
v105 = *(_QWORD *)(a1 + 464);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Buf1, *v104, v103);
(*(void (__fastcall **)(__int64, __int64))(v102 + 184))(v105, v106);
EditLevelLayer::setupLevelInfo(a1);
v108 = cocos2d::CCMenu::create(v107);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v108);
v110 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v109);
v111 = cocos2d::CCDirector::getScreenTop(v110) - 30.0;
v113 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v112);
v114 = cocos2d::CCDirector::getScreenRight(v113) - 30.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v207, v114, v111);
v115 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("GJ_deleteBtn_001.png");
v116 = CCMenuItemSpriteExtra::create(v115, 0, a1, (__int64)EditLevelLayer::confirmDelete);
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)v108 + 464LL))(v108, v116);
v117 = *(_QWORD *)v116;
cocos2d::CCNode::convertToNodeSpace(v108, Buf1, v207);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v117 + 184))(v116, v118);
v120 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v119);
v121 = cocos2d::CCDirector::getScreenRight(v120) - 30.0;
v122 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v122 + 160LL))(v122);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v122 + 352LL))(v122);
v123 = CCMenuItemSpriteExtra::create((int)v122, 0, a1, (__int64)EditLevelLayer::confirmMoveToTop);
*((_DWORD *)v123 + 93) = 1066192077;
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)v108 + 464LL))(v108, v123);
v124 = *(_QWORD *)v123;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Buf1, v121, (float)(v202 * 0.5) + 2.5);
cocos2d::CCNode::convertToNodeSpace(v108, &v200, v125);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v124 + 184))(v123, v126);
v127 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
(*(void (__fastcall **)(cocos2d::CCSprite *))(*(_QWORD *)v127 + 160LL))(v127);
cocos2d::CCSprite::setFlipY(v127, 1);
(*(void (__fastcall **)(cocos2d::CCSprite *))(*(_QWORD *)v127 + 352LL))(v127);
v128 = CCMenuItemSpriteExtra::create((int)v127, 0, a1, (__int64)EditLevelLayer::confirmMoveToBottom);
*((_DWORD *)v128 + 93) = 1066192077;
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)v108 + 464LL))(v108, v128);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Buf1, 0.0, -30.0);
v130 = v129;
v131 = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v123 + 200LL))(v123);
cocos2d::CCPoint::operator+(v131, &v200, v130);
(*(void (__fastcall **)(cocos2d::CCObject *, void ***))(*(_QWORD *)v128 + 184LL))(v128, &v200);
v132 = cocos2d::CCSprite::createWithSpriteFrameName("gj_folderBtn_001.png");
v133 = cocos2d::CCString::createWithFormat(
(const char *)&word_1406ED6F8,
*(unsigned int *)(*(_QWORD *)(a1 + 472) + 988LL));
CString = cocos2d::CCString::getCString(v133);
v135 = cocos2d::CCLabelBMFont::create(CString, (const char *)&qword_140704F78);
*(_QWORD *)(a1 + 488) = v135;
(*(void (__fastcall **)(struct cocos2d::CCSprite *, struct cocos2d::CCLabelBMFont *, __int64))(*(_QWORD *)v132 + 456LL))(
v132,
v135,
1);
v136 = **(_QWORD **)(a1 + 488);
v137 = (float)(*(float *)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v132 + 320LL))(v132) + 4)
* 0.5)
+ 1.0;
v138 = (float *)(*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v132 + 320LL))(v132);
v139 = *(_QWORD *)(a1 + 488);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Buf1, *v138 * 0.5, v137);
(*(void (__fastcall **)(__int64, __int64))(v136 + 184))(v139, v140);
cocos2d::CCLabelBMFont::limitLabelWidth(*(cocos2d::CCLabelBMFont **)(a1 + 488), 24.0, 0.55000001, 0.0);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v132 + 160LL))(v132);
v141 = CCMenuItemSpriteExtra::create((int)v132, 0, a1, (__int64)EditLevelLayer::onSetFolder);
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)v108 + 464LL))(v108, v141);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Buf1, 0.0, 25.0);
v143 = v142;
v144 = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v123 + 200LL))(v123);
cocos2d::CCPoint::operator+(v144, &v200, v143);
(*(void (__fastcall **)(cocos2d::CCObject *, void ***))(*(_QWORD *)v141 + 184LL))(v141, &v200);
v146 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v145);
v147 = cocos2d::CCDirector::getScreenLeft(v146) + 30.0;
v149 = (cocos2d::CCArray *)cocos2d::CCArray::create(v148);
v150 = cocos2d::CCSprite::createWithSpriteFrameName("sideBtn_config_001.png");
v200 = (void **)v150;
v151 = CCMenuItemSpriteExtra::create((int)v150, 0, a1, (__int64)EditLevelLayer::onCreatorSettings);
cocos2d::CCArray::addObject(v149, v151);
v152 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_duplicateBtn_001.png");
v153 = *(_QWORD *)v152;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v150 + 320LL))(v150);
(*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v152 + 320LL))(v152);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(v153 + 160))(v152);
v154 = CCMenuItemSpriteExtra::create((int)v152, 0, a1, (__int64)EditLevelLayer::confirmClone);
cocos2d::CCArray::addObject(v149, v154);
if ( *(_DWORD *)(*(_QWORD *)(a1 + 472) + 972LL) == 5 )
{
v155 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_levelLeaderboardBtn_001.png");
v156 = *(_QWORD *)v155;
(*((void (__fastcall **)(void **))*v200 + 40))(v200);
(*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v155 + 320LL))(v155);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(v156 + 160))(v155);
v157 = CCMenuItemSpriteExtra::create((int)v155, 0, a1, (__int64)EditLevelLayer::onLevelLeaderboard);
cocos2d::CCArray::addObject(v149, v157);
}
v158 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("GJ_exportBtn_001.png");
v159 = CCMenuItemSpriteExtra::create(v158, 0, a1, (__int64)EditLevelLayer::onExportLevel);
cocos2d::CCArray::addObject(v149, v159);
if ( *(_DWORD *)(*(_QWORD *)(a1 + 472) + 972LL) != 5 )
{
v160 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("sideBtn_death_001.png");
v161 = CCMenuItemSpriteExtra::create(v160, 0, a1, (__int64)EditLevelLayer::onDeathTracker);
cocos2d::CCArray::addObject(v149, v161);
}
v162 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("sideBtn_options_001.png");
v163 = CCMenuItemSpriteExtra::create(v162, 0, a1, (__int64)EditLevelLayer::onLevelOptions);
cocos2d::CCArray::addObject(v149, v163);
v164 = cocos2d::CCArray::count(v149);
v165 = (float)(v202 * 0.5) + (float)((float)((float)(int)(v164 - 1) * 34.0) * 0.5);
for ( i = 0; i < cocos2d::CCArray::count(v149); ++i )
{
v167 = cocos2d::CCArray::objectAtIndex(v149, i);
(*(void (__fastcall **)(__int64, struct cocos2d::CCObject *))(*(_QWORD *)v108 + 464LL))(v108, v167);
v168 = *(_QWORD *)v167;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Buf1, v147, v165 - (float)((float)(int)i * 34.0));
cocos2d::CCNode::convertToNodeSpace(v108, &v200, v169);
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(v168 + 184))(v167, v170);
}
v171 = (__int64 *)cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
Buf1[0] = operator new(0x208u);
v172 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)Buf1[0]);
if ( v172 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v172, v171, 0, a1, (__int64)EditLevelLayer::onBack) )
{
cocos2d::CCObject::autorelease(v172);
goto LABEL_63;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v172 + 8LL))(v172, 1);
}
v172 = nullptr;
LABEL_63:
*((_DWORD *)v172 + 93) = 1070386381;
v173 = cocos2d::CCMenu::create(v172, 0);
(*(void (__fastcall **)(__int64, struct cocos2d::CCMenu *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v173, 1);
v174 = *(_QWORD *)v173;
v176 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v175);
v177 = cocos2d::CCDirector::getScreenTop(v176) - 23.0;
v179 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v178);
v180 = cocos2d::CCDirector::getScreenLeft(v179) + 24.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Buf1, v180, v177);
(*(void (__fastcall **)(struct cocos2d::CCMenu *, __int64))(v174 + 184))(v173, v181);
v183 = cocos2d::CCMenu::create(v182);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 456LL))(a1, v183, 2);
v184 = (__int64 *)cocos2d::CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
Buf1[0] = operator new(0x208u);
v185 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)Buf1[0]);
if ( !v185 )
{
LABEL_67:
v185 = 0;
goto LABEL_68;
}
if ( !CCMenuItemSpriteExtra::init((__int64 *)v185, v184, 0, a1, (__int64)EditLevelLayer::onLevelInfo) )
{
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v185 + 8LL))(v185, 1);
goto LABEL_67;
}
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v185);
LABEL_68:
*(_DWORD *)(v185 + 372) = 0x40000000;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v183 + 464LL))(v183, v185);
v186 = *(_QWORD *)v183;
v188 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v187);
v189 = cocos2d::CCDirector::getScreenBottom(v188) + 30.0;
v191 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v190);
v192 = cocos2d::CCDirector::getScreenLeft(v191) + 30.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Buf1, v192, v189);
(*(void (__fastcall **)(__int64, __int64))(v186 + 184))(v183, v193);
if ( *(_BYTE *)(cocos2d::CCApplication::sharedApplication(v194) + 209) )
{
GameToolbox::addBackButton(a1, (__int64)v172);
v195 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_Start_001.png");
(*(void (__fastcall **)(struct cocos2d::CCSprite *, struct cocos2d::CCSprite *))(*(_QWORD *)v97 + 464LL))(v97, v195);
v196 = *(_QWORD *)v195;
v197 = (float)(*(float *)((*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v97 + 320LL))(v97) + 4)
* 0.5)
- 40.0;
v198 = (float *)(*(__int64 (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v97 + 320LL))(v97);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Buf1, *v198 * 0.5, v197);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v196 + 184))(v195, v199);
}
sub_14003D310((__int64)v215);
return 1;
}