//
// GJLevelScoreCell::loadFromScore from 0x100108c54 to 0x1001094cc (2168 bytes)
//
// 1 xrefs:
// > CustomListView::loadCell @ 0x100101008
//
// 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 __fastcall GJLevelScoreCell::loadFromScore(GJLevelScoreCell *a1, GJUserScore *a2)
{
char m_glowEnabled; // w21
SimplePlayer *v5; // x20
__n128 v6; // q0
__n128 v7; // q1
GameManager *v8; // x0
GameManager *v9; // x0
GJUserScore *m_userScore; // x8
cocos2d::CCNode *v11; // x21
__n128 v12; // q0
__n128 v13; // q1
int m_playerRank; // w8
cocos2d::CCString *v15; // x0
const char *CString; // x0
cocos2d::CCLabelBMFont *v17; // x22
const char *v18; // x9
const std::string::value_type *v19; // x1
std::string *p_dst; // x0
cocos2d::CCSprite *v21; // x22
GJUserScore *v22; // x8
std::string *v23; // x0
cocos2d::CCLabelBMFont *v24; // x22
float v25; // s0
float v26; // s1
cocos2d::CCLabelBMFont *v27; // x0
CCMenuItemSpriteExtra *v28; // x23
float v29; // s9
float v30; // s8
float32x2_t *v31; // x20
__n128 v32; // q0
__n128 v33; // q1
double v34; // d0
float v35; // s10
__n128 v36; // q0
__n128 v37; // q1
cocos2d::CCLayerColor *m_backgroundLayer; // x0
__int64 m_stars; // x20
GJUserScore *v40; // x8
cocos2d::CCString *v41; // x0
const char *v42; // x0
std::string *v43; // x0
cocos2d::CCLabelBMFont *v44; // x20
__n128 v45; // q0
__n128 v46; // q1
__n128 v47; // q0
__n128 v48; // q1
__n128 v49; // q0
__n128 v50; // q1
double v51; // d0
int m_secretCoins; // w24
unsigned int v53; // w25
cocos2d::CCSprite *v54; // x22
float32x2_t *v55; // x23
__n128 v56; // q0
__n128 v57; // q1
double v58; // d0
GJUserScore *v59; // x8
std::string *p_p; // x8
cocos2d::CCString *v61; // x0
const char *v62; // x0
cocos2d::CCLabelBMFont *v63; // x20
__n128 v64; // q0
__n128 v65; // q1
__n128 v66; // q0
__n128 v67; // q1
std::string __p; // [xsp+10h] [xbp-B0h] BYREF
float32x2_t v69; // [xsp+30h] [xbp-90h] BYREF
float32x2_t v70; // [xsp+38h] [xbp-88h] BYREF
std::string __dst; // [xsp+40h] [xbp-80h] BYREF
int v72; // [xsp+58h] [xbp-68h] BYREF
cocos2d::CCPoint v73; // 0:kr00_8.8
cocos2d::SEL_MenuHandler v74; // 0:x3.16
m_glowEnabled = 1;
((void (__fastcall *)(cocos2d::CCLayer *, __int64))a1->m_mainLayer->removeAllChildrenWithCleanup)(a1->m_mainLayer, 1);
a1->m_userScore = a2;
v5 = SimplePlayer::create(1);
((void (__fastcall *)(cocos2d::CCLayer *, SimplePlayer *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v5,
1);
v6 = ((__n128 (__fastcall *)(SimplePlayer *, float))v5->setScale)(v5, 0.8);
v7.n128_f32[0] = (float)(a1->m_height * 0.5) + 0.0;
v6.n128_u32[0] = 1114636288;
sub_100022980(v6, v7, &__dst);
((void (__fastcall *)(SimplePlayer *, std::string *))v5->setPosition)(v5, &__dst);
v8 = GameManager::sharedState();
*(cocos2d::ccColor3B *)&__dst.__r_.__value_.__l.__data_ = GameManager::colorForIdx(v8, a1->m_userScore->m_color1);
((void (__fastcall *)(SimplePlayer *, std::string *))v5->setColor)(v5, &__dst);
v9 = GameManager::sharedState();
*(cocos2d::ccColor3B *)&__dst.__r_.__value_.__l.__data_ = GameManager::colorForIdx(v9, a1->m_userScore->m_color2);
SimplePlayer::setSecondColor(v5, (const cocos2d::ccColor3B *)&__dst);
SimplePlayer::tryEnableCustomGlowColor(v5, a1->m_userScore->m_color3);
m_userScore = a1->m_userScore;
if ( m_userScore->m_special != 2 )
m_glowEnabled = m_userScore->m_glowEnabled;
v5->m_hasGlowOutline = m_glowEnabled & 1;
SimplePlayer::updatePlayerFrame(v5, m_userScore->m_iconID, m_userScore->m_iconType);
SimplePlayer::updateColors(v5);
v11 = (cocos2d::CCNode *)sub_1001D7ED0(0);
v12 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCNode *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v11);
v13.n128_f32[0] = a1->m_height * 0.5;
v12.n128_u32[0] = 22.0;
sub_100022980(v12, v13, &v72);
m_playerRank = a1->m_userScore->m_playerRank;
if ( m_playerRank < 4 )
{
memset(&__dst, 0, sizeof(__dst));
v18 = "rankIcon_top100_001.png";
if ( m_playerRank == 2 )
v18 = "rankIcon_top50_001.png";
if ( m_playerRank == 1 )
v19 = "rankIcon_top10_001.png";
else
v19 = v18;
std::string::assign(&__dst, v19);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_dst = &__dst;
else
p_dst = (std::string *)__dst.__r_.__value_.__r.__words[0];
v21 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)p_dst);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v21);
((void (__fastcall *)(cocos2d::CCSprite *, int *))v21->setPosition)(v21, &v72);
((void (__fastcall *)(cocos2d::CCSprite *, float))v21->setScale)(v21, 0.8);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
}
else
{
v15 = (cocos2d::CCString *)sub_100268F4C("%i", a1->m_userScore->m_playerRank);
CString = cocos2d::CCString::getCString(v15);
v17 = cocos2d::CCLabelBMFont::create_1(CString, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v17);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int *))v17->setPosition)(v17, &v72);
cocos2d::CCLabelBMFont::limitLabelWidth(v17, 20.0, 0.75, 0.0);
}
v22 = a1->m_userScore;
if ( v22->m_userName.m_data.m_short.shortStorage.__elems_[22] < 0 )
sub_1000097D0(&__dst, (void *)v22->m_userName.m_data.m_long.capacitym1, v22->m_userName.m_data.m_long.size);
else
__dst = (std::string)v22->m_userName;
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v23 = &__dst;
else
v23 = (std::string *)__dst.__r_.__value_.__r.__words[0];
v24 = cocos2d::CCLabelBMFont::create_1((const char *)v23, "goldFont.fnt");
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( a1->m_userScore->m_levelMode == 1 )
{
v25 = 100.0;
v26 = 0.7;
v27 = v24;
}
else
{
v25 = 130.0;
v27 = v24;
v26 = 0.8;
}
cocos2d::CCLabelBMFont::limitLabelWidth(v27, v25, v26, 0.0);
v74.ptr = (void (__cdecl *)(cocos2d::CCObject *))GJLevelScoreCell::onViewProfile;
v74.adj = 0;
v28 = CCMenuItemSpriteExtra::create(v24, nullptr, a1, v74);
((void (__fastcall *)(cocos2d::CCNode *, CCMenuItemSpriteExtra *))v11->addChild)(v11, v28);
v29 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v24->getContentSize)(v24);
v30 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v24->getScale)(v24);
v31 = (float32x2_t *)((__int64 (__fastcall *)(SimplePlayer *))v5->getPosition)(v5);
v32.n128_u32[0] = 30.0;
v33.n128_u32[0] = 0;
sub_100022980(v32, v33, &__dst);
*(float32x2_t *)&v34 = sub_1000229DC(v31, (float32x2_t *)&__dst, &v70);
v35 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, double))v24->getContentSize)(v24, v34) * 0.5;
v36.n128_f64[0] = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))v24->getScale)(v24);
v36.n128_f32[0] = v35 * v36.n128_f32[0];
v37.n128_u32[0] = 0;
sub_100022980(v36, v37, &v69);
sub_1000229DC(&v70, &v69, (float32x2_t *)&__p);
v73 = cocos2d::CCNode::convertToNodeSpace(v11, (const cocos2d::CCPoint *)&__p);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, float, float))v28->setPosition)(
v28,
&__dst,
v73.x,
v73.y);
if ( GJUserScore::isCurrentUser(a1->m_userScore) )
{
m_backgroundLayer = a1->m_backgroundLayer;
__dst.__r_.__value_.__s.__data_[2] = 10;
LOWORD(__dst.__r_.__value_.__l.__data_) = -26906;
((void (__fastcall *)(cocos2d::CCLayerColor *, std::string *))m_backgroundLayer->setColor)(
m_backgroundLayer,
&__dst);
}
m_stars = (unsigned int)a1->m_userScore->m_stars;
sub_100009900(&__dst, "");
v40 = a1->m_userScore;
if ( v40->m_levelMode == 1 )
{
if ( v40->m_leaderboardMode )
GameToolbox::pointsToString(m_stars, (__int64)&__p);
else
GameToolbox::msToTimeString(m_stars, 1, &__p);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
__dst = __p;
}
else
{
v41 = (cocos2d::CCString *)sub_100268F4C("%i%%", m_stars);
v42 = cocos2d::CCString::getCString(v41);
std::string::assign(&__dst, v42);
}
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v43 = &__dst;
else
v43 = (std::string *)__dst.__r_.__value_.__r.__words[0];
v44 = cocos2d::CCLabelBMFont::create_1((const char *)v43, "bigFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v44,
2);
if ( a1->m_userScore->m_levelMode == 1 )
{
v45.n128_u32[0] = 1.0;
v46.n128_u32[0] = 0.5;
sub_100022980(v45, v46, &__p);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v44->setAnchorPoint)(v44, &__p);
cocos2d::CCLabelBMFont::limitLabelWidth(v44, 85.0, 0.5, 0.0);
v47.n128_f32[0] = a1->m_width + -60.0;
v48.n128_f32[0] = a1->m_height * 0.5;
sub_100022980(v47, v48, &__p);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v44->setPosition)(v44, &__p);
}
else
{
v45.n128_u32[0] = 0;
v46.n128_u32[0] = 0.5;
sub_100022980(v45, v46, &__p);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v44->setAnchorPoint)(v44, &__p);
cocos2d::CCLabelBMFont::limitLabelWidth(v44, 200.0, 0.6, 0.0);
v49.n128_f32[0] = (float)(v29 * v30) + 6.0;
v50.n128_u32[0] = -1.0;
sub_100022980(v49, v50, &v69);
*(float32x2_t *)&v51 = sub_1000229DC(&v70, &v69, (float32x2_t *)&__p);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *, double))v44->setPosition)(v44, &__p, v51);
m_secretCoins = a1->m_userScore->m_secretCoins;
if ( m_secretCoins >= 1 )
{
v53 = 65;
do
{
v54 = cocos2d::CCSprite::createWithSpriteFrameName("usercoin_small01_001.png");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v54);
((void (__fastcall *)(cocos2d::CCSprite *, float))v54->setScale)(v54, 0.9);
v55 = (float32x2_t *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v44->getPosition)(v44);
v56.n128_f32[0] = (float)v53;
v57.n128_u32[0] = 5.0;
sub_100022980(v56, v57, &v69);
*(float32x2_t *)&v58 = sub_1000229DC(v55, &v69, (float32x2_t *)&__p);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *, double))v54->setPosition)(v54, &__p, v58);
v53 += 8;
--m_secretCoins;
}
while ( m_secretCoins );
}
}
v59 = a1->m_userScore;
if ( v59->m_unkString.m_data.m_short.shortStorage.__elems_[22] < 0 )
sub_1000097D0(&__p, (void *)v59->m_unkString.m_data.m_long.capacitym1, v59->m_unkString.m_data.m_long.size);
else
__p = (std::string)v59->m_unkString;
p_p = &__p;
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
p_p = (std::string *)__p.__r_.__value_.__r.__words[0];
v61 = (cocos2d::CCString *)sub_100268F4C("%s ago", (const char *)p_p);
v62 = cocos2d::CCString::getCString(v61);
v63 = cocos2d::CCLabelBMFont::create_1(v62, "chatFont.fnt");
v64 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v63,
1);
v64.n128_u32[0] = 1.0;
v65.n128_u32[0] = 0.5;
sub_100022980(v64, v65, &v69);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v63->setAnchorPoint)(v63, &v69);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v63->setScale)(v63, 0.5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _BYTE *))v63->setColor)(v63, algn_100636CCD);
v66 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v63->setOpacity)(v63, 125);
v66.n128_f32[0] = a1->m_width + -11.0;
v67.n128_u32[0] = 10.0;
sub_100022980(v66, v67, &v69);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v63->setPosition)(v63, &v69);
if ( a1->m_userScore->m_levelMode == 1 )
cocos2d::CCLabelBMFont::limitLabelWidth(v63, 35.0, 0.5, 0.0);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
}