//
// DailyLevelNode::init from 0x913874 to 0x914400 (2956 bytes)
//
// 2 xrefs:
// > DailyLevelNode::create @ 0x9144b0
// > ??> @ 0x504a8
//
// 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)
{
bool v7; // w22
cocos2d::CCDirector *v9; // x0
cocos2d::CCTouchDispatcher *v10; // x0
GJTimedLevelType m_type; // w2
double v12; // d0
GJGameLevel *m_level; // x0
_BOOL4 v14; // w26
float CellHeight; // s9
cocos2d::extension::CCScale9Sprite *v16; // x25
cocos2d::CCNode *v17; // x0
cocos2d::CCNode *v18; // x28
float v19; // s8
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x25
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
LevelCell *v22; // x0
cocos2d::CCNode *v23; // x25
void (__fastcall *v24)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
cocos2d::CCSprite *v25; // x27
float v26; // s9
void (__fastcall *v27)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x28
unsigned __int64 v28; // x1
cocos2d::CCString *v29; // x0
cocos2d::CCLabelBMFont *v30; // x28
void (__fastcall *v31)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x23
void (__fastcall *v32)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCSprite *v33; // x23
CCMenuItemSpriteExtra *v34; // x0
CCMenuItemSpriteExtra *v35; // x0
DailyLevelNode_vtbl *v36; // x3
CCMenuItemSpriteExtra *m_skipButton; // x23
void (__fastcall *v38)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCLabelBMFont *v39; // x26
void (__fastcall *v40)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCSprite *v41; // x25
GameStatsManager *v42; // x0
unsigned int BonusDiamonds; // w0
cocos2d::CCString *v44; // x0
cocos2d::CCLabelBMFont *v45; // x23
void (__fastcall *v46)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x19
float width; // s9
float v48; // s9
float v49; // s8
float v50; // s9
float v51; // s8
float v52; // s0
void (__fastcall *v53)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x19
float v54; // s8
float v55; // s9
float v56; // s0
void (__fastcall *v57)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19
__int64 v58; // x25
void (__fastcall *v59)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19
__int64 v60; // x25
float v61; // s8
float v62; // s0
char *p_m_fBrVertexMod; // x0
char *v64; // x23
unsigned int *v65; // x19
int v66; // w0
double v67; // d0
cocos2d::CCLabelBMFont *v68; // x28
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x27
void (__fastcall *v70)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
double v71; // d0
cocos2d::CCSprite *v72; // x26
CCMenuItemSpriteExtra *v73; // x26
cocos2d::CCMenu *v74; // x28
void (__fastcall *v75)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
float v76; // s0
float v77; // s1
cocos2d::CCNode *m_pParent; // x25
__int64 v79; // x0
void (__fastcall *v80)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
__int64 v81; // x26
GJChestSprite *v82; // x23
void (__fastcall *v83)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x19
__int64 v84; // x23
cocos2d::CCLabelBMFont *v85; // x0
cocos2d::CCLabelBMFont_vtbl *v86; // x1
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // x3
unsigned int *p_m_fTextureTop; // x1
int m_fTextureTop_low; // w2
_BOOL4 v90; // [xsp+7Ch] [xbp+7Ch]
char *v91; // [xsp+80h] [xbp+80h] BYREF
cocos2d::CCSprite *v92; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCPoint v93; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCRect v94; // [xsp+98h] [xbp+98h] BYREF
cocos2d::SEL_MenuHandler v95; // 0:x2.16
cocos2d::SEL_MenuHandler v96; // 0:x2.16
cocos2d::CCRect v97; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v90 = a4;
v7 = cocos2d::CCNode::init(a1);
if ( !v7 )
return v7;
v9 = cocos2d::CCDirector::sharedDirector();
v10 = v9->getTouchDispatcher(v9);
cocos2d::CCTouchDispatcher::registerForcePrio(v10, a1, 2);
if ( a2 )
{
a1->m_level = a2;
cocos2d::CCObject::retain(a2);
}
a1->m_page = a3;
m_type = a3->m_type;
v91 = &byte_124B6C8;
v92 = (cocos2d::CCSprite *)&byte_124B6C8;
if ( m_type == 1 )
{
*(_QWORD *)&v71 = sub_D1798C(&v91, "GJ_square05.png", 15).n128_u64[0];
sub_D1798C(&v92, "gj_weeklyCrown_001.png", 22, v71);
}
else if ( m_type == Event )
{
*(_QWORD *)&v67 = sub_D1798C(&v91, "GJ_square04.png", 15).n128_u64[0];
sub_D1798C(&v92, "gj_eventCrown_001.png", 21, v67);
}
else
{
*(_QWORD *)&v12 = sub_D1798C(&v91, "GJ_square02.png", 15).n128_u64[0];
sub_D1798C(&v92, "gj_dailyCrown_001.png", 21, v12);
}
m_level = a1->m_level;
v14 = 0;
if ( m_level )
v14 = m_level->m_orbCompletion.random - m_level->m_orbCompletion.seed > 99;
CellHeight = CustomListView::getCellHeight(Level);
if ( v14 )
v16 = (cocos2d::extension::CCScale9Sprite *)"GJ_square03.png";
else
v16 = (cocos2d::extension::CCScale9Sprite *)v91;
cocos2d::CCRect::CCRect(&v94, 0.0, 0.0, 80.0, 80.0);
v17 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(v16, (const char *)&v94, v97);
v18 = v17;
if ( !v14 && a1->m_page->m_type == 1 )
{
getTag = v17->__vftable[1].getTag;
LOWORD(v94.origin.x) = -20561;
BYTE2(v94.origin.x) = -81;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))getTag)(v17, &v94);
}
v19 = CellHeight + 26.0;
setContentSize = v18->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v94, 380.0, CellHeight + 26.0);
setContentSize(v18, (const cocos2d::CCSize *)&v94);
setPosition = v18->setPosition;
cocos2d::CCPoint::CCPoint(&v94.origin, 0.0, 0.0);
setPosition(v18, &v94.origin);
a1->addChild_0(a1, v18, 1);
if ( a1->m_level )
{
v22 = LevelCell::create(360.0, CellHeight);
v22->m_cellDrawn = 1;
v23 = v22;
LevelCell::loadFromLevel(v22, a2);
a1->addChild_0(a1, v23, 2);
v24 = v23->setPosition;
cocos2d::CCPoint::CCPoint(&v94.origin, -180.0, -2.0 - (float)(CellHeight * 0.5));
v24(v23, &v94.origin);
v25 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v92);
a1->addChild_0(a1, v25, 2);
v26 = v19 * 0.5;
v27 = v25->setPosition;
cocos2d::CCPoint::CCPoint(&v94.origin, 0.0, (float)((float)(v19 * 0.5) + 0.0) + 12.0);
v27(v25, &v94.origin);
if ( v90 )
{
v68 = cocos2d::CCLabelBMFont::create();
setAnchorPoint = v68->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v94.origin, 1.0, 1.0);
setAnchorPoint(v68, &v94.origin);
v70 = v68->setPosition;
cocos2d::CCPoint::CCPoint(&v94.origin, 182.0, v26 - 5.0);
v70(v68, &v94.origin);
v68->setScale(v68, 0.6);
a1->addChild_0(a1, v68, 3);
}
if ( v14 )
{
v72 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_rewardBtn_001.png");
v72->setScale(v72, 1.0);
v96.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v96.adj = (size_t)DailyLevelNode::onClaimReward;
v73 = CCMenuItemSpriteExtra::create(v72, nullptr, v96);
CCMenuItemSpriteExtra::setSizeMult(v73, 1.1);
v74 = cocos2d::CCMenu::createWithItem(v73);
a1->addChild_0(a1, v74, 10);
v75 = v74->setPosition;
cocos2d::CCPoint::CCPoint(&v94.origin, 150.0, -2.0);
v75(v74, &v94.origin);
v76 = ((float (__fastcall *)(cocos2d::CCMenu *))v74->getPosition)(v74);
cocos2d::CCPoint::operator=(&a1->m_unkPoint, v76, v77);
m_pParent = v23[1].m_pParent;
if ( m_pParent )
{
v79 = ((__int64 (__fastcall *)(cocos2d::CCNode *))m_pParent->__vftable[1].setScale_0)(m_pParent);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v79 + 160LL))(v79, 0.4);
v80 = m_pParent->setPosition;
v81 = (__int64)m_pParent->getPosition(m_pParent);
cocos2d::CCPoint::CCPoint(&v93, -55.0, 0.0);
cocos2d::CCPoint::operator+(&v94, v81, &v93);
v80(m_pParent, &v94.origin);
}
}
if ( !a1->m_level )
goto LABEL_24;
v28 = (unsigned int)(a2->m_dailyID.random - a2->m_dailyID.seed);
if ( (int)v28 <= 200000 )
{
if ( (int)v28 > 100000 )
{
v29 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"#%i",
(const char *)(unsigned int)(v28 - 100000));
goto LABEL_23;
}
}
else
{
v28 = (unsigned int)(v28 - 200000);
}
v29 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"#%i", (const char *)v28);
LABEL_23:
cocos2d::CCString::getCString(v29);
v30 = cocos2d::CCLabelBMFont::create();
v30->setColor(v30, (const cocos2d::ccColor3B *)&unk_EF3588);
v30->setOpacity(v30, 4294967190LL);
v31 = v30->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v94.origin, 1.0, 0.0);
v31(v30, &v94.origin);
v30->setScale(v30, 0.6);
a1->addChild_0(a1, v30, 3);
v32 = v30->setPosition;
cocos2d::CCPoint::CCPoint(&v94.origin, 183.0, 7.0 - (float)(v19 * 0.5));
v32(v30, &v94.origin);
LABEL_24:
v33 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_deleteBtn_001.png");
v33->setScale(v33, 0.7);
v95.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v95.adj = (size_t)DailyLevelNode::onSkipLevel;
v34 = CCMenuItemSpriteExtra::create(v33, nullptr, v95);
v35 = (CCMenuItemSpriteExtra *)cocos2d::CCMenu::createWithItem(v34);
v36 = a1->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_skipButton = v35;
v36->addChild_0(a1, v35, 10);
m_skipButton = a1->m_skipButton;
v38 = m_skipButton->setPosition;
cocos2d::CCPoint::CCPoint(&v94.origin, -186.0, v26 - 4.0);
v38(m_skipButton, &v94.origin);
a1->m_skipButton->setVisible(a1->m_skipButton, 0);
v39 = cocos2d::CCLabelBMFont::create();
a1->addChild_0(a1, v39, 10);
v40 = v39->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v94.origin, 1.0, 0.5);
v40(v39, &v94.origin);
v39->setScale(v39, 0.6);
if ( (unsigned int)(a1->m_page->m_type - 1) <= 1 )
{
v82 = GJChestSprite::create((int)&dword_0 + 3);
a1->addChild_0(a1, v82, 10);
v82->setScale(v82, 0.3);
v83 = v82->setPosition;
cocos2d::CCPoint::CCPoint(&v94.origin, 30.0, -84.0);
v83(v82, &v94.origin);
v59 = v39->setPosition;
v84 = (__int64)v82->getPosition(v82);
cocos2d::CCPoint::CCPoint(&v93, -25.0, 0.0);
cocos2d::CCPoint::operator+(&v94, v84, &v93);
}
else
{
v41 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigDiamond_001.png");
a1->addChild_0(a1, v41, 10);
v41->setScale(v41, 0.8);
v42 = GameStatsManager::sharedState();
BonusDiamonds = GameStatsManager::getBonusDiamonds(v42, a1->m_level->m_stars.random - a1->m_level->m_stars.seed);
v44 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%ix",
(const char *)BonusDiamonds);
cocos2d::CCString::getCString(v44);
v45 = cocos2d::CCLabelBMFont::create();
a1->addChild_0(a1, v45, 10);
v46 = v45->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v94.origin, 1.0, 0.5);
v46(v45, &v94.origin);
v45->setScale(v45, 0.6);
width = v41->getContentSize(v41)->width;
v48 = width * v41->getScale(v41);
v49 = v45->getContentSize(v45)->width;
v50 = v48 + (float)(v49 * v45->getScale(v45));
v51 = v39->getContentSize(v39)->width;
v52 = v39->getScale(v39);
v53 = v41->setPosition;
v54 = (float)((float)(v50 + (float)(v51 * v52)) + 25.0) * 0.5;
v55 = v41->getContentSize(v41)->width;
v56 = v41->getScale(v41);
cocos2d::CCPoint::CCPoint(&v94.origin, v54 - (float)((float)(v55 * v56) * 0.5), -84.0);
v53(v41, &v94.origin);
v57 = v45->setPosition;
v58 = (__int64)v41->getPosition(v41);
cocos2d::CCPoint::CCPoint(&v93, -20.0, 0.0);
cocos2d::CCPoint::operator+(&v94, v58, &v93);
v57(v45, &v94.origin);
v59 = v39->setPosition;
v60 = (__int64)v45->getPosition(v45);
v61 = v45->getContentSize(v45)->width;
v62 = v45->getScale(v45);
cocos2d::CCPoint::CCPoint(&v93, -5.0 - (float)(v61 * v62), 0.0);
cocos2d::CCPoint::operator+(&v94, v60, &v93);
}
v59(v39, &v94.origin);
goto LABEL_27;
}
((void (__fastcall *)(cocos2d::CCNode *, void *))v18->__vftable[1].getTag)(v18, &unk_EF3588);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v18->__vftable[1].~CCNode_0)(v18, 75);
v85 = cocos2d::CCLabelBMFont::create();
v86 = v85->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_timeLabel = v85;
((void (__fastcall *)(float))v86->setScale)(0.5);
a1->addChild_0(a1, a1->m_timeLabel, 3);
a1->m_needsDownloading = 1;
LABEL_27:
p_m_fBrVertexMod = (char *)&v92[-1].m_fBrVertexMod;
if ( (__int64 *)&v92[-1].m_fBrVertexMod != &qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_fTextureTop = (unsigned int *)&v92[-1].m_fTextureTop;
do
m_fTextureTop_low = __ldaxr(p_m_fTextureTop);
while ( __stlxr(m_fTextureTop_low - 1, p_m_fTextureTop) );
}
else
{
m_fTextureTop_low = LODWORD(v92[-1].m_fTextureTop);
LODWORD(v92[-1].m_fTextureTop) = m_fTextureTop_low - 1;
}
if ( m_fTextureTop_low <= 0 )
operator delete(p_m_fBrVertexMod);
}
v64 = v91 - 24;
if ( v91 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v65 = (unsigned int *)(v91 - 8);
do
v66 = __ldaxr(v65);
while ( __stlxr(v66 - 1, v65) );
}
else
{
v66 = *((_DWORD *)v91 - 2);
*((_DWORD *)v91 - 2) = v66 - 1;
}
if ( v66 <= 0 )
operator delete(v64);
}
return v7;
}