//
// GJItemIcon::init from 0x10035a580 to 0x10035aa6b (1259 bytes)
//
// 1 xrefs:
// > GJItemIcon::create @ 0x10035a517
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:28:53 +0000
//
__int64 __fastcall GJItemIcon::init(__int64 a1, __int64 a2, unsigned int a3, int a4, int a5, int a6, int a7, char a8)
{
unsigned int v10; // r12d
__int64 result; // rax
__int64 v13; // rdx
double v14; // xmm0_8
__int64 v15; // rax
const std::string::value_type *v16; // rsi
const std::string::value_type *v17; // rsi
int v18; // eax
int v19; // eax
__int64 v20; // rdx
char *v21; // r14
__int64 v22; // rdx
char *v23; // rdi
__int64 v24; // rdx
double v25; // xmm0_8
__int64 v26; // rax
__int64 v27; // rdi
__int64 v28; // rsi
unsigned int v29; // r12d
__int64 v30; // rdx
double v31; // xmm0_8
__int64 v32; // rax
_QWORD *v33; // rax
__int64 v34; // rax
__int64 CString; // rax
double v36; // xmm0_8
__int64 v37; // rax
double v38; // xmm0_8
__int16 v39; // ax
char v40; // eax^2
const std::string::value_type *v41; // rdi
__int64 v42; // r15
__int64 v43; // rax
__int64 v44; // [rsp+0h] [rbp-60h] BYREF
float v45; // [rsp+8h] [rbp-58h] BYREF
std::string v46; // [rsp+10h] [rbp-50h] BYREF
__int16 v47; // [rsp+28h] [rbp-38h] BYREF
char v48; // [rsp+2Ah] [rbp-36h]
__int16 v49; // [rsp+2Ch] [rbp-34h] BYREF
char v50; // [rsp+2Eh] [rbp-32h]
float v51; // [rsp+30h] [rbp-30h]
__int16 v52; // [rsp+34h] [rbp-2Ch] BYREF
char v53; // [rsp+36h] [rbp-2Ah]
unsigned __int8 v54; // [rsp+37h] [rbp-29h]
v10 = a2;
v47 = a4;
v48 = BYTE2(a4);
v49 = a5;
v50 = BYTE2(a5);
result = cocos2d::CCSprite::init(a1);
if ( (_BYTE)result )
{
v51 = *(float *)&a6;
v54 = result;
*(_DWORD *)(a1 + 624) = a3;
*(_DWORD *)(a1 + 628) = a2;
*(_QWORD *)&v14 = GameManager::sharedState(a1, a2, v13).u64[0];
*(_DWORD *)(a1 + 608) = GameManager::getIconRequestID(v15, v14);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)a1 + 1136LL))(a1, &unk_100BE2FB8);
sub_100278260((float *)&v44, 30.0, 30.0);
sub_100278660((_QWORD *)(a1 + 612), &v44);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)a1 + 320LL))(a1, &v44);
memset(&v46, 0, sizeof(v46));
switch ( (int)a2 )
{
case 1:
v16 = "player";
goto LABEL_18;
case 4:
v16 = "ship";
goto LABEL_18;
case 5:
v16 = "player_ball";
goto LABEL_18;
case 6:
v16 = "bird";
goto LABEL_18;
case 7:
v16 = "dart";
goto LABEL_18;
case 8:
v16 = "robot";
goto LABEL_18;
case 9:
v16 = "spider";
goto LABEL_18;
case 10:
v17 = "player_special";
goto LABEL_30;
case 11:
v17 = "explosionIcon";
goto LABEL_30;
case 12:
v17 = "gjItem";
goto LABEL_30;
case 13:
v16 = "swing";
goto LABEL_18;
case 14:
v16 = "jetpack";
LABEL_18:
std::string::assign(&v46, v16);
goto LABEL_19;
case 15:
v17 = "shipfireIcon";
LABEL_30:
std::string::assign(&v46, v17);
goto LABEL_31;
default:
std::string::assign(&v46, "player");
if ( (unsigned int)a2 > 0xE )
goto LABEL_31;
v18 = 24578;
if ( _bittest(&v18, a2) )
{
LABEL_19:
*(_BYTE *)(a1 + 620) = 1;
v21 = (char *)operator new(0x2A8u);
cocos2d::CCSprite::CCSprite((__int64)v21);
*(_QWORD *)v21 = off_100B23EF0;
*((_QWORD *)v21 + 40) = off_100B243D8;
*((_QWORD *)v21 + 43) = off_100B24458;
*((_DWORD *)v21 + 166) = 0;
v21[668] = 0;
v21[672] = 0;
*(_OWORD *)(v21 + 600) = 0;
*(_OWORD *)(v21 + 616) = 0;
*(_OWORD *)(v21 + 632) = 0;
*(_OWORD *)(v21 + 645) = 0;
v23 = v21;
if ( (unsigned __int8)SimplePlayer::init((__int64 *)v21, 1, v22) )
{
cocos2d::CCObject::autorelease(v21);
}
else
{
(*(void (__fastcall **)(char *))(*(_QWORD *)v21 + 16LL))(v21);
v21 = nullptr;
}
*(_QWORD *)&v25 = GameManager::sharedState(v23, 1, v24).u64[0];
v27 = v26;
v28 = v10;
v29 = GameManager::unlockTypeToIconType(v26, v10, v25);
*(_QWORD *)&v31 = GameManager::sharedState(v27, v28, v30).u64[0];
GameManager::isIconLoaded(v32, a3, v29, v31);
SimplePlayer::updatePlayerFrame((__int64)v21, a3, v29);
(*(void (__fastcall **)(_QWORD, __int16 *))(**((_QWORD **)v21 + 75) + 960LL))(*((_QWORD *)v21 + 75), &v47);
(*(void (__fastcall **)(_QWORD, __int16 *))(**((_QWORD **)v21 + 76) + 960LL))(*((_QWORD *)v21 + 76), &v49);
SimplePlayer::updateColors((__int64)v21);
v33 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)v21 + 75) + 328LL))(*((_QWORD *)v21 + 75));
sub_100278660((_QWORD *)(a1 + 612), v33);
}
else
{
v19 = 12;
if ( _bittest(&v19, a2) )
{
v21 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"player_special_01_001.png", 0.0);
if ( LOBYTE(v51) )
{
LABEL_14:
(*(void (__fastcall **)(char *, void *))(*(_QWORD *)v21 + 960LL))(v21, &unk_100A083D0);
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v21 + 912LL))(v21, 120);
goto LABEL_23;
}
*(_QWORD *)&v36 = GameManager::sharedState("player_special_01_001.png", "player", v20).u64[0];
*(_QWORD *)&v38 = GameManager::colorForIdx(v37, a3, v36).u64[0];
v52 = v39;
v53 = v40;
(*(void (__fastcall **)(char *, __int16 *, double))(*(_QWORD *)v21 + 960LL))(v21, &v52, v38);
if ( !a8 )
{
v41 = "2";
if ( (_DWORD)a2 == 2 )
v41 = "1";
v42 = cocos2d::CCLabelBMFont::create_3(v41, "bigFont.fnt");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v42 + 160LL))(v42, 0.5);
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v42 + 1072LL))(v42, &v52);
(*(void (__fastcall **)(char *, __int64, __int64))(*(_QWORD *)v21 + 464LL))(v21, v42, 1);
v51 = *(float *)(*(__int64 (__fastcall **)(char *))(*(_QWORD *)v21 + 328LL))(v21);
v43 = (*(__int64 (__fastcall **)(char *))(*(_QWORD *)v21 + 328LL))(v21);
sub_100278250(&v45, v51 * 0.5, 0.5 * *(float *)(v43 + 4));
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v42 + 184LL))(v42, &v45);
}
}
else
{
LABEL_31:
if ( a3 - 6 <= 9 && *(_DWORD *)(a1 + 628) == 12 )
{
v21 = (char *)GJPathSprite::create(a3 - 5);
}
else
{
v34 = sub_10088E820("%s_%02d_001.png", v44);
CString = cocos2d::CCString::getCString(v34);
v21 = cocos2d::CCSprite::createWithSpriteFrameName(CString, 0.0);
if ( LOBYTE(v51) )
goto LABEL_14;
}
}
}
LABEL_23:
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)a1 + 456LL))(a1, v21);
sub_100278250(&v45, *(float *)&v44 * 0.5, 0.5 * *((float *)&v44 + 1));
(*(void (__fastcall **)(char *, float *))(*(_QWORD *)v21 + 184LL))(v21, &v45);
*(_QWORD *)(a1 + 600) = v21;
if ( (*(_BYTE *)&v46.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v46.__r_.__value_.__l.__data_);
result = v54;
break;
}
}
return result;
}