//
// EndLevelLayer::playEndEffect from 0x7d4c98 to 0x7d4fbc (804 bytes)
//
// 4 xrefs:
// > EndLevelLayer::starEnterFinished @ 0x7d50e0
// > EndLevelLayer::currencyEnterFinished @ 0x7d5214
// > EndLevelLayer::diamondEnterFinished @ 0x7d5340
// > ??> @ 0xaed20
//
// 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 EndLevelLayer::playEndEffect(EndLevelLayer *a1)
{
FMODAudioEngine *v2; // x22
void *v3; // x0
FMODAudioEngine *v4; // x24
cocos2d::CCPoint v5; // x1
void *v6; // x0
float v7; // s0
float v8; // s1
int m_orbs; // w22
__int64 m_diamonds; // x3
__int64 v11; // x4
__int64 m_moons; // x2
_BOOL8 m_secretKey; // x5
int m_stars; // w23
float v15; // s2
float v16; // s3
CurrencyRewardLayer *v17; // x0
FMODAudioEngine *v18; // x24
unsigned int *v19; // x1
int v20; // w2
unsigned int *v21; // x1
unsigned int *v22; // x1
int v23; // w2
_QWORD v24[2]; // [xsp+10h] [xbp+0h] BYREF
__int64 v25; // [xsp+50h] [xbp+40h]
_BOOL8 v26; // [xsp+58h] [xbp+48h]
__int64 v27; // [xsp+60h] [xbp+50h]
__int64 v28; // [xsp+68h] [xbp+58h]
cocos2d::CCPoint v29; // [xsp+78h] [xbp+68h] BYREF
cocos2d::CCPoint v30; // [xsp+80h] [xbp+70h] BYREF
cocos2d::CCPoint v31; // 0:s0.4,4:s1.4
if ( a1->m_endEffectPlayed )
return;
a1->m_endEffectPlayed = (unsigned __int8)&dword_0 + 1;
v2 = FMODAudioEngine::sharedEngine();
sub_D153B8((unsigned int)v24 + 112, "gold02.ogg");
FMODAudioEngine::playEffect((__int64)v2, (__int64)&v30);
v3 = (void *)(*(_QWORD *)&v30 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v30 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(*(_QWORD *)&v30 - 8LL);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(*(_QWORD *)&v30 - 8LL);
*(_DWORD *)(*(_QWORD *)&v30 - 8LL) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v3);
}
if ( !a1->m_secretKey )
{
if ( a1->m_orbs <= 0 )
goto LABEL_6;
v4 = FMODAudioEngine::sharedEngine();
sub_D153B8((unsigned int)v24 + 112, "magicExplosion.ogg");
FMODAudioEngine::playEffect((__int64)v4, (__int64)&v30);
v5 = v30;
v6 = (void *)(*(_QWORD *)&v30 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v30 - 24LL) == &qword_124B6B0 )
goto LABEL_6;
if ( &pthread_create )
{
v21 = (unsigned int *)(*(_QWORD *)&v30 - 8LL);
do
v20 = __ldaxr(v21);
while ( __stlxr(v20 - 1, v21) );
goto LABEL_20;
}
goto LABEL_28;
}
v18 = FMODAudioEngine::sharedEngine();
sub_D153B8((unsigned int)v24 + 112, "secretKey.ogg");
FMODAudioEngine::playEffect((__int64)v18, (__int64)&v30);
v5 = v30;
v6 = (void *)(*(_QWORD *)&v30 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v30 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(*(_QWORD *)&v30 - 8LL);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
LABEL_20:
if ( v20 <= 0 )
operator delete(v6);
goto LABEL_6;
}
LABEL_28:
v20 = *(_DWORD *)(*(_QWORD *)&v5 - 8LL);
*(_DWORD *)(*(_QWORD *)&v5 - 8LL) = v20 - 1;
goto LABEL_20;
}
LABEL_6:
cocos2d::CCPoint::CCPoint(&v29, &a1->m_orbsPosition);
m_orbs = a1->m_orbs;
if ( m_orbs <= 0 )
{
cocos2d::CCPoint::operator=(&v29, v7, v8);
m_orbs = a1->m_orbs;
}
m_diamonds = (unsigned int)a1->m_diamonds;
if ( a1->m_secretKey )
v11 = 9;
else
v11 = 0;
m_moons = (unsigned int)a1->m_moons;
m_secretKey = a1->m_secretKey;
m_stars = a1->m_stars;
v25 = v11;
v26 = m_secretKey;
v27 = m_moons;
v28 = m_diamonds;
cocos2d::CCPoint::CCPoint(&v30, &v29);
v31.x = 0.0;
v31.y = 1.0;
v17 = CurrencyRewardLayer::create(
m_orbs,
m_stars,
v27,
v28,
(CurrencySpriteType)v25,
v26,
Icon,
0,
v31,
(CurrencyRewardType)&v30,
v15,
v16);
a1->addChild_0(a1, v17, 100);
}