//
// WorldSelectLayer::showCompleteDialog from 0x95e98c to 0x95eddc (1104 bytes)
//
// 3 xrefs:
// > ??> @ 0x399d8
// > WorldSelectLayer::init @ 0x961794
// > ??> @ 0x1229c78
//
// 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 WorldSelectLayer::showCompleteDialog(WorldSelectLayer *a1)
{
__int64 v2; // x0
GameManager *v3; // x0
cocos2d::CCArray *v4; // x0
cocos2d::CCArray *v5; // x23
cocos2d::CCObject *v6; // x0
void *v7; // x0
void *v8; // x0
cocos2d::CCObject *v9; // x0
void *v10; // x0
void *v11; // x0
cocos2d::CCObject *v12; // x0
void *v13; // x0
void *v14; // x0
DialogLayer *v15; // x19
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x1
int v27; // w2
__int64 v28; // [xsp+78h] [xbp+78h] BYREF
_QWORD v29[2]; // [xsp+80h] [xbp+80h] BYREF
v2 = _stack_chk_guard;
a1->m_buttonsLocked = 0;
v29[1] = v2;
v3 = GameManager::sharedState();
GameManager::setUGV(v3, "18", 1);
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
sub_D153B8((int)&v28, "The Keymaster");
sub_D153B8((int)v29, "Well, well, well... I see you have completed the first two islands.");
v6 = (cocos2d::CCObject *)DialogObject::create(1.0, (__int64)&v28, (__int64)v29, 2, 0, (int)&unk_FFFFFF);
cocos2d::CCArray::addObject(v5, v6);
v7 = (void *)(v29[0] - 24LL);
if ( (__int64 *)(v29[0] - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v29[0] - 8LL);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v29[0] - 8LL);
*(_DWORD *)(v29[0] - 8LL) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v7);
}
v8 = (void *)(v28 - 24);
if ( (__int64 *)(v28 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v28 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v28 - 8);
*(_DWORD *)(v28 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v8);
}
sub_D153B8((int)&v28, "The Keymaster");
sub_D153B8((int)v29, "Not bad, not bad at all.\nWhy not try some online levels?");
v9 = (cocos2d::CCObject *)DialogObject::create(0.85, (__int64)&v28, (__int64)v29, 2, 0, (int)&unk_FFFFFF);
cocos2d::CCArray::addObject(v5, v9);
v10 = (void *)(v29[0] - 24LL);
if ( (__int64 *)(v29[0] - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v29[0] - 8LL);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *(_DWORD *)(v29[0] - 8LL);
*(_DWORD *)(v29[0] - 8LL) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v10);
}
v11 = (void *)(v28 - 24);
if ( (__int64 *)(v28 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v28 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(v28 - 8);
*(_DWORD *)(v28 - 8) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v11);
}
sub_D153B8((int)&v28, "The Keymaster");
sub_D153B8((int)v29, "Let's see what more you can do...");
v12 = (cocos2d::CCObject *)DialogObject::create(1.0, (__int64)&v28, (__int64)v29, 2, 0, (int)&unk_FFFFFF);
cocos2d::CCArray::addObject(v5, v12);
v13 = (void *)(v29[0] - 24LL);
if ( (__int64 *)(v29[0] - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v29[0] - 8LL);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(_DWORD *)(v29[0] - 8LL);
*(_DWORD *)(v29[0] - 8LL) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v13);
}
v14 = (void *)(v28 - 24);
if ( (__int64 *)(v28 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(v28 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(_DWORD *)(v28 - 8);
*(_DWORD *)(v28 - 8) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v14);
}
v15 = DialogLayer::createWithObjects(v5, (int)&dword_0 + 2);
a1->addChild_0(a1, v15, 100);
DialogLayer::updateChatPlacement(v15, Center);
DialogLayer::animateInRandomSide(v15);
}