//
// LevelPage::init from 0x140319c20 to 0x14031a8a4 (3204 bytes)
//
// 5 xrefs:
// > LevelSelectLayer::init @ 0x140318a30
// > ??> @ 0x140692f38
// > ??> @ 0x140692f58
// > ??> @ 0x140692f70
// > ??> @ 0x1406d4ac0
//
// 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 LevelPage::init(LevelPage *a1, GJGameLevel *a2)
{
bool result; // al
_BOOL8 v4; // rdx
__int64 v5; // rcx
cocos2d::CCDirector *v6; // rax
__int64 v7; // rax
__int64 v8; // rcx
cocos2d::CCArray *v9; // rax
__int64 v10; // rcx
cocos2d::CCArray *v11; // rax
__int64 v12; // rcx
cocos2d::CCMenu *v13; // rax
LevelPage_vtbl *v14; // r9
float v15; // xmm0_4
cocos2d::CCMenu_vtbl *v16; // rbx
const cocos2d::CCPoint *v17; // rax
struct cocos2d::CCRect *v18; // rax
struct cocos2d::extension::CCScale9Sprite *v19; // rax
__int64 v20; // rdx
float v21; // xmm0_4
cocos2d::extension::CCScale9Sprite_vtbl *v22; // rbx
double v23; // xmm0_8
const cocos2d::CCPoint *v24; // rax
cocos2d::CCNode *v25; // r13
cocos2d::CCNode_vtbl *v26; // rbx
const cocos2d::CCSize *v27; // rax
cocos2d::extension::CCScale9Sprite *m_levelDisplay; // rcx
cocos2d::extension::CCScale9Sprite_vtbl *v29; // rbx
const cocos2d::CCSize *v30; // rax
const cocos2d::CCPoint *v31; // rax
CCMenuItemSpriteExtra *v32; // rax
struct cocos2d::CCSprite *v33; // r14
__int64 v34; // rdx
float v35; // xmm0_4
cocos2d::CCSprite_vtbl *v36; // rbx
const cocos2d::CCPoint *v37; // rax
cocos2d::CCSprite *v38; // rax
cocos2d::CCSprite *m_normalProgressBar; // rdx
float width; // xmm6_4
float v41; // xmm0_4
cocos2d::CCSprite_vtbl *v42; // rbx
const cocos2d::CCPoint *v43; // rax
cocos2d::CCSprite *v44; // rbx
cocos2d::CCSprite_vtbl *v45; // rdi
const cocos2d::CCPoint *v46; // rax
struct cocos2d::CCSprite *v47; // rsi
__int64 v48; // rdx
float v49; // xmm0_4
__int64 v50; // rax
cocos2d::CCSprite *v51; // rax
cocos2d::CCRGBAProtocol *v52; // rcx
float v53; // xmm0_4
cocos2d::CCSprite_vtbl *v54; // rbx
const cocos2d::CCPoint *v55; // rax
cocos2d::CCSprite_vtbl *v56; // rbx
const cocos2d::CCPoint *v57; // rax
cocos2d::CCLabelBMFont *v58; // rax
LevelPage_vtbl *v59; // r9
cocos2d::CCLabelBMFont_vtbl *v60; // rbx
__int64 v61; // rax
cocos2d::CCLabelBMFont *v62; // rax
LevelPage_vtbl *v63; // r9
cocos2d::CCLabelBMFont_vtbl *v64; // rbx
__int64 v65; // rax
struct cocos2d::CCLabelBMFont *v66; // rdi
float v67; // xmm0_4
__int64 v68; // rax
struct cocos2d::CCLabelBMFont *v69; // rdi
float v70; // xmm0_4
__int64 v71; // rax
double v72; // xmm0_8
cocos2d::CCLabelBMFont *v73; // rax
cocos2d::CCLabelBMFont_vtbl *v74; // rbx
const cocos2d::CCPoint *v75; // rax
cocos2d::CCSprite *v76; // rax
cocos2d::extension::CCScale9Sprite *v77; // rcx
cocos2d::CCSprite *v78; // rax
cocos2d::extension::CCScale9Sprite *v79; // rcx
float v80; // xmm0_4
cocos2d::CCSprite_vtbl *v81; // rbx
const cocos2d::CCPoint *v82; // rax
cocos2d::CCLabelBMFont *v83; // rax
cocos2d::extension::CCScale9Sprite *v84; // rcx
float v85; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v86; // rbx
__int64 v87; // rax
float v88; // xmm0_4
const cocos2d::CCPoint *v89; // rax
double v90; // xmm0_8
__int64 v91; // rcx
cocos2d::CCArray *v92; // rax
int i; // edi
struct cocos2d::CCSprite *v94; // rbx
float v95; // xmm0_4
__int64 v96; // rcx
cocos2d::CCArray *v97; // rax
__int64 v98; // rdx
__int64 v99; // rcx
struct cocos2d::CCSprite *v100; // rdi
float v101; // xmm0_4
const cocos2d::CCPoint *v102; // rax
char v103[8]; // [rsp+30h] [rbp-29h] BYREF
cocos2d::CCRect v104; // [rsp+38h] [rbp-21h] BYREF
GJGameLevel *v105; // [rsp+C8h] [rbp+6Fh] BYREF
cocos2d::CCSize v106; // [rsp+D0h] [rbp+77h] BYREF
float v107; // [rsp+D8h] [rbp+7Fh]
v105 = a2;
result = cocos2d::CCLayer::init(a1);
if ( result )
{
LOBYTE(v4) = 1;
a1->setTouchEnabled(a1, v4);
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6);
cocos2d::CCSize::CCSize(&v106, 340.0, 95.0);
cocos2d::CCSize::operator=(&a1->m_levelDisplaySize, v7);
v9 = (cocos2d::CCArray *)cocos2d::CCArray::create(v8);
a1->m_progressObjects = v9;
cocos2d::CCObject::retain(v9);
v11 = (cocos2d::CCArray *)cocos2d::CCArray::create(v10);
a1->m_levelObjects = v11;
cocos2d::CCObject::retain(v11);
v13 = (cocos2d::CCMenu *)cocos2d::CCMenu::create(v12);
v14 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_levelMenu = v13;
v15 = ((float (__fastcall *)(LevelPage *, cocos2d::CCMenu *, __int64))v14->addChild_0)(a1, v13, 0xFFFFFFFFLL);
v16 = a1->m_levelMenu->__vftable;
cocos2d::CCPoint::CCPoint(v15, v107 * 0.5);
v16->setPosition_0(a1->m_levelMenu, v17);
cocos2d::CCRect::CCRect(&v104, 0.0, 0.0, 80.0, 80.0);
v19 = cocos2d::extension::CCScale9Sprite::create("square02_001.png", v18);
a1->m_levelDisplay = v19;
LOBYTE(v20) = 125;
v19->setOpacity(&v19->cocos2d::CCRGBAProtocol, v20);
v21 = ((float (__fastcall *)(cocos2d::extension::CCScale9Sprite *, cocos2d::CCSize *))a1->m_levelDisplay->setContentSize)(
a1->m_levelDisplay,
&a1->m_levelDisplaySize);
v22 = a1->m_levelDisplay->__vftable;
v23 = cocos2d::CCPoint::CCPoint(v21, v107 * 0.5);
v22->setPosition_0(a1->m_levelDisplay, v24);
v25 = (cocos2d::CCNode *)cocos2d::CCSprite::create();
v25->addChild_1(v25, a1->m_levelDisplay);
v26 = v25->__vftable;
v27 = a1->m_levelDisplay->getContentSize(a1->m_levelDisplay);
v26->setContentSize(v25, v27);
m_levelDisplay = a1->m_levelDisplay;
v29 = m_levelDisplay->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
m_levelDisplay->getContentSize(m_levelDisplay);
v30 = a1->m_levelDisplay->getContentSize(a1->m_levelDisplay);
cocos2d::CCPoint::CCPoint(*(float *)&v23, v30->width * 0.5);
v29->setPosition_0(a1->m_levelDisplay, v31);
v32 = CCMenuItemSpriteExtra::create(v25, nullptr, a1, (cocos2d::SEL_MenuHandler *)LevelPage::onPlay);
LODWORD(v32->m_pDisabledImage) = 1066192077;
a1->m_levelMenu->addChild_1(a1->m_levelMenu, v32);
cocos2d::CCArray::addObject(a1->m_progressObjects, a1->m_levelMenu);
LOWORD(v105) = 0;
BYTE2(v105) = 0;
v33 = cocos2d::CCSprite::create("GJ_progressBar_001.png");
v33->setColor(&v33->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v105);
LOBYTE(v34) = 125;
v33->setOpacity(&v33->cocos2d::CCRGBAProtocol, v34);
((void (__fastcall *)(struct cocos2d::CCSprite *))v33->setScale_0)(v33);
v35 = ((float (__fastcall *)(LevelPage *, struct cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v33, 3);
v36 = v33->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v35, v107 * 0.5);
v36->setPosition_0(v33, v37);
cocos2d::CCArray::addObject(a1->m_progressObjects, v33);
v38 = cocos2d::CCSprite::create("GJ_progressBar_001.png");
a1->m_normalProgressBar = v38;
((void (__fastcall *)(cocos2d::CCSprite *))v38->setScaleX)(v38);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_normalProgressBar->setScaleY)(a1->m_normalProgressBar);
a1->m_normalProgressBar->setColor(&a1->m_normalProgressBar->cocos2d::CCRGBAProtocol, &stru_140529B68);
m_normalProgressBar = a1->m_normalProgressBar;
a1->m_progressWidth = m_normalProgressBar->m_obRect.size.width;
width = m_normalProgressBar->m_obRect.size.width;
v41 = ((float (__fastcall *)(struct cocos2d::CCSprite *, cocos2d::CCSprite *, __int64))v33->addChild_0)(
v33,
m_normalProgressBar,
1);
v42 = a1->m_normalProgressBar->__vftable;
cocos2d::CCPoint::CCPoint(v41, 0.0);
v42->setAnchorPoint(a1->m_normalProgressBar, v43);
v44 = a1->m_normalProgressBar;
v45 = v44->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v33->getContentSize(v33);
cocos2d::CCPoint::CCPoint(width * 0.99199998, (float)(width - (float)(width * 0.99199998)) * 0.5);
v45->setPosition_0(v44, v46);
v47 = cocos2d::CCSprite::create("GJ_progressBar_001.png");
v47->setColor(&v47->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v105);
LOBYTE(v48) = 125;
v47->setOpacity(&v47->cocos2d::CCRGBAProtocol, v48);
((void (__fastcall *)(struct cocos2d::CCSprite *))v47->setScale_0)(v47);
v49 = ((float (__fastcall *)(LevelPage *, struct cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v47, 3);
cocos2d::CCPoint::CCPoint(v49, 0.0);
v50 = (__int64)v33->getPosition_0(v33);
cocos2d::CCPoint::operator+(v50, &v106);
v47->setPosition_0(v47, (const cocos2d::CCPoint *)&v106);
cocos2d::CCArray::addObject(a1->m_progressObjects, v47);
v51 = cocos2d::CCSprite::create("GJ_progressBar_001.png");
a1->m_practiceProgressBar = v51;
((void (__fastcall *)(cocos2d::CCSprite *))v51->setScaleX)(v51);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_practiceProgressBar->setScaleY)(a1->m_practiceProgressBar);
v52 = &a1->m_practiceProgressBar->cocos2d::CCRGBAProtocol;
LOWORD(v106.width) = -256;
BYTE2(v106.width) = -1;
v52->setColor(v52, (const cocos2d::ccColor3B *)&v106);
v53 = ((float (__fastcall *)(struct cocos2d::CCSprite *, cocos2d::CCSprite *, __int64))v47->addChild_0)(
v47,
a1->m_practiceProgressBar,
1);
v54 = a1->m_practiceProgressBar->__vftable;
cocos2d::CCPoint::CCPoint(v53, 0.0);
v54->setAnchorPoint(a1->m_practiceProgressBar, v55);
v56 = a1->m_practiceProgressBar->__vftable;
v57 = a1->m_normalProgressBar->getPosition_0(a1->m_normalProgressBar);
v56->setPosition_0(a1->m_practiceProgressBar, v57);
v58 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
v59 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_normalProgressLabel = v58;
v59->addChild_0(a1, v58, 4);
v60 = a1->m_normalProgressLabel->__vftable;
v61 = (__int64)v33->getPosition_0(v33);
v60->setPosition_0(a1->m_normalProgressLabel, (const cocos2d::CCPoint *)v61);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_normalProgressLabel->setScale_0)(a1->m_normalProgressLabel);
cocos2d::CCArray::addObject(a1->m_progressObjects, a1->m_normalProgressLabel);
v62 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
v63 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_practiceProgressLabel = v62;
v63->addChild_0(a1, v62, 4);
v64 = a1->m_practiceProgressLabel->__vftable;
v65 = (__int64)v47->getPosition_0(v47);
v64->setPosition_0(a1->m_practiceProgressLabel, (const cocos2d::CCPoint *)v65);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_practiceProgressLabel->setScale_0)(a1->m_practiceProgressLabel);
cocos2d::CCArray::addObject(a1->m_progressObjects, a1->m_practiceProgressLabel);
v66 = cocos2d::CCLabelBMFont::create("Normal Mode", (const char *)&qword_14052A4D8);
v67 = ((float (__fastcall *)(LevelPage *, struct cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v66, 4);
cocos2d::CCPoint::CCPoint(v67, 0.0);
v68 = (__int64)v33->getPosition_0(v33);
cocos2d::CCPoint::operator+(v68, &v106);
v66->setPosition_0(v66, (const cocos2d::CCPoint *)&v106);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v66->setScale_0)(v66);
cocos2d::CCArray::addObject(a1->m_progressObjects, v66);
v69 = cocos2d::CCLabelBMFont::create("Practice Mode", (const char *)&qword_14052A4D8);
v70 = ((float (__fastcall *)(LevelPage *, struct cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v69, 4);
cocos2d::CCPoint::CCPoint(v70, 0.0);
v71 = (__int64)v47->getPosition_0(v47);
cocos2d::CCPoint::operator+(v71, &v106);
v72 = ((double (__fastcall *)(struct cocos2d::CCLabelBMFont *, cocos2d::CCSize *))v69->setPosition_0)(v69, &v106);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v69->setScale_0)(v69);
cocos2d::CCArray::addObject(a1->m_progressObjects, v69);
v73 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
a1->m_nameLabel = v73;
v74 = v73->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v72, 0.0);
v74->setAnchorPoint(a1->m_nameLabel, v75);
a1->m_levelDisplay->addChild_1(a1->m_levelDisplay, a1->m_nameLabel);
cocos2d::CCArray::addObject(a1->m_levelObjects, a1->m_nameLabel);
v76 = cocos2d::CCSprite::createWithSpriteFrameName("diffIcon_01_btn_001.png");
v77 = a1->m_levelDisplay;
a1->m_difficultySprite = v76;
v77->addChild_1(v77, v76);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_difficultySprite->setScale_0)(a1->m_difficultySprite);
cocos2d::CCArray::addObject(a1->m_levelObjects, a1->m_difficultySprite);
v78 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_starsIcon_001.png");
v79 = a1->m_levelDisplay;
a1->m_starsSprite = v78;
v79->addChild_1(v79, v78);
v80 = ((float (__fastcall *)(cocos2d::CCSprite *))a1->m_starsSprite->setScale_0)(a1->m_starsSprite);
v81 = a1->m_starsSprite->__vftable;
cocos2d::CCPoint::CCPoint(v80, a1->m_levelDisplaySize.width - 15.0);
v81->setPosition_0(a1->m_starsSprite, v82);
cocos2d::CCArray::addObject(a1->m_levelObjects, a1->m_starsSprite);
v83 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
v84 = a1->m_levelDisplay;
a1->m_starsLabel = v83;
v85 = ((float (__fastcall *)(cocos2d::extension::CCScale9Sprite *, cocos2d::CCLabelBMFont *))v84->addChild_1)(
v84,
v83);
v86 = a1->m_starsLabel->__vftable;
cocos2d::CCPoint::CCPoint(v85, 1.0);
v88 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v86->setAnchorPoint)(a1->m_starsLabel, v87);
cocos2d::CCPoint::CCPoint(v88, -12.0);
v89 = a1->m_starsSprite->getPosition_0(a1->m_starsSprite);
cocos2d::CCPoint::operator+(v89, &v106);
v90 = ((double (__fastcall *)(cocos2d::CCLabelBMFont *, cocos2d::CCSize *))a1->m_starsLabel->setPosition_0)(
a1->m_starsLabel,
&v106);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_starsLabel->setScale_0)(a1->m_starsLabel);
cocos2d::CCArray::addObject(a1->m_levelObjects, a1->m_starsLabel);
v92 = (cocos2d::CCArray *)cocos2d::CCArray::create(v91);
a1->m_coins = v92;
cocos2d::CCObject::retain(v92);
cocos2d::CCPoint::CCPoint(*(float *)&v90, a1->m_levelDisplaySize.width - 16.0);
for ( i = 2; i >= 0; --i )
{
v94 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_coinsIcon_001.png");
a1->m_levelDisplay->addChild_1(a1->m_levelDisplay, v94);
v95 = ((float (__fastcall *)(struct cocos2d::CCSprite *))v94->setScale_0)(v94);
cocos2d::CCPoint::CCPoint(v95, (float)i * -26.0);
cocos2d::CCPoint::operator+(v103, &v106);
v94->setPosition_0(v94, (const cocos2d::CCPoint *)&v106);
cocos2d::CCArray::addObject(a1->m_coins, v94);
cocos2d::CCArray::addObject(a1->m_levelObjects, v94);
}
v97 = (cocos2d::CCArray *)cocos2d::CCArray::create(v96);
a1->m_dynamicObjects = v97;
cocos2d::CCObject::retain(v97);
if ( *(_BYTE *)(cocos2d::CCApplication::sharedApplication(v99, v98) + 197) )
{
v100 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_Start_001.png");
v101 = ((float (__fastcall *)(cocos2d::CCNode *, struct cocos2d::CCSprite *, __int64))v25->addChild_0)(
v25,
v100,
10);
cocos2d::CCPoint::CCPoint(v101, 0.0);
v102 = a1->m_levelDisplay->getPosition_0(a1->m_levelDisplay);
cocos2d::CCPoint::operator+(v102, &v106);
v100->setPosition_0(v100, (const cocos2d::CCPoint *)&v106);
cocos2d::CCArray::addObject(a1->m_levelObjects, v100);
}
return 1;
}
return result;
}