//
// GJRobotSprite::updateFrame from 0x10023f87c to 0x10023fc98 (1052 bytes)
//
// 2 xrefs:
// > GJRobotSprite::init @ 0x10023f7dc
// > SimplePlayer::updatePlayerFrame @ 0x1003036d8
//
// 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 GJRobotSprite::updateFrame(GJRobotSprite *a1, int a2)
{
int v3; // w8
bool v4; // cc
__int64 v5; // x20
GameManager *v6; // x0
cocos2d::CCTexture2D *Icon; // x0
cocos2d::CCArray *m_spriteParts; // x21
__int64 v9; // x22
CCSpritePart *v10; // x27
__int64 v11; // x0
const char *v12; // x8
cocos2d::CCString *v13; // x0
const char *CString; // x0
std::string *v15; // x8
cocos2d::CCString *v16; // x0
char *v17; // x0
std::string *v18; // x8
cocos2d::CCString *v19; // x0
char *v20; // x0
std::string *v21; // x8
cocos2d::CCString *v22; // x0
char *v23; // x0
cocos2d::CCSpriteFrameCache *v24; // x0
void **v25; // x1
cocos2d::CCSpriteFrame *v26; // x0
__int64 v27; // x28
cocos2d::CCSpriteFrameCache *v28; // x0
void **v29; // x1
cocos2d::CCSpriteFrame *v30; // x0
float v31; // s9
__int64 v32; // x0
__n128 v33; // q0
__n128 v34; // q1
__int64 v35; // x0
__int64 v36; // x28
cocos2d::CCSpriteFrameCache *v37; // x0
void **v38; // x1
cocos2d::CCSpriteFrame *v39; // x0
std::string *v40; // x8
cocos2d::CCString *v41; // x0
char *v42; // x0
cocos2d::CCSpriteFrameCache *v43; // x0
void **v44; // x1
cocos2d::CCSpriteFrame *v45; // x1
cocos2d::CCSprite *m_extraSprite; // x0
cocos2d::CCSprite *v47; // x28
float v48; // s9
__int64 v49; // x0
__n128 v50; // q0
__n128 v51; // q1
int v52; // [xsp+18h] [xbp-E8h] BYREF
void *__p[2]; // [xsp+20h] [xbp-E0h] BYREF
char v54; // [xsp+37h] [xbp-C9h]
void *v55[2]; // [xsp+38h] [xbp-C8h] BYREF
char v56; // [xsp+4Fh] [xbp-B1h]
void *v57[2]; // [xsp+50h] [xbp-B0h] BYREF
char v58; // [xsp+67h] [xbp-99h]
void *v59[2]; // [xsp+68h] [xbp-98h] BYREF
char v60; // [xsp+7Fh] [xbp-81h]
std::string v61; // [xsp+80h] [xbp-80h] BYREF
if ( a1->m_iconType == Robot )
v3 = 68;
else
v3 = 69;
if ( v3 < a2 )
{
v4 = 0;
}
else
{
v3 = a2;
v4 = a2 <= 1;
}
if ( v4 )
v5 = 1;
else
v5 = (unsigned int)v3;
v6 = GameManager::sharedState();
Icon = GameManager::loadIcon(v6, v5, a1->m_iconType, a1->m_iconRequestID);
((void (__fastcall *)(GJRobotSprite *, cocos2d::CCTexture2D *))a1->setTexture)(a1, Icon);
m_spriteParts = a1->m_paSprite->m_spriteParts;
if ( (unsigned int)sub_10024A36C(m_spriteParts) )
{
v9 = 0;
do
{
v10 = (CCSpritePart *)sub_10024A388(m_spriteParts, v9);
v11 = ((__int64 (__fastcall *)(CCSpritePart *))v10->getTag)(v10);
memset(&v61, 0, sizeof(v61));
v12 = "spider_%02d_%02d";
if ( a1->m_iconType == Robot )
v12 = "robot_%02d_%02d";
v13 = (cocos2d::CCString *)sub_100268F4C(v12, v5, v11);
CString = cocos2d::CCString::getCString(v13);
std::string::assign(&v61, CString);
if ( (v61.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v15 = &v61;
else
v15 = (std::string *)v61.__r_.__value_.__r.__words[0];
v16 = (cocos2d::CCString *)sub_100268F4C("%s_001.png", (const char *)v15);
v17 = (char *)cocos2d::CCString::getCString(v16);
sub_100009900(v59, v17);
if ( (v61.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v18 = &v61;
else
v18 = (std::string *)v61.__r_.__value_.__r.__words[0];
v19 = (cocos2d::CCString *)sub_100268F4C("%s_2_001.png", (const char *)v18);
v20 = (char *)cocos2d::CCString::getCString(v19);
sub_100009900(v57, v20);
if ( (v61.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v21 = &v61;
else
v21 = (std::string *)v61.__r_.__value_.__r.__words[0];
v22 = (cocos2d::CCString *)sub_100268F4C("%s_glow_001.png", (const char *)v21);
v23 = (char *)cocos2d::CCString::getCString(v22);
sub_100009900(v55, v23);
v24 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
if ( v60 >= 0 )
v25 = v59;
else
v25 = (void **)v59[0];
v26 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v24, (const char *)v25);
((void (__fastcall *)(CCSpritePart *, cocos2d::CCSpriteFrame *))v10->setDisplayFrame)(v10, v26);
v27 = sub_10024A388(a1->m_secondArray, v9);
if ( v27 )
{
v28 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
if ( v58 >= 0 )
v29 = v57;
else
v29 = (void **)v57[0];
v30 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v28, (const char *)v29);
(*(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v27 + 1144LL))(v27, v30);
v31 = *(float *)((__int64 (__fastcall *)(CCSpritePart *))v10->getContentSize)(v10);
v32 = ((__int64 (__fastcall *)(CCSpritePart *))v10->getContentSize)(v10);
v33.n128_f32[0] = v31 * 0.5;
v34.n128_f32[0] = *(float *)(v32 + 4) * 0.5;
sub_100022980(v33, v34, __p);
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v27 + 184LL))(v27, __p);
}
v35 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_glowSprite->getChildren)(a1->m_glowSprite);
v36 = sub_10024A388(v35, v9);
v37 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
if ( v56 >= 0 )
v38 = v55;
else
v38 = (void **)v55[0];
v39 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v37, (const char *)v38);
(*(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v36 + 1144LL))(v36, v39);
if ( v10 == a1->m_headSprite )
{
if ( (v61.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v40 = &v61;
else
v40 = (std::string *)v61.__r_.__value_.__r.__words[0];
v41 = (cocos2d::CCString *)sub_100268F4C("%s_extra_001.png", (const char *)v40);
v42 = (char *)cocos2d::CCString::getCString(v41);
sub_100009900(__p, v42);
v43 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
if ( v54 >= 0 )
v44 = __p;
else
v44 = (void **)__p[0];
v45 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v43, (const char *)v44);
if ( v45 )
{
m_extraSprite = a1->m_extraSprite;
if ( m_extraSprite )
{
((void (__fastcall *)(cocos2d::CCSprite *))m_extraSprite->setDisplayFrame)(m_extraSprite);
}
else
{
a1->m_extraSprite = cocos2d::CCSprite::createWithSpriteFrame(v45);
((void (__fastcall *)(CCSpritePart *))a1->m_headSprite->addChild_0)(a1->m_headSprite);
}
v47 = a1->m_extraSprite;
v48 = *(float *)((__int64 (__fastcall *)(CCSpritePart *))v10->getContentSize)(v10);
v49 = ((__int64 (__fastcall *)(CCSpritePart *))v10->getContentSize)(v10);
v50.n128_f32[0] = v48 * 0.5;
v51.n128_f32[0] = *(float *)(v49 + 4) * 0.5;
sub_100022980(v50, v51, &v52);
((void (__fastcall *)(cocos2d::CCSprite *, int *))v47->setPosition)(v47, &v52);
LOBYTE(v45) = 1;
}
a1->m_hasExtra = (char)v45;
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_extraSprite->setVisible)(a1->m_extraSprite);
if ( v54 < 0 )
operator delete(__p[0]);
}
if ( v56 < 0 )
operator delete(v55[0]);
if ( v58 < 0 )
operator delete(v57[0]);
if ( v60 < 0 )
operator delete(v59[0]);
if ( SHIBYTE(v61.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v61.__r_.__value_.__l.__data_);
v9 = (unsigned int)(v9 + 1);
}
while ( (unsigned int)v9 < (unsigned int)sub_10024A36C(m_spriteParts) );
}
}