//
// PlayerObject::updatePlayerBirdFrame from 0x62897c to 0x628c3c (704 bytes)
//
// 3 xrefs:
// > PlayerObject::toggleBirdMode @ 0x6312d0
// > MenuGameLayer::resetPlayer @ 0x6c9578
// > ??> @ 0x33d50
//
// 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 PlayerObject::updatePlayerBirdFrame(PlayerObject *a1, int a2)
{
unsigned int v3; // w20
GameManager *v4; // x0
cocos2d::CCString *v5; // x0
const char *CString; // x28
cocos2d::CCString *v7; // x0
const char *v8; // x27
cocos2d::CCString *v9; // x0
const char *v10; // x26
cocos2d::CCString *v11; // x0
const char *v12; // x0
cocos2d::CCSprite *m_vehicleSprite; // x23
const char *v14; // x25
void (__fastcall *setDisplayFrame)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // x24
cocos2d::CCSpriteFrameCache *v16; // x0
cocos2d::CCSpriteFrame *v17; // x0
cocos2d::CCSprite *m_vehicleSpriteSecondary; // x23
void (__fastcall *v19)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // x24
cocos2d::CCSpriteFrameCache *v20; // x0
cocos2d::CCSpriteFrame *v21; // x0
cocos2d::CCSprite *m_birdVehicle; // x23
void (__fastcall *v23)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // x24
cocos2d::CCSpriteFrameCache *v24; // x0
cocos2d::CCSpriteFrame *v25; // x0
cocos2d::CCSprite *m_vehicleGlow; // x23
void (__fastcall *v27)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // x24
cocos2d::CCSpriteFrameCache *v28; // x0
cocos2d::CCSpriteFrame *v29; // x0
const cocos2d::CCSize *v30; // x0
cocos2d::CCSprite *v31; // x23
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCSprite *v33; // x23
void (__fastcall *v34)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
const cocos2d::CCPoint *v35; // x0
cocos2d::CCString *v36; // x0
char *v37; // x0
void *v38; // x0
unsigned int *v39; // x2
int v40; // w1
cocos2d::CCSize v41; // [xsp+78h] [xbp+78h] BYREF
cocos2d::CCPoint v42; // [xsp+80h] [xbp+80h] BYREF
if ( a2 <= 0 )
{
v3 = 1;
}
else if ( a2 > 149 )
{
v3 = 149;
}
else
{
v3 = a2;
}
v4 = GameManager::sharedState();
GameManager::loadIcon(v4, v3, 3, a1->m_iconRequestID);
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"bird_%02d_001.png",
(const char *)v3);
CString = cocos2d::CCString::getCString(v5);
v7 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"bird_%02d_2_001.png",
(const char *)v3);
v8 = cocos2d::CCString::getCString(v7);
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"bird_%02d_3_001.png",
(const char *)v3);
v10 = cocos2d::CCString::getCString(v9);
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"bird_%02d_glow_001.png",
(const char *)v3);
v12 = cocos2d::CCString::getCString(v11);
m_vehicleSprite = a1->m_vehicleSprite;
v14 = v12;
setDisplayFrame = m_vehicleSprite->setDisplayFrame;
v16 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v17 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v16, CString);
setDisplayFrame(m_vehicleSprite, v17);
m_vehicleSpriteSecondary = a1->m_vehicleSpriteSecondary;
v19 = m_vehicleSpriteSecondary->setDisplayFrame;
v20 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v21 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v20, v8);
v19(m_vehicleSpriteSecondary, v21);
m_birdVehicle = a1->m_birdVehicle;
v23 = m_birdVehicle->setDisplayFrame;
v24 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v25 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v24, v10);
v23(m_birdVehicle, v25);
m_vehicleGlow = a1->m_vehicleGlow;
v27 = m_vehicleGlow->setDisplayFrame;
v28 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v29 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v28, v14);
v27(m_vehicleGlow, v29);
v30 = a1->m_vehicleSprite->getContentSize(a1->m_vehicleSprite);
cocos2d::CCSize::CCSize(&v41, v30);
v31 = a1->m_vehicleSpriteSecondary;
setPosition = v31->setPosition;
cocos2d::CCPoint::CCPoint(&v42, v41.width * 0.5, v41.height * 0.5);
setPosition(v31, &v42);
v33 = a1->m_birdVehicle;
v34 = v33->setPosition;
v35 = a1->m_vehicleSpriteSecondary->getPosition(a1->m_vehicleSpriteSecondary);
v34(v33, v35);
v36 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"bird_%02d_extra_001.png",
(const char *)v3);
v37 = (char *)cocos2d::CCString::getCString(v36);
sub_D153B8((int)&v42, v37);
PlayerObject::updateShipSpriteExtra((__int64)a1, (const char **)&v42);
v38 = (void *)(*(_QWORD *)&v42 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v42 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)(*(_QWORD *)&v42 - 8LL);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *(_DWORD *)(*(_QWORD *)&v42 - 8LL);
*(_DWORD *)(*(_QWORD *)&v42 - 8LL) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v38);
}
}