//
// DailyLevelNode::init from 0x4d42fc to 0x4d4aba (1982 bytes)
//
// 1 xrefs:
// > DailyLevelNode::create @ 0x4d4b38
//
// 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 DailyLevelNode::init(DailyLevelNode *a1, GJGameLevel *a2, DailyLevelPage *a3, bool a4)
{
cocos2d::CCDirector *v7; // r0
cocos2d::CCTouchDispatcher *v8; // r0
GJTimedLevelType m_type; // r3
GJGameLevel *m_level; // r7
char *v11; // r1
float CellHeight; // s17
cocos2d::extension::CCScale9Sprite *v13; // r5
cocos2d::CCNode *v14; // r0
cocos2d::CCNode *v15; // r5
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // r2
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r10
float v18; // s16
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
LevelCell *v20; // r0
LevelCell *v21; // r10
void (__fastcall *v22)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r5
cocos2d::CCSprite *v23; // r6
float v24; // s17
void (__fastcall *v25)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r11
cocos2d::CCLabelBMFont *v26; // r6
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r11
void (__fastcall *v28)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
cocos2d::CCSprite *v29; // r7
CCMenuItemSpriteExtra *v30; // r7
cocos2d::CCMenu *v31; // r7
void (__fastcall *v32)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
float v33; // r0
int v34; // r2
bool v35; // r3
CCMenuItemSpriteExtra *m_button; // r7
int v37; // r0
void (__fastcall *v38)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
int v39; // r11
const char *v40; // r1
cocos2d::CCString *v41; // r0
cocos2d::CCLabelBMFont *v42; // r7
void (__fastcall *v43)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r8
void (__fastcall *v44)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCSprite *v45; // r5
CCMenuItemSpriteExtra *v46; // r0
CCMenuItemSpriteExtra *v47; // r0
DailyLevelNode_vtbl *v48; // r3
CCMenuItemSpriteExtra *m_skipButton; // r5
void (__fastcall *v50)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCLabelBMFont *v51; // r8
void (__fastcall *v52)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r5
GJChestSprite *v53; // r5
void (__fastcall *v54)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r4
void (__fastcall *v55)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r4
int v56; // r5
cocos2d::CCSprite *v57; // r7
GameStatsManager *v58; // r0
const char *BonusDiamonds; // r0
cocos2d::CCString *v60; // r0
cocos2d::CCLabelBMFont *v61; // r5
void (__fastcall *v62)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r4
float width; // s16
float v64; // s16
float v65; // s17
float v66; // s16
float v67; // s17
float v68; // r0
void (__fastcall *v69)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r6
float v70; // s16
float v71; // s18
float v72; // r0
void (__fastcall *v73)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r6
int v74; // r7
void (__fastcall *v75)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r6
int v76; // r7
float v77; // s16
float v78; // r0
cocos2d::CCLabelBMFont *v79; // r0
cocos2d::CCLabelBMFont_vtbl *v80; // r3
float v82; // r2
float v83; // r3
_BOOL4 v84; // [sp+Ch] [bp-48h]
_BOOL4 v85; // [sp+10h] [bp-44h]
cocos2d::extension::CCScale9Sprite *v86; // [sp+1Ch] [bp-38h] BYREF
cocos2d::CCSprite *v87; // [sp+20h] [bp-34h] BYREF
cocos2d::CCPoint v88; // [sp+24h] [bp-30h] BYREF
cocos2d::CCPoint v89; // [sp+2Ch] [bp-28h] BYREF
void (*v90)(DailyLevelNode *, cocos2d::CCObject *); // [sp+34h] [bp-20h]
int v91; // [sp+38h] [bp-1Ch]
cocos2d::CCRect v92; // [sp+3Ch] [bp-18h] BYREF
cocos2d::CCSize v93; // 0:^0.8
cocos2d::CCRect v94; // 0:kr00_16.16
v85 = a4;
v84 = cocos2d::CCNode::init(a1);
if ( v84 )
{
v7 = cocos2d::CCDirector::sharedDirector();
v8 = v7->getTouchDispatcher(v7);
cocos2d::CCTouchDispatcher::registerForcePrio(v8, a1, 2);
if ( a2 )
{
a1->m_level = a2;
cocos2d::CCObject::retain(a2);
}
a1->m_page = a3;
v86 = (cocos2d::extension::CCScale9Sprite *)&unk_ACDDA8;
v87 = (cocos2d::CCSprite *)&unk_ACDDA8;
m_type = a3->m_type;
if ( m_type == 1 )
{
sub_7753D4((int)&v86, "GJ_square05.png");
v11 = "gj_weeklyCrown_001.png";
}
else if ( m_type == Event )
{
sub_7753D4((int)&v86, "GJ_square04.png");
v11 = "gj_eventCrown_001.png";
}
else
{
sub_7753D4((int)&v86, "GJ_square02.png");
v11 = "gj_dailyCrown_001.png";
}
sub_7753D4((int)&v87, v11);
m_level = a1->m_level;
if ( m_level )
m_level = (GJGameLevel *)(m_level->m_orbCompletion.random - m_level->m_orbCompletion.seed > 99);
CellHeight = CustomListView::getCellHeight(Level);
if ( m_level )
v13 = (cocos2d::extension::CCScale9Sprite *)"GJ_square03.png";
else
v13 = v86;
cocos2d::CCRect::CCRect(&v92, 0.0, 0.0, 80.0, 80.0);
v94.origin.x = v82;
v94.origin.y = v83;
v94.size = v93;
v14 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(v13, (const char *)&v92, v94);
v15 = v14;
if ( a1->m_page->m_type == 1 && !m_level )
{
getTag = v14->__vftable[1].getTag;
LOWORD(v92.origin.x) = -20561;
BYTE2(v92.origin.x) = -81;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))getTag)(v14, &v92);
}
setContentSize = v15->setContentSize;
v18 = CellHeight + 26.0;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v92, 380.0, CellHeight + 26.0);
setContentSize(v15, (const cocos2d::CCSize *)&v92);
setPosition = v15->setPosition;
cocos2d::CCPoint::CCPoint(&v92.origin, 0.0, 0.0);
setPosition(v15, &v92.origin);
a1->addChild_0(a1, v15, 1);
if ( a1->m_level )
{
v20 = LevelCell::create(360.0, CellHeight);
v20->m_cellDrawn = 1;
v21 = v20;
LevelCell::loadFromLevel(v20, a2);
a1->addChild_0(a1, v21, 2);
v22 = v21->setPosition;
cocos2d::CCPoint::CCPoint(&v92.origin, -180.0, (float)-(float)(CellHeight * 0.5) - 2.0);
v22(v21, &v92.origin);
v23 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v87);
a1->addChild_0(a1, v23, 2);
v24 = v18 * 0.5;
v25 = v23->setPosition;
cocos2d::CCPoint::CCPoint(&v92.origin, 0.0, (float)((float)(v18 * 0.5) + 0.0) + 12.0);
v25(v23, &v92.origin);
if ( v85 )
{
v26 = cocos2d::CCLabelBMFont::create();
setAnchorPoint = v26->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v92.origin, 1.0, 1.0);
setAnchorPoint(v26, &v92.origin);
v28 = v26->setPosition;
cocos2d::CCPoint::CCPoint(&v92.origin, 182.0, v24 - 5.0);
v28(v26, &v92.origin);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v26->setScale)(v26, 1058642330);
a1->addChild_0(a1, v26, 3);
}
if ( m_level )
{
v29 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_rewardBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v29->setScale)(v29, 1065353216);
v90 = DailyLevelNode::onClaimReward;
v91 = 0;
v30 = CCMenuItemSpriteExtra::create(
v29,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(DailyLevelNode::onClaimReward, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v30, 1.1);
v31 = cocos2d::CCMenu::createWithItem(v30);
a1->addChild_0(a1, v31, 10);
v32 = v31->setPosition;
cocos2d::CCPoint::CCPoint(&v92.origin, 150.0, -2.0);
v32(v31, &v92.origin);
v33 = ((float (__fastcall *)(cocos2d::CCMenu *))v31->getPosition)(v31);
cocos2d::CCPoint::operator=((PlayerObject *)&a1->m_unkPoint, v33, v34, v35);
m_button = v21->m_button;
if ( m_button )
{
v37 = (int)m_button->getNormalImage(v21->m_button);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v37 + 80))(v37, 1053609165);
v38 = m_button->setPosition;
v39 = (int)m_button->getPosition(m_button);
cocos2d::CCPoint::CCPoint(&v89, -55.0, 0.0);
cocos2d::CCPoint::operator+(&v92, v39, &v89);
v38(m_button, &v92.origin);
}
}
if ( a1->m_level )
{
v40 = (const char *)(a2->m_dailyID.random - a2->m_dailyID.seed);
if ( (int)v40 <= 200000 )
{
if ( (int)v40 > 100000 )
v40 -= 100000;
v41 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"#%i", v40);
}
else
{
v41 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"#%i", v40 - 200000);
}
cocos2d::CCString::getCString(v41);
v42 = cocos2d::CCLabelBMFont::create();
v42->setColor(v42, &stru_9AC6D4);
v42->setOpacity(v42, 150);
v43 = v42->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v92.origin, 1.0, 0.0);
v43(v42, &v92.origin);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v42->setScale)(v42, 1058642330);
a1->addChild_0(a1, v42, 3);
v44 = v42->setPosition;
cocos2d::CCPoint::CCPoint(&v92.origin, 183.0, 7.0 - (float)(v18 * 0.5));
v44(v42, &v92.origin);
}
v45 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_deleteBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v45->setScale)(v45, 1060320051);
LODWORD(v92.origin.x) = DailyLevelNode::onSkipLevel;
v92.origin.y = 0.0;
v46 = CCMenuItemSpriteExtra::create(
v45,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(DailyLevelNode::onSkipLevel, (unsigned int)a1));
v47 = (CCMenuItemSpriteExtra *)cocos2d::CCMenu::createWithItem(v46);
v48 = a1->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_skipButton = v47;
v48->addChild_0(a1, v47, 10);
m_skipButton = a1->m_skipButton;
v50 = m_skipButton->setPosition;
cocos2d::CCPoint::CCPoint(&v89, -186.0, v24 - 4.0);
v50(m_skipButton, &v89);
a1->m_skipButton->setVisible(a1->m_skipButton, 0);
v51 = cocos2d::CCLabelBMFont::create();
a1->addChild_0(a1, v51, 10);
v52 = v51->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v89, 1.0, 0.5);
v52(v51, &v89);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v51->setScale)(v51, 1058642330);
if ( (unsigned int)(a1->m_page->m_type - 1) > 1 )
{
v57 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigDiamond_001.png");
a1->addChild_0(a1, v57, 10);
((void (__fastcall *)(cocos2d::CCSprite *, int))v57->setScale)(v57, 1061997773);
v58 = GameStatsManager::sharedState();
BonusDiamonds = (const char *)GameStatsManager::getBonusDiamonds(
v58,
a1->m_level->m_stars.random - a1->m_level->m_stars.seed);
v60 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%ix", BonusDiamonds);
cocos2d::CCString::getCString(v60);
v61 = cocos2d::CCLabelBMFont::create();
a1->addChild_0(a1, v61, 10);
v62 = v61->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v89, 1.0, 0.5);
v62(v61, &v89);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v61->setScale)(v61, 1058642330);
width = v57->getContentSize(v57)->width;
v64 = width * COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCSprite *))v57->getScale)(v57));
v65 = v61->getContentSize(v61)->width;
v66 = v64 + (float)(v65 * COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCLabelBMFont *))v61->getScale)(v61)));
v67 = v51->getContentSize(v51)->width;
v68 = COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCLabelBMFont *))v51->getScale)(v51));
v69 = v57->setPosition;
v70 = (float)(v66 + (float)(v67 * v68)) + 25.0;
v71 = v57->getContentSize(v57)->width;
v72 = v57->getScale(v57);
cocos2d::CCPoint::CCPoint(&v89, (float)(v70 * 0.5) - (float)((float)(v71 * v72) * 0.5), -84.0);
v69(v57, &v89);
v73 = v61->setPosition;
v74 = (int)v57->getPosition(v57);
cocos2d::CCPoint::CCPoint(&v88, -20.0, 0.0);
cocos2d::CCPoint::operator+(&v89, v74, &v88);
v73(v61, &v89);
v75 = v51->setPosition;
v76 = (int)v61->getPosition(v61);
v77 = v61->getContentSize(v61)->width;
v78 = v61->getScale(v61);
cocos2d::CCPoint::CCPoint(&v88, (float)-(float)(v78 * v77) - 5.0, 0.0);
cocos2d::CCPoint::operator+(&v89, v76, &v88);
v75(v51, &v89);
}
else
{
v53 = GJChestSprite::create((int)&dword_0 + 3);
a1->addChild_0(a1, v53, 10);
((void (__fastcall *)(GJChestSprite *, int))v53->setScale)(v53, 1050253722);
v54 = v53->setPosition;
cocos2d::CCPoint::CCPoint(&v89, 30.0, -84.0);
v54(v53, &v89);
v55 = v51->setPosition;
v56 = (int)v53->getPosition(v53);
cocos2d::CCPoint::CCPoint(&v88, -25.0, 0.0);
cocos2d::CCPoint::operator+(&v89, v56, &v88);
v55(v51, &v89);
}
}
else
{
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::ccColor3B *))v15->__vftable[1].getTag)(v15, &stru_9AC6D4);
((void (__fastcall *)(cocos2d::CCNode *, int))v15->__vftable[1].~CCNode_0)(v15, 75);
v79 = cocos2d::CCLabelBMFont::create();
v80 = v79->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_timeLabel = v79;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v80->setScale)(v79, 1056964608);
a1->addChild_0(a1, a1->m_timeLabel, 3);
a1->m_needsDownloading = 1;
}
sub_774008(&v87);
sub_774008(&v86);
}
return v84;
}