//
// GJLevelScoreCell::loadFromScore from 0x338318 to 0x33891e (1542 bytes)
//
// 1 xrefs:
// > CustomListView::loadCell @ 0x33bcee
//
// 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 GJLevelScoreCell::loadFromScore(GJLevelScoreCell *a1, GJUserScore *a2)
{
SimplePlayer *v4; // r5
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r6
void (__fastcall *setColor)(SimplePlayer *__hidden, const cocos2d::ccColor3B *); // r6
GameManager *v7; // r0
int v8; // r0
GameManager *v9; // r0
int v10; // r0
GJUserScore *m_userScore; // r3
int m_iconID; // r1
char v13; // r2
cocos2d::CCMenuItem *v14; // r1
cocos2d::CCNode *v15; // r8
const char *m_playerRank; // r1
cocos2d::CCString *v17; // r0
cocos2d::CCLabelBMFont *v18; // r6
char *v19; // r1
cocos2d::CCSprite *v20; // r6
cocos2d::CCLabelBMFont *v21; // r6
float v22; // r1
float v23; // r2
CCMenuItemSpriteExtra *v24; // r10
float width; // s19
float v26; // s18
int v27; // r7
void (__fastcall *v28)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
float v29; // s17
float v30; // r0
cocos2d::CCLayerColor *m_backgroundLayer; // r0
void (__fastcall *v32)(cocos2d::CCLayerColor *__hidden, const cocos2d::ccColor3B *); // r3
const char *m_stars; // r10
GJUserScore *v34; // r3
cocos2d::CCPoint *v35; // r0
cocos2d::CCString *v36; // r0
char *CString; // r0
cocos2d::CCLabelBMFont *v38; // r6
cocos2d::CCLabelBMFont_vtbl *v39; // r3
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r9
void (__fastcall *v41)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
void (__fastcall *v42)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r10
void (__fastcall *v43)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
int m_secretCoins; // r11
int i; // r10
cocos2d::CCSprite *v46; // r9
cocos2d::CCString *v47; // r0
cocos2d::CCLabelBMFont *v48; // r6
void (__fastcall *v49)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r9
void (__fastcall *v50)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
void (__fastcall *v51)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [sp+8h] [bp-3Ch]
int v52; // [sp+Ch] [bp-38h]
cocos2d::CCLabelBMFont *v53; // [sp+18h] [bp-2Ch] BYREF
cocos2d::CCPoint v54; // [sp+1Ch] [bp-28h] BYREF
_BYTE v55[8]; // [sp+24h] [bp-20h] BYREF
cocos2d::CCPoint v56; // [sp+2Ch] [bp-18h] BYREF
cocos2d::CCPoint v57; // [sp+34h] [bp-10h] BYREF
cocos2d::CCPoint v58; // [sp+3Ch] [bp-8h] BYREF
cocos2d::CCPoint v59; // [sp+44h] [bp+0h] BYREF
a1->m_mainLayer->removeAllChildrenWithCleanup(a1->m_mainLayer, 1);
a1->m_userScore = a2;
v4 = SimplePlayer::create((int)&dword_0 + 1);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v4, 1);
((void (__fastcall *)(SimplePlayer *, int))v4->setScale)(v4, 1061997773);
setPosition = v4->setPosition;
cocos2d::CCPoint::CCPoint(&v59, 60.0, (float)(a1->m_height * 0.5) + 0.0);
setPosition(v4, &v59);
setColor = v4->setColor;
v7 = GameManager::sharedState();
*(cocos2d::ccColor3B *)&v8 = GameManager::colorForIdx(v7, a1->m_userScore->m_color1);
LOWORD(v59.x) = v8;
BYTE2(v59.x) = BYTE2(v8);
setColor(v4, (const cocos2d::ccColor3B *)&v59);
v9 = GameManager::sharedState();
*(cocos2d::ccColor3B *)&v10 = GameManager::colorForIdx(v9, a1->m_userScore->m_color2);
LOWORD(v59.x) = v10;
BYTE2(v59.x) = BYTE2(v10);
SimplePlayer::setSecondColor(v4, (const cocos2d::ccColor3B *)&v59);
SimplePlayer::tryEnableCustomGlowColor(v4, a1->m_userScore->m_color3);
m_userScore = a1->m_userScore;
m_iconID = m_userScore->m_iconID;
v13 = m_userScore->m_special == 2 || m_userScore->m_glowEnabled;
v4->m_hasGlowOutline = v13;
SimplePlayer::updatePlayerFrame(v4, m_iconID, m_userScore->m_iconType);
SimplePlayer::updateColors(v4);
v15 = (cocos2d::CCNode *)cocos2d::CCMenu::create(nullptr, v14);
a1->m_mainLayer->addChild(a1->m_mainLayer, v15);
cocos2d::CCPoint::CCPoint(&v54, 22.0, a1->m_height * 0.5);
m_playerRank = (const char *)a1->m_userScore->m_playerRank;
if ( (int)m_playerRank <= 3 )
{
LODWORD(v59.x) = &unk_ACDDA8;
if ( m_playerRank == (_BYTE *)&dword_0 + 1 )
{
v19 = "rankIcon_top10_001.png";
}
else if ( m_playerRank == (_BYTE *)&dword_0 + 2 )
{
v19 = "rankIcon_top50_001.png";
}
else
{
v19 = "rankIcon_top100_001.png";
}
sub_7753D4((int)&v59, v19);
v20 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)LODWORD(v59.x));
a1->m_mainLayer->addChild(a1->m_mainLayer, v20);
v20->setPosition(v20, &v54);
((void (__fastcall *)(cocos2d::CCSprite *, int))v20->setScale)(v20, 1061997773);
sub_774008(&v59);
}
else
{
v17 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", m_playerRank);
cocos2d::CCString::getCString(v17);
v18 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v18);
v18->setPosition(v18, &v54);
cocos2d::CCLabelBMFont::limitLabelWidth(v18, 20.0, 0.75, 0.0);
}
sub_775C20(&v59, &a1->m_userScore->m_userName);
v21 = cocos2d::CCLabelBMFont::create();
sub_774008(&v59);
if ( a1->m_userScore->m_levelMode == 1 )
{
v22 = 100.0;
v23 = 0.7;
}
else
{
v22 = 130.0;
v23 = 0.8;
}
cocos2d::CCLabelBMFont::limitLabelWidth(v21, v22, v23, 0.0);
LODWORD(v59.x) = GJLevelScoreCell::onViewProfile;
v59.y = 0.0;
v24 = CCMenuItemSpriteExtra::create(
v21,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GJLevelScoreCell::onViewProfile, (unsigned int)a1));
v15->addChild(v15, v24);
width = v21->getContentSize(v21)->width;
v26 = COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCLabelBMFont *))v21->getScale)(v21));
v27 = (int)v4->getPosition(v4);
cocos2d::CCPoint::CCPoint(&v58, 30.0, 0.0);
cocos2d::CCPoint::operator+(v55, v27, &v58);
v28 = v24->setPosition;
v29 = v21->getContentSize(v21)->width;
v30 = v21->getScale(v21);
cocos2d::CCPoint::CCPoint(&v56, (float)(v29 * 0.5) * v30, 0.0);
cocos2d::CCPoint::operator+(&v57, v55, &v56);
cocos2d::CCNode::convertToNodeSpace(&v58, v15, &v57);
v28(v24, &v58);
if ( GJUserScore::isCurrentUser(a1->m_userScore) )
{
m_backgroundLayer = a1->m_backgroundLayer;
v32 = m_backgroundLayer->setColor;
LOWORD(v58.x) = -26906;
BYTE2(v58.x) = 10;
v32(m_backgroundLayer, (const cocos2d::ccColor3B *)&v58);
}
m_stars = (const char *)a1->m_userScore->m_stars;
sub_776584((int)&v53, (char *)&unk_939830);
v34 = a1->m_userScore;
if ( v34->m_levelMode == 1 )
{
if ( v34->m_leaderboardMode )
{
GameToolbox::pointsToString((GameToolbox *)&v58, (unsigned int)m_stars);
sub_774794(&v53, &v58);
v35 = &v58;
}
else
{
GameToolbox::msToTimeString((GameToolbox *)&v56, (int)m_stars, 1, 0);
sub_774794(&v53, &v56);
v35 = &v56;
}
sub_774008(v35);
}
else
{
v36 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i%%", m_stars);
CString = (char *)cocos2d::CCString::getCString(v36);
sub_7753D4((int)&v53, CString);
}
v38 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v38, 2);
v39 = v38->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( a1->m_userScore->m_levelMode == 1 )
{
setAnchorPoint = v39->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v58, 1.0, 0.5);
setAnchorPoint(v38, &v58);
cocos2d::CCLabelBMFont::limitLabelWidth(v38, 85.0, 0.5, 0.0);
v41 = v38->setPosition;
cocos2d::CCPoint::CCPoint(&v58, a1->m_width - 60.0, a1->m_height * 0.5);
v41(v38, &v58);
}
else
{
v42 = v39->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v58, 0.0, 0.5);
v42(v38, &v58);
cocos2d::CCLabelBMFont::limitLabelWidth(v38, 200.0, 0.6, 0.0);
v43 = v38->setPosition;
cocos2d::CCPoint::CCPoint(&v57, (float)(width * v26) + 6.0, -1.0);
cocos2d::CCPoint::operator+(&v58, v55, &v57);
v43(v38, &v58);
m_secretCoins = a1->m_userScore->m_secretCoins;
if ( m_secretCoins > 0 )
{
for ( i = 0; i != m_secretCoins; ++i )
{
v46 = cocos2d::CCSprite::createWithSpriteFrameName("usercoin_small01_001.png");
a1->m_mainLayer->addChild(a1->m_mainLayer, v46);
((void (__fastcall *)(cocos2d::CCSprite *, int))v46->setScale)(v46, 1063675494);
v51 = v46->setPosition;
v52 = (int)v38->getPosition(v38);
cocos2d::CCPoint::CCPoint(&v57, (float)(8 * i + 65), 5.0);
cocos2d::CCPoint::operator+(&v58, v52, &v57);
v51(v46, &v58);
}
}
}
sub_775C20(&v57, &a1->m_userScore->m_unkString);
v47 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s ago",
(const char *)LODWORD(v57.x));
cocos2d::CCString::getCString(v47);
v48 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v48, 1);
v49 = v48->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v58, 1.0, 0.5);
v49(v48, &v58);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v48->setScale)(v48, 1056964608);
v48->setColor(v48, &stru_9AA43F);
v48->setOpacity(v48, 125);
v50 = v48->setPosition;
cocos2d::CCPoint::CCPoint(&v58, a1->m_width - 11.0, 10.0);
v50(v48, &v58);
if ( a1->m_userScore->m_levelMode == 1 )
cocos2d::CCLabelBMFont::limitLabelWidth(v48, 35.0, 0.5, 0.0);
sub_774008(&v57);
sub_774008(&v53);
}