//
// PlayLayer::resetLevelFromStart from 0x1403b8d10 to 0x1403b8ea6 (406 bytes)
//
// 4 xrefs:
// > PlayLayer::fullReset @ 0x1403b8c79
// > PlayLayer::togglePracticeMode @ 0x1403b9eab
// > PlayLayer::resumeAndRestart @ 0x1403ba627
// > ??> @ 0x1406d70a0
//
// 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=5
void PlayLayer::resetLevelFromStart(PlayLayer *a1)
{
GameManager *v2; // rcx
bool GameVariable; // si
GameManager *v4; // rcx
__int64 v5; // rbx
GameManager *v6; // rcx
void *v7; // [rsp+30h] [rbp+8h]
void *v8; // [rsp+30h] [rbp+8h]
FMODAudioEngine *v9; // [rsp+30h] [rbp+8h]
void *v10; // [rsp+30h] [rbp+8h]
v2 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v7 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v7);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v2 = (GameManager *)qword_1406C2ED8;
}
GameVariable = GameManager::getGameVariable(v2, "0146");
v4 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v8 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v8);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v4 = (GameManager *)qword_1406C2ED8;
}
GameManager::setGameVariable(v4, "0146", 1);
a1->removeAllCheckpoints(a1);
v5 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v9 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v9);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v5 = qword_1406C2E88;
}
if ( *(_QWORD *)(v5 + 552) )
FMOD::ChannelControl::stop(*(FMOD::ChannelControl **)(v5 + 552));
sub_14005E0D0((_QWORD *)(v5 + 1064));
sub_14005E0D0((_QWORD *)(v5 + 1128));
sub_14005E0D0((_QWORD *)(v5 + 1192));
a1->m_freezeStartCamera = 1;
a1->resetLevel(a1);
v6 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v10 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = (GameManager *)qword_1406C2ED8;
}
GameManager::setGameVariable(v6, "0146", GameVariable);
}