//
// GJItemIcon::init from 0x40468c to 0x404974 (744 bytes)
//
// 1 xrefs:
// > GJItemIcon::create @ 0x404a5e
//
// 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
//
bool GJItemIcon::init(
GJItemIcon *a1,
UnlockType a2,
int a3,
cocos2d::ccColor3B a4,
cocos2d::ccColor3B a5,
bool a6,
bool a7,
bool a8,
cocos2d::ccColor3B a9)
{
_BOOL4 v12; // r10
GameManager *v13; // r0
int IconRequestID; // r0
void (__fastcall *setTextureRect)(cocos2d::CCSprite *__hidden, const cocos2d::CCRect *); // r3
unsigned __int32 v16; // r4
char *v17; // r1
SimplePlayer *v18; // r4
GameManager *v19; // r0
IconType v20; // r9
GameManager *v21; // r0
int v22; // r0
cocos2d::CCSprite *v23; // r0
void (*setColor)(void); // r3
GameManager *v25; // r0
int v26; // r0
SimplePlayer_vtbl *v27; // r3
cocos2d::CCLabelBMFont *v28; // r9
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
float width; // s17
int v31; // r0
cocos2d::CCString *v32; // r0
const char *CString; // r0
cocos2d::CCSprite *v34; // r0
void (__fastcall *v35)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
_BOOL4 v37; // [sp+4h] [bp-30h]
int v38; // [sp+Ch] [bp-28h] BYREF
__int16 v39; // [sp+14h] [bp-20h] BYREF
char v40; // [sp+16h] [bp-1Eh]
char *v41; // [sp+18h] [bp-1Ch] BYREF
cocos2d::CCSize v42; // [sp+1Ch] [bp-18h] BYREF
cocos2d::CCPoint v43; // [sp+24h] [bp-10h] BYREF
v38 = *(_DWORD *)&a4.r;
v37 = a6;
v12 = cocos2d::CCSprite::init(a1);
if ( v12 )
{
a1->m_unlockID = a3;
a1->m_unlockType = a2;
v13 = GameManager::sharedState();
IconRequestID = GameManager::getIconRequestID(v13);
setTextureRect = a1->setTextureRect;
a1->m_iconRequestID = IconRequestID;
setTextureRect(a1, &stru_AC610C);
cocos2d::CCSize::CCSize(&v42, 30.0, 30.0);
cocos2d::CCSize::operator=(&a1->m_playerSize, &v42);
v16 = a2 - 1;
a1->setContentSize(a1, &v42);
v41 = (char *)&unk_ACDDA8;
switch ( a2 )
{
case 1:
v17 = "player";
break;
case 4:
v17 = "ship";
break;
case 5:
v17 = "player_ball";
break;
case 6:
v17 = "bird";
break;
case 7:
v17 = "dart";
break;
case 8:
v17 = "robot";
break;
case 9:
v17 = "spider";
break;
case 10:
v17 = "player_special";
break;
case 11:
v17 = "explosionIcon";
break;
case 12:
v17 = "gjItem";
break;
case 13:
v17 = "swing";
break;
case 14:
v17 = "jetpack";
break;
case 15:
v17 = "shipfireIcon";
break;
default:
v17 = "player";
break;
}
sub_7753D4((int)&v41, v17);
if ( v16 <= 0xD )
{
if ( ((((_DWORD)&dword_0 + 1) << v16) & 0x31F9) != 0 )
{
a1->m_isIcon = (unsigned __int8)&dword_0 + 1;
v18 = SimplePlayer::create((int)&dword_0 + 1);
v19 = GameManager::sharedState();
v20 = GameManager::unlockTypeToIconType(v19, a2);
v21 = GameManager::sharedState();
GameManager::isIconLoaded(v21, a3, v20);
SimplePlayer::updatePlayerFrame(v18, a3, v20);
SimplePlayer::setColors(v18, (const cocos2d::ccColor3B *)&v38, &a5);
v22 = (int)v18->m_firstLayer->getContentSize(v18->m_firstLayer);
cocos2d::CCSize::operator=(&a1->m_playerSize, v22);
goto LABEL_33;
}
if ( ((((_DWORD)&dword_0 + 1) << v16) & 6) != 0 )
{
v23 = cocos2d::CCSprite::createWithSpriteFrameName("player_special_01_001.png");
v18 = (SimplePlayer *)v23;
if ( !v37 )
{
v25 = GameManager::sharedState();
*(cocos2d::ccColor3B *)&v26 = GameManager::colorForIdx(v25, a3);
v27 = v18->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v39 = v26;
v40 = BYTE2(v26);
v27->setColor(v18, (const cocos2d::ccColor3B *)&v39);
if ( !a8 )
{
v28 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v28->setScale)(v28, 1056964608);
v28->setColor(v28, (const cocos2d::ccColor3B *)&v39);
v18->addChild_0(v18, v28, 1);
setPosition = v28->setPosition;
width = v18->getContentSize(v18)->width;
v31 = (int)v18->getContentSize(v18);
cocos2d::CCPoint::CCPoint(&v43, width * 0.5, *(float *)(v31 + 4) * 0.5);
setPosition(v28, &v43);
}
goto LABEL_33;
}
setColor = (void (*)(void))v23->setColor;
goto LABEL_32;
}
}
if ( a1->m_unlockType == GJItem && (unsigned int)(a3 - 6) <= 9 )
{
v18 = (SimplePlayer *)GJPathSprite::create(a3 - 5);
}
else
{
v32 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_%02d_001.png", v41, a3);
CString = cocos2d::CCString::getCString(v32);
v34 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
v18 = (SimplePlayer *)v34;
if ( v37 )
{
setColor = (void (*)(void))v34->setColor;
LABEL_32:
setColor();
v18->setOpacity(v18, 120u);
}
}
LABEL_33:
a1->addChild(a1, v18);
v35 = v18->setPosition;
cocos2d::CCPoint::CCPoint(&v43, v42.width * 0.5, v42.height * 0.5);
v35(v18, &v43);
a1->m_player = v18;
sub_774008(&v41);
}
return v12;
}