//
// SecretLayer5::showFirstDialog from 0xa90198 to 0xa9080c (1652 bytes)
//
// 3 xrefs:
// > ??> @ 0x4f788
// > SecretLayer5::init @ 0xa967fc
// > ??> @ 0x122a8e8
//
// 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 SecretLayer5::showFirstDialog(SecretLayer5 *a1)
{
GameManager *v2; // x0
cocos2d::CCArray *v3; // x0
cocos2d::CCArray *v4; // x22
cocos2d::CCObject *v5; // x0
void *v6; // x0
void *v7; // x0
cocos2d::CCObject *v8; // x0
void *v9; // x0
void *v10; // x0
cocos2d::CCObject *v11; // x0
void *v12; // x0
void *v13; // x0
cocos2d::CCObject *v14; // x0
void *v15; // x0
void *v16; // x0
cocos2d::CCObject *v17; // x0
void *v18; // x0
void *v19; // x0
DialogLayer *v20; // x19
unsigned int *v21; // x1
int v22; // w2
unsigned int *v23; // x1
int v24; // w2
unsigned int *v25; // x1
int v26; // w2
unsigned int *v27; // x1
int v28; // w2
unsigned int *v29; // x1
int v30; // w2
unsigned int *v31; // x1
int v32; // w2
unsigned int *v33; // x1
int v34; // w2
unsigned int *v35; // x1
int v36; // w2
unsigned int *v37; // x1
int v38; // w2
unsigned int *v39; // x1
int v40; // w2
__int64 v41; // [xsp+78h] [xbp+78h] BYREF
__int64 v42; // [xsp+80h] [xbp+80h] BYREF
v2 = GameManager::sharedState();
GameManager::setUGV(v2, "38", 1);
v4 = (cocos2d::CCArray *)cocos2d::CCArray::create(v3);
sub_D153B8((int)&v41, "The Wraith");
sub_D153B8((int)&v42, "Great... Just what I needed.\nAnother visitor to my prison.");
v5 = (cocos2d::CCObject *)DialogObject::create(1.0, (__int64)&v41, (__int64)&v42, 54, 1, (int)&unk_FFFFFF);
cocos2d::CCArray::addObject(v4, v5);
v6 = (void *)(v42 - 24);
if ( (__int64 *)(v42 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(v42 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(v42 - 8);
*(_DWORD *)(v42 - 8) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v6);
}
v7 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)(v41 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v7);
}
sub_D153B8((int)&v41, "The Wraith");
sub_D153B8(
(int)&v42,
"Must be my lucky day... or yours.\nI don't really have days anymore.");
v8 = (cocos2d::CCObject *)DialogObject::create(1.0, (__int64)&v41, (__int64)&v42, 53, 0, (int)&unk_FFFFFF);
cocos2d::CCArray::addObject(v4, v8);
v9 = (void *)(v42 - 24);
if ( (__int64 *)(v42 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)(v42 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *(_DWORD *)(v42 - 8);
*(_DWORD *)(v42 - 8) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v9);
}
v10 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)(v41 - 8);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v28 - 1;
}
if ( v28 <= 0 )
operator delete(v10);
}
sub_D153B8((int)&v41, "The Wraith");
sub_D153B8(
(int)&v42,
"I wasn't always like this, you know.\n"
"I used to be something, greater...");
v11 = (cocos2d::CCObject *)DialogObject::create(1.0, (__int64)&v41, (__int64)&v42, 55, 0, (int)&unk_FFFFFF);
cocos2d::CCArray::addObject(v4, v11);
v12 = (void *)(v42 - 24);
if ( (__int64 *)(v42 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)(v42 - 8);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *(_DWORD *)(v42 - 8);
*(_DWORD *)(v42 - 8) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v12);
}
v13 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v31 = (unsigned int *)(v41 - 8);
do
v32 = __ldaxr(v31);
while ( __stlxr(v32 - 1, v31) );
}
else
{
v32 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v32 - 1;
}
if ( v32 <= 0 )
operator delete(v13);
}
sub_D153B8((int)&v41, "The Wraith");
sub_D153B8((int)&v42, "Now instead, I get to listen to you.\nWhat a treat...");
v14 = (cocos2d::CCObject *)DialogObject::create(1.0, (__int64)&v41, (__int64)&v42, 53, 0, (int)&unk_FFFFFF);
cocos2d::CCArray::addObject(v4, v14);
v15 = (void *)(v42 - 24);
if ( (__int64 *)(v42 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v33 = (unsigned int *)(v42 - 8);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *(_DWORD *)(v42 - 8);
*(_DWORD *)(v42 - 8) = v34 - 1;
}
if ( v34 <= 0 )
operator delete(v15);
}
v16 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)(v41 - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v16);
}
sub_D153B8((int)&v41, "The Wraith");
sub_D153B8((int)&v42, "Go on, or don't.\nNot like I can stop you.");
v17 = (cocos2d::CCObject *)DialogObject::create(1.0, (__int64)&v41, (__int64)&v42, 56, 0, (int)&unk_FFFFFF);
cocos2d::CCArray::addObject(v4, v17);
v18 = (void *)(v42 - 24);
if ( (__int64 *)(v42 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)(v42 - 8);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *(_DWORD *)(v42 - 8);
*(_DWORD *)(v42 - 8) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v18);
}
v19 = (void *)(v41 - 24);
if ( (__int64 *)(v41 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)(v41 - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *(_DWORD *)(v41 - 8);
*(_DWORD *)(v41 - 8) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v19);
}
v20 = DialogLayer::createWithObjects(v4, (int)&byte_4);
a1->addChild_0(a1, v20, 100);
DialogLayer::updateChatPlacement(v20, Center);
DialogLayer::animateIn(v20, FromLeft);
a1->m_uiLocked = 0;
a1->m_textInput->setTouchEnabled(a1->m_textInput, 1);
}