//
// MenuGameLayer::resetPlayer from 0x140470d30 to 0x140471658 (2344 bytes)
//
// 4 xrefs:
// > MenuGameLayer::init @ 0x140470108
// > MenuGameLayer::update @ 0x140470b77
// > MenuGameLayer::destroyPlayer @ 0x1404718f4
// > ??> @ 0x1409281a8
//
// 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:32:39 +0000
//
// Hidden C++ exception states: #wind=2
void __fastcall MenuGameLayer::resetPlayer(__int64 a1)
{
__int64 v2; // rbx
__int64 v3; // rbx
__int64 *v4; // rcx
__int64 v5; // rdi
float v6; // xmm6_4
int v7; // eax
__int64 v8; // rbx
__int64 v9; // rax
__int64 v10; // rbp
void (__fastcall **v11)(__int64, char *); // rdi
int v12; // eax
__int64 v13; // rbx
char *v14; // rax
__int64 v15; // rdi
int v16; // eax
__int64 v17; // rbx
char *v18; // rax
__int64 v19; // rdx
__int64 v20; // r8
float v21; // xmm1_4
__int64 v22; // rcx
int v23; // eax
float v24; // xmm0_4
__int64 v25; // rdi
unsigned int v26; // ebx
const struct cocos2d::CCPoint *v27; // rax
__int64 v28; // rax
int v29; // eax
int v30; // eax
__int64 v31; // rcx
int v32; // eax
float v33; // xmm0_4
__int64 v34; // rcx
int v35; // eax
float v36; // xmm0_4
__int64 v37; // rcx
int v38; // eax
int v39; // eax
int v40; // edx
unsigned int v41; // ebx
__int64 v42; // rdi
unsigned int v43; // ebx
const struct cocos2d::CCPoint *v44; // rax
__int64 v45; // rax
int v46; // eax
int v47; // eax
int v48; // r8d
__int64 v49; // rdi
const struct cocos2d::CCPoint *v50; // rax
__int64 v51; // rax
int v52; // eax
float v53; // xmm0_4
__int64 v54; // rbx
int v55; // eax
unsigned int v56; // ebx
int v57; // eax
__int64 v58; // rdx
__int64 v59; // rdx
__int64 v60; // rcx
__int64 v61; // rbx
const struct cocos2d::CCPoint *v62; // rax
__int64 v63; // rax
int v64; // [rsp+90h] [rbp+8h] BYREF
void *v65; // [rsp+98h] [rbp+10h] BYREF
void *v66; // [rsp+A0h] [rbp+18h]
v2 = *(_QWORD *)(a1 + 432);
cocos2d::CCMotionStreak::stopStroke(*(cocos2d::CCMotionStreak **)(v2 + 1960));
if ( *(_BYTE *)(v2 + 2432) )
{
*(_BYTE *)(v2 + 2432) = 0;
PlayerObject::fadeOutStreak2(v2);
}
v3 = *(_QWORD *)(a1 + 432);
if ( *(_BYTE *)(v3 + 2030) )
cocos2d::CCParticleSystem::stopSystem(*(cocos2d::CCParticleSystem **)(v3 + 2240));
*(_BYTE *)(v3 + 2030) = 0;
v4 = *(__int64 **)(a1 + 432);
v5 = *v4;
v6 = *(float *)((*(__int64 (__fastcall **)(__int64 *))(*v4 + 200))(v4) + 4);
v7 = rand();
v8 = *(_QWORD *)(a1 + 432);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v64,
-100.0 - (float)((float)((float)((float)v7 / 32767.0) * 5.0) * 100.0),
v6);
(*(void (__fastcall **)(__int64, __int64))(v5 + 184))(v8, v9);
PlayerObject::resetAllParticles(*(_QWORD *)(a1 + 432));
PlayerObject::togglePlayerScale(*(_QWORD *)(a1 + 432), 0, 0);
*(_BYTE *)(*(_QWORD *)(a1 + 432) + 1842LL) = (float)((float)rand() / 32767.0) > 0.80000001;
v10 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v65 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v65);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v10 = qword_14090BFD0;
}
v11 = *(void (__fastcall ***)(__int64, char *))(*(_QWORD *)(a1 + 432) + 320LL);
v12 = rand();
v13 = *(_QWORD *)(a1 + 432);
v14 = GameManager::colorForIdx(v10, (char *)&v64, (int)(float)((float)((float)v12 / 32767.0) * 108.0));
(*v11)(v13 + 320, v14);
v15 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v66 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v66);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v15 = qword_14090BFD0;
}
v16 = rand();
v17 = *(_QWORD *)(a1 + 432);
v18 = GameManager::colorForIdx(v15, (char *)&v65, (int)(float)((float)((float)v16 / 32767.0) * 108.0));
PlayerObject::setSecondColor(v17, v18);
PlayerObject::flipGravity(*(_QWORD *)(a1 + 432), 0);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 432) + 32LL))(*(_QWORD *)(a1 + 432));
v21 = (float)rand() / 32767.0;
if ( !*(_BYTE *)(a1 + 408) )
{
if ( v21 >= 0.12 || (v22 = *(_QWORD *)(a1 + 432), *(_BYTE *)(v22 + 2497)) )
{
if ( v21 < 0.23999999 )
{
v25 = *(_QWORD *)(a1 + 432);
if ( !*(_BYTE *)(v25 + 2499) )
{
v26 = 1;
if ( !*(_BYTE *)(v25 + 3024) )
{
v64 = 1;
*(_BYTE *)sub_14016EE40((__int64 *)(v25 + 3008), &v64) = 0;
}
if ( !*(_BYTE *)(v25 + 2611) )
{
if ( *(_BYTE *)(v25 + 2445) )
{
v27 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v25 + 200LL))(v25);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v64, v27);
PlayerObject::placeStreakPoint(v25, v28);
}
*(_WORD *)(v25 + 2445) = 0;
*(_BYTE *)(v25 + 2468) = 1;
if ( *(_BYTE *)(v25 + 2540) )
PlayerObject::stopDashing(v25);
}
PlayerObject::toggleRollMode(*(_QWORD *)(a1 + 432), 1, 0);
v29 = rand();
if ( (int)roundf((float)((float)v29 / 32767.0) * 118.0) >= 1 )
{
v30 = rand();
v26 = (int)roundf((float)((float)v30 / 32767.0) * 118.0);
}
PlayerObject::updatePlayerRollFrame(*(_QWORD *)(a1 + 432), v26);
goto LABEL_67;
}
}
if ( v21 >= 0.36000001 || (v31 = *(_QWORD *)(a1 + 432), *(_BYTE *)(v31 + 2498)) )
{
if ( v21 < 0.47999999 )
{
v34 = *(_QWORD *)(a1 + 432);
if ( !*(_BYTE *)(v34 + 2500) )
{
LOBYTE(v19) = 1;
PlayerObject::toggleDartMode(v34, v19, 0);
v35 = rand();
v36 = roundf((float)((float)v35 / 32767.0) * 96.0);
PlayerObject::updatePlayerDartFrame(*(_QWORD *)(a1 + 432), (unsigned int)(int)v36);
LABEL_67:
LOBYTE(v58) = (float)((float)rand() / 32767.0) <= 0.1;
PlayerObject::togglePlayerScale(*(_QWORD *)(a1 + 432), v58, 0);
goto LABEL_68;
}
}
if ( v21 < 0.60000002 )
{
v37 = *(_QWORD *)(a1 + 432);
if ( !*(_BYTE *)(v37 + 2501) )
{
LOBYTE(v19) = 1;
PlayerObject::toggleRobotMode(v37, v19, 0);
v38 = rand();
v39 = (int)roundf((float)((float)v38 / 32767.0) * 68.0);
v40 = 68;
if ( v39 < 68 )
v40 = v39;
v41 = 1;
if ( v40 > 1 )
v41 = v40;
PlayerObject::createRobot(*(_QWORD *)(a1 + 432), v41);
goto LABEL_67;
}
}
if ( v21 < 0.69999999 )
{
v42 = *(_QWORD *)(a1 + 432);
if ( !*(_BYTE *)(v42 + 2502) )
{
v43 = 1;
if ( !*(_BYTE *)(v42 + 3024) )
{
v64 = 1;
*(_BYTE *)sub_14016EE40((__int64 *)(v42 + 3008), &v64) = 0;
}
if ( !*(_BYTE *)(v42 + 2611) )
{
if ( *(_BYTE *)(v42 + 2445) )
{
v44 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v42 + 200LL))(v42);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v64, v44);
PlayerObject::placeStreakPoint(v42, v45);
}
*(_WORD *)(v42 + 2445) = 0;
*(_BYTE *)(v42 + 2468) = 1;
if ( *(_BYTE *)(v42 + 2540) )
PlayerObject::stopDashing(v42);
}
PlayerObject::toggleSpiderMode(*(_QWORD *)(a1 + 432), 1, 0);
v46 = rand();
v47 = (int)roundf((float)((float)v46 / 32767.0) * 69.0);
v48 = 69;
if ( v47 < 69 )
v48 = v47;
if ( v48 > 1 )
v43 = v48;
PlayerObject::createSpider(*(_QWORD *)(a1 + 432), v43);
goto LABEL_67;
}
}
if ( v21 < 0.80000001 )
{
v49 = *(_QWORD *)(a1 + 432);
if ( !*(_BYTE *)(v49 + 2508) )
{
if ( !*(_BYTE *)(v49 + 3024) )
{
v64 = 1;
*(_BYTE *)sub_14016EE40((__int64 *)(v49 + 3008), &v64) = 0;
}
if ( !*(_BYTE *)(v49 + 2611) )
{
if ( *(_BYTE *)(v49 + 2445) )
{
v50 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v49 + 200LL))(v49);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v64, v50);
PlayerObject::placeStreakPoint(v49, v51);
}
*(_WORD *)(v49 + 2445) = 0;
*(_BYTE *)(v49 + 2468) = 1;
if ( *(_BYTE *)(v49 + 2540) )
PlayerObject::stopDashing(v49);
}
LOBYTE(v19) = 1;
PlayerObject::toggleSwingMode(*(_QWORD *)(a1 + 432), v19, 0);
v52 = rand();
v53 = roundf((float)((float)v52 / 32767.0) * 43.0);
PlayerObject::updatePlayerSwingFrame(*(_QWORD *)(a1 + 432), (unsigned int)(int)v53);
goto LABEL_67;
}
}
v54 = *(_QWORD *)(a1 + 432);
PlayerObject::toggleFlyMode(v54, 0, 0);
PlayerObject::toggleBirdMode(v54, 0, 0);
PlayerObject::toggleRollMode(v54, 0, 0);
PlayerObject::toggleDartMode(v54, 0, 0);
PlayerObject::toggleRobotMode(v54, 0, 0);
PlayerObject::toggleSpiderMode(v54, 0, 0);
PlayerObject::toggleSwingMode(v54, 0, 0);
}
else
{
LOBYTE(v19) = 1;
PlayerObject::toggleBirdMode(v31, v19, 0);
v32 = rand();
v33 = roundf((float)((float)v32 / 32767.0) * 149.0);
PlayerObject::updatePlayerBirdFrame(*(_QWORD *)(a1 + 432), (unsigned int)(int)v33);
}
}
else
{
LOBYTE(v19) = 1;
PlayerObject::toggleFlyMode(v22, v19, 0);
v23 = rand();
v24 = roundf((float)((float)v23 / 32767.0) * 169.0);
PlayerObject::updatePlayerShipFrame(*(_QWORD *)(a1 + 432), (unsigned int)(int)v24);
}
v55 = rand();
if ( (int)roundf((float)((float)v55 / 32767.0) * 485.0) >= 1 )
{
v57 = rand();
v56 = (int)roundf((float)((float)v57 / 32767.0) * 485.0);
}
else
{
v56 = 1;
}
PlayerObject::updatePlayerFrame(*(_QWORD *)(a1 + 432), v56);
goto LABEL_67;
}
LABEL_68:
PlayerObject::updateGlowColor(*(_QWORD *)(a1 + 432), v19, v20);
rand();
PlayerObject::updateTimeMod(*(_QWORD *)(a1 + 432), v59, 0);
v60 = *(_QWORD *)(a1 + 432);
if ( *(_BYTE *)(v60 + 2500) )
{
PlayerObject::resetStreak(v60);
v61 = *(_QWORD *)(a1 + 432);
v62 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v61 + 200LL))(v61);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v64, v62);
PlayerObject::placeStreakPoint(v61, v63);
}
HardStreak::updateStroke(*(_QWORD *)(*(_QWORD *)(a1 + 432) + 1976LL));
}