//
// SimplePlayer::updatePlayerFrame from 0x79251c to 0x7929dc (1216 bytes)
//
// 30 xrefs:
// > CommentCell::loadFromComment @ 0x616ba8
// > GJScoreCell::loadFromScore @ 0x618cbc
// > GJLevelScoreCell::loadFromScore @ 0x61ab54
// > GJUserCell::loadFromScore @ 0x61b858
// > GJRequestCell::loadFromScore @ 0x61c2b4
// > GJGarageLayer::onSelect @ 0x792b84
// > SimplePlayer::asyncLoadIcon @ 0x792f34
// > SimplePlayer::iconFinishedLoading @ 0x792f4c
// > SimplePlayer::init @ 0x794018
// > GJItemIcon::init @ 0x794690
// > GJGarageLayer::init @ 0x79a410
// > GJGarageLayer::init @ 0x79a438
// > GJGarageLayer::init @ 0x79a460
// > GJGarageLayer::init @ 0x79a488
// > GJGarageLayer::init @ 0x79a4b0
// > GJGarageLayer::init @ 0x79a4d8
// > GJGarageLayer::init @ 0x79a500
// > GJGarageLayer::init @ 0x79a528
// > GJBaseGameLayer::playExitDualEffect @ 0x85a9f4
// > GJBaseGameLayer::playExitDualEffect @ 0x85aa18
// > GJBaseGameLayer::playExitDualEffect @ 0x85adac
// > GJBaseGameLayer::playExitDualEffect @ 0x85add0
// > GJBaseGameLayer::playExitDualEffect @ 0x85adf4
// > GJBaseGameLayer::playExitDualEffect @ 0x85ae18
// > ProfilePage::toggleShip @ 0x8f7be4
// > ProfilePage::loadPageFromUserInfo @ 0x8faf48
// > CharacterColorPage::toggleShip @ 0xa2450c
// > CharacterColorPage::init @ 0xa25bfc
// > CharacterColorPage::init @ 0xa260dc
// > ??> @ 0x571f8
//
// 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 SimplePlayer::updatePlayerFrame(SimplePlayer *a1, int a2, IconType a3)
{
int v6; // w25
GJRobotSprite *m_robotSprite; // x0
GJSpiderSprite *m_spiderSprite; // x0
unsigned int v9; // w23
GameManager *v10; // x0
cocos2d::CCString *v11; // x0
const char *CString; // x27
cocos2d::CCString *v13; // x0
const char *v14; // x26
const char *v15; // x24
cocos2d::CCString *v16; // x0
const char *v17; // x25
cocos2d::CCString *v18; // x0
const char *v19; // x0
cocos2d::CCSprite *m_firstLayer; // x20
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
char *v22; // x0
GJSpiderSprite *v23; // x0
char *v24; // x20
unsigned int *v25; // x19
int v26; // w0
GJSpiderSprite *v27; // x2
cocos2d::CCString *v28; // x0
unsigned int *v29; // x20
int v30; // w1
char *v31; // [xsp+68h] [xbp+68h] BYREF
cocos2d::CCPoint v32; // [xsp+70h] [xbp+70h] BYREF
v31 = &byte_124B6C8;
switch ( a3 )
{
case Ship:
sub_D1798C(&v31, "ship", 4);
v6 = 169;
break;
case Ball:
sub_D1798C(&v31, "player_ball", 11);
v6 = 118;
break;
case Ufo:
sub_D1798C(&v31, "bird", 4);
v6 = 149;
break;
case Wave:
sub_D1798C(&v31, "dart", 4);
v6 = 96;
break;
case Robot:
sub_D1798C(&v31, "robot", 5);
v6 = 68;
break;
case Spider:
sub_D1798C(&v31, "spider", 6);
v6 = 69;
break;
case Swing:
sub_D1798C(&v31, "swing", 5);
v6 = 43;
break;
case Jetpack:
sub_D1798C(&v31, "jetpack", 7);
v6 = 8;
break;
default:
sub_D1798C(&v31, "player", 6);
v6 = 485;
break;
}
m_robotSprite = a1->m_robotSprite;
if ( m_robotSprite )
m_robotSprite->setVisible(m_robotSprite, a3 == Robot);
m_spiderSprite = a1->m_spiderSprite;
if ( m_spiderSprite )
m_spiderSprite->setVisible(m_spiderSprite, a3 == Spider);
a1->m_firstLayer->setVisible(a1->m_firstLayer, (unsigned int)(a3 - 5) > 1);
a1->m_secondLayer->setVisible(a1->m_secondLayer, (unsigned int)(a3 - 5) > 1);
a1->m_birdDome->setVisible(a1->m_birdDome, (unsigned int)(a3 - 5) > 1);
if ( v6 < a2 || (v9 = 1, a2 > 0) )
{
if ( v6 > a2 )
v9 = a2;
else
v9 = v6;
}
v10 = GameManager::sharedState();
GameManager::loadIcon(v10, v9, a3, a1->m_iconRequestID);
if ( a3 != Robot )
{
if ( a3 != Spider )
{
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_%02d_001.png", v31, v9);
CString = cocos2d::CCString::getCString(v11);
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_%02d_2_001.png", v31, v9);
v14 = cocos2d::CCString::getCString(v13);
v15 = nullptr;
if ( a3 == Ufo )
{
v28 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_%02d_3_001.png",
v31,
v9);
v15 = cocos2d::CCString::getCString(v28);
}
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_%02d_glow_001.png",
v31,
v9);
v17 = cocos2d::CCString::getCString(v16);
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_%02d_extra_001.png",
v31,
v9);
v19 = cocos2d::CCString::getCString(v18);
SimplePlayer::setFrames(a1, CString, v14, v15, v17, v19);
a1->m_firstLayer->setScale(a1->m_firstLayer, 1.0);
if ( a3 == Ball )
{
a1->m_firstLayer->setScale(a1->m_firstLayer, 0.9);
}
else if ( a3 == Ufo )
{
m_firstLayer = a1->m_firstLayer;
setPosition = m_firstLayer->setPosition;
cocos2d::CCPoint::CCPoint(&v32, 0.0, -7.0);
LABEL_16:
setPosition(m_firstLayer, &v32);
v22 = v31 - 24;
if ( v31 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)(v31 - 8);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *((_DWORD *)v31 - 2);
*((_DWORD *)v31 - 2) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v22);
}
return;
}
m_firstLayer = a1->m_firstLayer;
setPosition = m_firstLayer->setPosition;
cocos2d::CCPoint::CCPoint(&v32, 0.0, 0.0);
goto LABEL_16;
}
v23 = a1->m_spiderSprite;
if ( v23 )
goto LABEL_20;
SimplePlayer::createSpiderSprite(a1, v9);
v27 = a1->m_spiderSprite;
LABEL_42:
v27->setVisible(v27, 1);
goto LABEL_21;
}
v23 = (GJSpiderSprite *)a1->m_robotSprite;
if ( !v23 )
{
SimplePlayer::createRobotSprite(a1, v9);
v27 = (GJSpiderSprite *)a1->m_robotSprite;
goto LABEL_42;
}
LABEL_20:
GJRobotSprite::updateFrame(v23, v9);
LABEL_21:
v24 = v31 - 24;
if ( v31 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)(v31 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *((_DWORD *)v31 - 2);
*((_DWORD *)v31 - 2) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v24);
}
}