//
// DailyLevelPage::init from 0x100230240 to 0x100230d97 (2903 bytes)
//
// 1 xrefs:
// > DailyLevelPage::create @ 0x1002301fb
//
// 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 DailyLevelPage::init(DailyLevelPage *a1, GJTimedLevelType a2)
{
bool result; // al
int v4; // ebx
cocos2d::CCLayer *v5; // rax
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v6; // r14
const char *data; // rbx
cocos2d::extension::CCScale9Sprite *v9; // rbx
const char *v10; // rdi
cocos2d::CCSprite *v11; // rbx
double v12; // xmm0_8
int i; // r13d
const char *v14; // rdi
cocos2d::CCSprite *v15; // r15
cocos2d::CCSprite *v16; // r12
float v17; // xmm2_4
float v18; // xmm1_4
double v19; // xmm0_8
double v20; // xmm0_8
double v21; // xmm0_8
double v22; // xmm0_8
cocos2d::CCSprite *v23; // rax
DailyLevelPage *v24; // r12
CCMenuItemSpriteExtra *v25; // rax
float v26; // r14d
int v27; // ebx
int v28; // edx
int v29; // ecx
int v30; // r8d
int v31; // r9d
__int64 v32; // rbx
cocos2d::CCSprite *v33; // rax
CCMenuItemSpriteExtra *v34; // rbx
const cocos2d::CCPoint *m_buttonMenu; // r15
const char *v36; // rdi
cocos2d::CCLabelBMFont *m_timeLabel; // rax
cocos2d::CCLabelBMFont *v38; // rbx
cocos2d::CCLabelBMFont *v39; // rbx
float v40; // xmm0_4
LoadingCircle *v41; // rax
cocos2d::CCSprite *m_sprite; // rbx
LoadingCircle *v43; // rax
cocos2d::CCSprite *v44; // rbx
int time; // r14d
GameLevelManager *v46; // rax
GameLevelManager *v47; // rax
GameLevelManager *v48; // rax
int ActiveDailyID; // ebx
GameStatsManager *v50; // rax
GJGameLevel *SavedDailyLevel; // rsi
GameLevelManager *v52; // rax
GameLevelManager *v53; // rax
bool hasDailyStateBeenLoaded; // al
__int64 m_type; // rsi
GameLevelManager *v56; // rax
bool v57; // bl
bool v58; // bl
_BYTE v59[8]; // [rsp+8h] [rbp-C8h] BYREF
DailyLevelPage *v60; // [rsp+10h] [rbp-C0h]
float v61; // [rsp+1Ch] [rbp-B4h]
std::string v62; // [rsp+20h] [rbp-B0h] BYREF
std::string v63; // [rsp+40h] [rbp-90h] BYREF
std::string v64; // [rsp+60h] [rbp-70h] BYREF
float v65; // [rsp+7Ch] [rbp-54h]
timeb v66; // [rsp+80h] [rbp-50h] BYREF
void *__p; // [rsp+90h] [rbp-40h]
bool v68; // [rsp+9Fh] [rbp-31h]
float v69; // [rsp+A0h] [rbp-30h] BYREF
float v70; // [rsp+A4h] [rbp-2Ch]
double v71; // 0:xmm0_8.8
double v72; // 0:xmm0_8.8
cocos2d::CCRect v73; // 0:xmm0_8.8,8:xmm1_8.8
FLAlertLayer::incrementForcePrio(a1);
*(_DWORD *)&v64.__r_.__value_.__l.0 = -1778384896;
result = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::ccColor4B *)&v64);
if ( result )
{
a1->m_type = a2;
memset(&v64, 0, sizeof(v64));
memset(&v62, 0, sizeof(v62));
memset(&v63, 0, sizeof(v63));
v68 = result;
if ( a2 == Event )
{
std::string::assign(&v64, "eventLevelLabel_001.png");
std::string::assign(&v62, "dailyLevelCorner_001.png");
v4 = -3;
std::string::assign(&v63, "GJ_square05.png");
}
else if ( a2 == 1 )
{
std::string::assign(&v64, "weeklyLevelLabel_001.png");
std::string::assign(&v62, "gauntletCorner_001.png");
v4 = -2;
std::string::assign(&v63, "GJ_square05.png");
}
else
{
std::string::assign(&v64, "dailyLevelLabel_001.png");
std::string::assign(&v62, "dailyLevelCorner_001.png");
v4 = -1;
std::string::assign(&v63, "GJ_square01.png");
}
a1->m_downloadLevelID = v4;
GameManager::sharedState()->m_dailyLevelPage = a1;
((void (__fastcall *)(DailyLevelPage *, __int64))a1->setTouchEnabled)(a1, 1);
((void (__fastcall *)(DailyLevelPage *, __int64))a1->setKeypadEnabled)(a1, 1);
cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v71 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v69);
v5 = cocos2d::CCLayer::create();
a1->m_mainLayer = v5;
((void (__fastcall *)(DailyLevelPage *, cocos2d::CCLayer *, double))a1->addChild)(a1, v5, v71);
v6 = v63.__r_.__value_.__s.0;
data = v63.__r_.__value_.__l.__data_;
v73.origin = 0;
v73.size = 0;
sub_10028CC00(&v66, 0.0, 0.0, 80.0, 80.0);
if ( (*(_BYTE *)&v6 & 1) == 0 )
data = v63.__r_.__value_.__s.__data_;
v9 = cocos2d::extension::CCScale9Sprite::create_2(data, v73);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v9->setOpacity)(v9, 255);
sub_10028CBF0(&v66, 420.0, 280.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, timeb *))v9->setContentSize)(v9, &v66);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v9,
0xFFFFFFFFLL);
sub_10028CBE0(&v66, v69 * 0.5, v70 * 0.5);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, timeb *))v9->setPosition)(v9, &v66);
if ( a1->m_type == Event )
{
BYTE2(v66.time) = -14;
LOWORD(v66.time) = 12222;
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, timeb *))v9->setColor)(v9, &v66);
}
a1->m_joystickConnected = -1;
if ( (*(_BYTE *)&v64.__r_.__value_.__s.0 & 1) != 0 )
v10 = v64.__r_.__value_.__l.__data_;
else
v10 = v64.__r_.__value_.__s.__data_;
v11 = cocos2d::CCSprite::createWithSpriteFrameName(v10);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v11,
20);
v65 = *(float *)&a2;
v60 = a1;
*(_QWORD *)&v12 = LODWORD(v69);
*(float *)&v12 = v69 * 0.5;
sub_10028CBE0(&v66, v69 * 0.5, (float)((float)(v70 * 0.5) + 140.0) + -29.0);
((void (__fastcall *)(cocos2d::CCSprite *, timeb *))v11->setPosition)(v11, &v66);
for ( i = 0; i != 4; ++i )
{
v14 = v62.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v62.__r_.__value_.__s.0 & 1) != 0 )
v14 = v62.__r_.__value_.__l.__data_;
v15 = cocos2d::CCSprite::createWithSpriteFrameName(v14);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))v60->m_mainLayer->addChild_0)(
v60->m_mainLayer,
v15,
8);
if ( v60->m_type == 1 )
{
v16 = cocos2d::CCSprite::createWithSpriteFrameName("whiteSquare20_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v16->setScaleX)(v16, 0.30000001);
((void (__fastcall *)(cocos2d::CCSprite *, float))v16->setScaleY)(v16, 0.80000001);
((void (__fastcall *)(cocos2d::CCSprite *, void *))v16->setColor)(v16, &unk_100817E88);
((void (__fastcall *)(cocos2d::CCSprite *, float))v16->setRotation)(v16, -45.0);
sub_10028CBE0(&v66, 2.0, 2.0);
((void (__fastcall *)(cocos2d::CCSprite *, timeb *))v16->setPosition)(v16, &v66);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *, __int64))v15->addChild_0)(v15, v16, 1);
*(_QWORD *)&v12 = 1059145646;
((void (__fastcall *)(cocos2d::CCSprite *, float))v15->setScale)(v15, 0.63);
}
v17 = -115.0;
v18 = -185.0;
switch ( i )
{
case 0:
break;
case 1:
v19 = ((double (__fastcall *)(cocos2d::CCSprite *, double, float, float))v15->getScaleY)(
v15,
v12,
-185.0,
-115.0);
((void (__fastcall *)(cocos2d::CCSprite *, double))v15->setScaleY)(
v15,
COERCE_DOUBLE(*(_QWORD *)&v19 ^ 0x8000000080000000LL));
v17 = 115.0;
v18 = -185.0;
break;
case 2:
v20 = ((double (__fastcall *)(cocos2d::CCSprite *, double, float, float))v15->getScaleX)(
v15,
v12,
-185.0,
-115.0);
((void (__fastcall *)(cocos2d::CCSprite *, double))v15->setScaleX)(
v15,
COERCE_DOUBLE(*(_QWORD *)&v20 ^ 0x8000000080000000LL));
v21 = ((double (__fastcall *)(cocos2d::CCSprite *))v15->getScaleY)(v15);
((void (__fastcall *)(cocos2d::CCSprite *, double))v15->setScaleY)(
v15,
COERCE_DOUBLE(*(_QWORD *)&v21 ^ 0x8000000080000000LL));
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v15->setVisible)(v15, 0);
v17 = 115.0;
v18 = 185.0;
break;
case 3:
v22 = ((double (__fastcall *)(cocos2d::CCSprite *, double, float, float))v15->getScaleX)(
v15,
v12,
-185.0,
-115.0);
((void (__fastcall *)(cocos2d::CCSprite *, double))v15->setScaleX)(
v15,
COERCE_DOUBLE(*(_QWORD *)&v22 ^ 0x8000000080000000LL));
v17 = -115.0;
v18 = 185.0;
break;
}
*(_QWORD *)&v12 = LODWORD(v69);
*(float *)&v12 = (float)(v69 * 0.5) + v18;
sub_10028CBE0(&v66, *(float *)&v12, (float)(v70 * 0.5) + v17);
((void (__fastcall *)(cocos2d::CCSprite *, timeb *))v15->setPosition)(v15, &v66);
}
v23 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v24 = v60;
v25 = CCMenuItemSpriteExtra::create(
v23,
nullptr,
v60,
(cocos2d::SEL_MenuHandler)(unsigned __int64)DailyLevelPage::onClose);
v26 = v65;
v27 = (int)v25;
CCMenuItemSpriteExtra::setSizeMult(v25, 1.6);
v32 = sub_100792C50(v27, 0, v28, v29, v30, v31);
v60->m_buttonMenu = (cocos2d::CCMenu *)v32;
sub_10028CBE0(&v66, (float)((float)(v69 * 0.5) + -210.0) + 10.0, (float)((float)(v70 * 0.5) + 140.0) + -10.0);
(*(void (__fastcall **)(__int64, timeb *))(*(_QWORD *)v32 + 184LL))(v32, &v66);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))v24->m_mainLayer->addChild_0)(
v24->m_mainLayer,
v24->m_buttonMenu,
10);
v33 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_safeBtn_001.png");
v34 = CCMenuItemSpriteExtra::create(
v33,
nullptr,
v24,
(cocos2d::SEL_MenuHandler)(unsigned __int64)DailyLevelPage::onTheSafe);
CCMenuItemSpriteExtra::setSizeMult(v34, 1.6);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v24->m_buttonMenu->addChild)(
v24->m_buttonMenu,
v34);
m_buttonMenu = (const cocos2d::CCPoint *)v24->m_buttonMenu;
sub_10028CBE0(v59, (float)((float)(v69 * 0.5) + 210.0) + -30.0, (float)((float)(0.5 * v70) + 140.0) + -30.0);
*(cocos2d::CCPoint *)&v72 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v66, m_buttonMenu);
((void (__fastcall *)(CCMenuItemSpriteExtra *, timeb *, double))v34->setPosition)(v34, &v66, v72);
DailyLevelPage::getDailyTimeString(&v66, v24, 0);
if ( (v66.time & 1) != 0 )
v36 = (const char *)__p;
else
v36 = (char *)&v66.time + 1;
m_timeLabel = cocos2d::CCLabelBMFont::create_3(v36, "goldFont.fnt");
v24->m_timeLabel = m_timeLabel;
if ( (v66.time & 1) != 0 )
{
operator delete(__p);
m_timeLabel = v24->m_timeLabel;
}
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))v24->m_mainLayer->addChild_0)(
v24->m_mainLayer,
m_timeLabel,
20);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v24->m_timeLabel->setScale)(
v24->m_timeLabel,
flt_100817E78[LODWORD(v26) == 2]);
v38 = v24->m_timeLabel;
sub_10028CBE0(&v66, 0.0, 0.5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, timeb *))v38->setAnchorPoint)(v38, &v66);
v39 = v24->m_timeLabel;
v65 = v69;
v61 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v39->getContentSize)(v39);
v40 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v24->m_timeLabel->getScale)(v24->m_timeLabel);
sub_10028CBE0(
&v66,
(float)(v65 * 0.5) - (float)((float)(v40 * v61) * 0.5),
(float)((float)(v70 * 0.5) + -140.0) + 15.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, timeb *))v39->setPosition)(v39, &v66);
cocos2d::CCNode::schedule_1(v24, (cocos2d::SEL_SCHEDULE)(unsigned __int64)DailyLevelPage::updateTimers, 1.0);
v41 = LoadingCircle::create();
v24->m_timeCircle = v41;
v41->m_parentLayer = v24->m_mainLayer;
v41->m_fade = 0;
LoadingCircle::show(v41);
m_sprite = v24->m_timeCircle->m_sprite;
sub_10028CBE0(&v66, v69 * 0.5, (float)((float)(v70 * 0.5) + -140.0) + 17.0);
((void (__fastcall *)(cocos2d::CCSprite *, timeb *))m_sprite->setPosition)(m_sprite, &v66);
((void (__fastcall *)(cocos2d::CCSprite *, float))v24->m_timeCircle->m_sprite->setScale)(
v24->m_timeCircle->m_sprite,
0.28);
((void (__fastcall *)(LoadingCircle *, _QWORD))v24->m_timeCircle->setVisible)(v24->m_timeCircle, 0);
v43 = LoadingCircle::create();
v24->m_nodeCircle = v43;
v43->m_parentLayer = v24->m_mainLayer;
v43->m_fade = 0;
LoadingCircle::show(v43);
v44 = v24->m_nodeCircle->m_sprite;
sub_10028CBE0(&v66, v69 * 0.5, 0.5 * v70);
((void (__fastcall *)(cocos2d::CCSprite *, timeb *))v44->setPosition)(v44, &v66);
((void (__fastcall *)(cocos2d::CCSprite *, float))v24->m_nodeCircle->m_sprite->setScale)(
v24->m_nodeCircle->m_sprite,
0.5);
((void (__fastcall *)(LoadingCircle *, _QWORD))v24->m_nodeCircle->setVisible)(v24->m_nodeCircle, 0);
ftime(&v66);
LODWORD(v44) = v66.millitm;
time = v66.time;
v46 = GameLevelManager::sharedState();
if ( (double)((int)v44 + 1000 * (time & 0xFFFFF)) / 1000.0 > (double)GameLevelManager::getDailyTimer(
v46,
v24->m_type) )
{
v47 = GameLevelManager::sharedState();
GameLevelManager::resetDailyLevelState(v47, v24->m_type);
}
v48 = GameLevelManager::sharedState();
ActiveDailyID = GameLevelManager::getActiveDailyID(v48, v24->m_type);
if ( ActiveDailyID > 0 )
{
v50 = GameStatsManager::sharedState();
if ( GameStatsManager::hasCompletedDailyLevel(v50, ActiveDailyID) )
{
SavedDailyLevel = nullptr;
}
else
{
v52 = GameLevelManager::sharedState();
SavedDailyLevel = GameLevelManager::getSavedDailyLevel(v52, ActiveDailyID);
}
DailyLevelPage::createDailyNode(v24, SavedDailyLevel, 1, 0.0, 0);
}
v53 = GameLevelManager::sharedState();
hasDailyStateBeenLoaded = GameLevelManager::hasDailyStateBeenLoaded(v53, v24->m_type);
m_type = (unsigned int)v24->m_type;
if ( hasDailyStateBeenLoaded )
{
((void (__fastcall *)(DailyLevelPage *, __int64))v24->dailyStatusFinished)(v24, m_type);
}
else
{
if ( (_DWORD)m_type != 2 )
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD))v24->m_timeLabel->setVisible)(v24->m_timeLabel, 0);
((void (__fastcall *)(LoadingCircle *, __int64))v24->m_timeCircle->setVisible)(v24->m_timeCircle, 1);
}
v56 = GameLevelManager::sharedState();
GameLevelManager::getGJDailyLevelState(v56, v24->m_type);
if ( !v24->m_dailyNode )
((void (__fastcall *)(LoadingCircle *, __int64))v24->m_nodeCircle->setVisible)(v24->m_nodeCircle, 1);
}
GameLevelManager::sharedState()->m_GJDailyLevelDelegate = &v24->GJDailyLevelDelegate;
GameLevelManager::sharedState()->m_levelDownloadDelegate = &v24->LevelDownloadDelegate;
if ( (*(_BYTE *)&v63.__r_.__value_.__s.0 & 1) != 0 )
{
operator delete(v63.__r_.__value_.__l.__data_);
result = v68;
if ( (*(_BYTE *)&v62.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_44:
if ( (*(_BYTE *)&v64.__r_.__value_.__s.0 & 1) == 0 )
return result;
goto LABEL_45;
}
}
else
{
result = v68;
if ( (*(_BYTE *)&v62.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_44;
}
v58 = result;
operator delete(v62.__r_.__value_.__l.__data_);
result = v58;
if ( (*(_BYTE *)&v64.__r_.__value_.__s.0 & 1) == 0 )
return result;
LABEL_45:
v57 = result;
operator delete(v64.__r_.__value_.__l.__data_);
return v57;
}
return result;
}