//
// DailyLevelNode::init from 0x1001bae04 to 0x1001bb8e0 (2780 bytes)
//
// 1 xrefs:
// > DailyLevelNode::create @ 0x1001ba844
//
// 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)
{
_BOOL4 v4; // w22
_BOOL4 v8; // w19
cocos2d::CCDirector *v9; // x0
cocos2d::CCTouchDispatcher *v10; // x0
GJTimedLevelType m_type; // w8
const std::string::value_type *v12; // x1
GJGameLevel *m_level; // x8
_BOOL4 v14; // w25
float CellHeight; // s8
int v16; // w24
std::string::size_type v17; // x23
std::string *v18; // x8
const char *v19; // x0
cocos2d::extension::CCScale9Sprite *v20; // x0
cocos2d::extension::CCScale9Sprite *v21; // x23
float v22; // s9
__n128 v23; // q0
__n128 v24; // q1
LevelCell *v25; // x23
__n128 v26; // q0
__n128 v27; // q1
std::string *v28; // x0
cocos2d::CCSprite *v29; // x24
__n128 v30; // q0
float v31; // s8
__n128 v32; // q1
cocos2d::CCLabelBMFont *v33; // x22
__n128 v34; // q0
__n128 v35; // q1
__n128 v36; // q0
__n128 v37; // q1
cocos2d::CCSprite *v38; // x22
CCMenuItemSpriteExtra *v39; // x22
cocos2d::CCMenu *v40; // x22
__n128 v41; // q0
__n128 v42; // q1
double *v43; // x0
double v44; // d0
CCMenuItemSpriteExtra *m_button; // x22
__int64 v46; // x0
float32x2_t *v47; // x23
__n128 v48; // q0
__n128 v49; // q1
double v50; // d0
int v51; // w8
int v52; // w10
int v53; // w8
cocos2d::CCString *v54; // x0
const char *CString; // x0
cocos2d::CCLabelBMFont *v56; // x21
__n128 v57; // q0
__n128 v58; // q1
__n128 v59; // q0
__n128 v60; // q1
cocos2d::CCSprite *v61; // x21
CCMenuItemSpriteExtra *v62; // x0
__n128 v63; // q0
CCMenuItemSpriteExtra *m_skipButton; // x21
__n128 v65; // q1
cocos2d::CCLabelBMFont *v66; // x21
__n128 v67; // q0
__n128 v68; // q1
GJChestSprite *v69; // x22
__n128 v70; // q0
__n128 v71; // q1
float32x2_t *v72; // x20
__n128 v73; // q1
__n128 v74; // q0
double v75; // d0
cocos2d::CCLabelBMFont *v76; // x0
cocos2d::CCSprite *v77; // x22
GameStatsManager *v78; // x0
int BonusDiamonds; // w0
cocos2d::CCString *v80; // x0
const char *v81; // x0
cocos2d::CCLabelBMFont *v82; // x23
__n128 v83; // q0
__n128 v84; // q1
float v85; // s11
float v86; // s8
float v87; // s12
float v88; // s9
float v89; // s13
float v90; // s10
float v91; // s14
__n128 v92; // q0
__n128 v93; // q1
float32x2_t *v94; // x20
__n128 v95; // q0
__n128 v96; // q1
double v97; // d0
float v98; // s8
float32x2_t v100; // [xsp+8h] [xbp-C8h] BYREF
float32x2_t v101[2]; // [xsp+10h] [xbp-C0h] BYREF
std::string v102; // [xsp+20h] [xbp-B0h] BYREF
std::string v103; // [xsp+38h] [xbp-98h] BYREF
cocos2d::SEL_MenuHandler v104; // 0:x3.16
cocos2d::SEL_MenuHandler v105; // 0:x3.16
cocos2d::CCRect v106; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v4 = a4;
v8 = cocos2d::CCNode::init(a1);
if ( v8 )
{
v9 = cocos2d::CCDirector::sharedDirector();
v10 = (cocos2d::CCTouchDispatcher *)((__int64 (__fastcall *)(cocos2d::CCDirector *))v9->getTouchDispatcher)(v9);
cocos2d::CCTouchDispatcher::registerForcePrio(v10, a1, 2);
if ( a2 )
{
a1->m_level = a2;
cocos2d::CCObject::retain(a2);
}
a1->m_page = a3;
memset(&v103, 0, sizeof(v103));
memset(&v102, 0, sizeof(v102));
m_type = a3->m_type;
if ( m_type == Event )
{
std::string::assign(&v103, "GJ_square04.png");
v12 = "gj_eventCrown_001.png";
}
else if ( m_type == 1 )
{
std::string::assign(&v103, "GJ_square05.png");
v12 = "gj_weeklyCrown_001.png";
}
else
{
std::string::assign(&v103, "GJ_square02.png");
v12 = "gj_dailyCrown_001.png";
}
std::string::assign(&v102, v12);
m_level = a1->m_level;
if ( m_level )
v14 = m_level->m_orbCompletion.random - m_level->m_orbCompletion.seed > 99;
else
v14 = 0;
CellHeight = CustomListView::getCellHeight(Level);
v16 = SHIBYTE(v103.__r_.__value_.__r.__words[2]);
v17 = v103.__r_.__value_.__r.__words[0];
sub_100022990((float *)v101, 0.0, 0.0, 80.0, 80.0);
v18 = &v103;
if ( v16 < 0 )
v18 = (std::string *)v17;
if ( v14 )
v19 = "GJ_square03.png";
else
v19 = (const char *)v18;
v20 = cocos2d::extension::CCScale9Sprite::create(v19, v106);
v21 = v20;
if ( a1->m_page->m_type == 1 && !v14 )
{
v101[0].i8[2] = -81;
v101[0].i16[0] = -20561;
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v20->setColor)(v20, v101);
}
v22 = CellHeight + 26.0;
sub_100022988((float *)v101, 380.0, CellHeight + 26.0);
v23 = ((__n128 (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v21->setContentSize)(v21, v101);
v23.n128_u32[0] = 0;
v24.n128_u32[0] = 0;
sub_100022980(v23, v24, v101);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v21->setPosition)(v21, v101);
((void (__fastcall *)(DailyLevelNode *, cocos2d::extension::CCScale9Sprite *, __int64))a1->addChild_0)(a1, v21, 1);
if ( a1->m_level )
{
v25 = LevelCell::create(360.0, CellHeight);
v25->m_cellDrawn = 1;
LevelCell::loadFromLevel(v25, a2);
v26 = ((__n128 (__fastcall *)(DailyLevelNode *, LevelCell *, __int64))a1->addChild_0)(a1, v25, 2);
v27.n128_f32[0] = (float)(CellHeight * -0.5) + -2.0;
v26.n128_u32[0] = -1020002304;
sub_100022980(v26, v27, v101);
((void (__fastcall *)(LevelCell *, float32x2_t *))v25->setPosition)(v25, v101);
if ( (v102.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v28 = &v102;
else
v28 = (std::string *)v102.__r_.__value_.__r.__words[0];
v29 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v28);
v30 = ((__n128 (__fastcall *)(DailyLevelNode *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v29, 2);
v31 = v22 * 0.5;
v32.n128_f32[0] = (float)((float)(v22 * 0.5) + 0.0) + 12.0;
v30.n128_u32[0] = 0;
sub_100022980(v30, v32, v101);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *))v29->setPosition)(v29, v101);
if ( v4 )
{
v33 = cocos2d::CCLabelBMFont::create_1("New!", "goldFont.fnt");
v34.n128_u32[0] = 1.0;
v35.n128_u32[0] = 1.0;
sub_100022980(v34, v35, v101);
v36 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v33->setAnchorPoint)(v33, v101);
v37.n128_f32[0] = v31 + -5.0;
v36.n128_u32[0] = 1127612416;
sub_100022980(v36, v37, v101);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v33->setPosition)(v33, v101);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v33->setScale)(v33, 0.6);
((void (__fastcall *)(DailyLevelNode *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v33, 3);
}
if ( v14 )
{
v38 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_rewardBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v38->setScale)(v38, 1.0);
v104.ptr = (void (__cdecl *)(cocos2d::CCObject *))DailyLevelNode::onClaimReward;
v104.adj = 0;
v39 = CCMenuItemSpriteExtra::create(v38, nullptr, a1, v104);
CCMenuItemSpriteExtra::setSizeMult(v39, 1.1);
v40 = cocos2d::CCMenu::createWithItem(v39);
v41 = ((__n128 (__fastcall *)(DailyLevelNode *, cocos2d::CCMenu *, __int64))a1->addChild_0)(a1, v40, 10);
v41.n128_u32[0] = 1125515264;
v42.n128_u32[0] = -2.0;
sub_100022980(v41, v42, v101);
((void (__fastcall *)(cocos2d::CCMenu *, float32x2_t *))v40->setPosition)(v40, v101);
v43 = (double *)((__int64 (__fastcall *)(cocos2d::CCMenu *))v40->getPosition)(v40);
v44 = sub_1000229D0(&a1->m_unkPoint, v43);
m_button = v25->m_button;
if ( m_button )
{
v46 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *, double))m_button->getNormalImage)(v25->m_button, v44);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v46 + 160LL))(v46, 0.4);
v47 = (float32x2_t *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))m_button->getPosition)(m_button);
v48.n128_u32[0] = -1034158080;
v49.n128_u32[0] = 0;
sub_100022980(v48, v49, &v100);
*(float32x2_t *)&v50 = sub_1000229DC(v47, &v100, v101);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))m_button->setPosition)(
m_button,
v101,
v50);
}
}
if ( a1->m_level )
{
v51 = a2->m_dailyID.random - a2->m_dailyID.seed;
v52 = v51 - 100000;
if ( v51 <= 100000 )
v52 = a2->m_dailyID.random - a2->m_dailyID.seed;
if ( v51 <= 200000 )
v53 = v52;
else
v53 = v51 - 200000;
v54 = (cocos2d::CCString *)sub_100268F4C("#%i", v53);
CString = cocos2d::CCString::getCString(v54);
v56 = cocos2d::CCLabelBMFont::create_1(CString, "chatFont.fnt");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))v56->setColor)(v56, &unk_100639CD2);
v57 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v56->setOpacity)(v56, 150);
v57.n128_u32[0] = 1.0;
v58.n128_u32[0] = 0;
sub_100022980(v57, v58, v101);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v56->setAnchorPoint)(v56, v101);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v56->setScale)(v56, 0.6);
v59 = ((__n128 (__fastcall *)(DailyLevelNode *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v56, 3);
v60.n128_f32[0] = 7.0 - v31;
v59.n128_u32[0] = 1127677952;
sub_100022980(v59, v60, v101);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v56->setPosition)(v56, v101);
}
v61 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_deleteBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v61->setScale)(v61, 0.7);
v105.ptr = (void (__cdecl *)(cocos2d::CCObject *))DailyLevelNode::onSkipLevel;
v105.adj = 0;
v62 = CCMenuItemSpriteExtra::create(v61, nullptr, a1, v105);
a1->m_skipButton = (CCMenuItemSpriteExtra *)cocos2d::CCMenu::createWithItem(v62);
v63 = ((__n128 (__fastcall *)(DailyLevelNode *))a1->addChild_0)(a1);
m_skipButton = a1->m_skipButton;
v65.n128_f32[0] = v31 + -4.0;
v63.n128_u32[0] = -1019609088;
sub_100022980(v63, v65, v101);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *))m_skipButton->setPosition)(m_skipButton, v101);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_skipButton->setVisible)(a1->m_skipButton, 0);
v66 = cocos2d::CCLabelBMFont::create_1("Bonus:", "goldFont.fnt");
v67 = ((__n128 (__fastcall *)(DailyLevelNode *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v66, 10);
v67.n128_u32[0] = 1.0;
v68.n128_u32[0] = 0.5;
sub_100022980(v67, v68, v101);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v66->setAnchorPoint)(v66, v101);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v66->setScale)(v66, 0.6);
if ( (unsigned int)(a1->m_page->m_type - 1) > 1 )
{
v77 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigDiamond_001.png");
((void (__fastcall *)(DailyLevelNode *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v77, 10);
((void (__fastcall *)(cocos2d::CCSprite *, float))v77->setScale)(v77, 0.8);
v78 = GameStatsManager::sharedState();
BonusDiamonds = GameStatsManager::getBonusDiamonds(v78, a1->m_level->m_stars.random - a1->m_level->m_stars.seed);
v80 = (cocos2d::CCString *)sub_100268F4C("%ix", BonusDiamonds);
v81 = cocos2d::CCString::getCString(v80);
v82 = cocos2d::CCLabelBMFont::create_1(v81, "bigFont.fnt");
v83 = ((__n128 (__fastcall *)(DailyLevelNode *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v82, 10);
v83.n128_u32[0] = 1.0;
v84.n128_u32[0] = 0.5;
sub_100022980(v83, v84, v101);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v82->setAnchorPoint)(v82, v101);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v82->setScale)(v82, 0.6);
v85 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v77->getContentSize)(v77);
v86 = ((float (__fastcall *)(cocos2d::CCSprite *))v77->getScale)(v77);
v87 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v82->getContentSize)(v82);
v88 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v82->getScale)(v82);
v89 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v66->getContentSize)(v66);
v90 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v66->getScale)(v66);
v91 = *(float *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v77->getContentSize)(v77);
v92.n128_f64[0] = ((double (__fastcall *)(cocos2d::CCSprite *))v77->getScale)(v77);
v92.n128_f32[0] = (float)((float)((float)((float)((float)(v87 * v88) + (float)(v85 * v86)) + (float)(v89 * v90))
+ 25.0)
* 0.5)
+ (float)((float)(v92.n128_f32[0] * v91) * -0.5);
v93.n128_u32[0] = -1029177344;
sub_100022980(v92, v93, v101);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *))v77->setPosition)(v77, v101);
v94 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v77->getPosition)(v77);
v95.n128_u32[0] = -20.0;
v96.n128_u32[0] = 0;
sub_100022980(v95, v96, &v100);
*(float32x2_t *)&v97 = sub_1000229DC(v94, &v100, v101);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *, double))v82->setPosition)(v82, v101, v97);
v72 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v82->getPosition)(v82);
v98 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v82->getContentSize)(v82);
v74.n128_f64[0] = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))v82->getScale)(v82);
v74.n128_f32[0] = -5.0 - (float)(v98 * v74.n128_f32[0]);
}
else
{
v69 = GJChestSprite::create(3);
((void (__fastcall *)(DailyLevelNode *, GJChestSprite *, __int64))a1->addChild_0)(a1, v69, 10);
v70 = ((__n128 (__fastcall *)(GJChestSprite *, float))v69->setScale)(v69, 0.3);
v71.n128_u32[0] = -1029177344;
v70.n128_u32[0] = 30.0;
sub_100022980(v70, v71, v101);
((void (__fastcall *)(GJChestSprite *, float32x2_t *))v69->setPosition)(v69, v101);
v72 = (float32x2_t *)((__int64 (__fastcall *)(GJChestSprite *))v69->getPosition)(v69);
v74.n128_u32[0] = -25.0;
}
v73.n128_u32[0] = 0;
sub_100022980(v74, v73, &v100);
*(float32x2_t *)&v75 = sub_1000229DC(v72, &v100, v101);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *, double))v66->setPosition)(v66, v101, v75);
}
else
{
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void *))v21->setColor)(v21, &unk_100639CD2);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v21->setOpacity)(v21, 75);
v76 = cocos2d::CCLabelBMFont::create_1("00:00:00", "bigFont.fnt");
a1->m_timeLabel = v76;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v76->setScale)(v76, 0.5);
((void (__fastcall *)(DailyLevelNode *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, a1->m_timeLabel, 3);
a1->m_needsDownloading = 1;
}
if ( SHIBYTE(v102.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v102.__r_.__value_.__l.__data_);
if ( SHIBYTE(v103.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v103.__r_.__value_.__l.__data_);
}
return v8;
}