//
// LevelInfoLayer::setupLevelInfo from 0x1402fae10 to 0x1402fba5d (3149 bytes)
//
// 2 xrefs:
// > LevelInfoLayer::init @ 0x1402f8106
// > ??> @ 0x1406d4178
//
// 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
//
// Hidden C++ exception states: #wind=3
void LevelInfoLayer::setupLevelInfo(LevelInfoLayer *a1)
{
unsigned int v2; // esi
cocos2d::CCArray *v3; // rax
__int64 v4; // rcx
cocos2d::CCDirector *v5; // rax
struct cocos2d::CCSprite *v6; // r15
struct cocos2d::CCSprite *v7; // r12
cocos2d::CCLabelBMFont *v8; // rax
float v9; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v10; // rbx
const cocos2d::CCPoint *v11; // rax
cocos2d::CCLabelBMFont *v12; // rax
float v13; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v14; // rbx
const cocos2d::CCPoint *v15; // rax
cocos2d::CCLabelBMFont *v16; // rax
float v17; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v18; // rbx
const cocos2d::CCPoint *v19; // rax
cocos2d::CCLabelBMFont *v20; // rax
float v21; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v22; // rbx
const cocos2d::CCPoint *v23; // rax
cocos2d::CCLabelBMFont *v24; // rax
float v25; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v26; // rbx
double v27; // xmm0_8
const cocos2d::CCPoint *v28; // rax
GJGameLevel *m_level; // rax
int v30; // r14d
float v31; // xmm9_4
cocos2d::CCSprite_vtbl *v32; // rbx
__int64 v33; // rax
float v34; // xmm0_4
cocos2d::CCSprite_vtbl *v35; // rbx
double v36; // xmm0_8
const cocos2d::CCPoint *v37; // rax
cocos2d::CCLabelBMFont_vtbl *v38; // rbx
__int64 v39; // rax
float v40; // xmm0_4
cocos2d::CCSprite_vtbl *v41; // rbx
__int64 v42; // rax
float v43; // xmm0_4
cocos2d::CCSprite_vtbl *v44; // rbx
double v45; // xmm0_8
const cocos2d::CCPoint *v46; // rax
cocos2d::CCLabelBMFont_vtbl *v47; // rbx
__int64 v48; // rax
float v49; // xmm0_4
cocos2d::CCSprite_vtbl *v50; // rbx
__int64 v51; // rax
float v52; // xmm0_4
cocos2d::CCSprite_vtbl *v53; // rbx
double v54; // xmm0_8
const cocos2d::CCPoint *v55; // rax
cocos2d::CCLabelBMFont_vtbl *v56; // rbx
__int64 v57; // rax
float v58; // xmm0_4
const cocos2d::CCPoint *v59; // rax
float v60; // xmm0_4
cocos2d::CCSprite_vtbl *v61; // rbx
__int64 v62; // rax
float v63; // xmm0_4
cocos2d::CCSprite_vtbl *v64; // rbx
double v65; // xmm0_8
const cocos2d::CCPoint *v66; // rax
cocos2d::CCLabelBMFont_vtbl *v67; // rbx
const cocos2d::CCPoint *v68; // rax
float v69; // xmm0_4
__int64 v70; // rax
GJDifficultySprite *v71; // rax
const char *v72; // rcx
cocos2d::CCSprite *v73; // rax
float v74; // xmm0_4
cocos2d::CCLabelBMFont *v75; // rax
float v76; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v77; // rbx
__int64 v78; // rax
float v79; // xmm0_4
const cocos2d::CCPoint *v80; // rax
GJGameLevel *v81; // rcx
struct cocos2d::CCSprite *v83; // r15
int v84; // ebx
GameStatsManager *v85; // rcx
int v86; // r12d
int AwardedDiamondsForLevel; // r13d
cocos2d::CCString *v88; // rax
const char *CString; // rax
size_t v90; // r8
const char *v91; // rcx
struct cocos2d::CCLabelBMFont *v92; // r14
float v93; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v94; // rbx
const cocos2d::CCPoint *v95; // rax
float *v96; // rbx
float v97; // xmm0_4
float v98; // xmm0_4
__int64 v99; // rax
struct cocos2d::CCObject *v100; // rax
cocos2d::CCPoint v101; // [rsp+28h] [rbp-79h] BYREF
void *v102; // [rsp+30h] [rbp-71h]
float v103; // [rsp+38h] [rbp-69h]
__int128 v104; // [rsp+40h] [rbp-61h] BYREF
__int64 v105; // [rsp+50h] [rbp-51h]
unsigned __int64 v106; // [rsp+58h] [rbp-49h]
v2 = 0;
v3 = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);
a1->m_icons = v3;
cocos2d::CCObject::retain(v3);
v5 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v4);
cocos2d::CCDirector::getWinSize(v5);
v6 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_timeIcon_001.png");
v7 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_downloadsIcon_001.png");
a1->m_orbsIcon = cocos2d::CCSprite::createWithSpriteFrameName((const char *)&xmmword_14053DCE8);
a1->m_likesIcon = cocos2d::CCSprite::createWithSpriteFrameName("GJ_likesIcon_001.png");
v8 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
a1->m_lengthLabel = v8;
v9 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v8->setScale_0)(v8);
v10 = a1->m_lengthLabel->__vftable;
cocos2d::CCPoint::CCPoint(v9, 0.0);
v10->setAnchorPoint(a1->m_lengthLabel, v11);
v12 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
a1->m_exactLengthLabel = v12;
v13 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v12->setScale_0)(v12);
v14 = a1->m_exactLengthLabel->__vftable;
cocos2d::CCPoint::CCPoint(v13, 0.0);
v14->setAnchorPoint(a1->m_exactLengthLabel, v15);
v16 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
a1->m_downloadsLabel = v16;
v17 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v16->setScale_0)(v16);
v18 = a1->m_downloadsLabel->__vftable;
cocos2d::CCPoint::CCPoint(v17, 0.0);
v18->setAnchorPoint(a1->m_downloadsLabel, v19);
v20 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
a1->m_likesLabel = v20;
v21 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v20->setScale_0)(v20);
v22 = a1->m_likesLabel->__vftable;
cocos2d::CCPoint::CCPoint(v21, 0.0);
v22->setAnchorPoint(a1->m_likesLabel, v23);
v24 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
a1->m_orbsLabel = v24;
v25 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v24->setScale_0)(v24);
v26 = a1->m_orbsLabel->__vftable;
v27 = cocos2d::CCPoint::CCPoint(v25, 0.0);
v26->setAnchorPoint(a1->m_orbsLabel, v28);
cocos2d::CCArray::addObject(a1->m_icons, v6);
cocos2d::CCArray::addObject(a1->m_icons, v7);
cocos2d::CCArray::addObject(a1->m_icons, a1->m_orbsIcon);
cocos2d::CCArray::addObject(a1->m_icons, a1->m_likesIcon);
cocos2d::CCArray::addObject(a1->m_icons, a1->m_downloadsLabel);
cocos2d::CCArray::addObject(a1->m_icons, a1->m_lengthLabel);
cocos2d::CCArray::addObject(a1->m_icons, a1->m_exactLengthLabel);
cocos2d::CCArray::addObject(a1->m_icons, a1->m_likesLabel);
cocos2d::CCArray::addObject(a1->m_icons, a1->m_orbsLabel);
a1->addChild_1(a1, v6);
a1->addChild_1(a1, v7);
a1->addChild_1(a1, a1->m_orbsIcon);
a1->addChild_1(a1, a1->m_likesIcon);
a1->addChild_1(a1, a1->m_downloadsLabel);
a1->addChild_1(a1, a1->m_lengthLabel);
a1->addChild_1(a1, a1->m_exactLengthLabel);
a1->addChild_1(a1, a1->m_likesLabel);
a1->addChild_1(a1, a1->m_orbsLabel);
m_level = a1->m_level;
v30 = m_level->m_stars.random - m_level->m_stars.seed;
LODWORD(v101.x) = m_level->m_levelLength;
v31 = (float)(v103 * 0.5) + 80.0;
a1->m_iconOffset = 10.0;
v32 = v7->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v27, 0.0);
v34 = ((float (__fastcall *)(struct cocos2d::CCSprite *, __int64))v32->setAnchorPoint)(v7, v33);
v35 = v7->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v36 = cocos2d::CCPoint::CCPoint(v34, v31);
v35->setPosition_0(v7, v37);
v38 = a1->m_downloadsLabel->__vftable;
v7->getPosition_0(v7);
cocos2d::CCPoint::CCPoint(*(float *)&v36, v31 + 33.0);
v40 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v38->setPosition_0)(a1->m_downloadsLabel, v39);
v41 = a1->m_likesIcon->__vftable;
cocos2d::CCPoint::CCPoint(v40, 0.0);
v43 = ((float (__fastcall *)(cocos2d::CCSprite *, __int64))v41->setAnchorPoint)(a1->m_likesIcon, v42);
v44 = a1->m_likesIcon->__vftable;
v45 = cocos2d::CCPoint::CCPoint(v43, v31);
v44->setPosition_0(a1->m_likesIcon, v46);
v47 = a1->m_likesLabel->__vftable;
a1->m_likesIcon->getPosition_0(a1->m_likesIcon);
cocos2d::CCPoint::CCPoint(*(float *)&v45, v31 + 33.0);
v49 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v47->setPosition_0)(a1->m_likesLabel, v48);
v50 = v6->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v49, 0.0);
v52 = ((float (__fastcall *)(struct cocos2d::CCSprite *, __int64))v50->setAnchorPoint)(v6, v51);
v53 = v6->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v54 = cocos2d::CCPoint::CCPoint(v52, v31);
v53->setPosition_0(v6, v55);
*(float *)&v7 = v101.x;
v56 = a1->m_lengthLabel->__vftable;
v6->getPosition_0(v6);
cocos2d::CCPoint::CCPoint(*(float *)&v54, v31 + 33.0);
v58 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v56->setPosition_0)(a1->m_lengthLabel, v57);
cocos2d::CCPoint::CCPoint(v58, 0.0);
v59 = a1->m_lengthLabel->getPosition_0(a1->m_lengthLabel);
cocos2d::CCPoint::operator+(v59, &v101);
v60 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *, cocos2d::CCPoint *))a1->m_exactLengthLabel->setPosition_0)(
a1->m_exactLengthLabel,
&v101);
v61 = a1->m_orbsIcon->__vftable;
cocos2d::CCPoint::CCPoint(v60, 0.0);
v63 = ((float (__fastcall *)(cocos2d::CCSprite *, __int64))v61->setAnchorPoint)(a1->m_orbsIcon, v62);
v64 = a1->m_orbsIcon->__vftable;
v65 = cocos2d::CCPoint::CCPoint(v63, v31 + 1.0);
v64->setPosition_0(a1->m_orbsIcon, v66);
v67 = a1->m_orbsLabel->__vftable;
a1->m_orbsIcon->getPosition_0(a1->m_orbsIcon);
cocos2d::CCPoint::CCPoint(*(float *)&v65, v31 + 33.0);
v67->setPosition_0(a1->m_orbsLabel, v68);
a1->m_orbsIcon->setVisible(a1->m_orbsIcon, v30 > 0);
v69 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *, bool))a1->m_orbsLabel->setVisible)(a1->m_orbsLabel, v30 > 0);
cocos2d::CCPoint::CCPoint(v69, (float)(v103 * 0.5) - 100.0);
cocos2d::CCPoint::operator=(&a1->m_basePosition, v70);
v71 = GJDifficultySprite::create(1, Long);
a1->m_difficultySprite = v71;
a1->addChild_0(a1, v71, 3);
a1->m_difficultySprite->setPosition_0(a1->m_difficultySprite, &a1->m_basePosition);
v72 = "star_small01_001.png";
if ( (_DWORD)v7 == 5 )
v72 = "moon_small01_001.png";
v73 = cocos2d::CCSprite::createWithSpriteFrameName(v72);
a1->m_starsIcon = v73;
v74 = ((float (__fastcall *)(LevelInfoLayer *, cocos2d::CCSprite *))a1->addChild_1)(a1, v73);
cocos2d::CCPoint::CCPoint(v74, 8.0);
cocos2d::CCPoint::operator+(&a1->m_basePosition, &v101);
a1->m_starsIcon->setPosition_0(a1->m_starsIcon, &v101);
v75 = cocos2d::CCLabelBMFont::create("0", (const char *)&qword_14052A4D8);
a1->m_starsLabel = v75;
v76 = ((float (__fastcall *)(LevelInfoLayer *, cocos2d::CCLabelBMFont *))a1->addChild_1)(a1, v75);
v77 = a1->m_starsLabel->__vftable;
cocos2d::CCPoint::CCPoint(v76, 1.0);
v79 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v77->setAnchorPoint)(a1->m_starsLabel, v78);
cocos2d::CCPoint::CCPoint(v79, -8.0);
v80 = a1->m_starsIcon->getPosition_0(a1->m_starsIcon);
cocos2d::CCPoint::operator+(v80, &v101);
a1->m_starsLabel->setPosition_0(a1->m_starsLabel, &v101);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_starsLabel->setScale_0)(a1->m_starsLabel);
a1->m_baseStarsY = a1->m_starsLabel->getPosition_0(a1->m_starsLabel)->y;
if ( v30 > 0 )
{
v81 = a1->m_level;
if ( v81->m_dailyID.random - v81->m_dailyID.seed > 0 || v81->m_gauntletLevel )
{
v83 = cocos2d::CCSprite::createWithSpriteFrameName("diamond_small01_001.png");
a1->addChild_1(a1, v83);
v84 = a1->m_level->m_stars.random - a1->m_level->m_stars.seed;
v85 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v102 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v102);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v85 = (GameStatsManager *)qword_1406C2EE8;
}
v86 = v84 + 2;
if ( (unsigned int)(v84 - 2) > 8 )
v86 = 0;
if ( !v85 )
{
v102 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v102);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v85 = (GameStatsManager *)qword_1406C2EE8;
}
AwardedDiamondsForLevel = GameStatsManager::getAwardedDiamondsForLevel(v85, a1->m_level);
v88 = cocos2d::CCString::createWithFormat("%i/%i", AwardedDiamondsForLevel, v86);
CString = cocos2d::CCString::getCString(v88);
v104 = 0;
v105 = 0;
v106 = 0;
v90 = -1;
do
++v90;
while ( CString[v90] );
sub_14003A930(&v104, CString, v90);
v91 = (const char *)&v104;
if ( v106 > 0xF )
v91 = (const char *)v104;
v92 = cocos2d::CCLabelBMFont::create(v91, (const char *)&qword_14052A4D8);
v93 = ((float (__fastcall *)(LevelInfoLayer *, struct cocos2d::CCLabelBMFont *))a1->addChild_1)(a1, v92);
v94 = v92->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v93, 1.0);
v94->setAnchorPoint(v92, v95);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v92->setScale_0)(v92);
v96 = (float *)v92->getContentSize(v92);
v97 = v92->getScale(v92) * *v96;
cocos2d::CCPoint::CCPoint((float)(v97 * 0.5) + 2.0, (float)(v97 * 0.5) + 2.0);
cocos2d::CCPoint::operator+(&a1->m_basePosition, &v101);
v98 = ((float (__fastcall *)(struct cocos2d::CCSprite *, cocos2d::CCPoint *))v83->setPosition_0)(v83, &v101);
cocos2d::CCPoint::CCPoint(v98, -8.0);
v99 = (__int64)v83->getPosition_0(v83);
cocos2d::CCPoint::operator+(v99, &v101);
v92->setPosition_0(v92, &v101);
if ( AwardedDiamondsForLevel == v86 )
{
LOWORD(v101.x) = -156;
BYTE2(v101.x) = -1;
v92->setColor(&v92->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v101);
}
sub_14003A830((__int64)&v104);
}
}
if ( a1->m_challenge )
{
if ( cocos2d::CCArray::count(a1->m_icons) )
{
do
{
v100 = cocos2d::CCArray::objectAtIndex(a1->m_icons, v2);
((void (__fastcall *)(struct cocos2d::CCObject *, _QWORD))v100->__vftable[4].update)(v100, 0);
++v2;
}
while ( v2 < cocos2d::CCArray::count(a1->m_icons) );
}
a1->m_orbsIcon->setVisible(a1->m_orbsIcon, 0);
a1->m_orbsLabel->setVisible(a1->m_orbsLabel, 0);
}
LevelInfoLayer::updateLabelValues(a1);
}