//
// MapPackCell::loadFromMapPack from 0x333900 to 0x334108 (2056 bytes)
//
// 2 xrefs:
// > MapPackCell::reloadCell @ 0x334138
// > CustomListView::loadCell @ 0x33bbee
//
// 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)
{
const char *m_difficulty; // r6
cocos2d::CCString *v5; // r0
const char *CString; // r0
cocos2d::CCSprite *v7; // r5
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCLabelBMFont *v9; // r5
void (__fastcall *setColor)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::ccColor3B *); // r2
GJMapPack *m_mapPack; // r3
GLubyte g; // r0
GLubyte b; // r1
void (__fastcall *v14)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
void (__fastcall *setScale)(cocos2d::CCLabelBMFont *__hidden, float); // r7
float *v16; // r0
void (__fastcall *v17)(cocos2d::CCLabelBMFont *__hidden, float); // r7
int v18; // r1
ButtonSprite *v19; // r7
CCMenuItemSpriteExtra *v20; // r0
cocos2d::CCNode *v21; // r5
float m_width; // s17
void (__fastcall *v23)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
float *v24; // r0
GameStatsManager *v25; // r0
const char *v26; // r1
_BOOL4 hasCompletedMapPack; // r7
int v28; // r8
cocos2d::CCNode *v29; // r5
void (__fastcall *v30)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
const char *v31; // r1
float *v32; // r8
void (__fastcall *v33)(float *, cocos2d::CCRect *); // r2
GJMapPack *v34; // r3
GLubyte v35; // r0
GLubyte v36; // r1
float v37; // s17
void (__fastcall *v38)(float *, cocos2d::CCRect *); // r9
void (__fastcall *v39)(float *, cocos2d::CCRect *); // r9
int v40; // r0
int v41; // s17
int v42; // r0
float v43; // s14
void (__fastcall *v44)(float *, cocos2d::CCRect *); // r9
float v45; // s17
float v46; // r3
const char *v47; // r8
int v48; // r0
cocos2d::CCString *v49; // r0
cocos2d::CCLabelBMFont *v50; // r8
void (__fastcall *v51)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
int v52; // r0
GJMapPack *v53; // r2
float v54; // s19
int v55; // r10
cocos2d::CCSprite *v56; // r8
void (__fastcall *v57)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9
float v58; // s15
cocos2d::CCString *v59; // r0
cocos2d::CCLabelBMFont *v60; // r6
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r11
void (__fastcall *v62)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::ccColor3B *); // r2
cocos2d::CCSprite *v63; // r9
void (__fastcall *v64)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r6
float v65; // s15
cocos2d::CCString *v66; // r0
cocos2d::CCLabelBMFont *v67; // r6
void (__fastcall *v68)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r10
int v69; // r11
void (__fastcall *v70)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::ccColor3B *); // r2
cocos2d::CCSprite *v71; // r6
void (__fastcall *v72)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
int v73; // r8
cocos2d::CCSprite *v74; // r0
CCMenuItemSpriteExtra *v75; // r0
CCMenuItemSpriteExtra *m_rewardButton; // r5
void (__fastcall *v77)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
const cocos2d::CCPoint *v78; // r0
float v79; // [sp+10h] [bp-44h]
int v80; // [sp+14h] [bp-40h]
void (__fastcall *v81)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+14h] [bp-40h]
void (__fastcall *v82)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+1Ch] [bp-38h]
_BYTE v83[4]; // [sp+20h] [bp-34h] BYREF
cocos2d::CCPoint v84; // [sp+24h] [bp-30h] BYREF
void (*v85)(MapPackCell *, cocos2d::CCObject *); // [sp+2Ch] [bp-28h]
int v86; // [sp+30h] [bp-24h]
void (*v87)(MapPackCell *, cocos2d::CCObject *); // [sp+34h] [bp-20h]
int v88; // [sp+38h] [bp-1Ch]
cocos2d::CCRect v89; // [sp+3Ch] [bp-18h] BYREF
a1->m_mainLayer->removeAllChildrenWithCleanup(a1->m_mainLayer, 1);
cocos2d::CCArray::removeAllObjects(a1->m_rewardSprites);
cocos2d::CCArray::removeAllObjects(a1->m_rewardLabels);
a1->m_mapPack = a2;
m_difficulty = (const char *)a2->m_difficulty;
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"difficulty_%02d_btn_001.png",
m_difficulty);
CString = cocos2d::CCString::getCString(v5);
if ( !m_difficulty )
CString = "difficulty_auto_btn_001.png";
v7 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
setPosition = v7->setPosition;
cocos2d::CCPoint::CCPoint(&v89.origin, 31.0, a1->m_height * 0.5);
setPosition(v7, &v89.origin);
((void (__fastcall *)(cocos2d::CCSprite *, int))v7->setScale)(v7, 1066192077);
a1->addChild_0(a1, v7, 2);
sub_775C20(&v89, &a1->m_mapPack->m_packName);
v9 = cocos2d::CCLabelBMFont::create();
sub_774008(&v89);
a1->m_mainLayer->addChild(a1->m_mainLayer, v9);
setColor = v9->setColor;
m_mapPack = a1->m_mapPack;
g = m_mapPack->m_barColour.g;
b = m_mapPack->m_barColour.b;
LOBYTE(m_mapPack) = m_mapPack->m_barColour.r;
BYTE1(v89.origin.x) = g;
BYTE2(v89.origin.x) = b;
LOBYTE(v89.origin.x) = (_BYTE)m_mapPack;
setColor(v9, (const cocos2d::ccColor3B *)&v89);
v14 = v9->setPosition;
cocos2d::CCPoint::CCPoint(
&v89.origin,
(float)((float)(a1->m_width * 0.5) - 14.0) - 2.0,
(float)(a1->m_height * 0.5) + 30.0);
v14(v9, &v89.origin);
if ( v9->getContentSize(v9)->width > 205.0 )
{
setScale = v9->setScale;
v16 = (float *)v9->getContentSize(v9);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _DWORD))setScale)(v9, 205.0 / *v16);
}
v17 = v9->setScale;
if ( v9->getScale(v9) > 0.9 )
v18 = 1063675494;
else
v18 = ((int (__fastcall *)(cocos2d::CCLabelBMFont *))v9->getScale)(v9);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v17)(v9, v18);
v85 = MapPackCell::onClick;
v86 = 0;
v19 = ButtonSprite::create(
(ButtonSprite *)"View",
(const char *)&word_32,
0,
0.6,
0,
"bigFont.fnt",
"GJ_button_01.png",
(const char *)0x42480000,
v79);
v20 = CCMenuItemSpriteExtra::create(
v19,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(MapPackCell::onClick, (unsigned int)a1));
a1->m_viewButton = v20;
CCMenuItemSpriteExtra::setSizeMult(v20, 1.5);
v21 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)a1->m_viewButton, nullptr);
a1->m_mainLayer->addChild(a1->m_mainLayer, v21);
m_width = a1->m_width;
v23 = v21->setPosition;
v24 = (float *)v19->getContentSize(v19);
cocos2d::CCPoint::CCPoint(&v89.origin, (float)(m_width - (float)(*v24 * 0.5)) - 9.0, a1->m_height * 0.5);
v23(v21, &v89.origin);
v25 = GameStatsManager::sharedState();
hasCompletedMapPack = GameStatsManager::hasCompletedMapPack(v25, a1->m_mapPack->m_packID);
if ( !hasCompletedMapPack )
{
v28 = GJMapPack::completedMaps(a1->m_mapPack);
if ( v28 >= 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");
v87 = MapPackCell::onClaimReward;
v88 = 0;
v75 = CCMenuItemSpriteExtra::create(
v74,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(MapPackCell::onClaimReward, (unsigned int)a1));
a1->m_rewardButton = v75;
CCMenuItemSpriteExtra::setSizeMult(v75, 1.5);
v21->addChild(v21, a1->m_rewardButton);
m_rewardButton = a1->m_rewardButton;
v77 = m_rewardButton->setPosition;
v78 = a1->m_viewButton->getPosition(a1->m_viewButton);
v77(m_rewardButton, v78);
}
}
v83[0] = 0;
v83[1] = 0;
v83[2] = 0;
v29 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v26);
((void (__fastcall *)(cocos2d::CCNode *, _BYTE *))v29->__vftable[1].getTag)(v29, v83);
((void (__fastcall *)(cocos2d::CCNode *, int))v29->__vftable[1].~CCNode_0)(v29, 125);
((void (__fastcall *)(cocos2d::CCNode *, int))v29->setScaleY)(v29, 1061997773);
((void (__fastcall *)(cocos2d::CCNode *, int))v29->setScaleX)(v29, 1058642330);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v29, 3);
v30 = v29->setPosition;
cocos2d::CCPoint::CCPoint(&v89.origin, (float)(a1->m_width * 0.5) - 14.0, (float)(a1->m_height * 0.5) - 2.0);
v30(v29, &v89.origin);
v32 = (float *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v31);
(*(void (__fastcall **)(float *, int))(*(_DWORD *)v32 + 64))(v32, 1065101558);
(*(void (__fastcall **)(float *, int))(*(_DWORD *)v32 + 72))(v32, 1062501089);
v33 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_DWORD *)v32 + 472);
v34 = a1->m_mapPack;
v35 = v34->m_textColour.g;
v36 = v34->m_textColour.b;
LOBYTE(v34) = v34->m_textColour.r;
BYTE1(v89.origin.x) = v35;
BYTE2(v89.origin.x) = v36;
LOBYTE(v89.origin.x) = (_BYTE)v34;
v33(v32, &v89);
v37 = v32[86] - (float)(v32[86] * 0.985);
v29->addChild_0(v29, (cocos2d::CCNode *)v32, 1);
v38 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_DWORD *)v32 + 140);
cocos2d::CCPoint::CCPoint(&v89.origin, 0.0, 0.5);
v38(v32, &v89);
v39 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_DWORD *)v32 + 92);
v40 = (int)v29->getContentSize(v29);
cocos2d::CCPoint::CCPoint(&v89.origin, v37 * 0.5, *(float *)(v40 + 4) * 0.5);
v39(v32, &v89);
v41 = GJMapPack::completedMaps(a1->m_mapPack);
v42 = GJMapPack::totalMaps(a1->m_mapPack);
v43 = v32[86];
v44 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_DWORD *)v32 + 560);
v45 = (float)v41 / (float)v42;
if ( v43 > (float)(v43 * v45) )
v46 = v43 * v45;
else
v46 = v32[86];
cocos2d::CCRect::CCRect(&v89, 0.0, 0.0, v46, v32[87]);
v44(v32, &v89);
v47 = (const char *)GJMapPack::completedMaps(a1->m_mapPack);
v48 = GJMapPack::totalMaps(a1->m_mapPack);
v49 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i/%i", v47, v48);
cocos2d::CCString::getCString(v49);
v50 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v50, 4);
v51 = v50->setPosition;
v52 = (int)v29->getPosition(v29);
v51(v50, (const cocos2d::CCPoint *)v52);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v50->setScale)(v50, 1056964608);
v53 = a1->m_mapPack;
v54 = (float)(a1->m_height * 0.5) - 30.0;
if ( v53->m_coins > 0 )
v55 = (v53->m_stars > 0) + 1;
else
v55 = v53->m_stars > 0;
if ( v53->m_stars > 0 )
{
v56 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_starsIcon_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v56, 2);
v57 = v56->setPosition;
v58 = (float)(a1->m_width * 0.5) - 4.0;
if ( v55 == 2 )
v58 = v58 - 40.0;
cocos2d::CCPoint::CCPoint(&v89.origin, v58, v54);
v57(v56, &v89.origin);
v59 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)a1->m_mapPack->m_stars);
cocos2d::CCString::getCString(v59);
v60 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v60, 1);
setAnchorPoint = v60->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v89.origin, 1.0, 0.5);
setAnchorPoint(v60, &v89.origin);
v82 = v60->setPosition;
v80 = (int)v56->getPosition(v56);
cocos2d::CCPoint::CCPoint(&v84, -17.0, 0.0);
cocos2d::CCPoint::operator+(&v89, v80, &v84);
v82(v60, &v89.origin);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v60->setScale)(v60, 1060320051);
cocos2d::CCArray::addObject(a1->m_rewardSprites, v56);
cocos2d::CCArray::addObject(a1->m_rewardLabels, v60);
if ( hasCompletedMapPack )
{
v62 = v60->setColor;
LOWORD(v89.origin.x) = -1;
BYTE2(v89.origin.x) = 50;
v62(v60, (const cocos2d::ccColor3B *)&v89);
}
}
if ( a1->m_mapPack->m_coins <= 0 )
{
if ( !hasCompletedMapPack )
return;
goto LABEL_28;
}
v63 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_coinsIcon_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v63, 2);
v64 = v63->setPosition;
v65 = (float)(a1->m_width * 0.5) - 4.0;
if ( v55 == 2 )
v65 = v65 + 40.0;
cocos2d::CCPoint::CCPoint(&v89.origin, v65, v54);
v64(v63, &v89.origin);
v66 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)a1->m_mapPack->m_coins);
cocos2d::CCString::getCString(v66);
v67 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v67, 1);
v68 = v67->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v89.origin, 1.0, 0.5);
v68(v67, &v89.origin);
v81 = v67->setPosition;
v69 = (int)v63->getPosition(v63);
cocos2d::CCPoint::CCPoint(&v84, -19.0, 0.0);
cocos2d::CCPoint::operator+(&v89, v69, &v84);
v81(v67, &v89.origin);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v67->setScale)(v67, 1060320051);
cocos2d::CCArray::addObject(a1->m_rewardSprites, v63);
cocos2d::CCArray::addObject(a1->m_rewardLabels, v67);
if ( hasCompletedMapPack )
{
v70 = v67->setColor;
LOWORD(v89.origin.x) = -1;
BYTE2(v89.origin.x) = 50;
v70(v67, (const cocos2d::ccColor3B *)&v89);
LABEL_28:
v71 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_completesIcon_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v71, 5);
((void (__fastcall *)(cocos2d::CCSprite *, int))v71->setScale)(v71, 1065353216);
v72 = v71->setPosition;
v73 = (int)v29->getPosition(v29);
cocos2d::CCPoint::CCPoint(&v84, 86.0, 1.0);
cocos2d::CCPoint::operator+(&v89, v73, &v84);
v72(v71, &v89.origin);
}
}