//
// PlayerObject::toggleSpiderMode from 0x43e730 to 0x43e938 (520 bytes)
//
// 4 xrefs:
// > PlayerObject::switchedToMode @ 0x43e716
// > PlayerObject::copyAttributes @ 0x43f974
// > MenuGameLayer::resetPlayer @ 0x492966
// > GJBaseGameLayer::switchToSpiderMode @ 0x58eec2
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:48:24 +0000
//
char *__fastcall PlayerObject::toggleSpiderMode(char *this, int a2, int a3)
{
int v4; // r4
int *v6; // r0
int v7; // r3
GameManager *v8; // r0
int v9; // r0
const char *v10; // r1
cocos2d::CCString *v11; // r0
const char *CString; // r5
size_t v13; // r0
cocos2d::CCSpriteFrameCache *v14; // r0
int v15; // r5
void (__fastcall *v16)(int, int); // r10
cocos2d::CCSpriteFrameCache *v17; // r0
char *v18; // r1
int v19; // r0
int v20; // r10
int v21; // r2
int v22; // r3
const char *v23; // r1
int v24; // [sp+0h] [bp-20h]
int v25[2]; // [sp+4h] [bp-1Ch] BYREF
char *v26; // [sp+Ch] [bp-14h]
int v27[3]; // [sp+10h] [bp-10h] BYREF
v4 = (int)this;
if ( (unsigned __int8)*(this + 1958) != a2 )
{
*((_QWORD *)this + 199) = *((_QWORD *)this + 266);
v6 = *((int **)this + 293);
*(_BYTE *)(v4 + 1958) = a2;
v7 = *v6;
if ( a2 )
{
(*(void (**)(void))(v7 + 232))();
PlayerObject::switchedToMode((char *)v4, 33);
*(_DWORD *)(v4 + 2144) = 1104674816;
*(_DWORD *)(v4 + 648) = 1104674816;
*(_DWORD *)(v4 + 652) = 1104674816;
*(_QWORD *)(v4 + 1680) = 0x3FF8000000000000LL;
PlayerObject::stopRotation((PlayerObject *)v4, 0, 14);
v8 = (GameManager *)(*(int (__fastcall **)(int, _DWORD))(*(_DWORD *)v4 + 180))(v4, 0);
v9 = GameManager::sharedState(v8);
v10 = (const char *)(*(_DWORD *)(v9 + 588) - *(_DWORD *)(v9 + 592));
if ( (int)v10 >= 69 )
v10 = (_BYTE *)(&dword_44 + 1);
if ( (int)v10 < 1 )
v10 = (char *)&dword_0 + 1;
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"spider_%02d_01_001.png", v10);
v25[0] = 0;
v25[1] = 0;
v26 = nullptr;
CString = (const char *)cocos2d::CCString::getCString(v11);
v13 = strlen(CString);
v14 = (cocos2d::CCSpriteFrameCache *)std::string::__init(v25, CString, v13);
v15 = *(_DWORD *)(v4 + 1492);
v16 = *(void (__fastcall **)(int, int))(*(_DWORD *)v15 + 580);
v17 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v14);
if ( (v25[0] & 1) != 0 )
v18 = v26;
else
v18 = (char *)v25 + 1;
v19 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v17, v18);
v16(v15, v19);
if ( *(_BYTE *)(v4 + 2320) && *(double *)(v4 + 2200) == 0.0 )
{
v20 = *(_DWORD *)(v4 + 1736);
memset(v27, 0, sizeof(v27));
std::string::__init(v27, "idle01", 6u);
CCAnimatedSprite::runAnimation(v20, (int)v27, v21, v22);
std::string::~string((int)v27);
}
else
{
PlayerObject::playDynamicSpiderRun(v4);
}
(*(void (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(v4 + 1492) + 172))(*(_DWORD *)(v4 + 1492), 0);
if ( !a3 )
{
LOWORD(v24) = 13055;
BYTE2(v24) = 50;
PlayerObject::spawnPortalCircle(v4, v24, (CCCircleWave *)0x42480000);
}
PlayerObject::updatePlayerScale((GJActionManager **)v4);
std::string::~string((int)v25);
}
else
{
(*(void (**)(void))(v7 + 276))();
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(v4 + 1492) + 172))(*(_DWORD *)(v4 + 1492), 1);
SpriteAnimationManager::stopAnimations(*(SpriteAnimationManager **)(*(_DWORD *)(v4 + 1736) + 532));
if ( *(float *)(v4 + 2008) != 1.0 && *(_BYTE *)(v4 + 2152) )
v23 = nullptr;
else
v23 = *(const char **)(v4 + 1320);
PlayerObject::updatePlayerFrame((PlayerObject *)v4, v23);
PlayerObject::resetPlayerIcon((PlayerObject *)v4);
}
PlayerObject::updatePlayerGlow((PlayerObject *)v4);
this = PlayerObject::stopRotation((PlayerObject *)v4, 1, 15);
if ( a2 )
return (char *)PlayerObject::modeDidChange((PlayerObject *)v4);
}
return this;
}