//
// GJRobotSprite::updateFrame from 0x1006adcb0 to 0x1006ae3d0 (1824 bytes)
//
// 2 xrefs:
// > SimplePlayer::updatePlayerFrame @ 0x1003545a4
// > GJRobotSprite::init @ 0x1006adc1e
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:35:23 +0000
//
__int64 __fastcall GJRobotSprite::updateFrame(__int64 a1, int a2, double a3)
{
__int64 v3; // r13
int v4; // eax
bool v5; // cc
unsigned int v6; // ebx
__int64 v7; // rax
unsigned int v8; // edx
int v9; // ecx
__int64 Icon; // rax
__int64 v11; // rbx
__int64 result; // rax
unsigned int v13; // r15d
__int64 v14; // r12
char *v15; // rdi
__int64 v16; // rax
const std::string::value_type *CString; // rax
__int64 v18; // rax
const char *v19; // r14
size_t v20; // rax
size_t v21; // r15
char *v22; // rbx
__int64 v23; // rax
const char *v24; // r14
size_t v25; // rax
size_t v26; // r15
char *v27; // rbx
__int64 v28; // rax
const char *v29; // r14
size_t v30; // rax
size_t v31; // r15
char *v32; // rbx
size_t v33; // r13
size_t v34; // r13
size_t v35; // r13
__int64 v36; // rax
unsigned int v37; // r15d
const char *v38; // rsi
__int64 v39; // rax
__int64 v40; // r14
__int64 v41; // rax
const char *v42; // rsi
__int64 v43; // rax
__int64 v44; // rax
__int64 v45; // rax
__int64 v46; // r14
__int64 v47; // rax
const char *v48; // rsi
__int64 v49; // rax
__int64 v50; // rax
const char *v51; // r14
size_t v52; // rax
size_t v53; // r15
char *v54; // rbx
size_t v55; // r13
__int64 v56; // rax
const char *v57; // rsi
__int64 v58; // rax
__int64 v59; // rdi
unsigned __int8 v60; // al
char *v61; // rax
__int64 v62; // r14
__int64 v63; // rax
char v64; // [rsp+0h] [rbp-E0h]
char v65; // [rsp+0h] [rbp-E0h]
char v66; // [rsp+0h] [rbp-E0h]
char v67; // [rsp+0h] [rbp-E0h]
float v68; // [rsp+8h] [rbp-D8h] BYREF
__int64 v69; // [rsp+10h] [rbp-D0h]
unsigned int v70; // [rsp+1Ch] [rbp-C4h]
_QWORD __dst[2]; // [rsp+20h] [rbp-C0h] BYREF
void *v72; // [rsp+30h] [rbp-B0h]
_QWORD v73[2]; // [rsp+38h] [rbp-A8h] BYREF
void *v74; // [rsp+48h] [rbp-98h]
_QWORD v75[2]; // [rsp+50h] [rbp-90h] BYREF
void *v76; // [rsp+60h] [rbp-80h]
_QWORD v77[2]; // [rsp+68h] [rbp-78h] BYREF
void *__p; // [rsp+78h] [rbp-68h]
__int64 v79; // [rsp+80h] [rbp-60h]
unsigned int v80; // [rsp+8Ch] [rbp-54h]
std::string v81; // [rsp+90h] [rbp-50h] BYREF
float v82; // [rsp+B4h] [rbp-2Ch]
v3 = a1;
v4 = (*(_DWORD *)(a1 + 760) == 5) ^ 0x45;
v5 = v4 < a2;
if ( v4 >= a2 )
v4 = a2;
v6 = 1;
if ( v5 )
v6 = v4;
if ( a2 >= 2 )
v6 = v4;
v7 = GameManager::sharedState();
v8 = *(_DWORD *)(a1 + 760);
v9 = *(_DWORD *)(a1 + 764);
v70 = v6;
Icon = GameManager::loadIcon(v7, v6, v8, v9, a3);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1064LL))(a1, Icon);
v11 = *(_QWORD *)(*(_QWORD *)(a1 + 672) + 632LL);
result = sub_1007FEF90(v11);
if ( (_DWORD)result )
{
v13 = 0;
v79 = a1;
v69 = v11;
do
{
v14 = sub_1007FEFE0(v11, v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v14 + 64LL))(v14);
memset(&v81, 0, sizeof(v81));
v15 = "spider_%02d_%02d";
if ( *(_DWORD *)(v3 + 760) == 5 )
v15 = "robot_%02d_%02d";
v16 = sub_10088E820(v15, v64);
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v16);
std::string::assign(&v81, CString);
v80 = v13;
v18 = sub_10088E820("%s_001.png", v65);
v19 = (const char *)cocos2d::CCString::getCString(v18);
v20 = strlen(v19);
if ( v20 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v21 = v20;
if ( v20 >= 0x17 )
{
v33 = (v20 | 7) + 1;
if ( (v20 | 7) == 0x17 )
v33 = 26;
v22 = (char *)operator new(v33);
v72 = v22;
__dst[0] = v33 | 1;
__dst[1] = v21;
}
else
{
LOBYTE(__dst[0]) = 2 * v20;
v22 = (char *)__dst + 1;
if ( !v20 )
{
BYTE1(__dst[0]) = 0;
goto LABEL_16;
}
}
memmove(v22, v19, v21);
v22[v21] = 0;
LABEL_16:
v23 = sub_10088E820("%s_2_001.png", v66);
v24 = (const char *)cocos2d::CCString::getCString(v23);
v25 = strlen(v24);
if ( v25 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v26 = v25;
if ( v25 >= 0x17 )
{
v34 = (v25 | 7) + 1;
if ( (v25 | 7) == 0x17 )
v34 = 26;
v27 = (char *)operator new(v34);
v74 = v27;
v73[0] = v34 | 1;
v73[1] = v26;
}
else
{
LOBYTE(v73[0]) = 2 * v25;
v27 = (char *)v73 + 1;
if ( !v25 )
{
BYTE1(v73[0]) = 0;
goto LABEL_20;
}
}
memmove(v27, v24, v26);
v27[v26] = 0;
LABEL_20:
v28 = sub_10088E820("%s_glow_001.png", v67);
v29 = (const char *)cocos2d::CCString::getCString(v28);
v30 = strlen(v29);
if ( v30 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v31 = v30;
if ( v30 >= 0x17 )
{
v35 = (v30 | 7) + 1;
if ( (v30 | 7) == 0x17 )
v35 = 26;
v32 = (char *)operator new(v35);
v76 = v32;
v75[0] = v35 | 1;
v75[1] = v31;
v3 = v79;
LABEL_35:
memmove(v32, v29, v31);
goto LABEL_36;
}
LOBYTE(v75[0]) = 2 * v30;
v32 = (char *)v75 + 1;
v3 = v79;
if ( v30 )
goto LABEL_35;
LABEL_36:
v32[v31] = 0;
v36 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v37 = v80;
v38 = (char *)__dst + 1;
if ( (__dst[0] & 1) != 0 )
v38 = (const char *)v72;
v39 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v36, v38);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v14 + 1160LL))(v14, v39);
v40 = sub_1007FEFE0(*(_QWORD *)(v3 + 736), v37);
if ( v40 )
{
v41 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v42 = (char *)v73 + 1;
if ( (v73[0] & 1) != 0 )
v42 = (const char *)v74;
v43 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v41, v42);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v40 + 1160LL))(v40, v43);
v82 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 328LL))(v14);
v44 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 328LL))(v14);
sub_100278250((float *)v77, v82 * 0.5, *(float *)(v44 + 4) * 0.5);
(*(void (__fastcall **)(__int64, _QWORD *))(*(_QWORD *)v40 + 184LL))(v40, v77);
}
v45 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v3 + 744) + 488LL))(*(_QWORD *)(v3 + 744));
v46 = sub_1007FEFE0(v45, v37);
v47 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v48 = (char *)v75 + 1;
if ( (v75[0] & 1) != 0 )
v48 = (const char *)v76;
v49 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v47, v48);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v46 + 1160LL))(v46, v49);
if ( v14 == *(_QWORD *)(v3 + 768) )
{
v50 = sub_10088E820("%s_extra_001.png", v64);
v51 = (const char *)cocos2d::CCString::getCString(v50);
v52 = strlen(v51);
if ( v52 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v53 = v52;
if ( v52 >= 0x17 )
{
v55 = (v52 | 7) + 1;
if ( (v52 | 7) == 0x17 )
v55 = 26;
v54 = (char *)operator new(v55);
__p = v54;
v77[0] = v55 | 1;
v77[1] = v53;
v3 = v79;
}
else
{
LOBYTE(v77[0]) = 2 * v52;
v54 = (char *)v77 + 1;
v3 = v79;
if ( !v52 )
goto LABEL_53;
}
memmove(v54, v51, v53);
LABEL_53:
v54[v53] = 0;
v56 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v37 = v80;
v57 = (char *)v77 + 1;
if ( (v77[0] & 1) != 0 )
v57 = (const char *)__p;
v58 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v56, v57);
if ( v58 )
{
v59 = *(_QWORD *)(v3 + 752);
if ( v59 )
{
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v59 + 1160LL))(v59, v58);
}
else
{
v61 = cocos2d::CCSprite::createWithSpriteFrame(v58);
*(_QWORD *)(v3 + 752) = v61;
(*(void (__fastcall **)(_QWORD, char *, __int64))(**(_QWORD **)(v3 + 768) + 464LL))(
*(_QWORD *)(v3 + 768),
v61,
2);
}
v62 = *(_QWORD *)(v3 + 752);
v82 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 328LL))(v14);
v63 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 328LL))(v14);
sub_100278250(&v68, v82 * 0.5, *(float *)(v63 + 4) * 0.5);
(*(void (__fastcall **)(__int64, float *))(*(_QWORD *)v62 + 184LL))(v62, &v68);
v60 = 1;
}
else
{
v60 = 0;
}
*(_BYTE *)(v3 + 728) = v60;
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v3 + 752) + 344LL))(*(_QWORD *)(v3 + 752), v60);
if ( (v77[0] & 1) != 0 )
operator delete(__p);
}
if ( (v75[0] & 1) != 0 )
{
operator delete(v76);
v11 = v69;
if ( (v73[0] & 1) == 0 )
{
LABEL_65:
if ( (__dst[0] & 1) == 0 )
goto LABEL_66;
goto LABEL_70;
}
}
else
{
v11 = v69;
if ( (v73[0] & 1) == 0 )
goto LABEL_65;
}
operator delete(v74);
if ( (__dst[0] & 1) == 0 )
{
LABEL_66:
if ( (*(_BYTE *)&v81.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_71;
goto LABEL_9;
}
LABEL_70:
operator delete(v72);
if ( (*(_BYTE *)&v81.__r_.__value_.__s.0 & 1) != 0 )
LABEL_71:
operator delete(v81.__r_.__value_.__l.__data_);
LABEL_9:
v13 = v37 + 1;
result = sub_1007FEF90(v11);
}
while ( v13 < (unsigned int)result );
}
return result;
}