//
// LevelAreaLayer::onEnterTower from 0xa3135c to 0xa31474 (280 bytes)
//
// 3 xrefs:
// > ??> @ 0xa0a40
// > LevelAreaLayer::fadeInsideTower @ 0xa2d1d4
// > ??> @ 0x122d820
//
// 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
//
bool LevelAreaLayer::onEnterTower(LevelAreaLayer *a1)
{
FMODAudioEngine *v1; // x21
void *v2; // x0
cocos2d::CCDirector *v3; // x20
cocos2d::CCScene *v4; // x0
unsigned int *v6; // x2
int v7; // w1
__int64 v8; // [xsp+40h] [xbp+40h] BYREF
v1 = FMODAudioEngine::sharedEngine();
sub_D153B8((int)&v8, "door01.ogg");
FMODAudioEngine::playEffect((__int64)v1, (__int64)&v8);
v2 = (void *)(v8 - 24);
if ( (__int64 *)(v8 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v6 = (unsigned int *)(v8 - 8);
do
v7 = __ldaxr(v6);
while ( __stlxr(v7 - 1, v6) );
}
else
{
v7 = *(_DWORD *)(v8 - 8);
*(_DWORD *)(v8 - 8) = v7 - 1;
}
if ( v7 <= 0 )
operator delete(v2);
}
v3 = cocos2d::CCDirector::sharedDirector();
v4 = LevelAreaInnerLayer::scene(0);
cocos2d::CCDirector::replaceScene(v3, v4);
return _stack_chk_guard;
}