//
// DialogLayer::displayDialogObject from 0x1400d3aa0 to 0x1400d3dec (844 bytes)
//
// 3 xrefs:
// > DialogLayer::init @ 0x1400d39f9
// > DialogLayer::displayNextObject @ 0x1400d3a6f
// > ??> @ 0x1406c8658
//
// 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
//
// Hidden C++ exception states: #wind=3
void DialogLayer::displayDialogObject(DialogLayer *a1, DialogObject *a2)
{
cocos2d::CCSprite *m_characterSprite; // rcx
TextArea *m_textArea; // rax
const char *v6; // rdx
int m_characterFrame; // eax
int v8; // edx
cocos2d::CCString *v9; // rax
const char *CString; // rax
cocos2d::CCSprite *v11; // rax
cocos2d::CCSprite_vtbl *v12; // rbx
const cocos2d::CCPoint *v13; // rax
float m_textScale; // xmm7_4
_QWORD *v15; // rdx
size_t v16; // r8
const struct cocos2d::CCPoint *v17; // rax
TextArea_vtbl *v18; // rbx
const cocos2d::CCPoint *v19; // rax
TextAreaDelegate *v20; // rcx
TextArea_vtbl *v21; // rbx
const cocos2d::CCPoint *v22; // rax
__int128 *v23; // [rsp+40h] [rbp-29h] BYREF
cocos2d::CCPoint v24; // [rsp+48h] [rbp-21h] BYREF
__int128 v25; // [rsp+50h] [rbp-19h] BYREF
__int64 v26; // [rsp+60h] [rbp-9h]
unsigned __int64 v27; // [rsp+68h] [rbp-1h]
_QWORD v28[4]; // [rsp+70h] [rbp+7h] BYREF
if ( a2 )
{
a1->m_animating = 1;
a1->m_skippable = a2->m_unskippable;
cocos2d::CCNode::stopAllActions(a1->m_navButtonSprite);
a1->m_navButtonSprite->setOpacity(&a1->m_navButtonSprite->cocos2d::CCRGBAProtocol, 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;
}
sub_14003BDB0((__int64)&v25, (__int64)&a2->m_character);
v6 = (const char *)&v25;
if ( v27 > 0xF )
v6 = (const char *)v25;
a1->m_characterLabel->setString(&a1->m_characterLabel->cocos2d::CCLabelProtocol, v6);
sub_14003A830((__int64)&v25);
LOWORD(v23) = *(_WORD *)&a2->m_nameColor.r;
BYTE2(v23) = a2->m_nameColor.b;
a1->m_characterLabel->setColor(&a1->m_characterLabel->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v23);
m_characterFrame = a2->m_characterFrame;
if ( m_characterFrame > 0 )
{
v8 = 56;
if ( m_characterFrame < 56 )
v8 = a2->m_characterFrame;
v9 = cocos2d::CCString::createWithFormat("dialogIcon_%03d.png", v8);
CString = cocos2d::CCString::getCString(v9);
v11 = cocos2d::CCSprite::create(CString);
a1->m_characterSprite = v11;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v11, 2);
v12 = a1->m_characterSprite->__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v23, -143.0, 0.0);
v12->setPosition_0(a1->m_characterSprite, v13);
}
m_textScale = a2->m_textScale;
v23 = &v25;
sub_14003BDB0((__int64)v28, (__int64)&a2->m_text);
v15 = v28;
if ( v28[3] > 0xFu )
v15 = (_QWORD *)v28[0];
v25 = 0;
v26 = 0;
v27 = 0;
v16 = -1;
do
++v16;
while ( *((_BYTE *)v15 + v16) );
sub_14003A930(&v25, v15, v16);
cocos2d::CCPoint::CCPoint(&v24, 0.0, 1.0);
a1->m_textArea = (TextArea *)TextArea::create(
(__int64)&v25,
"chatFont.fnt",
1.0,
220.0 / m_textScale,
v17,
1101004800,
0);
sub_14003A830((__int64)v28);
v18 = a1->m_textArea->__vftable;
cocos2d::CCPoint::CCPoint(&v24, 0.0, 0.5);
v18->setAnchorPoint(a1->m_textArea, v19);
((void (__fastcall *)(TextArea *))a1->m_textArea->setScale_0)(a1->m_textArea);
v20 = &a1->TextAreaDelegate;
if ( !a1 )
v20 = nullptr;
a1->m_textArea->m_delegate = v20;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_textArea, 3);
v21 = a1->m_textArea->__vftable;
cocos2d::CCPoint::CCPoint(&v24, -92.0, 0.0);
v21->setPosition_0(a1->m_textArea, v22);
TextArea::fadeInCharacters(a1->m_textArea, 0.2, 0.02, 0, Fade);
}
}