//
// SecretLayer2::init from 0x1403e22e0 to 0x1403e379a (5306 bytes)
//
// 5 xrefs:
// > SecretLayer2::scene @ 0x1403e228f
// > SecretLayer2::scene @ 0x1403e2296
// > SecretLayer2::scene @ 0x1403e2280
// > ??> @ 0x1405d2f00
// > ??> @ 0x1406d7f28
//
// 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=9
bool SecretLayer2::init(SecretLayer2 *a1)
{
bool result; // al
cocos2d::CCTextureCache *v3; // rax
__int64 v4; // rcx
cocos2d::CCSpriteFrameCache *v5; // rax
unsigned int v6; // r15d
__int64 v7; // rcx
_BOOL8 v8; // rdx
_BOOL8 v9; // rdx
__int64 v10; // rcx
cocos2d::CCDirector *v11; // rax
__int64 v12; // rcx
cocos2d::CCDictionary *v13; // rax
AchievementManager *v14; // rbx
cocos2d::CCString *v15; // rax
__int64 v16; // rcx
int v17; // ebx
unsigned __int64 v18; // rdx
void *v19; // rcx
struct cocos2d::CCObject *v20; // rbx
AchievementManager *v21; // rbx
cocos2d::CCString *v22; // rax
int v23; // ebx
void *v24; // rcx
AchievementManager *v25; // rbx
cocos2d::CCString *v26; // rax
__int64 v27; // rcx
int v28; // ebx
unsigned __int64 v29; // rdx
void *v30; // rcx
struct cocos2d::CCObject *v31; // rbx
AchievementManager *v32; // rbx
cocos2d::CCString *v33; // rax
__int64 v34; // rcx
int v35; // ebx
unsigned __int64 v36; // rdx
void *v37; // rcx
struct cocos2d::CCObject *v38; // rbx
AchievementManager *v39; // rbx
cocos2d::CCString *v40; // rax
__int64 v41; // rcx
int v42; // ebx
unsigned __int64 v43; // rdx
void *v44; // rcx
struct cocos2d::CCObject *v45; // rbx
AchievementManager *v46; // rbx
cocos2d::CCString *v47; // rax
__int64 v48; // rcx
int v49; // ebx
unsigned __int64 v50; // rdx
void *v51; // rcx
struct cocos2d::CCObject *v52; // rbx
AchievementManager *v53; // rbx
cocos2d::CCString *v54; // rax
__int64 v55; // rcx
int v56; // ebx
unsigned __int64 v57; // rdx
void *v58; // rcx
struct cocos2d::CCObject *v59; // rbx
AchievementManager *v60; // rbx
cocos2d::CCString *v61; // rax
__int64 v62; // rcx
int v63; // ebx
unsigned __int64 v64; // rdx
void *v65; // rcx
struct cocos2d::CCObject *v66; // rbx
GameManager *v67; // rcx
__int64 v68; // rdx
__int64 v69; // rcx
struct cocos2d::CCObject *v70; // rbx
struct cocos2d::CCSprite *v71; // rdi
cocos2d::CCSprite_vtbl *v72; // rbx
const cocos2d::CCPoint *v73; // rax
float v74; // xmm0_4
cocos2d::CCSprite_vtbl *v75; // rbx
const cocos2d::CCPoint *v76; // rax
struct cocos2d::CCLabelBMFont *v77; // rdi
float v78; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v79; // rbx
__int64 v80; // rax
float v81; // xmm0_4
cocos2d::CCLabelBMFont *v82; // rax
float v83; // xmm0_4
__int64 Message; // rax
struct cocos2d::CCRect *v85; // rax
struct cocos2d::extension::CCScale9Sprite *v86; // rbx
__int64 v87; // rdx
const char *v88; // r9
CCTextInputNode *v89; // rax
CCTextInputNode *m_searchInput; // rcx
CCTextInputNode *v91; // rcx
std::string *p_m_allowedChars; // rcx
void **v93; // rdx
struct cocos2d::CCSprite *v94; // rax
CCMenuItemSpriteExtra *v95; // rdi
struct cocos2d::CCMenu *v96; // r12
cocos2d::CCMenu_vtbl *v97; // rbx
__int64 v98; // rcx
cocos2d::CCDirector *v99; // rax
__int64 v100; // rcx
cocos2d::CCDirector *v101; // rax
float v102; // xmm0_4
const cocos2d::CCPoint *v103; // rax
__int64 v104; // rcx
struct cocos2d::CCSprite *v105; // rsi
struct cocos2d::CCSprite *v106; // rdi
cocos2d::CCSprite_vtbl *v107; // rbx
struct cocos2d::CCPoint v108; // rax
CCMenuItemSpriteExtra *v109; // rax
float v110; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v111; // rbx
struct cocos2d::CCPoint v112; // rax
GameManager *v113; // rcx
bool UGV; // al
const char *v115; // rcx
struct cocos2d::CCSprite *v116; // rax
CCMenuItemSpriteExtra *v117; // rax
float v118; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v119; // rbx
struct cocos2d::CCPoint v120; // rax
__int64 v121; // rcx
cocos2d::CCArray *v122; // rax
struct cocos2d::CCSprite *v123; // rbx
CCMenuItemSpriteExtra *v124; // rax
float v125; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v126; // rbx
struct cocos2d::CCPoint v127; // rax
struct cocos2d::CCLabelBMFont *v128; // rsi
float v129; // xmm0_4
struct cocos2d::CCLabelBMFont *v130; // rdi
float v131; // xmm0_4
__int64 v132; // rax
double v133; // xmm0_8
GameStatsManager *v134; // rcx
struct cocos2d::CCSprite *v135; // rbx
float v136; // xmm0_4
cocos2d::CCString *v137; // rax
const char *CString; // rax
struct cocos2d::CCLabelBMFont *v139; // rbx
float v140; // xmm0_4
GameManager *v141; // rcx
struct cocos2d::CCObject *v142; // rax
GameManager *v143; // rcx
GameLevelManager *v144; // rcx
GJGameLevel *MainLevel; // rax
__int64 v146; // rbx
struct cocos2d::CCDelayTime *v147; // rax
struct cocos2d::CCSequence *v148; // rax
cocos2d::ccColor3B *v149; // r8
int v150; // [rsp+28h] [rbp-A9h]
float v151; // [rsp+28h] [rbp-A9h]
void **v152; // [rsp+38h] [rbp-99h] BYREF
__int16 v153; // [rsp+40h] [rbp-91h] BYREF
char v154; // [rsp+42h] [rbp-8Fh]
__int64 v155; // [rsp+48h] [rbp-89h]
struct cocos2d::CCPoint v156; // [rsp+50h] [rbp-81h] BYREF
cocos2d::CCPoint v157; // [rsp+58h] [rbp-79h] BYREF
char v158[8]; // [rsp+60h] [rbp-71h] BYREF
void *Src[2]; // [rsp+68h] [rbp-69h] BYREF
size_t Size; // [rsp+78h] [rbp-59h]
unsigned __int64 v161; // [rsp+80h] [rbp-51h]
cocos2d::CCSize v162; // [rsp+88h] [rbp-49h] BYREF
cocos2d::CCRect v163; // [rsp+90h] [rbp-41h] BYREF
void *Block[2]; // [rsp+A0h] [rbp-31h] BYREF
__int64 v165; // [rsp+B0h] [rbp-21h]
unsigned __int64 v166; // [rsp+B8h] [rbp-19h]
result = cocos2d::CCLayer::init(a1);
if ( result )
{
v3 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v3, "SecretSheet.png", 0);
v5 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v4);
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v5, "SecretSheet.plist");
v152 = Block;
*(_OWORD *)Block = 0;
v6 = 0;
v165 = 0;
v166 = 15;
Block[0] = sub_14003AA10(0x20u);
v165 = 16;
v166 = 31;
strcpy((char *)Block[0], "secretLoop02.mp3");
if ( !qword_1406C2ED8 )
{
v156 = (struct cocos2d::CCPoint)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(*(_QWORD *)&v156);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
}
GameManager::fadeInMusic(v7, (__int64)Block);
LOBYTE(v8) = 1;
a1->setKeypadEnabled(a1, v8);
LOBYTE(v9) = 1;
a1->setKeyboardEnabled(a1, v9);
v11 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11);
v13 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v12);
a1->m_messageThreads = v13;
cocos2d::CCObject::retain(v13);
v14 = AchievementManager::sharedState();
*(_OWORD *)Block = 0;
v165 = 0;
v166 = 15;
Block[0] = sub_14003AA10(0x20u);
v165 = 24;
v166 = 31;
strcpy((char *)Block[0], "geometry.ach.v2.secret01");
v15 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v14->m_reportedAchievements, Block);
v17 = cocos2d::CCString::intValue(v15);
v18 = v166;
if ( v166 > 0xF )
{
v19 = Block[0];
if ( v166 + 1 >= 0x1000 )
{
v19 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v19 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v19);
}
if ( v17 < 100 )
{
v20 = (struct cocos2d::CCObject *)cocos2d::CCNode::create(v16, v18);
v20->setTag(v20, 1);
cocos2d::CCDictionary::setObject(a1->m_messageThreads, v20, 1);
}
v21 = AchievementManager::sharedState();
*(_OWORD *)Block = 0;
v165 = 0;
v166 = 15;
Block[0] = sub_14003AA10(0x20u);
v165 = 21;
v166 = 31;
strcpy((char *)Block[0], "geometry.ach.secret06");
v22 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v21->m_reportedAchievements, Block);
v23 = cocos2d::CCString::intValue(v22);
if ( v166 > 0xF )
{
v24 = Block[0];
if ( v166 + 1 >= 0x1000 )
{
v24 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v24 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v24);
}
if ( v23 >= 100 )
{
v25 = AchievementManager::sharedState();
*(_OWORD *)Block = 0;
v165 = 0;
v166 = 15;
Block[0] = sub_14003AA10(0x20u);
v165 = 24;
v166 = 31;
strcpy((char *)Block[0], "geometry.ach.v2.secret03");
v26 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v25->m_reportedAchievements, Block);
v28 = cocos2d::CCString::intValue(v26);
v29 = v166;
if ( v166 > 0xF )
{
v30 = Block[0];
if ( v166 + 1 >= 0x1000 )
{
v30 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v30 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v30);
}
if ( v28 < 100 )
{
v31 = (struct cocos2d::CCObject *)cocos2d::CCNode::create(v27, v29);
v31->setTag(v31, 3);
cocos2d::CCDictionary::setObject(a1->m_messageThreads, v31, 3);
}
}
v32 = AchievementManager::sharedState();
*(_OWORD *)Block = 0;
v165 = 0;
v166 = 15;
Block[0] = sub_14003AA10(0x20u);
v165 = 24;
v166 = 31;
strcpy((char *)Block[0], "geometry.ach.v2.secret05");
v33 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v32->m_reportedAchievements, Block);
v35 = cocos2d::CCString::intValue(v33);
v36 = v166;
if ( v166 > 0xF )
{
v37 = Block[0];
if ( v166 + 1 >= 0x1000 )
{
v37 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v37 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v37);
}
if ( v35 < 100 )
{
v38 = (struct cocos2d::CCObject *)cocos2d::CCNode::create(v34, v36);
v38->setTag(v38, 5);
cocos2d::CCDictionary::setObject(a1->m_messageThreads, v38, 5);
}
v39 = AchievementManager::sharedState();
*(_OWORD *)Block = 0;
v165 = 0;
v166 = 15;
Block[0] = sub_14003AA10(0x20u);
v165 = 24;
v166 = 31;
strcpy((char *)Block[0], "geometry.ach.v2.secret06");
v40 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v39->m_reportedAchievements, Block);
v42 = cocos2d::CCString::intValue(v40);
v43 = v166;
if ( v166 > 0xF )
{
v44 = Block[0];
if ( v166 + 1 >= 0x1000 )
{
v44 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v44 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v44);
}
if ( v42 < 100 )
{
v45 = (struct cocos2d::CCObject *)cocos2d::CCNode::create(v41, v43);
v45->setTag(v45, 6);
cocos2d::CCDictionary::setObject(a1->m_messageThreads, v45, 6);
}
v46 = AchievementManager::sharedState();
*(_OWORD *)Block = 0;
v165 = 0;
v166 = 15;
Block[0] = sub_14003AA10(0x20u);
v165 = 24;
v166 = 31;
strcpy((char *)Block[0], "geometry.ach.v2.secret08");
v47 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v46->m_reportedAchievements, Block);
v49 = cocos2d::CCString::intValue(v47);
v50 = v166;
if ( v166 > 0xF )
{
v51 = Block[0];
if ( v166 + 1 >= 0x1000 )
{
v51 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v51 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v51);
}
if ( v49 < 100 )
{
v52 = (struct cocos2d::CCObject *)cocos2d::CCNode::create(v48, v50);
v52->setTag(v52, 8);
cocos2d::CCDictionary::setObject(a1->m_messageThreads, v52, 8);
}
v53 = AchievementManager::sharedState();
*(_OWORD *)Block = 0;
v165 = 0;
v166 = 15;
Block[0] = sub_14003AA10(0x20u);
v165 = 24;
v166 = 31;
strcpy((char *)Block[0], "geometry.ach.v2.secret09");
v54 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v53->m_reportedAchievements, Block);
v56 = cocos2d::CCString::intValue(v54);
v57 = v166;
if ( v166 > 0xF )
{
v58 = Block[0];
if ( v166 + 1 >= 0x1000 )
{
v58 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v58 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v58);
}
if ( v56 < 100 )
{
v59 = (struct cocos2d::CCObject *)cocos2d::CCNode::create(v55, v57);
v59->setTag(v59, 9);
cocos2d::CCDictionary::setObject(a1->m_messageThreads, v59, 9);
}
v60 = AchievementManager::sharedState();
*(_OWORD *)Block = 0;
v165 = 0;
v166 = 15;
Block[0] = sub_14003AA10(0x20u);
v165 = 24;
v166 = 31;
strcpy((char *)Block[0], "geometry.ach.v2.secret10");
v61 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v60->m_reportedAchievements, Block);
v63 = cocos2d::CCString::intValue(v61);
v64 = v166;
if ( v166 > 0xF )
{
v65 = Block[0];
if ( v166 + 1 >= 0x1000 )
{
v65 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v65 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v65);
}
v165 = 0;
v166 = 15;
LOBYTE(Block[0]) = 0;
if ( v63 < 100 )
{
v66 = (struct cocos2d::CCObject *)cocos2d::CCNode::create(v62, v64);
v66->setTag(v66, 10);
cocos2d::CCDictionary::setObject(a1->m_messageThreads, v66, 10);
}
v67 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v152 = (void **)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v152);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v67 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getUGV(v67, (const char *)&word_140531EA4) )
{
v70 = (struct cocos2d::CCObject *)cocos2d::CCNode::create(v69, v68);
v70->setTag(v70, 20);
cocos2d::CCDictionary::setObject(a1->m_messageThreads, v70, 20);
}
v71 = cocos2d::CCSprite::create("GJ_gradientBG.png");
v72 = v71->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(4.5040475e30, 0.0);
v72->setAnchorPoint(v71, v73);
a1->addChild_0(a1, v71, -3);
((void (__fastcall *)(struct cocos2d::CCSprite *))v71->setScaleX)(v71);
v74 = ((float (__fastcall *)(struct cocos2d::CCSprite *))v71->setScaleY)(v71);
v75 = v71->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v74, -5.0);
v75->setPosition_0(v71, v76);
v153 = 75;
v154 = 100;
v71->setColor(&v71->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v153);
cocos2d::CCRect::CCRect(&v163, 0.0, 0.0, 40.0, 40.0);
v77 = cocos2d::CCLabelBMFont::create("Vault of Secrets", "goldFont.fnt");
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v77->setScale_0)(v77);
v78 = ((float (__fastcall *)(SecretLayer2 *, struct cocos2d::CCLabelBMFont *))a1->addChild_1)(a1, v77);
v79 = v77->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v78, *(float *)&v155 * 0.5);
v81 = ((float (__fastcall *)(struct cocos2d::CCLabelBMFont *, __int64))v79->setPosition_0)(v77, v80);
cocos2d::CCPoint::CCPoint(v81, *(float *)&v155 * 0.5);
v82 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
a1->m_messageLabel = v82;
v83 = ((float (__fastcall *)(SecretLayer2 *, cocos2d::CCLabelBMFont *))a1->addChild_1)(a1, v82);
cocos2d::CCPoint::CCPoint(v83, 0.0);
cocos2d::CCPoint::operator+(&v157, &v156);
a1->m_messageLabel->setPosition_0(a1->m_messageLabel, &v156);
Message = SecretLayer2::getMessage(a1, Block);
SecretLayer2::updateMessageLabel(a1, Message);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)Block, &v163);
v86 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v85);
LOBYTE(v87) = 100;
v86->setOpacity(&v86->cocos2d::CCRGBAProtocol, v87);
cocos2d::CCSize::CCSize(&v162, 200.0, 40.0);
v86->setContentSize(v86, &v162);
a1->addChild_0(a1, v86, -2);
v86->setPosition_0(v86, &v157);
v86->setColor(&v86->cocos2d::CCRGBAProtocol, &stru_140529C04);
v89 = CCTextInputNode::create(180.0, 50.0, "...", v88, v150, (const char *)&qword_14052A4D8);
a1->m_searchInput = v89;
a1->addChild_0(a1, v89, 20);
a1->m_searchInput->m_delegate = &a1->TextInputDelegate;
a1->m_searchInput->setPosition_0(a1->m_searchInput, &v157);
m_searchInput = a1->m_searchInput;
m_searchInput->m_maxLabelScale = 0.69999999;
CCTextInputNode::refreshLabel(m_searchInput);
v91 = a1->m_searchInput;
v91->m_maxLabelWidth = 180.0;
CCTextInputNode::refreshLabel(v91);
a1->m_searchInput->m_textField->setVisible(a1->m_searchInput->m_textField, 0);
a1->m_searchInput->m_maxLabelLength = 100;
*(_OWORD *)Src = 0;
Size = 0;
v161 = 15;
Src[0] = sub_14003AA10(0x70u);
Size = 97;
v161 = 111;
strcpy(
(char *)Src[0],
" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,-!?:;)(/\\\"'`*=+-_%[]<>|@&^#{}%$~");
v152 = Src;
p_m_allowedChars = &a1->m_searchInput->m_allowedChars;
if ( p_m_allowedChars != (std::string *)Src )
{
v93 = Src;
if ( v161 > 0xF )
v93 = (void **)Src[0];
sub_14003CCE0((void **)p_m_allowedChars, v93, Size);
}
sub_14003A830((__int64)Src);
SecretLayer2::updateSearchLabel(a1, byte_140518980);
v94 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v95 = CCMenuItemSpriteExtra::create(v94, nullptr, a1, (cocos2d::SEL_MenuHandler *)SecretLayer2::onBack);
HIDWORD(v95->m_pfnSelector.adj) = 1069547520;
v96 = cocos2d::CCMenu::create(v95, 0);
a1->addChild_0(a1, v96, 1);
v97 = v96->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v99 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v98);
cocos2d::CCDirector::getScreenTop(v99);
v101 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v100);
v102 = cocos2d::CCDirector::getScreenLeft(v101) + 24.0;
cocos2d::CCPoint::CCPoint(v102, v102);
v97->setPosition_0(v96, v103);
if ( *(_BYTE *)(cocos2d::CCApplication::sharedApplication(v104) + 197) )
GameToolbox::addBackButton(a1, v95);
v105 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_secretLock2_001.png");
v106 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_secretLock2_2_001.png");
v105->addChild_0(v105, v106, -1);
v107 = v106->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v108 = cocos2d::CCNode::convertToNodeSpace(v105, (const struct cocos2d::CCPoint *)&v152);
((void (__fastcall *)(struct cocos2d::CCSprite *, struct cocos2d::CCPoint))v107->setPosition_0)(v106, v108);
v109 = CCMenuItemSpriteExtra::create(v105, nullptr, a1, (cocos2d::SEL_MenuHandler *)SecretLayer2::onSubmit);
a1->m_submitButton = v109;
v110 = ((float (__fastcall *)(struct cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v96->addChild_1)(v96, v109);
v111 = a1->m_submitButton->__vftable;
cocos2d::CCPoint::CCPoint(v110, *(float *)&v155 * 0.5);
v112 = cocos2d::CCNode::convertToNodeSpace(v96, &v156);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v111->setPosition_0)(
a1->m_submitButton,
v112);
HIDWORD(a1->m_submitButton->m_pfnSelector.adj) = 1060320051;
v113 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
Block[0] = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)Block[0]);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v113 = (GameManager *)qword_1406C2ED8;
}
UGV = GameManager::getUGV(v113, (const char *)&word_140531E94);
v115 = "secretDoor_closed_001.png";
if ( UGV )
v115 = "secretDoor_open_001.png";
v116 = cocos2d::CCSprite::createWithSpriteFrameName(v115);
v117 = CCMenuItemSpriteExtra::create(v116, nullptr, a1, (cocos2d::SEL_MenuHandler *)SecretLayer2::onDoor);
a1->m_secretDoorButton = v117;
LOBYTE(v117->m_scaleMultiplier) = 0;
BYTE1(a1->m_secretDoorButton->m_scaleMultiplier) = 1;
v118 = ((float (__fastcall *)(struct cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v96->addChild_1)(
v96,
a1->m_secretDoorButton);
v119 = a1->m_secretDoorButton->__vftable;
cocos2d::CCPoint::CCPoint(v118, *(float *)&v155 - 45.0);
v120 = cocos2d::CCNode::convertToNodeSpace(v96, (const struct cocos2d::CCPoint *)&v152);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v119->setPosition_0)(
a1->m_secretDoorButton,
v120);
v122 = (cocos2d::CCArray *)cocos2d::CCArray::create(v121);
a1->m_secretLevelLabels = v122;
cocos2d::CCObject::retain(v122);
v123 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_playBtn2_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v123->setScale_0)(v123);
v124 = CCMenuItemSpriteExtra::create(v123, nullptr, a1, (cocos2d::SEL_MenuHandler *)SecretLayer2::onSecretLevel);
a1->m_secretLevelButton = v124;
v125 = ((float (__fastcall *)(struct cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v96->addChild_1)(v96, v124);
cocos2d::CCPoint::CCPoint(v125, (float)(*(float *)&v155 - 45.0) - 0.0);
v126 = a1->m_secretLevelButton->__vftable;
v127 = cocos2d::CCNode::convertToNodeSpace(v96, (const struct cocos2d::CCPoint *)Block);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v126->setPosition_0)(
a1->m_secretLevelButton,
v127);
v128 = cocos2d::CCLabelBMFont::create("The", (const char *)&qword_14052A4D8);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v128->setScale_0)(v128);
v129 = ((float (__fastcall *)(SecretLayer2 *, struct cocos2d::CCLabelBMFont *))a1->addChild_1)(a1, v128);
cocos2d::CCPoint::CCPoint(v129, 0.0);
cocos2d::CCPoint::operator+(v158, &v156);
v128->setPosition_0(v128, &v156);
cocos2d::CCArray::addObject(a1->m_secretLevelLabels, v128);
v130 = cocos2d::CCLabelBMFont::create("Challenge", (const char *)&qword_14052A4D8);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v130->setScale_0)(v130);
v131 = ((float (__fastcall *)(SecretLayer2 *, struct cocos2d::CCLabelBMFont *))a1->addChild_1)(a1, v130);
cocos2d::CCPoint::CCPoint(v131, 0.0);
v132 = (__int64)v128->getPosition_0(v128);
v133 = cocos2d::CCPoint::operator+(v132, &v156);
v130->setPosition_0(v130, &v156);
cocos2d::CCArray::addObject(a1->m_secretLevelLabels, v130);
v134 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
Block[0] = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)Block[0]);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v134 = (GameStatsManager *)qword_1406C2EE8;
}
if ( GameStatsManager::getStat(v134, "13") < 200 )
{
cocos2d::CCPoint::CCPoint(*(float *)&v133, 3.0);
cocos2d::CCPoint::operator+(v158, &v156);
v135 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_diamondsIcon_001.png");
v136 = ((float (__fastcall *)(SecretLayer2 *, struct cocos2d::CCSprite *))a1->addChild_1)(a1, v135);
cocos2d::CCPoint::CCPoint(v136, 12.0);
cocos2d::CCPoint::operator+(&v156, &v152);
v135->setPosition_0(v135, (const cocos2d::CCPoint *)&v152);
((void (__fastcall *)(struct cocos2d::CCSprite *))v135->setScale_0)(v135);
cocos2d::CCArray::addObject(a1->m_secretLevelLabels, v135);
v137 = cocos2d::CCString::createWithFormat("%i", 200);
CString = cocos2d::CCString::getCString(v137);
v139 = cocos2d::CCLabelBMFont::create(CString, (const char *)&qword_14052A4D8);
v140 = ((float (__fastcall *)(SecretLayer2 *, struct cocos2d::CCLabelBMFont *))a1->addChild_1)(a1, v139);
cocos2d::CCPoint::CCPoint(v140, -8.5);
cocos2d::CCPoint::operator+(&v156, &v152);
v139->setPosition_0(v139, (const cocos2d::CCPoint *)&v152);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v139->setScale_0)(v139);
cocos2d::CCArray::addObject(a1->m_secretLevelLabels, v139);
}
v141 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
Block[0] = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)Block[0]);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v141 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getUGV(v141, (const char *)&word_140531EA4) )
{
a1->m_secretLevelButton->setEnabled(a1->m_secretLevelButton, 0);
a1->m_secretLevelButton->setVisible(a1->m_secretLevelButton, 0);
if ( cocos2d::CCArray::count(a1->m_secretLevelLabels) )
{
do
{
v142 = cocos2d::CCArray::objectAtIndex(a1->m_secretLevelLabels, v6);
((void (__fastcall *)(struct cocos2d::CCObject *, _QWORD))v142->__vftable[4].update)(v142, 0);
++v6;
}
while ( v6 < cocos2d::CCArray::count(a1->m_secretLevelLabels) );
}
}
v143 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
Block[0] = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)Block[0]);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v143 = (GameManager *)qword_1406C2ED8;
}
if ( !GameManager::getUGV(v143, (const char *)&word_140531E94) )
{
v144 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
Block[0] = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)Block[0]);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v144 = (GameLevelManager *)qword_1406C2EC0;
}
MainLevel = GameLevelManager::getMainLevel(v144, 3001, 1);
if ( MainLevel->m_normalPercent.random - MainLevel->m_normalPercent.seed >= 100 )
{
v146 = cocos2d::CCCallFunc::create(a1, SecretLayer2::showCompletedLevel);
v147 = cocos2d::CCDelayTime::create(0.80000001);
v148 = cocos2d::CCSequence::create(v147, v146, 0);
cocos2d::CCNode::runAction((CCLightFlash *)a1, (cocos2d::CCPoint)v148, v149, 40.0, v151);
}
}
return 1;
}
return result;
}