//
// PlayerObject::updatePlayerBirdFrame from 0x1004171a0 to 0x100417433 (659 bytes)
//
// 2 xrefs:
// > PlayerObject::toggleBirdMode @ 0x100416f13
// > MenuGameLayer::resetPlayer @ 0x1004fa80f
//
// 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 PlayerObject::updatePlayerBirdFrame(PlayerObject *a1, int a2)
{
int v2; // r14d
GameManager *v3; // rax
cocos2d::CCString *v4; // rax
const char *CString; // r15
cocos2d::CCString *v6; // rax
const char *v7; // r13
cocos2d::CCString *v8; // rax
cocos2d::CCString *v9; // rax
cocos2d::CCSprite *m_vehicleSprite; // r12
cocos2d::CCSpriteFrameCache *v11; // rax
cocos2d::CCSpriteFrame *v12; // rax
cocos2d::CCSprite *m_vehicleSpriteSecondary; // r15
cocos2d::CCSpriteFrameCache *v14; // rax
cocos2d::CCSpriteFrame *v15; // rax
cocos2d::CCSprite *m_birdVehicle; // r15
cocos2d::CCSpriteFrameCache *v17; // rax
cocos2d::CCSpriteFrame *v18; // rax
cocos2d::CCSprite *m_vehicleGlow; // r15
cocos2d::CCSpriteFrameCache *v20; // rax
cocos2d::CCSpriteFrame *v21; // rax
_QWORD *v22; // rax
cocos2d::CCSprite *v23; // r15
double v24; // xmm0_8
cocos2d::CCSprite *v25; // r15
__int64 v26; // rax
cocos2d::CCString *v27; // rax
const char *v28; // r15
size_t v29; // rax
size_t v30; // r14
char *v31; // r12
size_t v32; // r13
float v33; // [rsp+0h] [rbp-60h] BYREF
const char *v34; // [rsp+8h] [rbp-58h]
const char *v35; // [rsp+10h] [rbp-50h]
__int64 v36; // [rsp+18h] [rbp-48h] BYREF
_QWORD __dst[2]; // [rsp+20h] [rbp-40h] BYREF
void *__p; // [rsp+30h] [rbp-30h]
v2 = a2;
if ( a2 >= 149 )
v2 = 149;
if ( v2 < 2 )
v2 = 1;
v3 = GameManager::sharedState();
GameManager::loadIcon(v3, v2, 3, a1->m_iconRequestID);
v4 = (cocos2d::CCString *)sub_1007AB580("bird_%02d_001.png", SLOBYTE(v33));
CString = cocos2d::CCString::getCString(v4);
v6 = (cocos2d::CCString *)sub_1007AB580("bird_%02d_2_001.png", SLOBYTE(v33));
v7 = cocos2d::CCString::getCString(v6);
v8 = (cocos2d::CCString *)sub_1007AB580("bird_%02d_3_001.png", SLOBYTE(v33));
v35 = cocos2d::CCString::getCString(v8);
v9 = (cocos2d::CCString *)sub_1007AB580("bird_%02d_glow_001.png", SLOBYTE(v33));
v34 = cocos2d::CCString::getCString(v9);
m_vehicleSprite = a1->m_vehicleSprite;
v11 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v12 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v11, CString);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSpriteFrame *))m_vehicleSprite->setDisplayFrame)(
m_vehicleSprite,
v12);
m_vehicleSpriteSecondary = a1->m_vehicleSpriteSecondary;
v14 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v15 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v14, v7);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSpriteFrame *))m_vehicleSpriteSecondary->setDisplayFrame)(
m_vehicleSpriteSecondary,
v15);
m_birdVehicle = a1->m_birdVehicle;
v17 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v18 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v17, v35);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSpriteFrame *))m_birdVehicle->setDisplayFrame)(
m_birdVehicle,
v18);
m_vehicleGlow = a1->m_vehicleGlow;
v20 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v21 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v20, v34);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSpriteFrame *))m_vehicleGlow->setDisplayFrame)(
m_vehicleGlow,
v21);
v22 = (_QWORD *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_vehicleSprite->getContentSize)(a1->m_vehicleSprite);
sub_10028CFC0(&v36, v22);
v23 = a1->m_vehicleSpriteSecondary;
*(_QWORD *)&v24 = (unsigned int)v36;
*(float *)&v24 = *(float *)&v36 * 0.5;
sub_10028CBE0(&v33, *(float *)&v36 * 0.5, 0.5 * *((float *)&v36 + 1));
((void (__fastcall *)(cocos2d::CCSprite *, float *))v23->setPosition)(v23, &v33);
v25 = a1->m_birdVehicle;
v26 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_vehicleSpriteSecondary->getPosition)(a1->m_vehicleSpriteSecondary);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v25->setPosition)(v25, v26);
v27 = (cocos2d::CCString *)sub_1007AB580("bird_%02d_extra_001.png", SLOBYTE(v33));
v28 = cocos2d::CCString::getCString(v27);
v29 = strlen(v28);
if ( v29 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v24);
v30 = v29;
if ( v29 >= 0x17 )
{
v32 = 26;
if ( (v29 | 7) != 0x17 )
v32 = (v29 | 7) + 1;
v31 = (char *)operator new(v32);
__p = v31;
__dst[0] = v32 + 1;
__dst[1] = v30;
goto LABEL_12;
}
LOBYTE(__dst[0]) = 2 * v29;
v31 = (char *)__dst + 1;
if ( v29 )
LABEL_12:
memmove(v31, v28, v30);
v31[v30] = 0;
PlayerObject::updateShipSpriteExtra((__int64)a1, (__int64)__dst);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
}