//
// EndLevelLayer::playEndEffect from 0x1002f855c to 0x1002f8700 (420 bytes)
//
// 3 xrefs:
// > EndLevelLayer::starEnterFinished @ 0x1002f8544
// > EndLevelLayer::currencyEnterFinished @ 0x1002f8a78
// > EndLevelLayer::diamondEnterFinished @ 0x1002f8b6c
//
// 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
//
void __fastcall EndLevelLayer::playEndEffect(EndLevelLayer *a1)
{
FMODAudioEngine *v2; // x20
FMODAudioEngine *v3; // x20
void **v4; // x8
FMODAudioEngine *v5; // x20
int m_orbs; // w20
_BOOL4 m_secretKey; // w21
CurrencySpriteType v8; // w22
int m_stars; // w23
int m_moons; // w24
int m_diamonds; // w25
float v12; // s2
float v13; // s3
CurrencyRewardLayer *v14; // x0
__int64 v15; // [xsp+18h] [xbp-98h] BYREF
__int64 v16; // [xsp+20h] [xbp-90h] BYREF
_QWORD v17[2]; // [xsp+28h] [xbp-88h] BYREF
char v18; // [xsp+3Fh] [xbp-71h]
_QWORD v19[2]; // [xsp+40h] [xbp-70h] BYREF
char v20; // [xsp+57h] [xbp-59h]
void *__p[2]; // [xsp+58h] [xbp-58h] BYREF
char v22; // [xsp+6Fh] [xbp-41h]
cocos2d::CCPoint v23; // 0:s0.4,4:s1.4
if ( a1->m_endEffectPlayed )
return;
a1->m_endEffectPlayed = 1;
v2 = FMODAudioEngine::sharedEngine();
sub_100009900(__p, "gold02.ogg");
FMODAudioEngine::playEffect_1((__int64)v2, (__int64)__p);
if ( v22 < 0 )
operator delete(__p[0]);
if ( !a1->m_secretKey )
{
if ( a1->m_orbs < 1 )
goto LABEL_11;
v5 = FMODAudioEngine::sharedEngine();
sub_100009900(v17, "magicExplosion.ogg");
FMODAudioEngine::playEffect_1((__int64)v5, (__int64)v17);
if ( (v18 & 0x80000000) == 0 )
goto LABEL_11;
v4 = (void **)v17;
goto LABEL_10;
}
v3 = FMODAudioEngine::sharedEngine();
sub_100009900(v19, "secretKey.ogg");
FMODAudioEngine::playEffect_1((__int64)v3, (__int64)v19);
if ( v20 < 0 )
{
v4 = (void **)v19;
LABEL_10:
operator delete(*v4);
}
LABEL_11:
sub_1000229B8(&v16, (__int64 *)&a1->m_orbsPosition);
m_orbs = a1->m_orbs;
if ( m_orbs <= 0 )
{
sub_1000229D0(&v16, (double *)&a1->m_starsPosition);
m_orbs = a1->m_orbs;
}
m_secretKey = a1->m_secretKey;
if ( a1->m_secretKey )
v8 = DemonKey;
else
v8 = Icon;
m_stars = a1->m_stars;
m_moons = a1->m_moons;
m_diamonds = a1->m_diamonds;
sub_1000229B8(&v15, &v16);
v23.x = 0.0;
v23.y = 1.0;
v14 = CurrencyRewardLayer::create(
m_orbs,
m_stars,
m_moons,
m_diamonds,
v8,
m_secretKey,
Icon,
0,
v23,
(CurrencyRewardType)&v15,
v12,
v13);
((void (__fastcall *)(EndLevelLayer *, CurrencyRewardLayer *, __int64))a1->addChild_0)(a1, v14, 100);
}