//
// DialogLayer::displayDialogObject from 0x1003c7890 to 0x1003c7c25 (917 bytes)
//
// 2 xrefs:
// > DialogLayer::init @ 0x1003c7734
// > DialogLayer::displayNextObject @ 0x1003c780e
//
// 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 __fastcall DialogLayer::displayDialogObject(DialogLayer *a1, DialogObject *a2)
{
double v2; // xmm0_8
cocos2d::CCSprite *m_characterSprite; // rdi
TextArea *m_textArea; // rdi
cocos2d::CCLabelBMFont *m_characterLabel; // r15
char *v8; // rsi
cocos2d::CCLabelBMFont *v9; // rdi
__int16 v10; // ax
cocos2d::CCString *v11; // rax
const char *CString; // rax
cocos2d::CCSprite *v13; // rax
cocos2d::CCSprite *v14; // r15
__int128 v15; // xmm0
std::string *p_m_text; // r14
const char *v17; // r14
size_t v18; // rax
size_t v19; // r15
char *v20; // r12
size_t v21; // r13
TextArea *v22; // r14
TextArea *v23; // rsi
TextArea *v24; // r14
char v25; // [rsp+0h] [rbp-70h]
double v26; // [rsp+8h] [rbp-68h] BYREF
__int128 __dst; // [rsp+10h] [rbp-60h] BYREF
void *v28; // [rsp+20h] [rbp-50h]
float m_textScale; // [rsp+2Ch] [rbp-44h]
char __s[16]; // [rsp+30h] [rbp-40h] BYREF
void *__p; // [rsp+40h] [rbp-30h]
if ( !a2 )
return;
a1->m_animating = 1;
a1->m_skippable = a2->m_unskippable;
cocos2d::CCNode::stopAllActions(a1->m_navButtonSprite);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))a1->m_navButtonSprite->setOpacity)(a1->m_navButtonSprite, 0);
m_characterSprite = a1->m_characterSprite;
if ( m_characterSprite )
{
((void (__fastcall *)(cocos2d::CCSprite *))m_characterSprite->removeMeAndCleanup)(m_characterSprite);
a1->m_characterSprite = nullptr;
}
m_textArea = a1->m_textArea;
if ( m_textArea )
{
m_textArea->m_delegate = nullptr;
((void (__fastcall *)(TextArea *))m_textArea->removeMeAndCleanup)(m_textArea);
a1->m_textArea = nullptr;
}
m_characterLabel = a1->m_characterLabel;
if ( (a2->m_character.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(__s, a2->m_character.m_data.m_long.longStorage, a2->m_character.m_data.m_long.size, v2);
if ( (__s[0] & 1) == 0 )
goto LABEL_8;
}
else
{
__p = a2->m_character.m_data.m_long.longStorage;
*(_OWORD *)__s = *(_OWORD *)&a2->m_character.m_data.m_short.sizex2;
if ( (__s[0] & 1) == 0 )
{
LABEL_8:
v8 = &__s[1];
goto LABEL_11;
}
}
v8 = (char *)__p;
LABEL_11:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *))m_characterLabel->setString)(m_characterLabel, v8);
if ( (__s[0] & 1) != 0 )
operator delete(__p);
v9 = a1->m_characterLabel;
v10 = *(_WORD *)&a2->m_nameColor.r;
__s[2] = a2->m_nameColor.b;
*(_WORD *)__s = v10;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *))v9->setColor)(v9, __s);
if ( a2->m_characterFrame > 0 )
{
v11 = (cocos2d::CCString *)sub_1007AB580("dialogIcon_%03d.png", v25);
CString = cocos2d::CCString::getCString(v11);
v13 = cocos2d::CCSprite::create_1(CString);
a1->m_characterSprite = v13;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v13,
2);
v14 = a1->m_characterSprite;
sub_10028CBE0((float *)__s, -143.0, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, char *))v14->setPosition)(v14, __s);
}
*(_QWORD *)&v15 = LODWORD(a2->m_textScale);
m_textScale = a2->m_textScale;
if ( (a2->m_text.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(__s, a2->m_text.m_data.m_long.longStorage, a2->m_text.m_data.m_long.size, *(double *)&v15);
if ( (__s[0] & 1) == 0 )
goto LABEL_17;
}
else
{
p_m_text = &a2->m_text;
__p = p_m_text->m_data.m_long.longStorage;
v15 = *(_OWORD *)&p_m_text->m_data.m_short.sizex2;
*(_OWORD *)__s = *(_OWORD *)&p_m_text->m_data.m_short.sizex2;
if ( (__s[0] & 1) == 0 )
{
LABEL_17:
v17 = &__s[1];
goto LABEL_20;
}
}
v17 = (const char *)__p;
LABEL_20:
v18 = strlen(v17);
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&v15);
v19 = v18;
if ( v18 >= 0x17 )
{
v21 = 26;
if ( (v18 | 7) != 0x17 )
v21 = (v18 | 7) + 1;
v20 = (char *)operator new(v21);
v28 = v20;
*(_QWORD *)&__dst = v21 | 1;
*((_QWORD *)&__dst + 1) = v19;
}
else
{
LOBYTE(__dst) = 2 * v18;
v20 = (char *)&__dst + 1;
if ( !v18 )
goto LABEL_28;
}
memmove(v20, v17, v19);
LABEL_28:
v20[v19] = 0;
sub_10028CBE0((float *)&v26, 0.0, 1.0);
a1->m_textArea = (TextArea *)TextArea::create(
&__dst,
(__int64)"chatFont.fnt",
&v26,
0,
1.0,
220.0 / m_textScale,
20.0);
if ( (__dst & 1) != 0 )
operator delete(v28);
if ( (__s[0] & 1) != 0 )
operator delete(__p);
v22 = a1->m_textArea;
sub_10028CBE0((float *)__s, 0.0, 0.5);
((void (__fastcall *)(TextArea *, char *))v22->setAnchorPoint)(v22, __s);
((void (__fastcall *)(TextArea *, float))a1->m_textArea->setScale)(a1->m_textArea, m_textScale);
v23 = a1->m_textArea;
v23->m_delegate = &a1->TextAreaDelegate;
((void (__fastcall *)(cocos2d::CCLayer *, TextArea *, __int64))a1->m_mainLayer->addChild_0)(a1->m_mainLayer, v23, 3);
v24 = a1->m_textArea;
sub_10028CBE0((float *)__s, -92.0, 0.0);
((void (__fastcall *)(TextArea *, char *))v24->setPosition)(v24, __s);
TextArea::fadeInCharacters(a1->m_textArea, 0.2, 0.02, 0, Fade);
}