//
// GJUserCell::loadFromScore from 0x338a34 to 0x338fa4 (1392 bytes)
//
// 1 xrefs:
// > CustomListView::loadCell @ 0x33bd2c
//
// 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 GJUserCell::loadFromScore(GJUserCell *a1, GJUserScore *a2)
{
GJUserScore *m_userScore; // r0
int m_friendReqStatus; // r2
SimplePlayer *v6; // r8
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r6
void (__fastcall *setColor)(SimplePlayer *__hidden, const cocos2d::ccColor3B *); // r6
GameManager *v9; // r0
int v10; // r0
GameManager *v11; // r0
int v12; // r0
GJUserScore *v13; // r3
int m_iconID; // r1
char v15; // r2
cocos2d::CCMenuItem *v16; // r1
cocos2d::CCNode *v17; // r6
int v18; // r7
GJUserScore *v19; // r7
cocos2d::CCLabelBMFont *v20; // r7
int v21; // r8
float width; // s18
float v23; // r0
CCMenuItemSpriteExtra *v24; // r11
ButtonSprite *v25; // r0
cocos2d::SEL_MenuHandler v26; // r2
ButtonSprite *v27; // r11
CCMenuItemSpriteExtra *v28; // r8
float m_width; // s18
float *v30; // r0
cocos2d::CCSprite *v31; // r8
CCMenuItemSpriteExtra *v32; // r8
void (__fastcall *v33)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCSprite *v34; // r8
CCMenuItemSpriteExtra *v35; // r8
void (__fastcall *v36)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCLabelBMFont *v37; // r5
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r8
void (__fastcall *v39)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
float v40; // s16
float v41; // r0
float v42; // [sp+10h] [bp-64h]
_BOOL4 v43; // [sp+14h] [bp-60h]
_BOOL4 v44; // [sp+18h] [bp-5Ch]
void (__fastcall *v45)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+20h] [bp-54h]
void (__fastcall *v46)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+20h] [bp-54h]
cocos2d::CCPoint v47; // [sp+2Ch] [bp-48h] BYREF
cocos2d::CCPoint v48; // [sp+34h] [bp-40h] BYREF
cocos2d::CCPoint v49; // [sp+3Ch] [bp-38h] BYREF
void (*v50)(GJUserCell *, cocos2d::CCObject *); // [sp+44h] [bp-30h]
int v51; // [sp+48h] [bp-2Ch]
void (*v52)(GJUserCell *, cocos2d::CCObject *); // [sp+4Ch] [bp-28h]
int v53; // [sp+50h] [bp-24h]
void (*v54)(GJUserCell *, cocos2d::CCObject *); // [sp+54h] [bp-20h]
int v55; // [sp+58h] [bp-1Ch]
cocos2d::CCPoint v56; // [sp+5Ch] [bp-18h] BYREF
cocos2d::CCPoint v57; // [sp+64h] [bp-10h] BYREF
a1->m_mainLayer->removeAllChildrenWithCleanup(a1->m_mainLayer, 1);
m_userScore = a1->m_userScore;
if ( m_userScore )
{
cocos2d::CCObject::release(m_userScore);
a1->m_userScore = nullptr;
}
if ( a2 )
{
a1->m_userScore = a2;
cocos2d::CCObject::retain(a2);
m_friendReqStatus = a2->m_friendReqStatus;
v43 = m_friendReqStatus == 2;
v44 = m_friendReqStatus == 4;
v6 = SimplePlayer::create((int)&dword_0 + 1);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v6, 1);
((void (__fastcall *)(SimplePlayer *, int))v6->setScale)(v6, 1065353216);
setPosition = v6->setPosition;
cocos2d::CCPoint::CCPoint(&v57, 30.0, a1->m_height * 0.5);
setPosition(v6, &v57);
setColor = v6->setColor;
v9 = GameManager::sharedState();
*(cocos2d::ccColor3B *)&v10 = GameManager::colorForIdx(v9, a1->m_userScore->m_color1);
LOWORD(v57.x) = v10;
BYTE2(v57.x) = BYTE2(v10);
setColor(v6, (const cocos2d::ccColor3B *)&v57);
v11 = GameManager::sharedState();
*(cocos2d::ccColor3B *)&v12 = GameManager::colorForIdx(v11, a1->m_userScore->m_color2);
LOWORD(v57.x) = v12;
BYTE2(v57.x) = BYTE2(v12);
SimplePlayer::setSecondColor(v6, (const cocos2d::ccColor3B *)&v57);
SimplePlayer::tryEnableCustomGlowColor(v6, a1->m_userScore->m_color3);
v13 = a1->m_userScore;
m_iconID = v13->m_iconID;
v15 = v13->m_special == 2 || v13->m_glowEnabled;
v6->m_hasGlowOutline = v15;
SimplePlayer::updatePlayerFrame(v6, m_iconID, v13->m_iconType);
SimplePlayer::updateColors(v6);
v17 = (cocos2d::CCNode *)cocos2d::CCMenu::create(nullptr, v16);
a1->m_mainLayer->addChild(a1->m_mainLayer, v17);
sub_775C20(&v57, &a1->m_userScore->m_userName);
v18 = *(_DWORD *)(LODWORD(v57.x) - 12);
sub_774008(&v57);
if ( !v18 )
{
v19 = a1->m_userScore;
sub_776584((int)&v57, "-");
sub_775D40(&v19->m_userName, &v57);
sub_774008(&v57);
}
sub_775C20(&v57, &a1->m_userScore->m_userName);
v20 = cocos2d::CCLabelBMFont::create();
sub_774008(&v57);
cocos2d::CCLabelBMFont::limitLabelWidth(v20, 150.0, 0.8, 0.0);
v21 = (int)v6->getPosition(v6);
width = v20->getContentSize(v20)->width;
v23 = v20->getScale(v20);
cocos2d::CCPoint::CCPoint(&v57, (float)((float)(width * 0.5) * v23) + 35.0, 0.0);
cocos2d::CCPoint::operator+(&v47, v21, &v57);
v51 = 0;
v50 = GJUserCell::onViewProfile;
v24 = CCMenuItemSpriteExtra::create(
v20,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GJUserCell::onViewProfile, (unsigned int)a1));
v17->addChild(v17, v24);
v45 = v24->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v57, v17, &v47);
v45(v24, &v57);
if ( v43 )
{
v24->setEnabled(v24, 0);
v25 = ButtonSprite::create(
(ButtonSprite *)"Unblock",
(const char *)&word_32,
0,
0.6,
0,
"bigFont.fnt",
"GJ_button_05.png",
(const char *)0x41E00000,
v42);
v26.adj = (size_t)GJUserCell::onUnblockUser;
v53 = 0;
v52 = GJUserCell::onUnblockUser;
v27 = v25;
}
else
{
if ( !v44 )
{
LABEL_14:
if ( a2->m_friendReqStatus == 1 )
{
if ( a2->m_messageState != 2 )
{
v31 = cocos2d::CCSprite::createWithSpriteFrameName("accountBtn_messages_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v31->setScale)(v31, 1060320051);
v56.y = 0.0;
LODWORD(v56.x) = GJUserCell::onSendMessage;
v32 = CCMenuItemSpriteExtra::create(
v31,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GJUserCell::onSendMessage, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v32, 1.2);
v17->addChild(v17, v32);
v33 = v32->setPosition;
cocos2d::CCPoint::CCPoint(&v49, a1->m_width - 60.0, a1->m_height * 0.5);
cocos2d::CCNode::convertToNodeSpace(&v57, v17, &v49);
v33(v32, &v57);
}
v34 = cocos2d::CCSprite::createWithSpriteFrameName("accountBtn_removeFriend_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v34->setScale)(v34, 1060320051);
v57.y = 0.0;
LODWORD(v57.x) = GJUserCell::onRemoveFriend;
v35 = CCMenuItemSpriteExtra::create(
v34,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GJUserCell::onRemoveFriend, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v35, 1.2);
v17->addChild(v17, v35);
v36 = v35->setPosition;
cocos2d::CCPoint::CCPoint(&v48, a1->m_width - 24.0, a1->m_height * 0.5);
cocos2d::CCNode::convertToNodeSpace(&v49, v17, &v48);
v36(v35, &v49);
}
if ( a1->m_userScore->m_newFriendRequest && !v43 && !v44 )
{
v37 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v37->setScale)(v37, 1056964608);
setAnchorPoint = v37->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v49, 0.0, 0.5);
setAnchorPoint(v37, &v49);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v37, 10);
v37->setTag(v37, 100);
v39 = v37->setPosition;
v40 = v20->getContentSize(v20)->width * 0.5;
v41 = v20->getScale(v20);
cocos2d::CCPoint::CCPoint(&v48, (float)(v40 * v41) + 10.0, 0.0);
cocos2d::CCPoint::operator+(&v49, &v47, &v48);
v39(v37, &v49);
}
return;
}
v25 = ButtonSprite::create(
(ButtonSprite *)"Cancel",
(const char *)&word_32,
0,
0.6,
0,
"bigFont.fnt",
"GJ_button_05.png",
(const char *)0x41E00000,
v42);
v26.adj = (size_t)GJUserCell::onCancelFriendRequest;
v55 = 0;
v54 = GJUserCell::onCancelFriendRequest;
v27 = v25;
}
v26.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v28 = CCMenuItemSpriteExtra::create(v25, nullptr, v26);
CCMenuItemSpriteExtra::setSizeMult(v28, 1.5);
v17->addChild(v17, v28);
m_width = a1->m_width;
v46 = v28->setPosition;
v30 = (float *)v27->getContentSize(v27);
cocos2d::CCPoint::CCPoint(&v56, (float)(m_width - (float)(*v30 * 0.5)) - 9.0, a1->m_height * 0.5);
cocos2d::CCNode::convertToNodeSpace(&v57, v17, &v56);
v46(v28, &v57);
goto LABEL_14;
}
}