//
// GJRobotSprite::updateFrame from 0x8e2f50 to 0x8e3604 (1716 bytes)
//
// 3 xrefs:
// > SimplePlayer::updatePlayerFrame @ 0x79279c
// > GJRobotSprite::init @ 0x8e39c4
// > ??> @ 0x68880
//
// 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)
{
IconType m_iconType; // w0
int v4; // w1
GameManager *v5; // x0
unsigned int v6; // w22
cocos2d::CCTexture2D *Icon; // x0
CCSpritePart *v8; // x19
__int64 v9; // x2
IconType v10; // w1
cocos2d::CCString *v11; // x0
size_t v12; // x0
double v13; // d0
cocos2d::CCString *v14; // x0
char *v15; // x0
cocos2d::CCString *v16; // x0
char *v17; // x0
cocos2d::CCString *v18; // x0
char *v19; // x0
void (__fastcall *setDisplayFrame)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // x24
cocos2d::CCSpriteFrameCache *v21; // x0
cocos2d::CCSpriteFrame *v22; // x0
__int64 v23; // x0
__int64 v24; // x24
void (__fastcall *v25)(__int64, cocos2d::CCSpriteFrame *); // x28
cocos2d::CCSpriteFrameCache *v26; // x0
cocos2d::CCSpriteFrame *v27; // x0
void (__fastcall *v28)(__int64, cocos2d::CCPoint *); // x28
float width; // s8
__int64 v30; // x0
cocos2d::CCArray *v31; // x0
__int64 v32; // x24
void (__fastcall *v33)(__int64, cocos2d::CCSpriteFrame *); // x28
cocos2d::CCSpriteFrameCache *v34; // x0
cocos2d::CCSpriteFrame *v35; // x0
char *v36; // x0
char *v37; // x0
char *v38; // x0
char *v39; // x0
unsigned int *v40; // x19
int v41; // w1
unsigned int *v42; // x1
int v43; // w2
unsigned int *v44; // x1
int v45; // w2
unsigned int *v46; // x1
int v47; // w2
cocos2d::CCString *v48; // x0
char *v49; // x0
cocos2d::CCSpriteFrameCache *v50; // x0
cocos2d::CCSpriteFrame *v51; // x0
cocos2d::CCSprite *m_extraSprite; // x2
cocos2d::CCSprite *v53; // x24
float v54; // s8
__int64 v55; // x0
_BOOL8 v56; // x1
char *v57; // x0
unsigned int *v58; // x1
int v59; // w2
int v60; // w0
cocos2d::CCSprite *v61; // x0
CCSpritePart *m_headSprite; // x3
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+70h] [xbp+70h]
int v64; // [xsp+8Ch] [xbp+8Ch]
cocos2d::CCArray *m_spriteParts; // [xsp+90h] [xbp+90h]
const char *CString; // [xsp+98h] [xbp+98h]
const char *v67; // [xsp+A8h] [xbp+A8h] BYREF
const char *v68; // [xsp+B0h] [xbp+B0h] BYREF
const char *v69; // [xsp+B8h] [xbp+B8h] BYREF
const char *v70; // [xsp+C0h] [xbp+C0h] BYREF
const char *v71; // [xsp+C8h] [xbp+C8h] BYREF
cocos2d::CCPoint v72; // [xsp+D0h] [xbp+D0h] BYREF
v64 = a2;
m_iconType = a1->m_iconType;
if ( m_iconType != Robot )
{
if ( a2 > 1 )
{
v4 = 69;
goto LABEL_4;
}
LABEL_60:
v64 = 1;
goto LABEL_5;
}
v4 = 68;
if ( v64 <= 1 )
goto LABEL_60;
LABEL_4:
if ( v4 < v64 )
{
if ( m_iconType == Robot )
v60 = 68;
else
v60 = 69;
v64 = v60;
}
LABEL_5:
v5 = GameManager::sharedState();
v6 = 0;
Icon = GameManager::loadIcon(v5, v64, a1->m_iconType, a1->m_iconRequestID);
a1->setTexture(a1, Icon);
m_spriteParts = a1->m_paSprite->m_spriteParts;
if ( (unsigned int)cocos2d::CCArray::count(m_spriteParts) )
{
do
{
v8 = (CCSpritePart *)cocos2d::CCArray::objectAtIndex(m_spriteParts, v6);
v9 = (unsigned int)v8->getTag(v8);
v10 = a1->m_iconType;
v67 = &byte_124B6C8;
if ( v10 == Robot )
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"robot_%02d_%02d",
(const char *)(unsigned int)v64,
v9);
else
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"spider_%02d_%02d",
(const char *)(unsigned int)v64,
v9);
CString = cocos2d::CCString::getCString(v11);
v12 = strlen(CString);
*(_QWORD *)&v13 = sub_D1798C(&v67, CString, v12).n128_u64[0];
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_001.png", v67, v13);
v15 = (char *)cocos2d::CCString::getCString(v14);
sub_D153B8((int)&v68, v15);
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_2_001.png", v67);
v17 = (char *)cocos2d::CCString::getCString(v16);
sub_D153B8((int)&v69, v17);
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_glow_001.png", v67);
v19 = (char *)cocos2d::CCString::getCString(v18);
sub_D153B8((int)&v70, v19);
setDisplayFrame = v8->setDisplayFrame;
v21 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v22 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v21, v68);
setDisplayFrame(v8, v22);
v23 = cocos2d::CCArray::objectAtIndex(a1->m_secondArray, v6);
v24 = v23;
if ( v23 )
{
v25 = *(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v23 + 1144LL);
v26 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v27 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v26, v69);
v25(v24, v27);
v28 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v24 + 184LL);
width = v8->getContentSize(v8)->width;
v30 = (__int64)v8->getContentSize(v8);
cocos2d::CCPoint::CCPoint(&v72, width * 0.5, *(float *)(v30 + 4) * 0.5);
v28(v24, &v72);
}
v31 = a1->m_glowSprite->getChildren(a1->m_glowSprite);
v32 = cocos2d::CCArray::objectAtIndex(v31, v6);
v33 = *(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v32 + 1144LL);
v34 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v35 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v34, v70);
v33(v32, v35);
if ( v8 == a1->m_headSprite )
{
v48 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s_extra_001.png", v67);
v49 = (char *)cocos2d::CCString::getCString(v48);
sub_D153B8((int)&v71, v49);
v50 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v51 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v50, v71);
if ( v51 )
{
m_extraSprite = a1->m_extraSprite;
if ( m_extraSprite )
{
m_extraSprite->setDisplayFrame(a1->m_extraSprite, v51);
}
else
{
v61 = cocos2d::CCSprite::createWithSpriteFrame(v51);
m_headSprite = a1->m_headSprite;
a1->m_extraSprite = v61;
m_headSprite->addChild_0(m_headSprite, v61, 2);
}
v53 = a1->m_extraSprite;
setPosition = v53->setPosition;
v54 = v8->getContentSize(v8)->width;
v55 = (__int64)v8->getContentSize(v8);
cocos2d::CCPoint::CCPoint(&v72, v54 * 0.5, *(float *)(v55 + 4) * 0.5);
setPosition(v53, &v72);
v56 = 1;
a1->m_hasExtra = 1;
}
else
{
a1->m_hasExtra = 0;
v56 = 0;
}
a1->m_extraSprite->setVisible(a1->m_extraSprite, v56);
v57 = (char *)(v71 - 24);
if ( v71 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v58 = (unsigned int *)(v71 - 8);
do
v59 = __ldaxr(v58);
while ( __stlxr(v59 - 1, v58) );
}
else
{
v59 = *((_DWORD *)v71 - 2);
*((_DWORD *)v71 - 2) = v59 - 1;
}
if ( v59 <= 0 )
operator delete(v57);
}
}
v36 = (char *)(v70 - 24);
if ( v70 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = (unsigned int *)(v70 - 8);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *((_DWORD *)v70 - 2);
*((_DWORD *)v70 - 2) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v36);
}
v37 = (char *)(v69 - 24);
if ( v69 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(v69 - 8);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *((_DWORD *)v69 - 2);
*((_DWORD *)v69 - 2) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v37);
}
v38 = (char *)(v68 - 24);
if ( v68 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)(v68 - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *((_DWORD *)v68 - 2);
*((_DWORD *)v68 - 2) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v38);
}
v39 = (char *)(v67 - 24);
if ( v67 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_15;
if ( &pthread_create )
{
v40 = (unsigned int *)(v67 - 8);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *((_DWORD *)v67 - 2);
*((_DWORD *)v67 - 2) = v41 - 1;
}
if ( v41 > 0 )
{
LABEL_15:
++v6;
}
else
{
++v6;
operator delete(v39);
}
}
while ( v6 < (unsigned int)cocos2d::CCArray::count(m_spriteParts) );
}
}