//
// GJRobotSprite::updateFrame from 0x1005dc3a0 to 0x1005dcac0 (1824 bytes)
//
// 2 xrefs:
// > SimplePlayer::updatePlayerFrame @ 0x10036b194
// > GJRobotSprite::init @ 0x1005dc30e
//
// 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)
{
GJRobotSprite *v2; // r13
int v3; // eax
bool v4; // cc
int v5; // ebx
GameManager *v6; // rax
IconType m_iconType; // edx
int m_iconRequestID; // ecx
cocos2d::CCTexture2D *Icon; // rax
cocos2d::CCArray *m_spriteParts; // rbx
unsigned int v11; // r15d
__int64 v12; // r12
double v13; // xmm0_8
char *v14; // rdi
cocos2d::CCString *v15; // rax
const char *CString; // rax
cocos2d::CCString *v17; // rax
const char *v18; // r14
size_t v19; // rax
size_t v20; // r15
char *v21; // rbx
cocos2d::CCString *v22; // rax
const char *v23; // r14
size_t v24; // rax
size_t v25; // r15
char *v26; // rbx
cocos2d::CCString *v27; // rax
const char *v28; // r14
size_t v29; // rax
size_t v30; // r15
char *v31; // rbx
size_t v32; // r13
size_t v33; // r13
size_t v34; // r13
cocos2d::CCSpriteFrameCache *v35; // rax
unsigned int v36; // r15d
const char *v37; // rsi
cocos2d::CCSpriteFrame *v38; // rax
__int64 v39; // r14
cocos2d::CCSpriteFrameCache *v40; // rax
const char *v41; // rsi
cocos2d::CCSpriteFrame *v42; // rax
__int64 v43; // rax
__int64 v44; // rax
__int64 v45; // r14
cocos2d::CCSpriteFrameCache *v46; // rax
const char *v47; // rsi
cocos2d::CCSpriteFrame *v48; // rax
cocos2d::CCString *v49; // rax
const char *v50; // r14
size_t v51; // rax
size_t v52; // r15
char *v53; // rbx
size_t v54; // r13
cocos2d::CCSpriteFrameCache *v55; // rax
const char *v56; // rsi
cocos2d::CCSpriteFrame *v57; // rax
cocos2d::CCSprite *m_extraSprite; // rdi
unsigned __int8 v59; // al
cocos2d::CCSprite *v60; // rax
cocos2d::CCSprite *v61; // r14
__int64 v62; // rax
char v63; // [rsp+0h] [rbp-E0h]
char v64; // [rsp+0h] [rbp-E0h]
char v65; // [rsp+0h] [rbp-E0h]
char v66; // [rsp+0h] [rbp-E0h]
float v67; // [rsp+8h] [rbp-D8h] BYREF
cocos2d::CCArray *v68; // [rsp+10h] [rbp-D0h]
int v69; // [rsp+1Ch] [rbp-C4h]
_QWORD __dst[2]; // [rsp+20h] [rbp-C0h] BYREF
void *v71; // [rsp+30h] [rbp-B0h]
_QWORD v72[2]; // [rsp+38h] [rbp-A8h] BYREF
void *v73; // [rsp+48h] [rbp-98h]
_QWORD v74[2]; // [rsp+50h] [rbp-90h] BYREF
void *v75; // [rsp+60h] [rbp-80h]
_QWORD v76[2]; // [rsp+68h] [rbp-78h] BYREF
void *__p; // [rsp+78h] [rbp-68h]
GJRobotSprite *v78; // [rsp+80h] [rbp-60h]
unsigned int v79; // [rsp+8Ch] [rbp-54h]
std::string v80; // [rsp+90h] [rbp-50h] BYREF
float v81; // [rsp+B4h] [rbp-2Ch]
v2 = a1;
v3 = (a1->m_iconType == Robot) ^ 0x45;
v4 = v3 < a2;
if ( v3 >= a2 )
v3 = a2;
v5 = 1;
if ( v4 )
v5 = v3;
if ( a2 >= 2 )
v5 = v3;
v6 = GameManager::sharedState();
m_iconType = a1->m_iconType;
m_iconRequestID = a1->m_iconRequestID;
v69 = v5;
Icon = GameManager::loadIcon(v6, v5, m_iconType, m_iconRequestID);
((void (__fastcall *)(GJRobotSprite *, cocos2d::CCTexture2D *))a1->setTexture)(a1, Icon);
m_spriteParts = a1->m_paSprite->m_spriteParts;
if ( (unsigned int)sub_100720070(m_spriteParts) )
{
v11 = 0;
v78 = a1;
v68 = m_spriteParts;
do
{
v12 = sub_1007200C0(m_spriteParts, v11);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v12 + 64LL))(v12);
v13 = 0.0;
memset(&v80, 0, sizeof(v80));
v14 = "spider_%02d_%02d";
if ( v2->m_iconType == Robot )
v14 = "robot_%02d_%02d";
v15 = (cocos2d::CCString *)sub_1007AB580(v14, v63);
CString = cocos2d::CCString::getCString(v15);
std::string::assign(&v80, CString);
v79 = v11;
v17 = (cocos2d::CCString *)sub_1007AB580("%s_001.png", v64);
v18 = cocos2d::CCString::getCString(v17);
v19 = strlen(v18);
if ( v19 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(0.0);
v20 = v19;
if ( v19 >= 0x17 )
{
v32 = (v19 | 7) + 1;
if ( (v19 | 7) == 0x17 )
v32 = 26;
v21 = (char *)operator new(v32);
v71 = v21;
__dst[0] = v32 | 1;
__dst[1] = v20;
}
else
{
LOBYTE(__dst[0]) = 2 * v19;
v21 = (char *)__dst + 1;
if ( !v19 )
{
BYTE1(__dst[0]) = 0;
goto LABEL_16;
}
}
memmove(v21, v18, v20);
v21[v20] = 0;
LABEL_16:
v22 = (cocos2d::CCString *)sub_1007AB580("%s_2_001.png", v65);
v23 = cocos2d::CCString::getCString(v22);
v24 = strlen(v23);
if ( v24 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(0.0);
v25 = v24;
if ( v24 >= 0x17 )
{
v33 = (v24 | 7) + 1;
if ( (v24 | 7) == 0x17 )
v33 = 26;
v26 = (char *)operator new(v33);
v73 = v26;
v72[0] = v33 | 1;
v72[1] = v25;
}
else
{
LOBYTE(v72[0]) = 2 * v24;
v26 = (char *)v72 + 1;
if ( !v24 )
{
BYTE1(v72[0]) = 0;
goto LABEL_20;
}
}
memmove(v26, v23, v25);
v26[v25] = 0;
LABEL_20:
v27 = (cocos2d::CCString *)sub_1007AB580("%s_glow_001.png", v66);
v28 = cocos2d::CCString::getCString(v27);
v29 = strlen(v28);
if ( v29 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(0.0);
v30 = v29;
if ( v29 >= 0x17 )
{
v34 = (v29 | 7) + 1;
if ( (v29 | 7) == 0x17 )
v34 = 26;
v31 = (char *)operator new(v34);
v75 = v31;
v74[0] = v34 | 1;
v74[1] = v30;
v2 = v78;
LABEL_35:
memmove(v31, v28, v30);
goto LABEL_36;
}
LOBYTE(v74[0]) = 2 * v29;
v31 = (char *)v74 + 1;
v2 = v78;
if ( v29 )
goto LABEL_35;
LABEL_36:
v31[v30] = 0;
v35 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v36 = v79;
v37 = (char *)__dst + 1;
if ( (__dst[0] & 1) != 0 )
v37 = (const char *)v71;
v38 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v35, v37);
(*(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v12 + 1144LL))(v12, v38);
v39 = sub_1007200C0(v2->m_secondArray, v36);
if ( v39 )
{
v40 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v41 = (char *)v72 + 1;
if ( (v72[0] & 1) != 0 )
v41 = (const char *)v73;
v42 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v40, v41);
(*(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v39 + 1144LL))(v39, v42);
v81 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 312LL))(v12);
v43 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 312LL))(v12);
*(_QWORD *)&v13 = LODWORD(v81);
*(float *)&v13 = v81 * 0.5;
sub_10028CBE0((float *)v76, v81 * 0.5, *(float *)(v43 + 4) * 0.5);
(*(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v39 + 184LL))(v39, v76);
}
v44 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v2->m_glowSprite->getChildren)(v2->m_glowSprite);
v45 = sub_1007200C0(v44, v36);
v46 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v47 = (char *)v74 + 1;
if ( (v74[0] & 1) != 0 )
v47 = (const char *)v75;
v48 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v46, v47);
(*(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v45 + 1144LL))(v45, v48);
if ( (CCSpritePart *)v12 == v2->m_headSprite )
{
v49 = (cocos2d::CCString *)sub_1007AB580("%s_extra_001.png", v63);
v50 = cocos2d::CCString::getCString(v49);
v51 = strlen(v50);
if ( v51 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v13);
v52 = v51;
if ( v51 >= 0x17 )
{
v54 = (v51 | 7) + 1;
if ( (v51 | 7) == 0x17 )
v54 = 26;
v53 = (char *)operator new(v54);
__p = v53;
v76[0] = v54 | 1;
v76[1] = v52;
v2 = v78;
}
else
{
LOBYTE(v76[0]) = 2 * v51;
v53 = (char *)v76 + 1;
v2 = v78;
if ( !v51 )
goto LABEL_53;
}
memmove(v53, v50, v52);
LABEL_53:
v53[v52] = 0;
v55 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v36 = v79;
v56 = (char *)v76 + 1;
if ( (v76[0] & 1) != 0 )
v56 = (const char *)__p;
v57 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v55, v56);
if ( v57 )
{
m_extraSprite = v2->m_extraSprite;
if ( m_extraSprite )
{
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSpriteFrame *))m_extraSprite->setDisplayFrame)(
m_extraSprite,
v57);
}
else
{
v60 = cocos2d::CCSprite::createWithSpriteFrame(v57);
v2->m_extraSprite = v60;
((void (__fastcall *)(CCSpritePart *, cocos2d::CCSprite *, __int64))v2->m_headSprite->addChild_0)(
v2->m_headSprite,
v60,
2);
}
v61 = v2->m_extraSprite;
v81 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 312LL))(v12);
v62 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 312LL))(v12);
sub_10028CBE0(&v67, v81 * 0.5, *(float *)(v62 + 4) * 0.5);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v61->setPosition)(v61, &v67);
v59 = 1;
}
else
{
v59 = 0;
}
v2->m_hasExtra = v59;
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))v2->m_extraSprite->setVisible)(v2->m_extraSprite, v59);
if ( (v76[0] & 1) != 0 )
operator delete(__p);
}
if ( (v74[0] & 1) != 0 )
{
operator delete(v75);
m_spriteParts = v68;
if ( (v72[0] & 1) == 0 )
{
LABEL_65:
if ( (__dst[0] & 1) == 0 )
goto LABEL_66;
goto LABEL_70;
}
}
else
{
m_spriteParts = v68;
if ( (v72[0] & 1) == 0 )
goto LABEL_65;
}
operator delete(v73);
if ( (__dst[0] & 1) == 0 )
{
LABEL_66:
if ( (*(_BYTE *)&v80.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_71;
goto LABEL_9;
}
LABEL_70:
operator delete(v71);
if ( (*(_BYTE *)&v80.__r_.__value_.__s.0 & 1) != 0 )
LABEL_71:
operator delete(v80.__r_.__value_.__l.__data_);
LABEL_9:
v11 = v36 + 1;
}
while ( v11 < (unsigned int)sub_100720070(m_spriteParts) );
}
}