//
// EndLevelLayer::playEndEffect from 0x140136ab0 to 0x140136d6d (701 bytes)
//
// 4 xrefs:
// > EndLevelLayer::starEnterFinished @ 0x140135bc5
// > EndLevelLayer::currencyEnterFinished @ 0x140136607
// > EndLevelLayer::diamondEnterFinished @ 0x140136a97
// > ??> @ 0x1406ca014
//
// 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=4
void EndLevelLayer::playEndEffect(EndLevelLayer *a1)
{
int v2; // ecx
int v3; // ecx
int *p_m_orbs; // r14
int v5; // ecx
bool m_secretKey; // cl
CurrencySpriteType v7; // edi
_BOOL8 v8; // rbx
cocos2d::CCPoint v9; // rax
CurrencyRewardLayer *v10; // rax
__int128 v11; // [rsp+60h] [rbp-9h] BYREF
__int64 v12; // [rsp+70h] [rbp+7h]
__int64 v13; // [rsp+78h] [rbp+Fh]
_QWORD v14[8]; // [rsp+80h] [rbp+17h] BYREF
cocos2d::CCPoint v15; // [rsp+D0h] [rbp+67h] BYREF
__int128 *v16; // [rsp+D8h] [rbp+6Fh] BYREF
FMODAudioEngine *v17; // [rsp+E0h] [rbp+77h]
if ( !a1->m_endEffectPlayed )
{
a1->m_endEffectPlayed = 1;
v16 = (__int128 *)v14;
v14[1] = 26471;
v14[2] = 10;
v14[3] = 15;
v14[0] = 0x6F2E3230646C6F67LL;
v2 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v17 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v2 = qword_1406C2E88;
}
FMODAudioEngine::playEffect_1(v2, (__int64)v14);
if ( a1->m_secretKey )
{
v16 = &v11;
v12 = 13;
v13 = 15;
strcpy((char *)&v11, "secretKey.ogg");
HIWORD(v11) = 0;
v3 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v17 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v3 = qword_1406C2E88;
}
FMODAudioEngine::playEffect_1(v3, (__int64)&v11);
p_m_orbs = &a1->m_orbs;
}
else
{
p_m_orbs = &a1->m_orbs;
if ( a1->m_orbs > 0 )
{
v16 = &v11;
v11 = 0;
v12 = 0;
v13 = 15;
*(_QWORD *)&v11 = sub_14003AA10(0x20u);
v12 = 18;
v13 = 31;
strcpy((char *)v11, "magicExplosion.ogg");
v5 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v17 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v5 = qword_1406C2E88;
}
FMODAudioEngine::playEffect_1(v5, (__int64)&v11);
}
}
cocos2d::CCPoint::CCPoint(&v15);
if ( *p_m_orbs <= 0 )
cocos2d::CCPoint::operator=(&v15, &a1->m_starsPosition);
m_secretKey = a1->m_secretKey;
v7 = m_secretKey ? DemonKey : Icon;
v8 = m_secretKey;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v16);
v10 = CurrencyRewardLayer::create(
*p_m_orbs,
a1->m_stars,
a1->m_moons,
a1->m_diamonds,
v7,
v8,
Icon,
0,
v9,
(CurrencyRewardType)0,
0.0,
1.0);
a1->addChild_0(a1, v10, 100);
}
}