//
// SimplePlayer::updatePlayerFrame from 0x10036af50 to 0x10036b3dc (1164 bytes)
//
// 16 xrefs:
// > GJBaseGameLayer::playExitDualEffect @ 0x100129972
// > CommentCell::loadFromComment @ 0x100247c31
// > GJScoreCell::loadFromScore @ 0x1002498c1
// > GJLevelScoreCell::loadFromScore @ 0x10024ae53
// > GJUserCell::loadFromScore @ 0x10024bba2
// > GJRequestCell::loadFromScore @ 0x10024c3b4
// > GJGarageLayer::init @ 0x100369f2c
// > GJGarageLayer::onSelect @ 0x10036e2f8
// > SimplePlayer::init @ 0x100370548
// > SimplePlayer::asyncLoadIcon @ 0x10037074a
// > SimplePlayer::iconFinishedLoading @ 0x1003708e0
// > GJItemIcon::init @ 0x10037134f
// > CharacterColorPage::init @ 0x10065cf07
// > CharacterColorPage::toggleShip @ 0x10065d829
// > ProfilePage::loadPageFromUserInfo @ 0x1007baa31
// > ProfilePage::toggleShip @ 0x1007bcb03
//
// 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 SimplePlayer::updatePlayerFrame(SimplePlayer *a1, int a2, IconType a3)
{
unsigned int v5; // r12d
GJRobotSprite *m_robotSprite; // rdi
GJSpiderSprite *m_spiderSprite; // rdi
int v8; // r15d
GameManager *v9; // rax
_QWORD *p_m_spiderSprite; // r14
GJSpiderSprite *v11; // rdi
GJRobotSprite *v12; // rax
cocos2d::CCString *v13; // rax
cocos2d::CCString *v14; // rax
cocos2d::CCString *v15; // rax
cocos2d::CCString *v16; // rax
const char *v17; // r13
cocos2d::CCString *v18; // rax
const char *v19; // rax
cocos2d::CCSprite *m_firstLayer; // r15
cocos2d::CCSprite *v21; // rbx
GJSpiderSprite *v22; // rax
__int64 v23; // rbx
char v24; // [rsp+0h] [rbp-60h]
char CString; // [rsp+0h] [rbp-60h]
char v26; // [rsp+0h] [rbp-60h]
char v27; // [rsp+0h] [rbp-60h]
const char *v28; // [rsp+0h] [rbp-60h]
const char *v29; // [rsp+8h] [rbp-58h]
const char *v30; // [rsp+10h] [rbp-50h]
float v31; // [rsp+18h] [rbp-48h] BYREF
std::string v32; // [rsp+20h] [rbp-40h] BYREF
memset(&v32, 0, sizeof(v32));
switch ( a3 )
{
case Ship:
v5 = 169;
std::string::assign(&v32, "ship");
break;
case Ball:
v5 = 118;
std::string::assign(&v32, "player_ball");
break;
case Ufo:
v5 = 149;
std::string::assign(&v32, "bird");
break;
case Wave:
v5 = 96;
std::string::assign(&v32, "dart");
break;
case Robot:
v5 = 68;
std::string::assign(&v32, "robot");
break;
case Spider:
v5 = 69;
std::string::assign(&v32, "spider");
break;
case Swing:
v5 = 43;
std::string::assign(&v32, "swing");
break;
case Jetpack:
v5 = 8;
std::string::assign(&v32, "jetpack");
break;
default:
v5 = 485;
std::string::assign(&v32, "player");
break;
}
m_robotSprite = a1->m_robotSprite;
if ( m_robotSprite )
((void (__fastcall *)(GJRobotSprite *, bool))m_robotSprite->setVisible)(m_robotSprite, a3 == Robot);
m_spiderSprite = a1->m_spiderSprite;
if ( m_spiderSprite )
((void (__fastcall *)(GJSpiderSprite *, bool))m_spiderSprite->setVisible)(m_spiderSprite, a3 == Spider);
((void (__fastcall *)(cocos2d::CCSprite *, bool))a1->m_firstLayer->setVisible)(
a1->m_firstLayer,
(unsigned int)(a3 - 7) < 0xFFFFFFFE);
((void (__fastcall *)(cocos2d::CCSprite *, bool))a1->m_secondLayer->setVisible)(
a1->m_secondLayer,
(unsigned int)(a3 - 7) < 0xFFFFFFFE);
((void (__fastcall *)(cocos2d::CCSprite *, bool))a1->m_birdDome->setVisible)(
a1->m_birdDome,
(unsigned int)(a3 - 7) < 0xFFFFFFFE);
if ( v5 >= a2 )
v5 = a2;
v8 = 1;
if ( a2 > 0 )
v8 = v5;
v9 = GameManager::sharedState();
GameManager::loadIcon(v9, v8, a3, a1->m_iconRequestID);
if ( a3 == Spider )
{
p_m_spiderSprite = &a1->m_spiderSprite;
v11 = a1->m_spiderSprite;
if ( !v11 )
{
v22 = GJSpiderSprite::create(v8);
a1->m_spiderSprite = v22;
((void (__fastcall *)(SimplePlayer *, GJSpiderSprite *))a1->addChild)(a1, v22);
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)*p_m_spiderSprite + 328LL))(*p_m_spiderSprite, 0);
v23 = *p_m_spiderSprite;
sub_10028CBE0(&v31, 0.0, -1.5);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v23 + 184LL))(v23, &v31);
goto LABEL_34;
}
LABEL_24:
GJRobotSprite::updateFrame(v11, v8);
goto LABEL_36;
}
if ( a3 == Robot )
{
p_m_spiderSprite = &a1->m_robotSprite;
v11 = (GJSpiderSprite *)a1->m_robotSprite;
if ( !v11 )
{
v12 = GJRobotSprite::create(v8);
a1->m_robotSprite = v12;
((void (__fastcall *)(SimplePlayer *, GJRobotSprite *))a1->addChild)(a1, v12);
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)*p_m_spiderSprite + 328LL))(*p_m_spiderSprite, 0);
LABEL_34:
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*p_m_spiderSprite + 328LL))(*p_m_spiderSprite, 1);
goto LABEL_36;
}
goto LABEL_24;
}
v13 = (cocos2d::CCString *)sub_1007AB580("%s_%02d_001.png", v24);
CString = (unsigned __int8)cocos2d::CCString::getCString(v13);
v14 = (cocos2d::CCString *)sub_1007AB580("%s_%02d_2_001.png", CString);
v29 = cocos2d::CCString::getCString(v14);
if ( a3 == Ufo )
{
v15 = (cocos2d::CCString *)sub_1007AB580("%s_%02d_3_001.png", v26);
v30 = cocos2d::CCString::getCString(v15);
}
else
{
v30 = nullptr;
}
v16 = (cocos2d::CCString *)sub_1007AB580("%s_%02d_glow_001.png", v26);
v17 = cocos2d::CCString::getCString(v16);
v18 = (cocos2d::CCString *)sub_1007AB580("%s_%02d_extra_001.png", v27);
v19 = cocos2d::CCString::getCString(v18);
SimplePlayer::setFrames(a1, v28, v29, v30, v17, v19);
((void (__fastcall *)(cocos2d::CCSprite *, float))a1->m_firstLayer->setScale)(a1->m_firstLayer, 1.0);
m_firstLayer = a1->m_firstLayer;
if ( a3 == Ball )
{
((void (__fastcall *)(cocos2d::CCSprite *, float))m_firstLayer->setScale)(a1->m_firstLayer, 0.89999998);
v21 = a1->m_firstLayer;
sub_10028CBE0(&v31, 0.0, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v21->setPosition)(v21, &v31);
}
else
{
if ( a3 == Ufo )
sub_10028CBE0(&v31, 0.0, -7.0);
else
sub_10028CBE0(&v31, 0.0, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, float *))m_firstLayer->setPosition)(m_firstLayer, &v31);
}
LABEL_36:
if ( (*(_BYTE *)&v32.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v32.__r_.__value_.__l.__data_);
}