//
// DialogLayer::displayDialogObject from 0x916724 to 0x916b54 (1072 bytes)
//
// 3 xrefs:
// > DialogLayer::displayNextObject @ 0x916c2c
// > DialogLayer::init @ 0x917078
// > ??> @ 0x827a0
//
// 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 DialogLayer::displayDialogObject(DialogLayer *a1, DialogObject *a2)
{
cocos2d::CCSprite *m_navButtonSprite; // x0
cocos2d::CCSprite *m_characterSprite; // x0
TextArea *m_textArea; // x0
cocos2d::CCLabelBMFont *m_characterLabel; // x23
void (__fastcall *setString)(cocos2d::CCLabelBMFont *__hidden, const unsigned __int8 *); // x24
long double v9; // q0
void *v10; // x0
GLubyte g; // w4
cocos2d::CCLabelBMFont *v12; // x0
GLubyte b; // w3
void (__fastcall *setColor)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::ccColor3B *); // x2
int m_characterFrame; // w0
unsigned int v16; // w1
cocos2d::CCString *v17; // x0
cocos2d::CCSprite *CString; // x0
const char *v19; // x1
cocos2d::CCSprite *v20; // x0
cocos2d::CCLayer *m_mainLayer; // x3
cocos2d::CCSprite *v22; // x24
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
float m_textScale; // s9
void *v25; // x0
char *v26; // x0
TextArea *v27; // x20
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
TextArea *v29; // x20
void (__fastcall *v30)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
unsigned int *v31; // x1
int v32; // w2
unsigned int *v33; // x1
int v34; // w2
unsigned int *v35; // x20
int v36; // w1
char *v37; // [xsp+70h] [xbp+70h] BYREF
cocos2d::CCPoint v38; // [xsp+78h] [xbp+78h] BYREF
cocos2d::CCPoint v39; // [xsp+80h] [xbp+80h] BYREF
if ( a2 )
{
a1->m_animating = 1;
m_navButtonSprite = a1->m_navButtonSprite;
a1->m_skippable = a2->m_unskippable;
cocos2d::CCNode::stopAllActions(m_navButtonSprite);
a1->m_navButtonSprite->setOpacity(a1->m_navButtonSprite, 0);
m_characterSprite = a1->m_characterSprite;
if ( m_characterSprite )
{
m_characterSprite->removeMeAndCleanup(m_characterSprite);
a1->m_characterSprite = nullptr;
}
m_textArea = a1->m_textArea;
if ( m_textArea )
{
m_textArea->m_delegate = nullptr;
a1->m_textArea->removeMeAndCleanup(a1->m_textArea);
a1->m_textArea = nullptr;
}
m_characterLabel = a1->m_characterLabel;
setString = m_characterLabel->setString;
*(__n128 *)&v9 = sub_D18D28(&v39);
((void (__fastcall *)(_QWORD, _QWORD, long double))setString)(m_characterLabel, v39, v9);
v10 = (void *)(*(_QWORD *)&v39 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v39 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v31 = (unsigned int *)(*(_QWORD *)&v39 - 8LL);
do
v32 = __ldaxr(v31);
while ( __stlxr(v32 - 1, v31) );
}
else
{
v32 = *(_DWORD *)(*(_QWORD *)&v39 - 8LL);
*(_DWORD *)(*(_QWORD *)&v39 - 8LL) = v32 - 1;
}
if ( v32 <= 0 )
operator delete(v10);
}
g = a2->m_nameColor.g;
v12 = a1->m_characterLabel;
b = a2->m_nameColor.b;
setColor = v12->setColor;
LOBYTE(v39.x) = a2->m_nameColor.r;
BYTE1(v39.x) = g;
BYTE2(v39.x) = b;
setColor(v12, (const cocos2d::ccColor3B *)&v39);
m_characterFrame = a2->m_characterFrame;
if ( m_characterFrame > 0 )
{
if ( m_characterFrame > 56 )
v16 = 56;
else
v16 = a2->m_characterFrame;
v17 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"dialogIcon_%03d.png",
(const char *)v16);
CString = (cocos2d::CCSprite *)cocos2d::CCString::getCString(v17);
v20 = (cocos2d::CCSprite *)cocos2d::CCSprite::create(CString, v19);
m_mainLayer = a1->m_mainLayer;
a1->m_characterSprite = v20;
m_mainLayer->addChild_0(m_mainLayer, v20, 2);
v22 = a1->m_characterSprite;
setPosition = v22->setPosition;
cocos2d::CCPoint::CCPoint(&v39, -143.0, 0.0);
setPosition(v22, &v39);
}
m_textScale = a2->m_textScale;
sub_D18D28(&v37);
sub_D153B8((int)&v39, v37);
cocos2d::CCPoint::CCPoint(&v38, 0.0, 1.0);
a1->m_textArea = (TextArea *)TextArea::create(
(__int64)&v39,
"chatFont.fnt",
&v38,
0,
1.0,
220.0 / m_textScale,
20.0);
v25 = (void *)(*(_QWORD *)&v39 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v39 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v33 = (unsigned int *)(*(_QWORD *)&v39 - 8LL);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *(_DWORD *)(*(_QWORD *)&v39 - 8LL);
*(_DWORD *)(*(_QWORD *)&v39 - 8LL) = v34 - 1;
}
if ( v34 <= 0 )
operator delete(v25);
}
v26 = v37 - 24;
if ( v37 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)(v37 - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *((_DWORD *)v37 - 2);
*((_DWORD *)v37 - 2) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v26);
}
v27 = a1->m_textArea;
setAnchorPoint = v27->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v39, 0.0, 0.5);
setAnchorPoint(v27, &v39);
a1->m_textArea->setScale(a1->m_textArea, m_textScale);
a1->m_textArea->m_delegate = &a1->TextAreaDelegate;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_textArea, 3);
v29 = a1->m_textArea;
v30 = v29->setPosition;
cocos2d::CCPoint::CCPoint(&v39, -92.0, 0.0);
v30(v29, &v39);
TextArea::fadeInCharacters(a1->m_textArea, 0.2, 0.02, 0, Fade);
}
}