//
// PlayerObject::toggleRobotMode from 0x1002c7dd4 to 0x1002c8088 (692 bytes)
//
// 5 xrefs:
// > GJBaseGameLayer::switchToRobotMode @ 0x100281ebc
// > PlayerObject::switchedToMode @ 0x1002c3d30
// > PlayerObject::switchedToMode @ 0x1002c3db0
// > PlayerObject::copyAttributes @ 0x1002ca0a8
// > MenuGameLayer::resetPlayer @ 0x100442744
//
// This function is hookable on this platform (idp: arm, 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 11:02:33 +0000
//
void __fastcall PlayerObject::toggleRobotMode(__int64 a1, int a2, char a3)
{
__int64 v5; // x8
__int64 v7; // x0
__int64 v8; // x0
int v9; // w8
__int64 v10; // x0
char *CString; // x0
_QWORD *v12; // x0
__int64 v13; // x22
__int64 v14; // x0
void **v15; // x1
__int64 v16; // x0
__int64 v17; // x22
void **p_dst; // x8
__int64 v19; // x0
int v20; // w1
__int64 v21; // x22
__n128 v22; // q0
__int128 __dst; // [xsp+10h] [xbp-80h] BYREF
__int64 v24; // [xsp+20h] [xbp-70h]
_QWORD v25[2]; // [xsp+30h] [xbp-60h] BYREF
char v26; // [xsp+47h] [xbp-49h]
void *__p[2]; // [xsp+48h] [xbp-48h] BYREF
char v28; // [xsp+5Fh] [xbp-31h]
if ( *(unsigned __int8 *)(a1 + 2421) != a2 )
{
*(_QWORD *)(a1 + 1960) = *(_QWORD *)(a1 + 2624);
*(_BYTE *)(a1 + 2421) = a2;
v5 = **(_QWORD **)(a1 + 1360);
if ( !a2 )
{
(*(void (**)(void))(v5 + 552))();
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 1800) + 344LL))(*(_QWORD *)(a1 + 1800), 1);
SpriteAnimationManager::stopAnimations(*(_QWORD *)(*(_QWORD *)(a1 + 2136) + 648LL));
if ( *(float *)(a1 + 2472) == 1.0 || (*(_BYTE *)(a1 + 2648) & 1) == 0 )
{
v20 = *(_DWORD *)(a1 + 1560);
v19 = a1;
}
else
{
v19 = a1;
v20 = 0;
}
PlayerObject::updatePlayerFrame(v19, v20);
LABEL_29:
PlayerObject::updatePlayerGlow(a1);
*(_WORD *)(a1 + 1784) = 0;
*(_BYTE *)(a1 + 1640) = 0;
*(_DWORD *)(a1 + 1776) = 0;
if ( a2 )
{
PlayerObject::updatePlayerArt(a1, v22);
sub_1002C28E0(a1);
}
return;
}
(*(void (**)(void))(v5 + 464))();
PlayerObject::switchedToMode(a1, 27);
*(_QWORD *)(a1 + 2048) = 0x3FF8000000000000LL;
*(_WORD *)(a1 + 1784) = 0;
*(_BYTE *)(a1 + 1640) = 0;
*(_DWORD *)(a1 + 1776) = 0;
v7 = (*(__int64 (__fastcall **)(__int64, float))(*(_QWORD *)a1 + 360LL))(a1, 0.0);
v8 = GameManager::sharedState(v7);
v9 = *(_DWORD *)(v8 + 776) - *(_DWORD *)(v8 + 780);
if ( v9 >= 68 )
v9 = 68;
if ( v9 <= 1 )
v9 = 1;
v10 = sub_1003065B0("robot_%02d_01_001.png", v9);
CString = (char *)cocos2d::CCString::getCString(v10);
v12 = sub_100009900(__p, CString);
v13 = *(_QWORD *)(a1 + 1800);
v14 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v12);
if ( v28 >= 0 )
v15 = __p;
else
v15 = (void **)__p[0];
v16 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v14, v15);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v13 + 1160LL))(v13, v16);
if ( *(_BYTE *)(a1 + 2832) == 1 && *(double *)(a1 + 2712) == 0.0 )
{
v17 = *(_QWORD *)(a1 + 2136);
sub_100009900(v25, "idle01");
CCAnimatedSprite::runAnimation(v17, v25);
if ( (v26 & 0x80000000) == 0 )
{
LABEL_25:
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 1800) + 344LL))(*(_QWORD *)(a1 + 1800), 0);
if ( (a3 & 1) == 0 )
PlayerObject::spawnPortalCircle(a1, 3289855);
GJActionManager::stopInternalAction(*(_QWORD *)(a1 + 3032), 6);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)a1 + 128LL))(a1, *(float *)(a1 + 2472));
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)a1 + 144LL))(a1, *(float *)(a1 + 2472));
if ( v28 < 0 )
operator delete(__p[0]);
goto LABEL_29;
}
p_dst = (void **)v25;
}
else
{
v21 = *(_QWORD *)(a1 + 2136);
if ( *(char *)(a1 + 2967) < 0 )
{
sub_1000097D0(&__dst, *(void **)(a1 + 2944), *(_QWORD *)(a1 + 2952));
}
else
{
__dst = *(_OWORD *)(a1 + 2944);
v24 = *(_QWORD *)(a1 + 2960);
}
CCAnimatedSprite::runAnimation(v21, &__dst);
if ( (SHIBYTE(v24) & 0x80000000) == 0 )
goto LABEL_25;
p_dst = (void **)&__dst;
}
operator delete(*p_dst);
goto LABEL_25;
}
}