//
// DailyLevelPage::init from 0x1400ce540 to 0x1400cf981 (5185 bytes)
//
// 2 xrefs:
// > DailyLevelPage::create @ 0x1400ce4f2
// > ??> @ 0x1406c8520
//
// 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=16
bool DailyLevelPage::init(DailyLevelPage *a1, GJTimedLevelType a2)
{
__int64 v4; // rax
cocos2d::CCTouchDispatcher *v5; // rax
bool result; // al
GJGameLevel *SavedDailyLevel; // r12
char *v8; // rax
__int64 v9; // rbx
__int64 v10; // rdi
unsigned __int64 v11; // rsi
_BYTE *v12; // rbx
unsigned __int64 v13; // rcx
char *v14; // r15
void *v15; // rcx
unsigned __int64 v16; // rsi
void **v17; // rbx
_BOOL8 v18; // rdx
unsigned __int64 v19; // rcx
_WORD *v20; // rbx
void *v21; // rcx
char *v22; // rax
__int64 v23; // rbx
__int64 v24; // rdi
unsigned __int64 v25; // rsi
_BYTE *v26; // rbx
unsigned __int64 v27; // rcx
char *v28; // r15
void *v29; // rcx
unsigned __int64 v30; // rsi
void **v31; // rbx
unsigned __int64 v32; // rcx
_WORD *v33; // rbx
void *v34; // rcx
char *v35; // rax
__int64 v36; // rbx
__int64 v37; // rdi
unsigned __int64 v38; // rsi
_BYTE *v39; // rbx
unsigned __int64 v40; // rcx
char *v41; // r15
void *v42; // rcx
unsigned __int64 v43; // rsi
void **v44; // rbx
unsigned __int64 v45; // rcx
_WORD *v46; // rbx
void *v47; // rcx
__int64 v48; // rax
_BOOL8 v49; // rdx
__int64 v50; // rcx
cocos2d::CCDirector *v51; // rax
cocos2d::CCLayer *v52; // rax
void **v53; // rbx
struct cocos2d::CCRect *v54; // rax
struct cocos2d::extension::CCScale9Sprite *v55; // rdi
__int64 v56; // rdx
cocos2d::extension::CCScale9Sprite_vtbl *v57; // rbx
const cocos2d::CCSize *v58; // rax
cocos2d::extension::CCScale9Sprite_vtbl *v59; // rbx
const cocos2d::CCPoint *v60; // rax
const char *v61; // rcx
struct cocos2d::CCSprite *v62; // rdi
cocos2d::CCSprite_vtbl *v63; // rbx
const cocos2d::CCPoint *v64; // rax
int i; // r15d
void **v66; // rcx
struct cocos2d::CCSprite *v67; // rsi
struct cocos2d::CCSprite *v68; // rdi
cocos2d::CCSprite_vtbl *v69; // rbx
const cocos2d::CCPoint *v70; // rax
float v71; // xmm6_4
float v72; // xmm7_4
cocos2d::CCSprite_vtbl *v73; // rbx
cocos2d::CCSprite_vtbl *v74; // rbx
cocos2d::CCSprite_vtbl *v75; // rbx
cocos2d::CCSprite_vtbl *v76; // rbx
cocos2d::CCSprite_vtbl *v77; // rbx
const cocos2d::CCPoint *v78; // rax
struct cocos2d::CCSprite *v79; // rdi
CCMenuItemSpriteExtra *v80; // rbx
cocos2d::CCMenu *v81; // rax
cocos2d::CCMenu_vtbl *v82; // rbx
const cocos2d::CCPoint *v83; // rax
struct cocos2d::CCSprite *v84; // rbx
CCMenuItemSpriteExtra *v85; // rdi
CCMenuItemSpriteExtra_vtbl *v86; // rbx
struct cocos2d::CCPoint v87; // rax
__int64 DailyTimeString; // rax
cocos2d::CCLabelBMFont_vtbl *v89; // rbx
const cocos2d::CCPoint *v90; // rax
cocos2d::CCLabelBMFont *m_timeLabel; // rcx
cocos2d::CCLabelBMFont_vtbl *v92; // rdi
float *v93; // rbx
float v94; // xmm6_4
const cocos2d::CCPoint *v95; // rax
LoadingCircle *v96; // rax
cocos2d::CCSprite *m_sprite; // rbx
cocos2d::CCSprite_vtbl *v98; // rdi
const cocos2d::CCPoint *v99; // rax
LoadingCircle *v100; // rax
cocos2d::CCSprite *v101; // rbx
cocos2d::CCSprite_vtbl *v102; // rdi
const cocos2d::CCPoint *v103; // rax
double v104; // xmm6_8
GameLevelManager *v105; // rcx
GJTimedLevelType m_type; // ebx
int m_weeklyTimeLeft; // eax
__int32 v108; // ebx
GJTimedLevelType v109; // edx
__int32 v110; // edx
int m_activeEventID; // ebx
GameStatsManager *v112; // rcx
GameLevelManager *v113; // rcx
GJTimedLevelType v114; // r8d
bool v115; // zf
bool v116; // sf
_BOOL8 v117; // rdx
_BOOL8 v118; // rdx
__int64 v119; // rdx
float v120; // [rsp+30h] [rbp-D0h]
float v121; // [rsp+34h] [rbp-CCh]
struct __timeb64 Time; // [rsp+38h] [rbp-C8h] BYREF
void *Block[2]; // [rsp+48h] [rbp-B8h] BYREF
__int64 v124; // [rsp+58h] [rbp-A8h]
unsigned __int64 v125; // [rsp+60h] [rbp-A0h]
void *v126[2]; // [rsp+68h] [rbp-98h] BYREF
__int64 v127; // [rsp+78h] [rbp-88h]
unsigned __int64 v128; // [rsp+80h] [rbp-80h]
cocos2d::CCRect v129[2]; // [rsp+88h] [rbp-78h] BYREF
__int128 v130; // [rsp+A8h] [rbp-58h] BYREF
__int64 v131; // [rsp+B8h] [rbp-48h]
unsigned __int64 v132; // [rsp+C0h] [rbp-40h]
if ( !a1->m_forcePrioRegistered )
{
a1->m_forcePrioRegistered = 1;
v4 = cocos2d::CCDirector::sharedDirector(a1);
v5 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 144LL))(v4);
cocos2d::CCTouchDispatcher::registerForcePrio(v5, a1, 2);
}
LODWORD(Time.time) = -1778384896;
result = cocos2d::CCLayerColor::initWithColor(a1, (const struct cocos2d::_ccColor4B *)&Time);
if ( result )
{
a1->m_type = a2;
v130 = 0;
SavedDailyLevel = nullptr;
v131 = 0;
v132 = 15;
LOBYTE(v130) = 0;
*(_OWORD *)v126 = 0;
v127 = 0;
v128 = 15;
LOBYTE(v126[0]) = 0;
*(_OWORD *)Block = 0;
v124 = 0;
v125 = 15;
LOBYTE(Block[0]) = 0;
if ( a2 )
{
if ( a2 == 1 )
{
v22 = (char *)sub_14003AA10(0x20u);
v131 = 24;
v23 = 31;
v132 = 31;
strcpy(v22, "weeklyLevelLabel_001.png");
*(_QWORD *)&v130 = v22;
v24 = 0x7FFFFFFFFFFFFFFFLL;
v25 = v128;
if ( v128 < 0x16 )
{
v27 = v128 >> 1;
if ( v128 <= 0x7FFFFFFFFFFFFFFFLL - (v128 >> 1) )
{
if ( v128 + v27 > 0x1F )
v23 = v128 + v27;
}
else
{
v23 = 0x7FFFFFFFFFFFFFFFLL;
}
v28 = (char *)sub_14003AA10(v23 + 1);
v127 = 22;
v128 = v23;
strcpy(v28, "gauntletCorner_001.png");
if ( v25 > 0xF )
{
v29 = v126[0];
if ( v25 + 1 >= 0x1000 )
{
v29 = *((void **)v126[0] - 1);
if ( (unsigned __int64)((char *)v126[0] - (char *)v29 - 8) > 0x1F )
goto LABEL_74;
}
j_j_free(v29);
}
v126[0] = v28;
}
else
{
v26 = v126[0];
v127 = 22;
memmove(v126[0], "gauntletCorner_001.png", 0x16u);
v26[22] = 0;
}
v30 = v125;
if ( v125 >= 0xF )
{
v31 = Block;
if ( v125 > 0xF )
v31 = (void **)Block[0];
v124 = 15;
memmove(v31, "GJ_square05.png", 0xFu);
*((_BYTE *)v31 + 15) = 0;
a1->m_downloadLevelID = -2;
LABEL_78:
v48 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
Time.time = (__time64_t)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(Time.time);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v48 = qword_1406C2ED8;
}
*(_QWORD *)(v48 + 1040) = a1;
LOBYTE(v18) = 1;
a1->setTouchEnabled(a1, v18);
LOBYTE(v49) = 1;
a1->setKeypadEnabled(a1, v49);
v51 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v50);
cocos2d::CCDirector::getWinSize(v51);
v52 = (cocos2d::CCLayer *)cocos2d::CCLayer::create();
a1->m_mainLayer = v52;
a1->addChild_1(a1, v52);
v53 = Block;
if ( v125 > 0xF )
v53 = (void **)Block[0];
cocos2d::CCRect::CCRect(v129, 0.0, 0.0, 80.0, 80.0);
v55 = cocos2d::extension::CCScale9Sprite::create((const char *)v53, v54);
LOBYTE(v56) = -1;
v55->setOpacity(&v55->cocos2d::CCRGBAProtocol, v56);
v57 = v55->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&Time, 420.0, 280.0);
v57->setContentSize(v55, v58);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v55, -1);
v59 = v55->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&Time, v120 * 0.5, v121 * 0.5);
v59->setPosition_0(v55, v60);
if ( a1->m_type == Event )
{
LOWORD(Time.time) = 12222;
BYTE2(Time.time) = -14;
v55->setColor(&v55->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&Time);
}
a1->m_joystickConnected = -1;
v61 = (const char *)&v130;
if ( v132 > 0xF )
v61 = (const char *)v130;
v62 = cocos2d::CCSprite::createWithSpriteFrameName(v61);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v62, 20);
v63 = v62->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&Time, v120 * 0.5, (float)((float)(v121 * 0.5) + 140.0) - 29.0);
v63->setPosition_0(v62, v64);
for ( i = 0; i < 4; ++i )
{
v66 = v126;
if ( v128 > 0xF )
v66 = (void **)v126[0];
v67 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v66);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v67, 8);
if ( a1->m_type == 1 )
{
v68 = cocos2d::CCSprite::createWithSpriteFrameName("whiteSquare20_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v68->setScaleX)(v68);
((void (__fastcall *)(struct cocos2d::CCSprite *))v68->setScaleY)(v68);
v68->setColor(&v68->cocos2d::CCRGBAProtocol, &stru_140529A38);
((void (__fastcall *)(struct cocos2d::CCSprite *))v68->setRotation)(v68);
v69 = v68->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&Time, 2.0, 2.0);
v69->setPosition_0(v68, v70);
v67->addChild_0(v67, v68, 1);
((void (__fastcall *)(struct cocos2d::CCSprite *))v67->setScale_0)(v67);
}
v71 = 185.0;
v72 = 115.0;
if ( i )
{
switch ( i )
{
case 1:
v71 = -185.0;
v76 = v67->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v67->getScaleY(v67);
((void (__fastcall *)(struct cocos2d::CCSprite *))v76->setScaleY)(v67);
break;
case 2:
v74 = v67->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v67->getScaleX(v67);
((void (__fastcall *)(struct cocos2d::CCSprite *))v74->setScaleX)(v67);
v75 = v67->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v67->getScaleY(v67);
((void (__fastcall *)(struct cocos2d::CCSprite *))v75->setScaleY)(v67);
v67->setVisible(v67, 0);
break;
case 3:
v72 = -115.0;
v73 = v67->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v67->getScaleX(v67);
((void (__fastcall *)(struct cocos2d::CCSprite *))v73->setScaleX)(v67);
break;
}
}
else
{
v71 = -185.0;
v72 = -115.0;
}
v77 = v67->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v129[0].origin, (float)(v120 * 0.5) + v71, (float)(v121 * 0.5) + v72);
v77->setPosition_0(v67, v78);
}
v79 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v129[0].origin = (cocos2d::CCPoint)operator new(0x208u);
v80 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(*(CCMenuItemSpriteExtra **)&v129[0].origin);
if ( v80 )
{
if ( CCMenuItemSpriteExtra::init(v80, v79, nullptr, a1, (cocos2d::SEL_MenuHandler *)ChallengesPage::onClose) )
{
cocos2d::CCObject::autorelease(v80);
goto LABEL_105;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v80->~CCMenuItemSpriteExtra)(v80, 1);
}
v80 = nullptr;
LABEL_105:
HIDWORD(v80->m_pfnSelector.adj) = 1070386381;
v81 = cocos2d::CCMenu::create(v80, 0);
a1->m_buttonMenu = v81;
v82 = v81->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(
&v129[0].origin,
(float)((float)(v120 * 0.5) - 210.0) + 10.0,
(float)((float)(v121 * 0.5) + 140.0) - 10.0);
v82->setPosition_0(a1->m_buttonMenu, v83);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_buttonMenu, 10);
v84 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_safeBtn_001.png");
v129[0].origin = (cocos2d::CCPoint)operator new(0x208u);
v85 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(*(CCMenuItemSpriteExtra **)&v129[0].origin);
if ( v85 )
{
if ( CCMenuItemSpriteExtra::init(
v85,
v84,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)DailyLevelPage::onTheSafe) )
{
cocos2d::CCObject::autorelease(v85);
goto LABEL_110;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v85->~CCMenuItemSpriteExtra)(v85, 1);
}
v85 = nullptr;
LABEL_110:
HIDWORD(v85->m_pfnSelector.adj) = 1070386381;
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v85);
v86 = v85->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(
&v129[0].origin,
(float)((float)(v120 * 0.5) + 210.0) - 30.0,
(float)((float)(v121 * 0.5) + 140.0) - 30.0);
v87 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&Time);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v86->setPosition_0)(v85, v87);
DailyTimeString = DailyLevelPage::getDailyTimeString(a1, v129, 0);
if ( *(_QWORD *)(DailyTimeString + 24) > 0xFu )
DailyTimeString = *(_QWORD *)DailyTimeString;
a1->m_timeLabel = cocos2d::CCLabelBMFont::create((const char *)DailyTimeString, "goldFont.fnt");
sub_14003A830((__int64)v129);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_timeLabel, 20);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_timeLabel->setScale_0)(a1->m_timeLabel);
v89 = a1->m_timeLabel->__vftable;
cocos2d::CCPoint::CCPoint(&v129[0].origin, 0.0, 0.5);
v89->setAnchorPoint(a1->m_timeLabel, v90);
m_timeLabel = a1->m_timeLabel;
v92 = m_timeLabel->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v93 = (float *)m_timeLabel->getContentSize(m_timeLabel);
v94 = (float)(v120 * 0.5) - (float)((float)(a1->m_timeLabel->getScale(a1->m_timeLabel) * *v93) * 0.5);
cocos2d::CCPoint::CCPoint(&v129[0].origin, v94, (float)((float)(v121 * 0.5) - 140.0) + 15.0);
v92->setPosition_0(a1->m_timeLabel, v95);
cocos2d::CCNode::schedule(a1, DailyLevelPage::updateTimers);
v96 = LoadingCircle::create();
a1->m_timeCircle = v96;
v96->m_parentLayer = a1->m_mainLayer;
a1->m_timeCircle->m_fade = 0;
LoadingCircle::show(a1->m_timeCircle);
m_sprite = a1->m_timeCircle->m_sprite;
v98 = m_sprite->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v129[0].origin, v120 * 0.5, (float)((float)(v121 * 0.5) - 140.0) + 17.0);
v98->setPosition_0(m_sprite, v99);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_timeCircle->m_sprite->setScale_0)(a1->m_timeCircle->m_sprite);
a1->m_timeCircle->setVisible(a1->m_timeCircle, 0);
v100 = LoadingCircle::create();
a1->m_nodeCircle = v100;
v100->m_parentLayer = a1->m_mainLayer;
a1->m_nodeCircle->m_fade = 0;
LoadingCircle::show(a1->m_nodeCircle);
v101 = a1->m_nodeCircle->m_sprite;
v102 = v101->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v129[0].origin, v120 * 0.5, v121 * 0.5);
v102->setPosition_0(v101, v103);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_nodeCircle->m_sprite->setScale_0)(a1->m_nodeCircle->m_sprite);
a1->m_nodeCircle->setVisible(a1->m_nodeCircle, 0);
ftime64(&Time);
v104 = (double)(Time.millitm + 1000 * (Time.time & 0xFFFFF));
v105 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v129[0].origin = (cocos2d::CCPoint)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(*(_QWORD *)&v129[0].origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v105 = (GameLevelManager *)qword_1406C2EC0;
}
m_type = a1->m_type;
if ( m_type )
{
if ( m_type == 1 )
{
m_weeklyTimeLeft = v105->m_weeklyTimeLeft;
}
else if ( m_type == Event )
{
m_weeklyTimeLeft = v105->m_eventTimeLeft;
}
else
{
m_weeklyTimeLeft = 0;
}
}
else
{
m_weeklyTimeLeft = v105->m_dailyTimeLeft;
}
if ( v104 / 1000.0 > (double)m_weeklyTimeLeft )
{
if ( !v105 )
{
v129[0].origin = (cocos2d::CCPoint)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(*(_QWORD *)&v129[0].origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v105 = (GameLevelManager *)qword_1406C2EC0;
}
if ( m_type )
{
v108 = m_type - 1;
if ( v108 )
{
if ( v108 == 1 )
*(_QWORD *)&v105->m_eventTimeLeft = 0;
}
else
{
*(_QWORD *)&v105->m_weeklyTimeLeft = 0;
}
}
else
{
*(_QWORD *)&v105->m_dailyTimeLeft = 0;
}
}
if ( !v105 )
{
v129[0].origin = (cocos2d::CCPoint)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(*(_QWORD *)&v129[0].origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v105 = (GameLevelManager *)qword_1406C2EC0;
}
v109 = a1->m_type;
if ( v109 )
{
v110 = v109 - 1;
if ( v110 )
{
if ( v110 != 1 )
goto LABEL_146;
m_activeEventID = v105->m_activeEventID;
}
else
{
m_activeEventID = v105->m_activeWeeklyID;
}
}
else
{
m_activeEventID = v105->m_activeDailyID;
}
if ( m_activeEventID > 0 )
{
v112 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v129[0].origin = (cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(*(_QWORD *)&v129[0].origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v112 = (GameStatsManager *)qword_1406C2EE8;
}
if ( !GameStatsManager::hasCompletedDailyLevel(v112, m_activeEventID) )
{
v113 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v129[0].origin = (cocos2d::CCPoint)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(*(_QWORD *)&v129[0].origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v113 = (GameLevelManager *)qword_1406C2EC0;
}
SavedDailyLevel = GameLevelManager::getSavedDailyLevel(v113, m_activeEventID);
}
DailyLevelPage::createDailyNode(a1, SavedDailyLevel, 1, 0.0, 0);
v105 = (GameLevelManager *)qword_1406C2EC0;
}
LABEL_146:
if ( !v105 )
{
v129[0].origin = (cocos2d::CCPoint)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(*(_QWORD *)&v129[0].origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v105 = (GameLevelManager *)qword_1406C2EC0;
}
v114 = a1->m_type;
if ( v114 )
{
if ( v114 == 1 )
{
v115 = v105->m_weeklyTimeLeft == 0;
v116 = v105->m_weeklyTimeLeft < 0;
}
else
{
if ( v114 != Event )
goto LABEL_156;
v115 = v105->m_eventTimeLeft == 0;
v116 = v105->m_eventTimeLeft < 0;
}
}
else
{
v115 = v105->m_dailyTimeLeft == 0;
v116 = v105->m_dailyTimeLeft < 0;
}
if ( !v116 && !v115 )
{
a1->dailyStatusFinished(&a1->GJDailyLevelDelegate, v114);
LABEL_162:
v119 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v129[0].origin = (cocos2d::CCPoint)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(*(_QWORD *)&v129[0].origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v119 = qword_1406C2EC0;
}
*(_QWORD *)(v119 + 880) = &a1->GJDailyLevelDelegate;
*(_QWORD *)(v119 + 728) = &a1->LevelDownloadDelegate;
sub_14003A830((__int64)Block);
sub_14003A830((__int64)v126);
sub_14003A830((__int64)&v130);
return 1;
}
LABEL_156:
if ( v114 != Event )
{
a1->m_timeLabel->setVisible(a1->m_timeLabel, 0);
LOBYTE(v117) = 1;
a1->m_timeCircle->setVisible(a1->m_timeCircle, v117);
v105 = (GameLevelManager *)qword_1406C2EC0;
}
if ( !v105 )
{
v129[0].origin = (cocos2d::CCPoint)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(*(_QWORD *)&v129[0].origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v105 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::getGJDailyLevelState(v105, a1->m_type);
if ( !a1->m_dailyNode )
{
LOBYTE(v118) = 1;
a1->m_nodeCircle->setVisible(a1->m_nodeCircle, v118);
}
goto LABEL_162;
}
v32 = v125 >> 1;
if ( v125 <= 0x7FFFFFFFFFFFFFFFLL - (v125 >> 1) )
{
v24 = 15;
if ( v32 + v125 > 0xF )
v24 = v32 + v125;
}
v33 = sub_14003AA10(v24 + 1);
v124 = 15;
v125 = v24;
qmemcpy(v33, "GJ_square05.pn", 14);
v33[7] = (unsigned __int8)aGjSquare05Png[14];
if ( v30 > 0xF )
{
v34 = Block[0];
if ( v30 + 1 >= 0x1000 )
{
v34 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v34 - 8) > 0x1F )
goto LABEL_74;
}
j_j_free(v34);
}
Block[0] = v33;
a1->m_downloadLevelID = -2;
goto LABEL_78;
}
if ( a2 == Event )
{
v8 = (char *)sub_14003AA10(0x20u);
v131 = 23;
v9 = 31;
v132 = 31;
strcpy(v8, "eventLevelLabel_001.png");
*(_QWORD *)&v130 = v8;
v10 = 0x7FFFFFFFFFFFFFFFLL;
v11 = v128;
if ( v128 < 0x18 )
{
v13 = v128 >> 1;
if ( v128 <= 0x7FFFFFFFFFFFFFFFLL - (v128 >> 1) )
{
if ( v128 + v13 > 0x1F )
v9 = v128 + v13;
}
else
{
v9 = 0x7FFFFFFFFFFFFFFFLL;
}
v14 = (char *)sub_14003AA10(v9 + 1);
v127 = 24;
v128 = v9;
strcpy(v14, "dailyLevelCorner_001.png");
if ( v11 > 0xF )
{
v15 = v126[0];
if ( v11 + 1 >= 0x1000 )
{
v15 = *((void **)v126[0] - 1);
if ( (unsigned __int64)((char *)v126[0] - (char *)v15 - 8) > 0x1F )
goto LABEL_74;
}
j_j_free(v15);
}
v126[0] = v14;
}
else
{
v12 = v126[0];
v127 = 24;
memmove(v126[0], "dailyLevelCorner_001.png", 0x18u);
v12[24] = 0;
}
v16 = v125;
if ( v125 >= 0xF )
{
v17 = Block;
if ( v125 > 0xF )
v17 = (void **)Block[0];
v124 = 15;
memmove(v17, "GJ_square05.png", 0xFu);
*((_BYTE *)v17 + 15) = 0;
a1->m_downloadLevelID = -3;
goto LABEL_78;
}
v19 = v125 >> 1;
if ( v125 <= 0x7FFFFFFFFFFFFFFFLL - (v125 >> 1) )
{
v10 = 15;
if ( v19 + v125 > 0xF )
v10 = v19 + v125;
}
v20 = sub_14003AA10(v10 + 1);
v124 = 15;
v125 = v10;
qmemcpy(v20, "GJ_square05.pn", 14);
v20[7] = (unsigned __int8)aGjSquare05Png[14];
if ( v16 <= 0xF )
{
LABEL_29:
Block[0] = v20;
a1->m_downloadLevelID = -3;
goto LABEL_78;
}
v21 = Block[0];
if ( v16 + 1 < 0x1000
|| (v21 = *((void **)Block[0] - 1), (unsigned __int64)((char *)Block[0] - (char *)v21 - 8) <= 0x1F) )
{
j_j_free(v21);
goto LABEL_29;
}
LABEL_74:
invalid_parameter_noinfo_noreturn();
}
}
v35 = (char *)sub_14003AA10(0x20u);
v131 = 23;
v36 = 31;
v132 = 31;
strcpy(v35, "dailyLevelLabel_001.png");
*(_QWORD *)&v130 = v35;
v37 = 0x7FFFFFFFFFFFFFFFLL;
v38 = v128;
if ( v128 < 0x18 )
{
v40 = v128 >> 1;
if ( v128 <= 0x7FFFFFFFFFFFFFFFLL - (v128 >> 1) )
{
if ( v128 + v40 > 0x1F )
v36 = v128 + v40;
}
else
{
v36 = 0x7FFFFFFFFFFFFFFFLL;
}
v41 = (char *)sub_14003AA10(v36 + 1);
v127 = 24;
v128 = v36;
strcpy(v41, "dailyLevelCorner_001.png");
if ( v38 > 0xF )
{
v42 = v126[0];
if ( v38 + 1 >= 0x1000 )
{
v42 = *((void **)v126[0] - 1);
if ( (unsigned __int64)((char *)v126[0] - (char *)v42 - 8) > 0x1F )
goto LABEL_74;
}
j_j_free(v42);
}
v126[0] = v41;
}
else
{
v39 = v126[0];
v127 = 24;
memmove(v126[0], "dailyLevelCorner_001.png", 0x18u);
v39[24] = 0;
}
v43 = v125;
if ( v125 < 0xF )
{
v45 = v125 >> 1;
if ( v125 <= 0x7FFFFFFFFFFFFFFFLL - (v125 >> 1) )
{
v37 = 15;
if ( v45 + v125 > 0xF )
v37 = v45 + v125;
}
v46 = sub_14003AA10(v37 + 1);
v124 = 15;
v125 = v37;
qmemcpy(v46, "GJ_square01.pn", 14);
v46[7] = (unsigned __int8)aGjSquare01Png[14];
if ( v43 > 0xF )
{
v47 = Block[0];
if ( v43 + 1 >= 0x1000 )
{
v47 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v47 - 8) > 0x1F )
goto LABEL_74;
}
j_j_free(v47);
}
Block[0] = v46;
}
else
{
v44 = Block;
if ( v125 > 0xF )
v44 = (void **)Block[0];
v124 = 15;
memmove(v44, "GJ_square01.png", 0xFu);
*((_BYTE *)v44 + 15) = 0;
}
a1->m_downloadLevelID = -1;
goto LABEL_78;
}
return result;
}