//
// DailyLevelNode::init from 0x1002327f0 to 0x1002332c7 (2775 bytes)
//
// 1 xrefs:
// > DailyLevelNode::create @ 0x10023204b
//
// 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 __fastcall DailyLevelNode::init(DailyLevelNode *a1, GJGameLevel *a2, DailyLevelPage *a3, bool a4)
{
cocos2d::CCDirector *v8; // rax
cocos2d::CCTouchDispatcher *v9; // rax
GJTimedLevelType m_type; // eax
const std::string::value_type *v11; // rsi
GJGameLevel *m_level; // rax
bool v13; // r15
const char *data; // rbx
cocos2d::extension::CCScale9Sprite *v15; // r13
LevelCell *v16; // r13
const char *v17; // rdi
cocos2d::CCLabelBMFont *v18; // rax
cocos2d::CCSprite *v19; // rbx
cocos2d::CCLabelBMFont *v20; // r12
cocos2d::CCSprite *v21; // rbx
CCMenuItemSpriteExtra *v22; // rbx
cocos2d::CCMenu *v23; // r12
__int64 v24; // rsi
double v25; // xmm0_8
CCMenuItemSpriteExtra *m_button; // r12
__int64 v27; // rax
__int64 v28; // rbx
cocos2d::CCString *v29; // rax
const char *CString; // rax
cocos2d::CCLabelBMFont *v31; // r15
cocos2d::CCSprite *v32; // rbx
CCMenuItemSpriteExtra *v33; // rax
cocos2d::CCMenu *v34; // rax
CCMenuItemSpriteExtra *m_skipButton; // rbx
cocos2d::CCLabelBMFont *v36; // r15
GJChestSprite *v37; // r12
__int64 v38; // rbx
cocos2d::CCSprite *v39; // r12
GameStatsManager *v40; // rax
cocos2d::CCString *v41; // rax
const char *v42; // rax
cocos2d::CCLabelBMFont *v43; // r13
float v44; // xmm0_4
__int64 v45; // rbx
__int64 v46; // r14
float v47; // xmm0_4
std::string v49; // [rsp+0h] [rbp-A0h] BYREF
float v50; // [rsp+20h] [rbp-80h]
float v51; // [rsp+24h] [rbp-7Ch]
float v52; // [rsp+28h] [rbp-78h]
float v53; // [rsp+2Ch] [rbp-74h]
std::string v54; // [rsp+30h] [rbp-70h] BYREF
GJGameLevel *v55; // [rsp+48h] [rbp-58h]
_BYTE v56[8]; // [rsp+54h] [rbp-4Ch] BYREF
float CellHeight; // [rsp+5Ch] [rbp-44h]
bool v58; // [rsp+63h] [rbp-3Dh]
float v59; // [rsp+64h] [rbp-3Ch]
__int16 v60; // [rsp+68h] [rbp-38h] BYREF
char v61; // [rsp+6Ah] [rbp-36h]
cocos2d::CCRect v62; // 0:xmm0_8.8,8:xmm1_8.8
v58 = cocos2d::CCNode::init(a1);
if ( v58 )
{
v8 = cocos2d::CCDirector::sharedDirector();
v9 = (cocos2d::CCTouchDispatcher *)((__int64 (__fastcall *)(cocos2d::CCDirector *))v8->getTouchDispatcher)(v8);
cocos2d::CCTouchDispatcher::registerForcePrio(v9, a1, 2);
if ( a2 )
{
a1->m_level = a2;
cocos2d::CCObject::retain(a2);
}
a1->m_page = a3;
memset(&v54, 0, sizeof(v54));
memset(&v49, 0, sizeof(v49));
m_type = a3->m_type;
if ( m_type == Event )
{
std::string::assign(&v54, "GJ_square04.png");
v11 = "gj_eventCrown_001.png";
}
else if ( m_type == 1 )
{
std::string::assign(&v54, "GJ_square05.png");
v11 = "gj_weeklyCrown_001.png";
}
else
{
std::string::assign(&v54, "GJ_square02.png");
v11 = "gj_dailyCrown_001.png";
}
std::string::assign(&v49, v11);
v55 = a2;
m_level = a1->m_level;
if ( m_level )
v13 = m_level->m_orbCompletion.random - m_level->m_orbCompletion.seed >= 100;
else
v13 = 0;
CellHeight = CustomListView::getCellHeight(Level);
if ( v13 )
{
data = "GJ_square03.png";
}
else if ( (*(_BYTE *)&v54.__r_.__value_.__s.0 & 1) != 0 )
{
data = v54.__r_.__value_.__l.__data_;
}
else
{
data = v54.__r_.__value_.__s.__data_;
}
v62.origin = 0;
v62.size = 0;
sub_10028CC00(&v60, 0.0, 0.0, 80.0, 80.0);
v15 = cocos2d::extension::CCScale9Sprite::create_2(data, v62);
if ( !v13 && a1->m_page->m_type == 1 )
{
v61 = -81;
v60 = -20561;
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int16 *))v15->setColor)(v15, &v60);
}
v59 = CellHeight + 26.0;
sub_10028CBF0(&v60, 380.0, CellHeight + 26.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int16 *))v15->setContentSize)(v15, &v60);
sub_10028CBE0(&v60, 0.0, 0.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int16 *))v15->setPosition)(v15, &v60);
((void (__fastcall *)(DailyLevelNode *, cocos2d::extension::CCScale9Sprite *, __int64))a1->addChild_0)(a1, v15, 1);
if ( a1->m_level )
{
v16 = LevelCell::create(360.0, CellHeight);
v16->m_cellDrawn = 1;
LevelCell::loadFromLevel(v16, v55);
((void (__fastcall *)(DailyLevelNode *, LevelCell *, __int64))a1->addChild_0)(a1, v16, 2);
sub_10028CBE0(&v60, -180.0, (float)(CellHeight * -0.5) + -2.0);
((void (__fastcall *)(LevelCell *, __int16 *))v16->setPosition)(v16, &v60);
if ( (*(_BYTE *)&v49.__r_.__value_.__s.0 & 1) != 0 )
v17 = v49.__r_.__value_.__l.__data_;
else
v17 = v49.__r_.__value_.__s.__data_;
v19 = cocos2d::CCSprite::createWithSpriteFrameName(v17);
((void (__fastcall *)(DailyLevelNode *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v19, 2);
v59 = v59 * 0.5;
sub_10028CBE0(&v60, 0.0, (float)(v59 + 0.0) + 12.0);
((void (__fastcall *)(cocos2d::CCSprite *, __int16 *))v19->setPosition)(v19, &v60);
if ( a4 )
{
v20 = cocos2d::CCLabelBMFont::create_3("New!", "goldFont.fnt");
sub_10028CBE0(&v60, 1.0, 1.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int16 *))v20->setAnchorPoint)(v20, &v60);
sub_10028CBE0(&v60, 182.0, v59 + -5.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int16 *))v20->setPosition)(v20, &v60);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v20->setScale)(v20, 0.60000002);
((void (__fastcall *)(DailyLevelNode *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v20, 3);
}
if ( v13 )
{
v21 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_rewardBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v21->setScale)(v21, 1.0);
v22 = CCMenuItemSpriteExtra::create(
v21,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)DailyLevelNode::onClaimReward);
CCMenuItemSpriteExtra::setSizeMult(v22, 1.1);
v23 = cocos2d::CCMenu::createWithItem(v22);
((void (__fastcall *)(DailyLevelNode *, cocos2d::CCMenu *, __int64))a1->addChild_0)(a1, v23, 10);
sub_10028CBE0(&v60, 150.0, -2.0);
((void (__fastcall *)(cocos2d::CCMenu *, __int16 *))v23->setPosition)(v23, &v60);
v24 = ((__int64 (__fastcall *)(cocos2d::CCMenu *))v23->getPosition)(v23);
v25 = sub_10028CC90();
m_button = v16->m_button;
if ( m_button )
{
v27 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *, __int64, double))m_button->getNormalImage)(
v16->m_button,
v24,
v25);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v27 + 160LL))(v27, 0.40000001);
v28 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))m_button->getPosition)(m_button);
sub_10028CBE0(v56, -55.0, 0.0);
sub_10028CCE0(&v60, v28);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))m_button->setPosition)(m_button, &v60);
}
}
if ( a1->m_level )
{
v29 = (cocos2d::CCString *)sub_1007AB580("#%i", *(_BYTE *)&v49.__r_.__value_.__l.0);
CString = cocos2d::CCString::getCString(v29);
v31 = cocos2d::CCLabelBMFont::create_3(CString, "chatFont.fnt");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))v31->setColor)(v31, &unk_100817E88);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v31->setOpacity)(v31, 150);
sub_10028CBE0(&v60, 1.0, 0.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int16 *))v31->setAnchorPoint)(v31, &v60);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v31->setScale)(v31, 0.60000002);
((void (__fastcall *)(DailyLevelNode *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v31, 3);
sub_10028CBE0(&v60, 183.0, 7.0 - v59);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int16 *))v31->setPosition)(v31, &v60);
}
v32 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_deleteBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v32->setScale)(v32, 0.69999999);
v33 = CCMenuItemSpriteExtra::create(
v32,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)DailyLevelNode::onSkipLevel);
v34 = cocos2d::CCMenu::createWithItem(v33);
a1->m_skipButton = (CCMenuItemSpriteExtra *)v34;
((void (__fastcall *)(DailyLevelNode *, cocos2d::CCMenu *, __int64))a1->addChild_0)(a1, v34, 10);
m_skipButton = a1->m_skipButton;
sub_10028CBE0(&v60, -186.0, v59 + -4.0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int16 *))m_skipButton->setPosition)(m_skipButton, &v60);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_skipButton->setVisible)(a1->m_skipButton, 0);
v36 = cocos2d::CCLabelBMFont::create_3("Bonus:", "goldFont.fnt");
((void (__fastcall *)(DailyLevelNode *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v36, 10);
sub_10028CBE0(&v60, 1.0, 0.5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int16 *))v36->setAnchorPoint)(v36, &v60);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v36->setScale)(v36, 0.60000002);
if ( (unsigned int)(a1->m_page->m_type - 1) > 1 )
{
v39 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigDiamond_001.png");
((void (__fastcall *)(DailyLevelNode *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v39, 10);
((void (__fastcall *)(cocos2d::CCSprite *, float))v39->setScale)(v39, 0.80000001);
v40 = GameStatsManager::sharedState();
GameStatsManager::getBonusDiamonds(v40, a1->m_level->m_stars.random - a1->m_level->m_stars.seed);
v41 = (cocos2d::CCString *)sub_1007AB580("%ix", *(_BYTE *)&v49.__r_.__value_.__l.0);
v42 = cocos2d::CCString::getCString(v41);
v43 = cocos2d::CCLabelBMFont::create_3(v42, "bigFont.fnt");
((void (__fastcall *)(DailyLevelNode *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v43, 10);
sub_10028CBE0(&v60, 1.0, 0.5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int16 *))v43->setAnchorPoint)(v43, &v60);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v43->setScale)(v43, 0.60000002);
v59 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v39->getContentSize)(v39);
CellHeight = ((float (__fastcall *)(cocos2d::CCSprite *))v39->getScale)(v39);
LODWORD(v55) = *(_DWORD *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v43->getContentSize)(v43);
v50 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v43->getScale)(v43);
v51 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v36->getContentSize)(v36);
v52 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v36->getScale)(v36);
v53 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v39->getContentSize)(v39);
v44 = ((float (__fastcall *)(cocos2d::CCSprite *))v39->getScale)(v39);
sub_10028CBE0(
&v60,
(float)((float)(v44 * v53) * -0.5)
+ (float)((float)((float)((float)(v51 * v52) + (float)((float)(v59 * CellHeight) + (float)(*(float *)&v55 * v50)))
+ 25.0)
* 0.5),
-84.0);
((void (__fastcall *)(cocos2d::CCSprite *, __int16 *))v39->setPosition)(v39, &v60);
v45 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v39->getPosition)(v39);
sub_10028CBE0(v56, -20.0, 0.0);
sub_10028CCE0(&v60, v45);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int16 *))v43->setPosition)(v43, &v60);
v46 = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v43->getPosition)(v43);
v59 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v43->getContentSize)(v43);
v47 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v43->getScale)(v43);
sub_10028CBE0(v56, -5.0 - (float)(v59 * v47), 0.0);
sub_10028CCE0(&v60, v46);
}
else
{
v37 = GJChestSprite::create(3);
((void (__fastcall *)(DailyLevelNode *, GJChestSprite *, __int64))a1->addChild_0)(a1, v37, 10);
((void (__fastcall *)(GJChestSprite *, float))v37->setScale)(v37, 0.30000001);
sub_10028CBE0(&v60, 30.0, -84.0);
((void (__fastcall *)(GJChestSprite *, __int16 *))v37->setPosition)(v37, &v60);
v38 = ((__int64 (__fastcall *)(GJChestSprite *))v37->getPosition)(v37);
sub_10028CBE0(v56, -25.0, 0.0);
sub_10028CCE0(&v60, v38);
}
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int16 *))v36->setPosition)(v36, &v60);
}
else
{
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void *))v15->setColor)(v15, &unk_100817E88);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v15->setOpacity)(v15, 75);
v18 = cocos2d::CCLabelBMFont::create_3("00:00:00", "bigFont.fnt");
a1->m_timeLabel = v18;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v18->setScale)(v18, 0.5);
((void (__fastcall *)(DailyLevelNode *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, a1->m_timeLabel, 3);
a1->m_needsDownloading = 1;
}
if ( (*(_BYTE *)&v49.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v49.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v54.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v54.__r_.__value_.__l.__data_);
}
return v58;
}