//
// SimplePlayer::updatePlayerFrame from 0x100303498 to 0x1003038ec (1108 bytes)
//
// 14 xrefs:
// > CommentCell::loadFromComment @ 0x100106048
// > GJScoreCell::loadFromScore @ 0x100107964
// > GJLevelScoreCell::loadFromScore @ 0x100108da4
// > GJUserCell::loadFromScore @ 0x100109a24
// > GJRequestCell::loadFromScore @ 0x10010a23c
// > CharacterColorPage::init @ 0x100129224
// > CharacterColorPage::toggleShip @ 0x1001296dc
// > ProfilePage::loadPageFromUserInfo @ 0x1001986a8
// > ProfilePage::toggleShip @ 0x10019a254
// > GJBaseGameLayer::playExitDualEffect @ 0x1001e9fa0
// > GJGarageLayer::init @ 0x100302510
// > GJGarageLayer::onSelect @ 0x100305d30
// > SimplePlayer::init @ 0x100307398
// > GJItemIcon::init @ 0x100307c8c
//
// 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 v6; // w22
GJRobotSprite *m_robotSprite; // x0
GJSpiderSprite *m_spiderSprite; // x0
int v9; // w8
int v10; // w21
GameManager *v11; // x0
_QWORD *p_m_spiderSprite; // x20
GJSpiderSprite *v13; // x0
std::string *v14; // x8
cocos2d::CCString *v15; // x0
const char *CString; // x22
std::string *v17; // x8
cocos2d::CCString *v18; // x0
const char *v19; // x23
std::string *v20; // x8
cocos2d::CCString *v21; // x0
const char *v22; // x24
std::string *v23; // x8
cocos2d::CCString *v24; // x0
const char *v25; // x25
std::string *v26; // x8
cocos2d::CCString *v27; // x0
const char *v28; // x0
__n128 v29; // q0
__n128 v30; // q1
cocos2d::CCSprite *m_firstLayer; // x21
__n128 v32; // q0
cocos2d::CCSprite *v33; // x19
__n128 v34; // q1
int v35; // [xsp+10h] [xbp-60h] BYREF
std::string v36; // [xsp+18h] [xbp-58h] BYREF
memset(&v36, 0, sizeof(v36));
if ( a3 > Wave )
{
if ( a3 > Spider )
{
if ( a3 == Swing )
{
std::string::assign(&v36, "swing");
v6 = 43;
goto LABEL_19;
}
if ( a3 == Jetpack )
{
std::string::assign(&v36, "jetpack");
v6 = 8;
goto LABEL_19;
}
goto LABEL_18;
}
if ( a3 == Robot )
{
std::string::assign(&v36, "robot");
v6 = 68;
}
else
{
std::string::assign(&v36, "spider");
v6 = 69;
}
}
else
{
if ( a3 <= Ball )
{
if ( a3 == Ship )
{
std::string::assign(&v36, "ship");
v6 = 169;
goto LABEL_19;
}
if ( a3 == Ball )
{
std::string::assign(&v36, "player_ball");
v6 = 118;
goto LABEL_19;
}
LABEL_18:
std::string::assign(&v36, "player");
v6 = 485;
goto LABEL_19;
}
if ( a3 == Ufo )
{
std::string::assign(&v36, "bird");
v6 = 149;
}
else
{
std::string::assign(&v36, "dart");
v6 = 96;
}
}
LABEL_19:
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 ( v6 >= a2 )
v9 = a2;
else
v9 = v6;
if ( a2 < 1 )
v10 = 1;
else
v10 = v9;
v11 = GameManager::sharedState();
GameManager::loadIcon(v11, v10, a3, a1->m_iconRequestID);
if ( a3 == Spider )
{
p_m_spiderSprite = &a1->m_spiderSprite;
v13 = a1->m_spiderSprite;
if ( !v13 )
{
SimplePlayer::createSpiderSprite(a1, v10);
goto LABEL_54;
}
LABEL_34:
GJRobotSprite::updateFrame(v13, v10);
goto LABEL_56;
}
if ( a3 == Robot )
{
p_m_spiderSprite = &a1->m_robotSprite;
v13 = (GJSpiderSprite *)a1->m_robotSprite;
if ( !v13 )
{
SimplePlayer::createRobotSprite(a1, v10);
LABEL_54:
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*p_m_spiderSprite + 328LL))(*p_m_spiderSprite, 1);
goto LABEL_56;
}
goto LABEL_34;
}
v14 = &v36;
if ( (v36.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v14 = (std::string *)v36.__r_.__value_.__r.__words[0];
v15 = (cocos2d::CCString *)sub_100268F4C("%s_%02d_001.png", (const char *)v14, v10);
CString = cocos2d::CCString::getCString(v15);
v17 = &v36;
if ( (v36.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v17 = (std::string *)v36.__r_.__value_.__r.__words[0];
v18 = (cocos2d::CCString *)sub_100268F4C("%s_%02d_2_001.png", (const char *)v17, v10);
v19 = cocos2d::CCString::getCString(v18);
if ( a3 == Ufo )
{
v20 = &v36;
if ( (v36.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v20 = (std::string *)v36.__r_.__value_.__r.__words[0];
v21 = (cocos2d::CCString *)sub_100268F4C("%s_%02d_3_001.png", (const char *)v20, v10);
v22 = cocos2d::CCString::getCString(v21);
}
else
{
v22 = nullptr;
}
v23 = &v36;
if ( (v36.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v23 = (std::string *)v36.__r_.__value_.__r.__words[0];
v24 = (cocos2d::CCString *)sub_100268F4C("%s_%02d_glow_001.png", (const char *)v23, v10);
v25 = cocos2d::CCString::getCString(v24);
v26 = &v36;
if ( (v36.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v26 = (std::string *)v36.__r_.__value_.__r.__words[0];
v27 = (cocos2d::CCString *)sub_100268F4C("%s_%02d_extra_001.png", (const char *)v26, v10);
v28 = cocos2d::CCString::getCString(v27);
SimplePlayer::setFrames(a1, CString, v19, v22, v25, v28);
((void (__fastcall *)(cocos2d::CCSprite *, float))a1->m_firstLayer->setScale)(a1->m_firstLayer, 1.0);
m_firstLayer = a1->m_firstLayer;
if ( a3 == Ball )
{
v32 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, float))m_firstLayer->setScale)(a1->m_firstLayer, 0.9);
v33 = a1->m_firstLayer;
v32.n128_u32[0] = 0;
v34.n128_u32[0] = 0;
sub_100022980(v32, v34, &v35);
((void (__fastcall *)(cocos2d::CCSprite *, int *))v33->setPosition)(v33, &v35);
}
else
{
v29.n128_u32[0] = 0;
if ( a3 == Ufo )
v30.n128_u32[0] = -7.0;
else
v30.n128_u32[0] = 0;
sub_100022980(v29, v30, &v35);
((void (__fastcall *)(cocos2d::CCSprite *, int *))m_firstLayer->setPosition)(m_firstLayer, &v35);
}
LABEL_56:
if ( SHIBYTE(v36.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v36.__r_.__value_.__l.__data_);
}