//
// MapPackCell::loadFromMapPack from 0x61294c to 0x6134c8 (2940 bytes)
//
// 3 xrefs:
// > MapPackCell::reloadCell @ 0x6134f8
// > CustomListView::loadCell @ 0x620658
// > ??> @ 0x46968
//
// 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
//
void MapPackCell::loadFromMapPack(MapPackCell *a1, GJMapPack *a2)
{
GJDifficulty m_difficulty; // w20
cocos2d::CCString *v5; // x0
const char *CString; // x0
cocos2d::CCSprite *v7; // x21
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCLabelBMFont *v9; // x21
void *v10; // x0
GJMapPack *m_mapPack; // x2
void (__fastcall *setColor)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::ccColor3B *); // x3
GLubyte g; // w5
GLubyte b; // w4
void (__fastcall *v15)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
float width; // s0
void (__fastcall *v17)(cocos2d::CCLabelBMFont *__hidden, float); // x23
float v18; // s0
float v19; // s1
const char *v20; // x6
cocos2d::CCNode *v21; // x23
CCMenuItemSpriteExtra *v22; // x0
cocos2d::CCNode *v23; // x21
cocos2d::CCNode *v24; // x0
float m_width; // s8
const cocos2d::CCSize *(__fastcall *getContentSize)(const cocos2d::CCNode *__hidden); // x1
void (__fastcall *v27)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
float *v28; // x0
GameStatsManager *v29; // x0
bool hasCompletedMapPack; // w0
const char *v31; // x1
_BOOL4 v32; // w27
cocos2d::CCNode *v33; // x21
void (__fastcall *v34)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
const char *v35; // x1
float *v36; // x23
GJMapPack *v37; // x2
void (__fastcall *v38)(float *, cocos2d::CCRect *); // x3
GLubyte v39; // w5
GLubyte v40; // w4
float v41; // s9
void (__fastcall *v42)(float *, cocos2d::CCRect *); // x25
void (__fastcall *v43)(float *, cocos2d::CCRect *); // x25
__int64 v44; // x0
int v45; // w0
float v46; // s1
float v47; // s2
void (__fastcall *v48)(float *, cocos2d::CCRect *); // x25
unsigned int v49; // w0
cocos2d::CCString *v50; // x0
cocos2d::CCLabelBMFont *v51; // x23
void (__fastcall *v52)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
__int64 v53; // x0
GJMapPack *v54; // x0
int m_stars; // w1
float v56; // s8
int v57; // w28
cocos2d::CCSprite *v58; // x26
void (__fastcall *v59)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCString *v60; // x0
cocos2d::CCLabelBMFont *v61; // x23
cocos2d::CCSprite *v62; // x23
void (__fastcall *v63)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
cocos2d::CCString *v64; // x0
cocos2d::CCLabelBMFont *v65; // x22
void (__fastcall *v66)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x26
void (__fastcall *v67)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
__int64 v68; // x28
void (__fastcall *v69)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::ccColor3B *); // x3
cocos2d::CCSprite *v70; // x22
void (__fastcall *v71)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x19
__int64 v72; // x21
int v73; // w23
cocos2d::CCSprite *v74; // x0
CCMenuItemSpriteExtra *v75; // x0
CCMenuItemSpriteExtra *m_rewardButton; // x21
void (__fastcall *v77)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
const cocos2d::CCPoint *v78; // x0
void (__fastcall *setScale)(cocos2d::CCLabelBMFont *__hidden, float); // x23
float *v80; // x0
void (__fastcall *v81)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::ccColor3B *); // x3
unsigned int *v82; // x2
int v83; // w1
void (__fastcall *v84)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+78h] [xbp+78h]
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // [xsp+80h] [xbp+80h]
__int64 v86; // [xsp+80h] [xbp+80h]
char *v87; // [xsp+88h] [xbp+88h]
_BYTE v88[8]; // [xsp+98h] [xbp+98h] BYREF
cocos2d::CCPoint v89; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::CCRect v90; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::SEL_MenuHandler v91; // 0:x2.16
cocos2d::SEL_MenuHandler v92; // 0:x2.16
a1->m_mainLayer->removeAllChildrenWithCleanup(a1->m_mainLayer, 1);
cocos2d::CCArray::removeAllObjects(a1->m_rewardSprites);
cocos2d::CCArray::removeAllObjects(a1->m_rewardLabels);
m_difficulty = a2->m_difficulty;
a1->m_mapPack = a2;
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"difficulty_%02d_btn_001.png",
(const char *)(unsigned int)m_difficulty);
CString = cocos2d::CCString::getCString(v5);
if ( m_difficulty == Auto )
CString = "difficulty_auto_btn_001.png";
v7 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
setPosition = v7->setPosition;
cocos2d::CCPoint::CCPoint(&v90.origin, 31.0, a1->m_height * 0.5);
setPosition(v7, &v90.origin);
v7->setScale(v7, 1.1);
a1->addChild_0(a1, v7, 2);
sub_D18D28(&v90, &a1->m_mapPack->m_packName);
v9 = cocos2d::CCLabelBMFont::create();
v10 = (void *)(*(_QWORD *)&v90.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v90.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v82 = (unsigned int *)(*(_QWORD *)&v90.origin - 8LL);
do
v83 = __ldaxr(v82);
while ( __stlxr(v83 - 1, v82) );
}
else
{
v83 = *(_DWORD *)(*(_QWORD *)&v90.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v90.origin - 8LL) = v83 - 1;
}
if ( v83 <= 0 )
operator delete(v10);
}
a1->m_mainLayer->addChild(a1->m_mainLayer, v9);
m_mapPack = a1->m_mapPack;
setColor = v9->setColor;
g = m_mapPack->m_barColour.g;
b = m_mapPack->m_barColour.b;
LOBYTE(v90.origin.x) = m_mapPack->m_barColour.r;
BYTE1(v90.origin.x) = g;
BYTE2(v90.origin.x) = b;
setColor(v9, (const cocos2d::ccColor3B *)&v90);
v15 = v9->setPosition;
cocos2d::CCPoint::CCPoint(
&v90.origin,
(float)((float)(a1->m_width * 0.5) + -14.0) - 2.0,
(float)(a1->m_height * 0.5) + 30.0);
v15(v9, &v90.origin);
width = v9->getContentSize(v9)->width;
if ( width > 205.0 )
{
setScale = v9->setScale;
v80 = (float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v9->getContentSize)(v9, width);
setScale(v9, 205.0 / *v80);
}
v17 = v9->setScale;
v18 = v9->getScale(v9);
v19 = 0.9;
if ( v18 <= 0.9 )
v19 = v9->getScale(v9);
v17(v9, v19);
v21 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"View",
(const char *)&dword_30 + 2,
0,
0,
0.6,
"bigFont.fnt",
"GJ_button_01.png",
v20,
50.0);
v91.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v91.adj = (size_t)MapPackCell::onClick;
v22 = CCMenuItemSpriteExtra::create(v21, nullptr, v91);
a1->m_viewButton = v22;
CCMenuItemSpriteExtra::setSizeMult(v22, 1.5);
v23 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)a1->m_viewButton, nullptr);
a1->m_mainLayer->addChild(a1->m_mainLayer, v23);
v24 = v21;
m_width = a1->m_width;
getContentSize = v21->getContentSize;
v27 = v23->setPosition;
v28 = (float *)getContentSize(v24);
cocos2d::CCPoint::CCPoint(&v90.origin, (float)(m_width - (float)(*v28 * 0.5)) - 9.0, a1->m_height * 0.5);
v27(v23, &v90.origin);
v29 = GameStatsManager::sharedState();
hasCompletedMapPack = GameStatsManager::hasCompletedMapPack(v29, a1->m_mapPack->m_packID);
v32 = hasCompletedMapPack;
if ( !hasCompletedMapPack )
{
v73 = GJMapPack::completedMaps(a1->m_mapPack);
if ( v73 >= GJMapPack::totalMaps(a1->m_mapPack) )
{
a1->m_viewButton->setVisible(a1->m_viewButton, 0);
a1->m_viewButton->setEnabled(a1->m_viewButton, 0);
v74 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_rewardBtn_001.png");
v92.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v92.adj = (size_t)MapPackCell::onClaimReward;
v75 = CCMenuItemSpriteExtra::create(v74, nullptr, v92);
a1->m_rewardButton = v75;
CCMenuItemSpriteExtra::setSizeMult(v75, 1.5);
v23->addChild(v23, a1->m_rewardButton);
m_rewardButton = a1->m_rewardButton;
v77 = m_rewardButton->setPosition;
v78 = a1->m_viewButton->getPosition(a1->m_viewButton);
v77(m_rewardButton, v78);
}
}
v88[0] = 0;
v88[1] = 0;
v88[2] = 0;
v33 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v31);
((void (__fastcall *)(cocos2d::CCNode *, _BYTE *))v33->__vftable[1].getTag)(v33, v88);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v33->__vftable[1].~CCNode_0)(v33, 125);
v33->setScaleY(v33, 0.8);
v33->setScaleX(v33, 0.6);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v33, 3);
v34 = v33->setPosition;
cocos2d::CCPoint::CCPoint(&v90.origin, (float)(a1->m_width * 0.5) + -14.0, (float)(a1->m_height * 0.5) + -2.0);
v34(v33, &v90.origin);
v36 = (float *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v35);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v36 + 128LL))(v36, 0.985);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v36 + 144LL))(v36, 0.83);
v37 = a1->m_mapPack;
v38 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_QWORD *)v36 + 944LL);
v39 = v37->m_textColour.g;
v40 = v37->m_textColour.b;
LOBYTE(v90.origin.x) = v37->m_textColour.r;
BYTE1(v90.origin.x) = v39;
BYTE2(v90.origin.x) = v40;
v38(v36, &v90);
v41 = v36[108] - (float)(v36[108] * 0.985);
v33->addChild_0(v33, (cocos2d::CCNode *)v36, 1);
v42 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_QWORD *)v36 + 280LL);
cocos2d::CCPoint::CCPoint(&v90.origin, 0.0, 0.5);
v42(v36, &v90);
v43 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_QWORD *)v36 + 184LL);
v44 = (__int64)v33->getContentSize(v33);
cocos2d::CCPoint::CCPoint(&v90.origin, v41 * 0.5, *(float *)(v44 + 4) * 0.5);
v43(v36, &v90);
LODWORD(v43) = GJMapPack::completedMaps(a1->m_mapPack);
v45 = GJMapPack::totalMaps(a1->m_mapPack);
v46 = v36[108];
v47 = (float)((float)(int)v43 / (float)v45) * v46;
if ( v46 <= v47 )
v47 = v36[108];
v48 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_QWORD *)v36 + 1120LL);
cocos2d::CCRect::CCRect(&v90, 0.0, 0.0, v47, v36[109]);
v48(v36, &v90);
v87 = (char *)(unsigned int)GJMapPack::completedMaps(a1->m_mapPack);
v49 = GJMapPack::totalMaps(a1->m_mapPack);
v50 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i/%i", v87, v49);
cocos2d::CCString::getCString(v50);
v51 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v51, 4);
v52 = v51->setPosition;
v53 = (__int64)v33->getPosition(v33);
v52(v51, (const cocos2d::CCPoint *)v53);
v51->setScale(v51, 0.5);
v54 = a1->m_mapPack;
m_stars = v54->m_stars;
v56 = (float)(a1->m_height * 0.5) + -30.0;
v57 = (m_stars > 0) + (v54->m_coins > 0);
if ( m_stars <= 0 )
{
if ( v54->m_coins <= 0 )
{
if ( v32 )
goto LABEL_23;
return;
}
}
else
{
v58 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_starsIcon_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v58, 2);
v59 = v58->setPosition;
if ( v57 == 2 )
cocos2d::CCPoint::CCPoint(&v90.origin, (float)((float)(a1->m_width * 0.5) + -4.0) - 40.0, v56);
else
cocos2d::CCPoint::CCPoint(&v90.origin, (float)(a1->m_width * 0.5) + -4.0, v56);
v59(v58, &v90.origin);
v60 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)a1->m_mapPack->m_stars);
cocos2d::CCString::getCString(v60);
v61 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v61, 1);
setAnchorPoint = v61->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v90.origin, 1.0, 0.5);
setAnchorPoint(v61, &v90.origin);
v84 = v61->setPosition;
v86 = (__int64)v58->getPosition(v58);
cocos2d::CCPoint::CCPoint(&v89, -17.0, 0.0);
cocos2d::CCPoint::operator+(&v90, v86, &v89);
v84(v61, &v90.origin);
v61->setScale(v61, 0.7);
cocos2d::CCArray::addObject(a1->m_rewardSprites, v58);
cocos2d::CCArray::addObject(a1->m_rewardLabels, v61);
if ( v32 )
{
v81 = v61->setColor;
LOWORD(v90.origin.x) = -1;
BYTE2(v90.origin.x) = 50;
v81(v61, (const cocos2d::ccColor3B *)&v90);
if ( a1->m_mapPack->m_coins <= 0 )
goto LABEL_23;
}
else if ( a1->m_mapPack->m_coins <= 0 )
{
return;
}
}
v62 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_coinsIcon_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v62, 2);
v63 = v62->setPosition;
if ( v57 == 2 )
cocos2d::CCPoint::CCPoint(&v90.origin, (float)((float)(a1->m_width * 0.5) + -4.0) + 40.0, v56);
else
cocos2d::CCPoint::CCPoint(&v90.origin, (float)(a1->m_width * 0.5) + -4.0, v56);
v63(v62, &v90.origin);
v64 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)a1->m_mapPack->m_coins);
cocos2d::CCString::getCString(v64);
v65 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v65, 1);
v66 = v65->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v90.origin, 1.0, 0.5);
v66(v65, &v90.origin);
v67 = v65->setPosition;
v68 = (__int64)v62->getPosition(v62);
cocos2d::CCPoint::CCPoint(&v89, -19.0, 0.0);
cocos2d::CCPoint::operator+(&v90, v68, &v89);
v67(v65, &v90.origin);
v65->setScale(v65, 0.7);
cocos2d::CCArray::addObject(a1->m_rewardSprites, v62);
cocos2d::CCArray::addObject(a1->m_rewardLabels, v65);
if ( v32 )
{
v69 = v65->setColor;
LOWORD(v90.origin.x) = -1;
BYTE2(v90.origin.x) = 50;
v69(v65, (const cocos2d::ccColor3B *)&v90);
LABEL_23:
v70 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_completesIcon_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v70, 5);
v70->setScale(v70, 1.0);
v71 = v70->setPosition;
v72 = (__int64)v33->getPosition(v33);
cocos2d::CCPoint::CCPoint(&v89, 86.0, 1.0);
cocos2d::CCPoint::operator+(&v90, v72, &v89);
v71(v70, &v90.origin);
}
}