//
// SecretLayer5::init from 0xa95a80 to 0xa96b10 (4240 bytes)
//
// 3 xrefs:
// > SecretLayer5::create @ 0xa91278
// > ??> @ 0x5d8e8
// > ??> @ 0x11f33c0
//
// 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
//
bool SecretLayer5::init(SecretLayer5 *a1)
{
bool v2; // w23
cocos2d::CCTextureCache *v4; // x0
cocos2d::CCSpriteFrameCache *v5; // x0
cocos2d::CCTextureCache *v6; // x0
cocos2d::CCSpriteFrameCache *v7; // x0
GameManager *v8; // x24
void *v9; // x0
cocos2d::CCDirector *v10; // x0
int *m_start; // x0
_BYTE *m_finish; // x3
__int64 v13; // x24
char *v14; // x28
cocos2d::CCSprite *v15; // x4
unsigned int v16; // w0
int *v17; // x28
unsigned __int64 v18; // x3
const char *v19; // x1
cocos2d::CCSprite *v20; // x28
cocos2d::CCSprite *m_background; // x28
cocos2d::CCSprite *v22; // x0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
cocos2d::CCLabelBMFont *v24; // x0
SecretLayer5_vtbl *v25; // x2
cocos2d::CCLabelBMFont *m_messageLabel; // x28
void *v27; // x0
cocos2d::extension::CCScale9Sprite *v28; // x0
cocos2d::extension::CCScale9Sprite_vtbl *v29; // x2
CCTextInputNode *v30; // x0
CCTextInputNode *m_textInput; // x25
void *v32; // x0
cocos2d::CCSprite *v33; // x0
CCMenuItemSpriteExtra *v34; // x27
cocos2d::CCNode *v35; // x25
cocos2d::CCDirector *v36; // x0
float v37; // s0
float v38; // s8
cocos2d::CCDirector *v39; // x0
float v40; // s0
void *v41; // x0
CCSpriteGrayscale *m_wraithGraySprite; // x0
void *v43; // x2
CCSpriteGrayscale_vtbl *v44; // x2
void (__fastcall *v45)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
CCSpriteGrayscale *v46; // x27
cocos2d::CCSprite *v47; // x0
cocos2d::CCSprite_vtbl *v48; // x2
cocos2d::CCSprite *m_eyesSprite; // x27
cocos2d::CCNode *v50; // x27
cocos2d::CCSprite *v51; // x0
cocos2d::CCNode_vtbl *v52; // x3
cocos2d::CCNode_vtbl *v53; // x2
cocos2d::CCSprite *m_lockSprite; // x27
cocos2d::CCSprite *v55; // x0
void (__fastcall *v56)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
CCMenuItemSpriteExtra *v57; // x0
cocos2d::CCNode_vtbl *v58; // x2
CCMenuItemSpriteExtra *m_wraithButton; // x27
LoadingCircleSprite *v60; // x0
LoadingCircleSprite_vtbl *v61; // x1
LoadingCircleSprite *m_circleSprite; // x0
void (__fastcall *v63)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
GameManager *v64; // x0
GameManager *v65; // x0
const char *FontFile; // x25
TextArea *v67; // x0
TextArea *m_messageArea; // x28
void *v69; // x27
_BOOL4 v70; // w25
TextArea *v71; // x28
cocos2d::CCArray *v72; // x0
cocos2d::CCArray *v73; // x0
cocos2d::CCSprite *v74; // x27
void (__fastcall *v75)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
float v77; // s2
cocos2d::CCArray *v78; // x0
cocos2d::CCArray *v79; // x24
__int64 v80; // x27
float v81; // s2
cocos2d::CCArray *m_torchFires; // x27
cocos2d::CCObject *v83; // x0
cocos2d::CCArray *v84; // x27
cocos2d::CCObject *v85; // x0
GameManager *v86; // x0
bool UGV; // w0
cocos2d::CCSequence *v88; // x20
cocos2d::CCFiniteTimeAction *v89; // x0
cocos2d::CCAction *v90; // x0
__int64 v91; // x24
int *v92; // x0
int *v93; // x24
unsigned int *v94; // x1
int v95; // w2
unsigned int *v96; // x25
int v97; // w0
unsigned int *v98; // x1
int v99; // w0
unsigned int *v100; // x1
int v101; // w2
unsigned int *v102; // x1
int v103; // w2
unsigned int *v104; // x1
int v105; // w2
_QWORD v106[2]; // [xsp+0h] [xbp+0h] BYREF
__int64 v107; // [xsp+98h] [xbp+98h]
__int64 v108; // [xsp+A0h] [xbp+A0h]
__int64 v109; // [xsp+A8h] [xbp+A8h]
cocos2d::CCNode *m_wraithSprite; // [xsp+B0h] [xbp+B0h]
cocos2d::CCSprite *p_m_soundEffects; // [xsp+B8h] [xbp+B8h]
float v112; // [xsp+C8h] [xbp+C8h]
float v113; // [xsp+CCh] [xbp+CCh]
cocos2d::CCPoint v114; // [xsp+D0h] [xbp+D0h] BYREF
cocos2d::CCSize v115; // [xsp+D8h] [xbp+D8h] BYREF
cocos2d::CCPoint v116; // [xsp+E0h] [xbp+E0h] BYREF
cocos2d::CCRect v117; // [xsp+E8h] [xbp+E8h] BYREF
cocos2d::CCRect v118; // [xsp+F8h] [xbp+F8h] BYREF
cocos2d::CCPoint v119; // 0:kr08_8.8
cocos2d::CCPoint v120; // 0:kr10_8.8
cocos2d::CCPoint v121; // 0:kr18_8.8
cocos2d::CCPoint v122; // 0:kr20_8.8
cocos2d::SEL_MenuHandler v123; // 0:x2.16
cocos2d::SEL_MenuHandler v124; // 0:x2.16
cocos2d::CCPoint v125; // 0:s0.4,4:s1.4
cocos2d::CCRect v126; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v2 = cocos2d::CCLayer::init(a1);
if ( v2 )
{
v4 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v4, "SecretSheet.png", 0);
v5 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v5, "SecretSheet.plist");
v6 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v6, "TowerSheet.png", 0);
v7 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v7, "TowerSheet.plist");
v8 = GameManager::sharedState();
sub_D153B8((unsigned int)v106 + 248, "secretLoop04.ogg");
GameManager::fadeInMusic((__int64)v8, &v118);
v9 = (void *)(*(_QWORD *)&v118.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v118.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v94 = (unsigned int *)(*(_QWORD *)&v118.origin - 8LL);
do
v95 = __ldaxr(v94);
while ( __stlxr(v95 - 1, v94) );
}
else
{
v95 = *(_DWORD *)(*(_QWORD *)&v118.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v118.origin - 8LL) = v95 - 1;
}
if ( v95 <= 0 )
operator delete(v9);
}
a1->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
v10 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v10);
m_start = a1->m_soundEffects.m_start;
if ( (int *)((char *)a1->m_soundEffects.m_reserveEnd - (char *)m_start) <= (int *)((char *)&dword_40 + 3) )
{
v91 = operator new(0x44u);
*(_DWORD *)(v91 + 64) = 22349;
*(_QWORD *)v91 = 0x58500000579BLL;
*(_QWORD *)(v91 + 8) = 0x584300005842LL;
*(_QWORD *)(v91 + 16) = 0x57C7000057BDLL;
*(_QWORD *)(v91 + 24) = 0x583800005839LL;
*(_QWORD *)(v91 + 32) = 0x583B000057F1LL;
*(_QWORD *)(v91 + 40) = 0x583D0000583CLL;
*(_QWORD *)(v91 + 48) = 0x57D700005840LL;
*(_QWORD *)(v91 + 56) = 0x57370000580BLL;
v92 = a1->m_soundEffects.m_start;
if ( v92 )
operator delete(v92);
a1->m_soundEffects.m_start = (int *)v91;
v93 = (int *)(v91 + 68);
a1->m_soundEffects.m_finish = v93;
a1->m_soundEffects.m_reserveEnd = v93;
}
else
{
m_finish = a1->m_soundEffects.m_finish;
v13 = m_finish - (_BYTE *)m_start;
if ( (unsigned __int64)(m_finish - (_BYTE *)m_start) > 0x43 )
{
m_start[16] = 22349;
*(_QWORD *)m_start = 0x58500000579BLL;
*((_QWORD *)m_start + 1) = 0x584300005842LL;
*((_QWORD *)m_start + 2) = 0x57C7000057BDLL;
*((_QWORD *)m_start + 3) = 0x583800005839LL;
*((_QWORD *)m_start + 4) = 0x583B000057F1LL;
*((_QWORD *)m_start + 5) = 0x583D0000583CLL;
*((_QWORD *)m_start + 6) = 0x57D700005840LL;
*((_QWORD *)m_start + 7) = 0x57370000580BLL;
a1->m_soundEffects.m_finish = m_start + 17;
}
else
{
v14 = (char *)&qword_F158B0 + v13;
if ( v13 >> 2 )
{
p_m_soundEffects = (cocos2d::CCSprite *)&a1->m_soundEffects;
memcpy(m_start, &qword_F158B0, m_finish - (_BYTE *)m_start);
v15 = p_m_soundEffects;
m_finish = *(_BYTE **)&p_m_soundEffects->m_uID;
}
else
{
v15 = (cocos2d::CCSprite *)&a1->m_soundEffects;
}
if ( (algn_F158F4 - v14) >> 2 )
{
p_m_soundEffects = v15;
m_finish = memmove(m_finish, v14, algn_F158F4 - v14);
v15 = p_m_soundEffects;
}
*(_QWORD *)&v15->m_uID = &m_finish[algn_F158F4 - v14];
}
}
v16 = time(nullptr);
srand(v16);
v17 = a1->m_soundEffects.m_start;
p_m_soundEffects = (cocos2d::CCSprite *)a1->m_soundEffects.m_finish;
v18 = rand() % 0x7FFFFFFFuLL;
if ( !v18 )
v18 = 1;
v118.origin = (cocos2d::CCPoint)v18;
std::shuffle<__gnu_cxx::__normal_iterator>,std::linear_congruential_engine>(
v17,
(int *)p_m_soundEffects,
(unsigned __int64 *)&v118);
v20 = (cocos2d::CCSprite *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_gradientBG.png", v19);
a1->m_background = v20;
p_m_soundEffects = (cocos2d::CCSprite *)v20->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v118.origin, 0.0, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCRect *))p_m_soundEffects)(v20, &v118);
a1->addChild_0(a1, a1->m_background, -3);
a1->m_background->setScaleX(a1->m_background, (float)(v112 + 10.0) / a1->m_background->m_obRect.size.width);
a1->m_background->setScaleY(a1->m_background, (float)(v113 + 10.0) / a1->m_background->m_obRect.size.height);
m_background = a1->m_background;
p_m_soundEffects = (cocos2d::CCSprite *)m_background->setPosition;
cocos2d::CCPoint::CCPoint(&v118.origin, -5.0, -5.0);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCRect *))p_m_soundEffects)(m_background, &v118);
v22 = a1->m_background;
setColor = v22->setColor;
LOWORD(v118.origin.x) = 3613;
BYTE2(v118.origin.x) = 47;
setColor(v22, (const cocos2d::ccColor3B *)&v118);
cocos2d::CCRect::CCRect(&v117, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCPoint::CCPoint(&v114, v112 * 0.5, (float)(v113 * 0.5) + 55.0);
v24 = cocos2d::CCLabelBMFont::create();
v25 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_messageLabel = v24;
((void (__fastcall *)(SecretLayer5 *))v25->addChild)(a1);
m_messageLabel = a1->m_messageLabel;
p_m_soundEffects = (cocos2d::CCSprite *)m_messageLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v116, 0.0, 43.0);
cocos2d::CCPoint::operator+(&v118, &v114, &v116);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, cocos2d::CCRect *))p_m_soundEffects)(m_messageLabel, &v118);
SecretLayer5::getMessage(a1, (__int64)&v118);
SecretLayer5::updateMessageLabel((__int64)a1, &v118);
v27 = (void *)(*(_QWORD *)&v118.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v118.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v100 = (unsigned int *)(*(_QWORD *)&v118.origin - 8LL);
do
v101 = __ldaxr(v100);
while ( __stlxr(v101 - 1, v100) );
}
else
{
v101 = *(_DWORD *)(*(_QWORD *)&v118.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v118.origin - 8LL) = v101 - 1;
}
if ( v101 <= 0 )
operator delete(v27);
}
cocos2d::CCRect::CCRect(&v118, &v117);
v28 = (cocos2d::extension::CCScale9Sprite *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02b_small.png",
(const char *)&v118,
v126);
v29 = v28->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_inputBackground = v28;
v29->setOpacity(v28, 100);
p_m_soundEffects = (cocos2d::CCSprite *)&v115;
cocos2d::CCSize::CCSize(&v115, 200.0, 40.0);
a1->m_inputBackground->setContentSize(a1->m_inputBackground, (const cocos2d::CCSize *)p_m_soundEffects);
a1->addChild_0(a1, a1->m_inputBackground, -2);
a1->m_inputBackground->setPosition(a1->m_inputBackground, &v114);
a1->m_inputBackground->setColor(a1->m_inputBackground, (const cocos2d::ccColor3B *)&algn_F158F4[4]);
v30 = CCTextInputNode::create(180.0, 50.0, "...", "Thonburi");
a1->m_textInput = v30;
a1->addChild_0(a1, v30, 20);
a1->m_textInput->m_delegate = &a1->TextInputDelegate;
a1->m_textInput->setPosition(a1->m_textInput, &v114);
CCTextInputNode::setMaxLabelScale(a1->m_textInput, 0.7);
CCTextInputNode::setMaxLabelWidth(a1->m_textInput, 180.0);
a1->m_textInput->m_textField->setVisible(a1->m_textInput->m_textField, 0);
m_textInput = a1->m_textInput;
m_textInput->m_maxLabelLength = 100;
sub_D153B8(
(unsigned int)v106 + 248,
" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,-!?:;)(/\\\"'`*=+-_%[]<>|@&^#{}%$~");
CCTextInputNode::setAllowedChars((__int64)m_textInput, (__int64)&v118);
v32 = (void *)(*(_QWORD *)&v118.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v118.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v104 = (unsigned int *)(*(_QWORD *)&v118.origin - 8LL);
do
v105 = __ldaxr(v104);
while ( __stlxr(v105 - 1, v104) );
}
else
{
v105 = *(_DWORD *)(*(_QWORD *)&v118.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v118.origin - 8LL) = v105 - 1;
}
if ( v105 <= 0 )
operator delete(v32);
}
SecretLayer5::updateSearchLabel(a1, &byte_F288A0);
v33 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v123.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v123.adj = (size_t)SecretLayer5::onBack;
v34 = CCMenuItemSpriteExtra::create(v33, nullptr, v123);
CCMenuItemSpriteExtra::setSizeMult(v34, 1.5);
v35 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v34, nullptr);
a1->addChild_0(a1, v35, 1);
p_m_soundEffects = (cocos2d::CCSprite *)v35->setPosition;
v36 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v36);
v38 = v37;
v39 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v39);
cocos2d::CCPoint::CCPoint(&v118.origin, v38 + 24.0, v40 - 23.0);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))p_m_soundEffects)(v35, &v118);
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, v34);
sub_D153B8((unsigned int)v106 + 248, "GJ_secretLock4_001.png");
a1->m_wraithSprite = CCSpriteWithHue::createWithSpriteFrameName((const char **)&v118);
v41 = (void *)(*(_QWORD *)&v118.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v118.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v102 = (unsigned int *)(*(_QWORD *)&v118.origin - 8LL);
do
v103 = __ldaxr(v102);
while ( __stlxr(v103 - 1, v102) );
}
else
{
v103 = *(_DWORD *)(*(_QWORD *)&v118.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v118.origin - 8LL) = v103 - 1;
}
if ( v103 <= 0 )
operator delete(v41);
}
sub_D153B8((unsigned int)v106 + 248, "GJ_secretLock4_001.png");
m_wraithGraySprite = CCSpriteGrayscale::createWithSpriteFrameName((const char **)&v118);
a1->m_wraithGraySprite = m_wraithGraySprite;
v43 = (void *)(*(_QWORD *)&v118.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v118.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v98 = (unsigned int *)(*(_QWORD *)&v118.origin - 8LL);
do
v99 = __ldaxr(v98);
while ( __stlxr(v99 - 1, v98) );
}
else
{
v99 = *(_DWORD *)(*(_QWORD *)&v118.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v118.origin - 8LL) = v99 - 1;
}
if ( v99 <= 0 )
operator delete(v43);
m_wraithGraySprite = a1->m_wraithGraySprite;
}
v44 = m_wraithGraySprite->CCSpriteWithHue::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v107 = 4294967240LL;
v45 = v44->setColor;
LOWORD(v118.origin.x) = 25800;
v108 = 100;
BYTE2(v118.origin.x) = -1;
v109 = 0xFFFFFFFFLL;
v45(m_wraithGraySprite, (const cocos2d::ccColor3B *)&v118);
a1->m_wraithSprite->addChild_0(a1->m_wraithSprite, a1->m_wraithGraySprite, 1);
a1->m_wraithGraySprite->setOpacity(a1->m_wraithGraySprite, 0);
v46 = a1->m_wraithGraySprite;
m_wraithSprite = a1->m_wraithSprite;
p_m_soundEffects = (cocos2d::CCSprite *)v46->setPosition;
cocos2d::CCPoint::CCPoint(&v116, 0.0, 0.0);
v119 = cocos2d::CCNode::convertToNodeSpace(m_wraithSprite, &v116);
((void (__fastcall *)(CCSpriteGrayscale *, cocos2d::CCRect *, float, float))p_m_soundEffects)(
v46,
&v118,
v119.x,
v119.y);
v47 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_secretLock4_eyes_001.png");
v48 = v47->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_eyesSprite = v47;
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v48->setBlendFunc)(v47, 0x100000302LL);
a1->m_wraithSprite->addChild_0(a1->m_wraithSprite, a1->m_eyesSprite, 2);
m_eyesSprite = a1->m_eyesSprite;
m_wraithSprite = a1->m_wraithSprite;
p_m_soundEffects = (cocos2d::CCSprite *)m_eyesSprite->setPosition;
cocos2d::CCPoint::CCPoint(&v116, 0.0, 0.0);
v120 = cocos2d::CCNode::convertToNodeSpace(m_wraithSprite, &v116);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCRect *, float, float))p_m_soundEffects)(
m_eyesSprite,
&v118,
v120.x,
v120.y);
a1->m_eyesSprite->setOpacity(a1->m_eyesSprite, 0);
p_m_soundEffects = (cocos2d::CCSprite *)"GJ_secretLock2_2_001.png";
cocos2d::CCSprite::createWithSpriteFrameName("GJ_secretLock2_2_001.png");
v50 = cocos2d::CCNode::create();
v51 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)p_m_soundEffects);
v52 = v50->__vftable;
a1->m_lockSprite = v51;
((void (__fastcall *)(cocos2d::CCNode *))v52->addChild_0)(v50);
a1->m_wraithSprite->addChild_0(a1->m_wraithSprite, v50, -2);
v53 = v50->__vftable;
m_wraithSprite = a1->m_wraithSprite;
p_m_soundEffects = (cocos2d::CCSprite *)v53->setPosition;
cocos2d::CCPoint::CCPoint(&v116, 0.0, -30.0);
v121 = cocos2d::CCNode::convertToNodeSpace(m_wraithSprite, &v116);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *, float, float))p_m_soundEffects)(
v50,
&v118,
v121.x,
v121.y);
m_lockSprite = a1->m_lockSprite;
p_m_soundEffects = (cocos2d::CCSprite *)m_lockSprite->setPosition;
cocos2d::CCPoint::CCPoint(&v118.origin, 0.0, 25.0);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCRect *))p_m_soundEffects)(m_lockSprite, &v118);
v55 = a1->m_lockSprite;
v56 = v55->setColor;
LOWORD(v118.origin.x) = 18286;
BYTE2(v118.origin.x) = -103;
v56(v55, (const cocos2d::ccColor3B *)&v118);
a1->m_wraithSprite->setScale(a1->m_wraithSprite, 1.2);
v124.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v124.adj = (size_t)SecretLayer5::onSubmit;
v57 = CCMenuItemSpriteExtra::create(a1->m_wraithSprite, nullptr, v124);
v58 = v35->__vftable;
a1->m_wraithButton = v57;
((void (__fastcall *)(cocos2d::CCNode *))v58->addChild)(v35);
m_wraithButton = a1->m_wraithButton;
p_m_soundEffects = (cocos2d::CCSprite *)m_wraithButton->setPosition;
cocos2d::CCPoint::CCPoint(&v116, v112 * 0.5, (float)(v113 * 0.5) + -25.0);
v122 = cocos2d::CCNode::convertToNodeSpace(v35, &v116);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *, float, float))p_m_soundEffects)(
m_wraithButton,
&v118,
v122.x,
v122.y);
CCMenuItemSpriteExtra::setSizeMult(a1->m_wraithButton, 0.7);
v60 = LoadingCircleSprite::create(0.5);
v61 = v60->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_circleSprite = v60;
((void (__fastcall *)(float))v61->setScale)(0.5);
a1->addChild_0(a1, a1->m_circleSprite, 28);
a1->m_circleSprite->setOpacity(a1->m_circleSprite, 0);
a1->m_circleSprite->setPosition(a1->m_circleSprite, &v114);
((void (__fastcall *)(LoadingCircleSprite *, __int64))a1->m_circleSprite->setBlendFunc)(
a1->m_circleSprite,
0x100000302LL);
m_circleSprite = a1->m_circleSprite;
v63 = m_circleSprite->setColor;
LOBYTE(v118.origin.x) = v107;
BYTE1(v118.origin.x) = v108;
BYTE2(v118.origin.x) = v109;
v63(m_circleSprite, (const cocos2d::ccColor3B *)&v118);
v64 = GameManager::sharedState();
GameManager::loadFont(v64, 19);
sub_D153B8((unsigned int)v106 + 248, " ");
v65 = GameManager::sharedState();
FontFile = GameManager::getFontFile(v65, 19);
cocos2d::CCPoint::CCPoint(&v116, 0.5, 1.0);
v67 = (TextArea *)TextArea::create((__int64)&v118, FontFile, &v116, 0, 1.0, 533.33, 20.0);
a1->m_messageArea = v67;
m_messageArea = v67;
v69 = (void *)(*(_QWORD *)&v118.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v118.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v96 = (unsigned int *)(*(_QWORD *)&v118.origin - 8LL);
do
v97 = __ldaxr(v96);
while ( __stlxr(v97 - 1, v96) );
}
else
{
v97 = *(_DWORD *)(*(_QWORD *)&v118.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v118.origin - 8LL) = v97 - 1;
}
if ( v97 <= 0 )
operator delete(v69);
m_messageArea = a1->m_messageArea;
}
v70 = 0;
p_m_soundEffects = (cocos2d::CCSprite *)m_messageArea->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v118.origin, 0.5, 0.5);
((void (__fastcall *)(TextArea *, cocos2d::CCRect *))p_m_soundEffects)(m_messageArea, &v118);
a1->m_messageArea->setScale(a1->m_messageArea, 0.75);
a1->addChild_0(a1, a1->m_messageArea, 3);
v71 = a1->m_messageArea;
p_m_soundEffects = (cocos2d::CCSprite *)v71->setPosition;
cocos2d::CCPoint::CCPoint(&v116, 0.0, 60.0);
cocos2d::CCPoint::operator+(&v118, &v114, &v116);
v72 = (cocos2d::CCArray *)((__int64 (__fastcall *)(TextArea *, cocos2d::CCRect *))p_m_soundEffects)(v71, &v118);
v73 = (cocos2d::CCArray *)cocos2d::CCArray::create(v72);
a1->m_torchFires = v73;
cocos2d::CCObject::retain(v73);
while ( 1 )
{
v74 = cocos2d::CCSprite::createWithSpriteFrameName("towerTorchInner_001.png");
v75 = v74->setColor;
LOWORD(v118.origin.x) = 23160;
BYTE2(v118.origin.x) = -103;
v75(v74, (const cocos2d::ccColor3B *)&v118);
a1->addChild_0(a1, v74, 4);
setPosition = v74->setPosition;
v77 = v70 ? 195.0 : -195.0;
cocos2d::CCPoint::CCPoint(&v118.origin, (float)(v112 * 0.5) + v77, (float)(v113 * 0.5) + 4.0);
v78 = (cocos2d::CCArray *)((__int64 (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCRect *))setPosition)(
v74,
&v118);
v79 = (cocos2d::CCArray *)cocos2d::CCArray::create(v78);
v80 = (__int64)v74->getPosition(v74);
cocos2d::CCPoint::CCPoint(&v116, 0.0, 33.0);
cocos2d::CCPoint::operator+(&v118, v80, &v116);
v125.x = 1.0;
LevelAreaLayer::addTorch(a1, v125, (int)&v118, v81, 2, 4, 1, (cocos2d::CCArray *)((char *)&dword_0 + 1));
m_torchFires = a1->m_torchFires;
v83 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v79, 0);
cocos2d::CCArray::addObject(m_torchFires, v83);
v84 = a1->m_torchFires;
v85 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v79, 1u);
cocos2d::CCArray::addObject(v84, v85);
if ( v70 )
break;
v70 = 1;
}
cocos2d::CCNode::scheduleUpdate(a1);
GameLevelManager::sharedState()->m_GJOnlineRewardDelegate = &a1->GJOnlineRewardDelegate;
v86 = GameManager::sharedState();
UGV = GameManager::getUGV(v86, "38");
if ( UGV )
{
return UGV;
}
else
{
a1->m_uiLocked = v70;
v88 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(1.2);
v89 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, SecretLayer5::showFirstDialog, 0);
v90 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v88, v89, 0);
cocos2d::CCNode::runAction(a1, v90);
a1->m_textInput->setTouchEnabled(a1->m_textInput, 0);
}
}
return v2;
}