//
// PlayerObject::toggleSpiderMode from 0x759640 to 0x759954 (788 bytes)
//
// 8 xrefs:
// > PlayerObject::switchedToMode @ 0x7595c4
// > PlayerObject::switchedToMode @ 0x759604
// > PlayerObject::switchedToMode @ 0x759624
// > PlayerObject::copyAttributes @ 0x75d480
// > MenuGameLayer::resetPlayer @ 0x7da74c
// > GJBaseGameLayer::switchToSpiderMode @ 0x99de10
// > GJBaseGameLayer::switchToSpiderMode @ 0x99de28
// > ??> @ 0xc9eb0
//
// 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 12:52:59 +0000
//
__int64 __fastcall PlayerObject::toggleSpiderMode(PlayerObject *this, unsigned __int8 a2, unsigned __int8 a3)
{
int v4; // w22
__int64 v5; // x0
__int64 v6; // x3
GameManager *v8; // x0
__int64 v9; // x1
cocos2d::CCString *v10; // x0
size_t v11; // x0
cocos2d::CCSpriteFrameCache **v12; // x23
void (__fastcall *v13)(cocos2d::CCSpriteFrameCache **, __int64); // x24
cocos2d::CCSpriteFrameCache *v14; // x0
char *v15; // x1
__int64 v16; // x0
__int64 v17; // x23
char *CString; // [xsp+48h] [xbp+48h]
int v19; // [xsp+50h] [xbp+50h]
__int64 v20[2]; // [xsp+58h] [xbp+58h] BYREF
char *v21; // [xsp+68h] [xbp+68h]
__int64 v22[2]; // [xsp+70h] [xbp+70h] BYREF
void *v23; // [xsp+80h] [xbp+80h]
v4 = a3;
if ( *((unsigned __int8 *)this + 2422) != a2 )
{
v5 = *((_QWORD *)this + 328);
*((_BYTE *)this + 2422) = a2;
v6 = *((_QWORD *)this + 170);
*((_QWORD *)this + 245) = v5;
if ( a2 )
{
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v6 + 464LL))(v6, *((_QWORD *)this + 373), 2);
PlayerObject::switchedToMode(this, 33);
*((float *)this + 660) = 27.0;
*((float *)this + 191) = 27.0;
*((float *)this + 192) = 27.0;
*((double *)this + 256) = 1.5;
PlayerObject::stopRotation(this);
v8 = (GameManager *)(*(__int64 (__fastcall **)(PlayerObject *, float))(*(_QWORD *)this + 360LL))(this, 0.0);
v9 = GameManager::sharedState(v8);
LODWORD(v9) = *(_DWORD *)(v9 + 788) - *(_DWORD *)(v9 + 792);
if ( (int)v9 > 69 )
LODWORD(v9) = 69;
if ( (int)v9 <= 0 )
v9 = 1;
else
v9 = (unsigned int)v9;
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"spider_%02d_01_001.png",
(const char *)v9);
v20[0] = 0;
CString = (char *)cocos2d::CCString::getCString(v10);
v20[1] = 0;
v21 = nullptr;
v11 = strlen(CString);
std::string::__init(v20, CString, v11);
v12 = *((cocos2d::CCSpriteFrameCache ***)this + 225);
v13 = *((void (__fastcall **)(cocos2d::CCSpriteFrameCache **, __int64))*v12 + 145);
v14 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(*v12);
v15 = (char *)v20 + 1;
if ( (v20[0] & 1) != 0 )
v15 = v21;
v16 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v14, v15);
v13(v12, v16);
if ( *((_BYTE *)this + 2832) && *((double *)this + 339) == 0.0 )
{
v17 = *((_QWORD *)this + 268);
v22[0] = 0;
v22[1] = 0;
v23 = nullptr;
std::string::__init(v22, "idle01", 6u);
CCAnimatedSprite::runAnimation(v17, (char *)v22);
if ( (v22[0] & 1) != 0 )
operator delete(v23);
}
else
{
PlayerObject::playDynamicSpiderRun(this);
}
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 225) + 344LL))(*((_QWORD *)this + 225), 0);
if ( !v4 )
{
LOWORD(v19) = 13055;
BYTE2(v19) = 50;
PlayerObject::spawnPortalCircle((__int64)this, v19, 50.0);
}
PlayerObject::updatePlayerScale((GJActionManager **)this);
if ( (v20[0] & 1) != 0 )
operator delete(v21);
PlayerObject::updatePlayerGlow(this);
PlayerObject::stopRotation(this);
PlayerObject::modeDidChange(this);
}
else
{
(*(void (__fastcall **)(__int64, _QWORD, _QWORD))(*(_QWORD *)v6 + 552LL))(v6, *((_QWORD *)this + 373), 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 225) + 344LL))(*((_QWORD *)this + 225), 1);
SpriteAnimationManager::stopAnimations(*(SpriteAnimationManager **)(*((_QWORD *)this + 268) + 648LL));
if ( *((float *)this + 618) != 1.0 && *((_BYTE *)this + 2648) )
PlayerObject::updatePlayerFrame(this, 0);
else
PlayerObject::updatePlayerFrame(this, *((_DWORD *)this + 390));
PlayerObject::resetPlayerIcon((cocos2d::CCParticleSystem **)this);
PlayerObject::updatePlayerGlow(this);
PlayerObject::stopRotation(this);
}
}
return _stack_chk_guard;
}