//
// MenuGameLayer::destroyPlayer from 0x140333340 to 0x1403335f1 (689 bytes)
//
// 2 xrefs:
// > MenuGameLayer::ccTouchBegan @ 0x140333797
// > ??> @ 0x1406d50c0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=3
void MenuGameLayer::destroyPlayer(MenuGameLayer *a1)
{
GameStatsManager *v2; // rcx
__int64 v3; // r8
__int64 v4; // r9
int v5; // ecx
struct cocos2d::CCParticleSystemQuad *v6; // rdi
_BOOL8 v7; // rdx
cocos2d::CCParticleSystemQuad_vtbl *v8; // rbx
const cocos2d::CCPoint *v9; // rax
float v10; // xmm0_4
CCCircleWave *v11; // rdi
CCCircleWave_vtbl *v12; // rbx
const cocos2d::CCPoint *v13; // rax
__int16 v14; // [rsp+30h] [rbp-68h]
char v15[16]; // [rsp+40h] [rbp-58h] BYREF
__int64 v16; // [rsp+50h] [rbp-48h]
__int64 v17; // [rsp+58h] [rbp-40h]
char *v18; // [rsp+60h] [rbp-38h]
FMODAudioEngine *v19; // [rsp+68h] [rbp-30h] BYREF
float v20; // [rsp+70h] [rbp-28h]
int v21; // [rsp+74h] [rbp-24h]
a1->m_isDestroyingPlayer = 1;
v2 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v18 = (char *)operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v18);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v2 = (GameStatsManager *)qword_1406C2EE8;
}
GameStatsManager::incrementStat(v2, "9", 1);
v18 = v15;
v15[15] = 0;
v16 = 14;
v17 = 15;
strcpy(v15, "explode_11.ogg");
v5 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v19 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v19);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v5 = qword_1406C2E88;
}
FMODAudioEngine::playEffect(v5, (__int64)v15, v3, v4, 1056964608);
v6 = cocos2d::CCParticleSystemQuad::create("explodeEffect.plist", 0);
v6->setPositionType(v6, kCCPositionTypeGrouped);
a1->addChild_0(a1, v6, 1);
LOBYTE(v7) = 1;
v6->setAutoRemoveOnFinish(v6, v7);
v8 = v6->cocos2d::CCParticleSystem::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v9 = a1->m_playerObject->getPosition_0(a1->m_playerObject);
v8->setPosition_0(v6, v9);
v14 = *(_WORD *)&a1->m_playerObject->m_playerColor1.r;
v10 = (float)a1->m_playerObject->m_playerColor1.b / 255.0;
*(float *)&v19 = (float)(unsigned __int8)v14 / 255.0;
*((float *)&v19 + 1) = (float)HIBYTE(v14) / 255.0;
v20 = v10;
v21 = 1065353216;
v6->setStartColor(v6, (const cocos2d::ccColor4F *)&v19);
cocos2d::CCParticleSystem::resetSystem(v6);
v11 = CCCircleWave::create(10.0, 90.0, 0.5, 0, 1);
v11->m_color = a1->m_playerObject->m_playerColor1;
v12 = v11->__vftable;
v13 = a1->m_playerObject->getPosition_0(a1->m_playerObject);
v12->setPosition_0(v11, v13);
a1->addChild_0(a1, v11, 0);
MenuGameLayer::resetPlayer(a1);
}