//
// GJRobotSprite::updateFrame from 0x4b8158 to 0x4b8452 (762 bytes)
//
// 2 xrefs:
// > SimplePlayer::updatePlayerFrame @ 0x4035c8
// > GJRobotSprite::init @ 0x4b8760
//
// 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 GJRobotSprite::updateFrame(GJRobotSprite *a1, int a2)
{
const char *v3; // r6
GameManager *v4; // r0
unsigned int v5; // r8
cocos2d::CCTexture2D *Icon; // r0
CCSpritePart *v7; // r5
int v8; // r0
int v9; // r2
char *v10; // r0
cocos2d::CCString *v11; // r0
char *CString; // r0
cocos2d::CCString *v13; // r0
char *v14; // r0
cocos2d::CCString *v15; // r0
char *v16; // r0
cocos2d::CCString *v17; // r0
char *v18; // r0
void (__fastcall *setDisplayFrame)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // r10
cocos2d::CCSpriteFrameCache *v20; // r0
cocos2d::CCSpriteFrame *v21; // r0
int v22; // r0
int v23; // r10
void (__fastcall *v24)(int, cocos2d::CCSpriteFrame *); // r11
cocos2d::CCSpriteFrameCache *v25; // r0
cocos2d::CCSpriteFrame *v26; // r0
void (__fastcall *v27)(int, cocos2d::CCPoint *); // r11
float width; // s17
int v29; // r0
cocos2d::CCArray *v30; // r0
int v31; // r10
void (__fastcall *v32)(int, cocos2d::CCSpriteFrame *); // r11
cocos2d::CCSpriteFrameCache *v33; // r0
cocos2d::CCSpriteFrame *v34; // r0
cocos2d::CCString *v35; // r0
char *v36; // r0
cocos2d::CCSpriteFrameCache *v37; // r0
cocos2d::CCSpriteFrame *v38; // r0
cocos2d::CCSprite *m_extraSprite; // r3
cocos2d::CCSprite *v40; // r0
cocos2d::CCSprite *v41; // r10
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r11
float v43; // s17
int v44; // r0
cocos2d::CCArray *m_spriteParts; // [sp+8h] [bp-44h]
char *v46; // [sp+28h] [bp-24h] BYREF
char *v47; // [sp+2Ch] [bp-20h] BYREF
char *v48; // [sp+30h] [bp-1Ch] BYREF
char *v49; // [sp+34h] [bp-18h] BYREF
char *v50; // [sp+38h] [bp-14h] BYREF
cocos2d::CCPoint v51; // [sp+3Ch] [bp-10h] BYREF
v3 = (const char *)a2;
if ( a1->m_iconType == Robot )
{
if ( a2 > 68 )
{
v3 = (const char *)&dword_44;
goto LABEL_6;
}
}
else if ( a2 > 69 )
{
v3 = (_BYTE *)(&dword_44 + 1);
goto LABEL_6;
}
if ( a2 < 1 )
v3 = (_BYTE *)(&dword_0 + 1);
LABEL_6:
v4 = GameManager::sharedState();
v5 = 0;
Icon = GameManager::loadIcon(v4, (int)v3, a1->m_iconType, a1->m_iconRequestID);
a1->setTexture(a1, Icon);
m_spriteParts = a1->m_paSprite->m_spriteParts;
while ( v5 < cocos2d::CCArray::count(m_spriteParts) )
{
v7 = (CCSpritePart *)cocos2d::CCArray::objectAtIndex(m_spriteParts, v5);
v8 = v7->getTag(v7);
v46 = (char *)&unk_ACDDA8;
v9 = v8;
if ( a1->m_iconType == Robot )
v10 = "robot_%02d_%02d";
else
v10 = "spider_%02d_%02d";
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)v10, v3, v9);
CString = (char *)cocos2d::CCString::getCString(v11);
sub_7753D4((int)&v46, CString);
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_001.png", v46);
v14 = (char *)cocos2d::CCString::getCString(v13);
sub_776584((int)&v47, v14);
v15 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_2_001.png", v46);
v16 = (char *)cocos2d::CCString::getCString(v15);
sub_776584((int)&v48, v16);
v17 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_glow_001.png", v46);
v18 = (char *)cocos2d::CCString::getCString(v17);
sub_776584((int)&v49, v18);
setDisplayFrame = v7->setDisplayFrame;
v20 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v21 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v20, v47);
setDisplayFrame(v7, v21);
v22 = cocos2d::CCArray::objectAtIndex(a1->m_secondArray, v5);
v23 = v22;
if ( v22 )
{
v24 = *(void (__fastcall **)(int, cocos2d::CCSpriteFrame *))(*(_DWORD *)v22 + 572);
v25 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v26 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v25, v48);
v24(v23, v26);
v27 = *(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v23 + 92);
width = v7->getContentSize(v7)->width;
v29 = (int)v7->getContentSize(v7);
cocos2d::CCPoint::CCPoint(&v51, width * 0.5, *(float *)(v29 + 4) * 0.5);
v27(v23, &v51);
}
v30 = a1->m_glowSprite->getChildren(a1->m_glowSprite);
v31 = cocos2d::CCArray::objectAtIndex(v30, v5);
v32 = *(void (__fastcall **)(int, cocos2d::CCSpriteFrame *))(*(_DWORD *)v31 + 572);
v33 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v34 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v33, v49);
v32(v31, v34);
if ( v7 == a1->m_headSprite )
{
v35 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_extra_001.png", v46);
v36 = (char *)cocos2d::CCString::getCString(v35);
sub_776584((int)&v50, v36);
v37 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v38 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v37, v50);
if ( v38 )
{
m_extraSprite = a1->m_extraSprite;
if ( m_extraSprite )
{
m_extraSprite->setDisplayFrame(a1->m_extraSprite, v38);
}
else
{
v40 = cocos2d::CCSprite::createWithSpriteFrame(v38);
a1->m_extraSprite = v40;
a1->m_headSprite->addChild_0(a1->m_headSprite, v40, 2);
}
v41 = a1->m_extraSprite;
setPosition = v41->setPosition;
v43 = v7->getContentSize(v7)->width;
v44 = (int)v7->getContentSize(v7);
cocos2d::CCPoint::CCPoint(&v51, v43 * 0.5, *(float *)(v44 + 4) * 0.5);
setPosition(v41, &v51);
a1->m_hasExtra = 1;
}
else
{
a1->m_hasExtra = 0;
}
a1->m_extraSprite->setVisible(a1->m_extraSprite, a1->m_hasExtra);
sub_774008(&v50);
}
++v5;
sub_774008(&v49);
sub_774008(&v48);
sub_774008(&v47);
sub_774008(&v46);
}
}