//
// PlayerObject::toggleSpiderMode from 0x1404f9d80 to 0x1404fa150 (976 bytes)
//
// 20 xrefs:
// > GJBaseGameLayer::setupLevelStart @ 0x14031965e
// > GJBaseGameLayer::setupLevelStart @ 0x14031970b
// > GJBaseGameLayer::setupLevelStart @ 0x140319a1a
// > GJBaseGameLayer::setupLevelStart @ 0x140319ac7
// > GJBaseGameLayer::setupLevelStart @ 0x140319bc1
// > GJBaseGameLayer::setupLevelStart @ 0x140319c52
// > sub_140319F40 @ 0x140319f94
// > sub_14031A030 @ 0x14031a117
// > sub_14031A120 @ 0x14031a174
// > GJBaseGameLayer::collisionCheckObjects @ 0x14031c2aa
// > GJBaseGameLayer::collisionCheckObjects @ 0x14031c57d
// > GJBaseGameLayer::collisionCheckObjects @ 0x14031c73c
// > GJBaseGameLayer::collisionCheckObjects @ 0x14031c8b4
// > GJBaseGameLayer::collisionCheckObjects @ 0x14031c8c6
// > MenuGameLayer::resetPlayer @ 0x140471329
// > MenuGameLayer::resetPlayer @ 0x1404714b2
// > PlayerObject::resetObject @ 0x1404f5628
// > PlayerObject::switchedToMode @ 0x1404fa1c3
// > PlayerObject::copyAttributes @ 0x1404feb45
// > ??> @ 0x14092a2cc
//
// 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 11:33:21 +0000
//
// Hidden C++ exception states: #wind=4
void __fastcall PlayerObject::toggleSpiderMode(__int64 a1, char a2, char a3)
{
__int64 *v5; // rcx
__int64 v6; // rax
bool v7; // zf
__int64 v8; // rdx
__int64 v9; // rcx
int v10; // edx
cocos2d::CCString *v11; // rax
const char *CString; // rax
size_t v13; // r8
__int64 v14; // rdx
__int64 v15; // rcx
void **v16; // rsi
__int64 v17; // rdi
__int64 v18; // rbx
cocos2d::CCSpriteFrameCache *v19; // rax
struct cocos2d::CCSpriteFrame *v20; // rax
void *v21; // rcx
__int64 v22; // rdx
__int64 v23; // rbx
cocos2d::CCNode *v24; // rcx
cocos2d::CCNode *v25; // rcx
__int64 v26; // rdx
__int16 v27; // [rsp+30h] [rbp-29h] BYREF
char v28; // [rsp+32h] [rbp-27h]
void *v29; // [rsp+40h] [rbp-19h]
__int128 v30; // [rsp+48h] [rbp-11h] BYREF
__int64 v31; // [rsp+58h] [rbp-1h]
__int64 v32; // [rsp+60h] [rbp+7h]
void *Block[2]; // [rsp+68h] [rbp+Fh] BYREF
__int64 v34; // [rsp+78h] [rbp+1Fh]
unsigned __int64 v35; // [rsp+80h] [rbp+27h]
if ( *(_BYTE *)(a1 + 2502) != a2 )
{
*(_QWORD *)(a1 + 2016) = *(_QWORD *)(a1 + 2728);
*(_BYTE *)(a1 + 2502) = a2;
v5 = *(__int64 **)(a1 + 1368);
v6 = *v5;
v7 = a2 == 0;
v8 = *(_QWORD *)(a1 + 3080);
if ( v7 )
{
(*(void (__fastcall **)(__int64 *, __int64, _QWORD))(v6 + 536))(v5, v8, 0);
LOBYTE(v22) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 1856) + 336LL))(*(_QWORD *)(a1 + 1856), v22);
v23 = *(_QWORD *)(*(_QWORD *)(a1 + 2224) + 664LL);
SpriteAnimationManager::overridePrio(v23);
v24 = *(cocos2d::CCNode **)(*(_QWORD *)(v23 + 320) + 688LL);
if ( v24 )
cocos2d::CCNode::stopAllActions(v24);
v25 = *(cocos2d::CCNode **)(*(_QWORD *)(v23 + 320) + 680LL);
if ( v25 )
cocos2d::CCNode::stopAllActions(v25);
if ( *(float *)(a1 + 2552) == 1.0 || (v26 = 0, !*(_BYTE *)(a1 + 2752)) )
v26 = *(unsigned int *)(a1 + 1568);
PlayerObject::updatePlayerFrame(a1, v26);
PlayerObject::resetPlayerIcon(a1);
PlayerObject::updatePlayerGlow(a1);
*(_WORD *)(a1 + 1840) = 0;
*(_BYTE *)(a1 + 1648) = 0;
*(_DWORD *)(a1 + 1832) = 0;
}
else
{
(*(void (__fastcall **)(__int64 *, __int64, __int64))(v6 + 456))(v5, v8, 2);
PlayerObject::switchedToMode(a1, 33);
*(_DWORD *)(a1 + 2744) = 1104674816;
*(_DWORD *)(a1 + 764) = 1104674816;
*(_DWORD *)(a1 + 768) = 1104674816;
*(_QWORD *)(a1 + 2104) = 0x3FF8000000000000LL;
*(_WORD *)(a1 + 1840) = 0;
*(_BYTE *)(a1 + 1648) = 0;
*(_DWORD *)(a1 + 1832) = 0;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 352LL))(a1);
v9 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v29 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v29);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v9 = qword_14090BFD0;
}
v10 = 69;
if ( *(_DWORD *)(v9 + 820) - *(_DWORD *)(v9 + 824) < 69 )
v10 = *(_DWORD *)(v9 + 820) - *(_DWORD *)(v9 + 824);
if ( v10 < 1 )
v10 = 1;
v11 = cocos2d::CCString::createWithFormat("spider_%02d_01_001.png", v10);
CString = cocos2d::CCString::getCString(v11);
*(_OWORD *)Block = 0;
v34 = 0;
v35 = 0;
v13 = -1;
do
++v13;
while ( CString[v13] );
sub_14003D230(Block, CString, v13);
v16 = Block;
if ( v35 > 0xF )
v16 = (void **)Block[0];
v17 = **(_QWORD **)(a1 + 1856);
v18 = *(_QWORD *)(a1 + 1856);
v19 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v15, v14);
v20 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v19, (const char *)v16);
(*(void (__fastcall **)(__int64, struct cocos2d::CCSpriteFrame *))(v17 + 1008))(v18, v20);
if ( *(_BYTE *)(a1 + 2936) && *(double *)(a1 + 2816) == 0.0 )
{
v30 = 0;
v31 = 6;
v32 = 15;
strcpy((char *)&v30, "idle01");
CCAnimatedSprite::runAnimation(*(_QWORD *)(a1 + 2224), (__int64)&v30);
}
else
{
PlayerObject::playDynamicSpiderRun(a1);
}
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 1856) + 336LL))(*(_QWORD *)(a1 + 1856), 0);
if ( !a3 )
{
v27 = 13055;
v28 = 50;
PlayerObject::spawnPortalCircle(a1, (__int64)&v27);
}
PlayerObject::updatePlayerScale(a1);
if ( v35 > 0xF )
{
v21 = Block[0];
if ( v35 + 1 >= 0x1000 )
{
v21 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v21 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v21);
}
PlayerObject::updatePlayerGlow(a1);
*(_WORD *)(a1 + 1840) = 0;
*(_BYTE *)(a1 + 1648) = 0;
*(_DWORD *)(a1 + 1832) = 0;
PlayerObject::updatePlayerArt(a1);
PlayerObject::updateDashArt(a1);
}
}
}