//
// SimplePlayer::updatePlayerFrame from 0x14027a090 to 0x14027a5b4 (1316 bytes)
//
// 15 xrefs:
// > CharacterColorPage::init @ 0x140088779
// > CharacterColorPage::toggleShip @ 0x140088db5
// > CommentCell::loadFromComment @ 0x1400b62b1
// > GJScoreCell::loadFromScore @ 0x1400b86dc
// > GJLevelScoreCell::loadFromScore @ 0x1400ba2a9
// > GJUserCell::loadFromScore @ 0x1400bae82
// > GJRequestCell::loadFromScore @ 0x1400bc56c
// > GJBaseGameLayer::playExitDualEffect @ 0x14021711b
// > GJGarageLayer::init @ 0x140273c41
// > GJGarageLayer::onSelect @ 0x140277643
// > SimplePlayer::init @ 0x140279a29
// > GJItemIcon::init @ 0x14027aed8
// > ProfilePage::loadPageFromUserInfo @ 0x1403c0a73
// > ProfilePage::toggleShip @ 0x1403c30a0
// > ??> @ 0x1406d10c4
//
// 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
//
// local variable allocation has failed, the output may be wrong!
// Hidden C++ exception states: #wind=2
void SimplePlayer::updatePlayerFrame(SimplePlayer *a1, int a2, IconType a3)
{
float v6; // xmm0_4
unsigned __int64 v7; // kr08_8
unsigned __int64 v8; // rdx
int v9; // esi
GJRobotSprite *m_robotSprite; // rcx
GJSpiderSprite *m_spiderSprite; // rcx
bool v12; // bl
int v13; // r15d
GameManager *v14; // rcx
GJSpiderSprite *v15; // rcx
GJRobotSprite *v16; // rax
_BOOL8 v17; // rdx
_BOOL8 v18; // rdx
cocos2d::CCString *v19; // rax
const char *CString; // r12
void **v21; // rdx
cocos2d::CCString *v22; // rax
const char *v23; // r13
const char *v24; // rsi
void **v25; // rdx
cocos2d::CCString *v26; // rax
void **v27; // rdx
cocos2d::CCString *v28; // rax
const char *v29; // rbx
void **v30; // rdx
cocos2d::CCString *v31; // rax
const char *v32; // rax
cocos2d::CCSprite_vtbl *v33; // rbx
const cocos2d::CCPoint *v34; // rax
void *v35; // rcx
void *v36; // [rsp+30h] [rbp-30h]
void *Block[2]; // [rsp+38h] [rbp-28h] BYREF
__int64 v38; // [rsp+48h] [rbp-18h]
unsigned __int64 v39; // [rsp+50h] [rbp-10h]
v6 = 0.0;
*(_OWORD *)Block = 0;
v39 = 15;
LOBYTE(Block[0]) = 0;
v7 = *(_QWORD *)&a2;
v8 = 0x140000000uLL;
switch ( a3 )
{
case Ship:
v38 = 4;
strcpy((char *)Block, "ship");
v9 = 169;
break;
case Ball:
v38 = 11;
v6 = 7.3154135e34;
strcpy((char *)Block, "player_ball");
v9 = 118;
break;
case Ufo:
v38 = 4;
strcpy((char *)Block, "bird");
v9 = 149;
break;
case Wave:
v38 = 4;
strcpy((char *)Block, "dart");
v9 = 96;
break;
case Robot:
v38 = 5;
strcpy((char *)Block, "robot");
v9 = 68;
break;
case Spider:
LODWORD(Block[0]) = 1684631667;
v9 = 69;
goto LABEL_10;
case Swing:
v38 = 5;
strcpy((char *)Block, "swing");
v9 = 43;
break;
case Jetpack:
v38 = 7;
Block[0] = (void *)0x6B63617074656ALL;
v9 = 8;
break;
default:
v8 = v7;
LODWORD(Block[0]) = 2036427888;
v9 = 485;
LABEL_10:
BYTE6(Block[0]) = 0;
WORD2(Block[0]) = 29285;
v38 = 6;
break;
}
m_robotSprite = a1->m_robotSprite;
if ( m_robotSprite )
{
LOBYTE(v8) = a3 == Robot;
m_robotSprite->setVisible(m_robotSprite, v8);
}
m_spiderSprite = a1->m_spiderSprite;
if ( m_spiderSprite )
{
LOBYTE(v8) = a3 == Spider;
m_spiderSprite->setVisible(m_spiderSprite, v8);
}
v12 = (unsigned int)(a3 - 5) > 1;
a1->m_firstLayer->setVisible(a1->m_firstLayer, v12);
a1->m_secondLayer->setVisible(a1->m_secondLayer, v12);
a1->m_birdDome->setVisible(a1->m_birdDome, v12);
if ( a2 < v9 )
v9 = a2;
v13 = 1;
if ( v9 > 1 )
v13 = v9;
v14 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v36 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v36);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v14 = (GameManager *)qword_1406C2ED8;
}
GameManager::loadIcon(v14, v13, a3, a1->m_iconRequestID);
if ( a3 == Robot )
{
v15 = (GJSpiderSprite *)a1->m_robotSprite;
if ( v15 )
{
LABEL_23:
GJRobotSprite::updateFrame(v15, v13);
goto LABEL_41;
}
v16 = GJRobotSprite::create(v13);
a1->m_robotSprite = v16;
a1->addChild_1(a1, v16);
a1->m_robotSprite->setVisible(a1->m_robotSprite, 0);
LOBYTE(v17) = 1;
a1->m_robotSprite->setVisible(a1->m_robotSprite, v17);
}
else if ( a3 == Spider )
{
v15 = a1->m_spiderSprite;
if ( v15 )
goto LABEL_23;
SimplePlayer::createSpiderSprite(a1, v13);
LOBYTE(v18) = 1;
a1->m_spiderSprite->setVisible(a1->m_spiderSprite, v18);
}
else
{
v19 = cocos2d::CCString::createWithFormat("%s_%02d_001.png", (const char *)Block, v13);
CString = cocos2d::CCString::getCString(v19);
v21 = Block;
if ( v39 > 0xF )
v21 = (void **)Block[0];
v22 = cocos2d::CCString::createWithFormat("%s_%02d_2_001.png", (const char *)v21, v13);
v23 = cocos2d::CCString::getCString(v22);
v24 = nullptr;
if ( a3 == Ufo )
{
v25 = Block;
if ( v39 > 0xF )
v25 = (void **)Block[0];
v26 = cocos2d::CCString::createWithFormat("%s_%02d_3_001.png", (const char *)v25, v13);
v24 = cocos2d::CCString::getCString(v26);
}
v27 = Block;
if ( v39 > 0xF )
v27 = (void **)Block[0];
v28 = cocos2d::CCString::createWithFormat("%s_%02d_glow_001.png", (const char *)v27, v13);
v29 = cocos2d::CCString::getCString(v28);
v30 = Block;
if ( v39 > 0xF )
v30 = (void **)Block[0];
v31 = cocos2d::CCString::createWithFormat("%s_%02d_extra_001.png", (const char *)v30, v13);
v32 = cocos2d::CCString::getCString(v31);
SimplePlayer::setFrames(a1, CString, v23, v24, v29, v32);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_firstLayer->setScale_0)(a1->m_firstLayer);
if ( a3 == Ball )
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_firstLayer->setScale_0)(a1->m_firstLayer);
v33 = a1->m_firstLayer->__vftable;
cocos2d::CCPoint::CCPoint(v6, 0.0);
v33->setPosition_0(a1->m_firstLayer, v34);
}
LABEL_41:
if ( v39 > 0xF )
{
v35 = Block[0];
if ( v39 + 1 >= 0x1000 )
{
v35 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v35 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v35);
}
}