//
// DailyLevelNode::init from 0x1400d20c0 to 0x1400d2db8 (3320 bytes)
//
// 2 xrefs:
// > DailyLevelPage::createDailyNode @ 0x1400d0330
// > ??> @ 0x1406c85e0
//
// 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=4
bool DailyLevelNode::init(DailyLevelNode *a1, GJGameLevel *a2, DailyLevelPage *a3, bool a4)
{
bool result; // al
__int64 v9; // rcx
__int64 v10; // rax
cocos2d::CCTouchDispatcher *v11; // rax
GJTimedLevelType m_type; // ecx
__int32 v13; // ecx
char *v14; // rax
GJGameLevel *m_level; // rcx
char v16; // r12
const char *v17; // rbx
struct cocos2d::CCRect *v18; // rax
struct cocos2d::extension::CCScale9Sprite *v19; // rax
struct cocos2d::extension::CCScale9Sprite *v20; // rdi
cocos2d::extension::CCScale9Sprite_vtbl *v21; // rbx
const cocos2d::CCSize *v22; // rax
cocos2d::extension::CCScale9Sprite_vtbl *v23; // rbx
const cocos2d::CCPoint *v24; // rax
LevelCell *v25; // rax
LevelCell *v26; // rsi
LevelCell_vtbl *v27; // rbx
const cocos2d::CCPoint *v28; // rax
void **v29; // rcx
struct cocos2d::CCSprite *v30; // rdi
cocos2d::CCSprite_vtbl *v31; // rbx
const cocos2d::CCPoint *v32; // rax
struct cocos2d::CCLabelBMFont *v33; // rdi
cocos2d::CCLabelBMFont_vtbl *v34; // rbx
const cocos2d::CCPoint *v35; // rax
cocos2d::CCLabelBMFont_vtbl *v36; // rbx
const cocos2d::CCPoint *v37; // rax
struct cocos2d::CCSprite *v38; // rbx
CCMenuItemSpriteExtra *v39; // rax
struct cocos2d::CCMenu *v40; // rdi
cocos2d::CCMenu_vtbl *v41; // rbx
const cocos2d::CCPoint *v42; // rax
__int64 v43; // rax
CCMenuItemSpriteExtra *m_button; // rdi
__int64 v45; // rax
__int64 v46; // rax
int v47; // edx
cocos2d::CCString *v48; // rax
const char *CString; // rax
struct cocos2d::CCLabelBMFont *v50; // rdi
__int64 v51; // rdx
cocos2d::CCLabelBMFont_vtbl *v52; // rbx
const cocos2d::CCPoint *v53; // rax
cocos2d::CCLabelBMFont_vtbl *v54; // rbx
const cocos2d::CCPoint *v55; // rax
struct cocos2d::CCSprite *v56; // rbx
CCMenuItemSpriteExtra *v57; // rax
CCMenuItemSpriteExtra *v58; // rax
CCMenuItemSpriteExtra_vtbl *v59; // rbx
const cocos2d::CCPoint *v60; // rax
struct cocos2d::CCLabelBMFont *v61; // r15
cocos2d::CCLabelBMFont_vtbl *v62; // rbx
const cocos2d::CCPoint *v63; // rax
GJTimedLevelType v64; // ecx
struct cocos2d::CCSprite *v65; // r12
int v66; // ebx
int v67; // edx
cocos2d::CCString *v68; // rax
const char *v69; // rax
struct cocos2d::CCLabelBMFont *v70; // rsi
cocos2d::CCLabelBMFont_vtbl *v71; // rbx
const cocos2d::CCPoint *v72; // rax
float width; // xmm6_4
double v74; // xmm0_8
float v75; // xmm7_4
float v76; // xmm6_4
double v77; // xmm0_8
float v78; // xmm8_4
float *v79; // rbx
double v80; // xmm0_8
float v81; // xmm6_4
cocos2d::CCSprite_vtbl *v82; // rdi
float *v83; // rbx
float v84; // xmm6_4
const cocos2d::CCPoint *v85; // rax
__int64 v86; // rax
float *v87; // rbx
double v88; // xmm0_8
__int64 (__fastcall **v89)(void *); // rdx
void *v90; // rcx
GJChestSprite *v91; // rdi
GJChestSprite_vtbl *v92; // rbx
const cocos2d::CCPoint *v93; // rax
__int64 v94; // rax
__int64 v95; // rdx
cocos2d::CCLabelBMFont *v96; // rax
void *v97; // rcx
void *v98; // rcx
__int16 v99; // [rsp+38h] [rbp-89h] BYREF
char v100; // [rsp+3Ah] [rbp-87h]
LevelCell *v101; // [rsp+40h] [rbp-81h] BYREF
cocos2d::CCRect v102; // [rsp+48h] [rbp-79h] BYREF
void *Block[2]; // [rsp+58h] [rbp-69h] BYREF
__int64 v104; // [rsp+68h] [rbp-59h]
unsigned __int64 v105; // [rsp+70h] [rbp-51h]
void *v106[2]; // [rsp+78h] [rbp-49h] BYREF
__int64 v107; // [rsp+88h] [rbp-39h]
unsigned __int64 v108; // [rsp+90h] [rbp-31h]
result = cocos2d::CCNode::init(a1);
if ( !result )
return result;
v10 = cocos2d::CCDirector::sharedDirector(v9);
v11 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v10 + 144LL))(v10);
cocos2d::CCTouchDispatcher::registerForcePrio(v11, a1, 2);
if ( a2 )
{
a1->m_level = a2;
cocos2d::CCObject::retain(a2);
}
a1->m_page = a3;
*(_OWORD *)v106 = 0;
v107 = 0;
v108 = 15;
LOBYTE(v106[0]) = 0;
*(_OWORD *)Block = 0;
v104 = 0;
v105 = 15;
LOBYTE(Block[0]) = 0;
m_type = a3->m_type;
if ( m_type == Daily )
goto LABEL_9;
v13 = m_type - 1;
if ( !v13 )
{
v107 = 15;
qmemcpy(v106, "GJ_square05.pn", 14);
HIWORD(v106[1]) = (unsigned __int8)aGjSquare05Png[14];
v14 = (char *)sub_14003AA10(0x20u);
v104 = 22;
v105 = 31;
strcpy(v14, "gj_weeklyCrown_001.png");
goto LABEL_11;
}
if ( v13 == 1 )
{
v107 = 15;
strcpy((char *)v106, "GJ_square04.png");
v14 = (char *)sub_14003AA10(0x20u);
v104 = 21;
v105 = 31;
qmemcpy(v14, "gj_eventCrown_001.pn", 20);
}
else
{
LABEL_9:
v107 = 15;
qmemcpy(v106, "GJ_square02.pn", 14);
HIWORD(v106[1]) = (unsigned __int8)aGjSquare02Png[14];
v14 = (char *)sub_14003AA10(0x20u);
v104 = 21;
v105 = 31;
qmemcpy(v14, "gj_dailyCrown_001.pn", 20);
}
*((_WORD *)v14 + 10) = 103;
LABEL_11:
Block[0] = v14;
m_level = a1->m_level;
if ( m_level && m_level->m_orbCompletion.random - m_level->m_orbCompletion.seed >= 100 )
{
v16 = 1;
v17 = "GJ_square03.png";
}
else
{
v16 = 0;
v17 = (const char *)v106;
if ( v108 > 0xF )
v17 = (const char *)v106[0];
}
cocos2d::CCRect::CCRect(&v102, 0.0, 0.0, 80.0, 80.0);
v19 = cocos2d::extension::CCScale9Sprite::create(v17, v18);
v20 = v19;
if ( a1->m_page->m_type == 1 && !v16 )
{
v99 = -20561;
v100 = -81;
v19->setColor(&v19->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v99);
}
v21 = v20->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v101, 380.0, 116.0);
v21->setContentSize(v20, v22);
v23 = v20->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v101, 0.0, 0.0);
v23->setPosition_0(v20, v24);
a1->addChild_0(a1, v20, 1);
if ( a1->m_level )
{
v101 = (LevelCell *)operator new(0x268u);
v25 = LevelCell::LevelCell(v101, " ", 360.0, 90.0);
v26 = v25;
if ( v25 )
{
if ( v25->init(v25) )
{
cocos2d::CCObject::autorelease(v26);
}
else
{
((void (__fastcall *)(LevelCell *, __int64))v26->~LevelCell)(v26, 1);
v26 = nullptr;
}
}
v26->m_cellDrawn = 1;
LevelCell::loadFromLevel(v26, a2);
a1->addChild_0(a1, v26, 2);
v27 = v26->TableViewCell::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v101, -180.0, -47.0);
v27->setPosition_0(v26, v28);
v29 = Block;
if ( v105 > 0xF )
v29 = (void **)Block[0];
v30 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v29);
a1->addChild_0(a1, v30, 2);
v31 = v30->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v101, 0.0, 70.0);
v31->setPosition_0(v30, v32);
if ( a4 )
{
v33 = cocos2d::CCLabelBMFont::create("New!", "goldFont.fnt");
v34 = v33->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v101, 1.0, 1.0);
v34->setAnchorPoint(v33, v35);
v36 = v33->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v101, 182.0, 53.0);
v36->setPosition_0(v33, v37);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v33->setScale_0)(v33);
a1->addChild_0(a1, v33, 3);
}
if ( v16 )
{
v38 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_rewardBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v38->setScale_0)(v38);
v39 = CCMenuItemSpriteExtra::create(v38, nullptr, a1, (cocos2d::SEL_MenuHandler *)DailyLevelNode::onClaimReward);
HIDWORD(v39->m_pfnSelector.adj) = 1066192077;
v40 = cocos2d::CCMenu::createWithItem(v39);
a1->addChild_0(a1, v40, 10);
v41 = v40->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v101, 150.0, -2.0);
v41->setPosition_0(v40, v42);
v43 = (__int64)v40->getPosition_0(v40);
cocos2d::CCPoint::operator=(&a1->m_unkPoint, v43);
m_button = v26->m_button;
if ( m_button )
{
v45 = (__int64)m_button->getNormalImage(v26->m_button);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v45 + 160LL))(v45);
cocos2d::CCPoint::CCPoint(&v102.origin, -55.0, 0.0);
v46 = (__int64)m_button->getPosition_0(m_button);
cocos2d::CCPoint::operator+(v46, &v101);
m_button->setPosition_0(m_button, (const cocos2d::CCPoint *)&v101);
}
}
if ( a1->m_level )
{
v47 = a2->m_dailyID.random - a2->m_dailyID.seed;
if ( v47 <= 200000 )
{
if ( v47 > 100000 )
v47 -= 100000;
}
else
{
v47 -= 200000;
}
v48 = cocos2d::CCString::createWithFormat("#%i", v47);
CString = cocos2d::CCString::getCString(v48);
v50 = cocos2d::CCLabelBMFont::create(CString, "chatFont.fnt");
v50->setColor(&v50->cocos2d::CCRGBAProtocol, &stru_140529A38);
LOBYTE(v51) = -106;
v50->setOpacity(&v50->cocos2d::CCRGBAProtocol, v51);
v52 = v50->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v102.origin, 1.0, 0.0);
v52->setAnchorPoint(v50, v53);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v50->setScale_0)(v50);
a1->addChild_0(a1, v50, 3);
v54 = v50->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v102.origin, 183.0, -51.0);
v54->setPosition_0(v50, v55);
}
v56 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_deleteBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v56->setScale_0)(v56);
v57 = CCMenuItemSpriteExtra::create(v56, nullptr, a1, (cocos2d::SEL_MenuHandler *)DailyLevelNode::onSkipLevel);
v58 = (CCMenuItemSpriteExtra *)cocos2d::CCMenu::createWithItem(v57);
a1->m_skipButton = v58;
a1->addChild_0(a1, v58, 10);
v59 = a1->m_skipButton->__vftable;
cocos2d::CCPoint::CCPoint(&v102.origin, -186.0, 54.0);
v59->setPosition_0(a1->m_skipButton, v60);
a1->m_skipButton->setVisible(a1->m_skipButton, 0);
v61 = cocos2d::CCLabelBMFont::create("Bonus:", "goldFont.fnt");
a1->addChild_0(a1, v61, 10);
v62 = v61->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v102.origin, 1.0, 0.5);
v62->setAnchorPoint(v61, v63);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v61->setScale_0)(v61);
v64 = a1->m_page->m_type;
if ( v64 == 1 || v64 == Event )
{
v91 = GJChestSprite::create(3);
a1->addChild_0(a1, v91, 10);
((void (__fastcall *)(GJChestSprite *))v91->setScale_0)(v91);
v92 = v91->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v102.origin, 30.0, -84.0);
v92->setPosition_0(v91, v93);
cocos2d::CCPoint::CCPoint(&v102.origin, -25.0, 0.0);
v89 = (__int64 (__fastcall **)(void *))v91->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v90 = v91;
}
else
{
v65 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigDiamond_001.png");
a1->addChild_0(a1, v65, 10);
((void (__fastcall *)(struct cocos2d::CCSprite *))v65->setScale_0)(v65);
v66 = a1->m_level->m_stars.random - a1->m_level->m_stars.seed;
if ( !qword_1406C2EE8 )
{
v102.origin = (cocos2d::CCPoint)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(*(_QWORD *)&v102.origin);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
}
if ( (unsigned int)(v66 - 2) > 8 )
{
v67 = 0;
}
else if ( v66 == 10 )
{
v67 = 20;
}
else
{
v67 = (int)floorf((float)(v66 + 2) * 0.5);
}
v68 = cocos2d::CCString::createWithFormat("%ix", v67);
v69 = cocos2d::CCString::getCString(v68);
v70 = cocos2d::CCLabelBMFont::create(v69, (const char *)&qword_14052A4D8);
a1->addChild_0(a1, v70, 10);
v71 = v70->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v102.origin, 1.0, 0.5);
v71->setAnchorPoint(v70, v72);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v70->setScale_0)(v70);
width = v65->getContentSize(v65)->width;
v74 = ((double (__fastcall *)(struct cocos2d::CCSprite *))v65->getScale)(v65);
v75 = *(float *)&v74 * width;
v76 = v70->getContentSize(v70)->width;
v77 = ((double (__fastcall *)(struct cocos2d::CCLabelBMFont *))v70->getScale)(v70);
v78 = (float)(*(float *)&v77 * v76) + v75;
v79 = (float *)v61->getContentSize(v61);
v80 = ((double (__fastcall *)(struct cocos2d::CCLabelBMFont *))v61->getScale)(v61);
v81 = (float)((float)(*(float *)&v80 * *v79) + v78) + 25.0;
v82 = v65->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v83 = (float *)v65->getContentSize(v65);
v84 = (float)(v81 * 0.5) - (float)((float)(v65->getScale(v65) * *v83) * 0.5);
cocos2d::CCPoint::CCPoint(&v102.origin, v84, -84.0);
v82->setPosition_0(v65, v85);
cocos2d::CCPoint::CCPoint(&v102.origin, -20.0, 0.0);
v86 = (__int64)v65->getPosition_0(v65);
cocos2d::CCPoint::operator+(v86, &v101);
v70->setPosition_0(v70, (const cocos2d::CCPoint *)&v101);
v87 = (float *)v70->getContentSize(v70);
v88 = ((double (__fastcall *)(struct cocos2d::CCLabelBMFont *))v70->getScale)(v70);
cocos2d::CCPoint::CCPoint(&v102.origin, (float)-(float)(*(float *)&v88 * *v87) - 5.0, 0.0);
v89 = (__int64 (__fastcall **)(void *))v70->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v90 = v70;
}
v94 = v89[25](v90);
cocos2d::CCPoint::operator+(v94, &v101);
v61->setPosition_0(v61, (const cocos2d::CCPoint *)&v101);
}
else
{
v20->setColor(&v20->cocos2d::CCRGBAProtocol, &stru_140529A38);
LOBYTE(v95) = 75;
v20->setOpacity(&v20->cocos2d::CCRGBAProtocol, v95);
v96 = cocos2d::CCLabelBMFont::create("00:00:00", (const char *)&qword_14052A4D8);
a1->m_timeLabel = v96;
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v96->setScale_0)(v96);
a1->addChild_0(a1, a1->m_timeLabel, 3);
a1->m_needsDownloading = 1;
}
if ( v105 > 0xF )
{
v97 = Block[0];
if ( v105 + 1 >= 0x1000 )
{
v97 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v97 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v97);
}
v104 = 0;
v105 = 15;
LOBYTE(Block[0]) = 0;
if ( v108 > 0xF )
{
v98 = v106[0];
if ( v108 + 1 >= 0x1000 )
{
v98 = *((void **)v106[0] - 1);
if ( (unsigned __int64)((char *)v106[0] - (char *)v98 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v98);
}
return 1;
}