//
// LevelAreaLayer::showDialog from 0xa2da50 to 0xa2ddac (860 bytes)
//
// 3 xrefs:
// > ??> @ 0x410a0
// > LevelAreaLayer::init @ 0xa301b8
// > ??> @ 0x122a110
//
// 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 LevelAreaLayer::showDialog(LevelAreaLayer *a1)
{
GameManager *v2; // x0
cocos2d::CCArray *v3; // x0
cocos2d::CCArray *v4; // x24
cocos2d::CCObject *v5; // x0
void *v6; // x0
void *v7; // x0
cocos2d::CCObject *v8; // x0
void *v9; // x0
void *v10; // x0
DialogDelegate *v11; // x22
DialogLayer *v12; // x0
DialogLayer *v13; // x19
cocos2d::CCDirector *v14; // x0
unsigned int *v15; // x1
int v16; // w2
unsigned int *v17; // x1
int v18; // w2
unsigned int *v19; // x1
int v20; // w2
unsigned int *v21; // x1
int v22; // w2
__int64 v23; // [xsp+78h] [xbp+78h] BYREF
__int64 v24; // [xsp+80h] [xbp+80h] BYREF
v2 = GameManager::sharedState();
GameManager::setUGV(v2, "29", 1);
v4 = (cocos2d::CCArray *)cocos2d::CCArray::create(v3);
sub_D153B8((int)&v23, "Scratch");
sub_D153B8((int)&v24, "Who left the lights on?");
v5 = (cocos2d::CCObject *)DialogObject::create(1.0, (__int64)&v23, (__int64)&v24, 13, 0, (int)&unk_FFFFFF);
cocos2d::CCArray::addObject(v4, v5);
v6 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v15 = (unsigned int *)(v24 - 8);
do
v16 = __ldaxr(v15);
while ( __stlxr(v16 - 1, v15) );
}
else
{
v16 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v16 - 1;
}
if ( v16 <= 0 )
operator delete(v6);
}
v7 = (void *)(v23 - 24);
if ( (__int64 *)(v23 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(v23 - 8);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(_DWORD *)(v23 - 8);
*(_DWORD *)(v23 - 8) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v7);
}
sub_D153B8((int)&v23, "Scratch");
sub_D153B8((int)&v24, "I got a bad feeling about this...");
v8 = (cocos2d::CCObject *)DialogObject::create(1.0, (__int64)&v23, (__int64)&v24, 11, 0, (int)&unk_FFFFFF);
cocos2d::CCArray::addObject(v4, v8);
v9 = (void *)(v24 - 24);
if ( (__int64 *)(v24 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(v24 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *(_DWORD *)(v24 - 8);
*(_DWORD *)(v24 - 8) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v9);
}
v10 = (void *)(v23 - 24);
if ( (__int64 *)(v23 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(v23 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(v23 - 8);
*(_DWORD *)(v23 - 8) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v10);
}
v11 = &a1->DialogDelegate;
v12 = DialogLayer::createWithObjects(v4, (int)&dword_0 + 2);
v12->m_delegate = v11;
v13 = v12;
v14 = cocos2d::CCDirector::sharedDirector();
v14->m_pRunningScene->addChild_0(v14->m_pRunningScene, v13, 1000);
v13->m_delegate = v11;
DialogLayer::updateChatPlacement(v13, Center);
DialogLayer::animateInRandomSide(v13);
}