//
// DialogLayer::init from 0x1400d35e0 to 0x1400d3a3d (1117 bytes)
//
// 2 xrefs:
// > DialogLayer::createDialogLayer @ 0x1400d35a4
// > ??> @ 0x1406c8640
//
// 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=1
bool DialogLayer::init(DialogLayer *a1, DialogObject *a2, cocos2d::CCArray *a3, int a4)
{
bool result; // al
__int64 v9; // rcx
cocos2d::CCDirector *v10; // rax
__int64 v11; // rcx
__int64 v12; // rax
cocos2d::CCTouchDispatcher *v13; // rax
_BOOL8 v14; // rdx
_BOOL8 v15; // rdx
_BOOL8 v16; // rdx
cocos2d::CCLayer *v17; // rax
cocos2d::CCLayer_vtbl *v18; // rbx
const cocos2d::CCPoint *v19; // rax
cocos2d::CCString *v20; // rax
const char *CString; // rax
size_t v22; // r8
const char *v23; // rbx
struct cocos2d::CCRect *v24; // rax
struct cocos2d::extension::CCScale9Sprite *v25; // rdi
cocos2d::extension::CCScale9Sprite_vtbl *v26; // rbx
const cocos2d::CCSize *v27; // rax
cocos2d::CCLabelBMFont *v28; // rax
cocos2d::CCLabelBMFont_vtbl *v29; // rbx
const cocos2d::CCPoint *v30; // rax
cocos2d::CCLabelBMFont_vtbl *v31; // rbx
const cocos2d::CCPoint *v32; // rax
struct cocos2d::CCRect *v33; // rax
struct cocos2d::extension::CCScale9Sprite *v34; // rdi
cocos2d::extension::CCScale9Sprite_vtbl *v35; // rbx
const cocos2d::CCPoint *v36; // rax
__int64 v37; // rdx
cocos2d::CCSprite *v38; // rax
cocos2d::CCSprite_vtbl *v39; // rbx
const cocos2d::CCPoint *v40; // rax
cocos2d::CCPoint v41; // [rsp+30h] [rbp-39h] BYREF
float v42; // [rsp+38h] [rbp-31h]
float v43; // [rsp+3Ch] [rbp-2Dh]
cocos2d::CCSize v44; // [rsp+40h] [rbp-29h] BYREF
cocos2d::CCRect v45; // [rsp+48h] [rbp-21h] BYREF
cocos2d::CCRect v46; // [rsp+58h] [rbp-11h] BYREF
__int128 v47; // [rsp+68h] [rbp-1h] BYREF
__int128 v48; // [rsp+78h] [rbp+Fh]
v41.x = -1.0339758e-25;
result = cocos2d::CCLayerColor::initWithColor(a1, (const struct cocos2d::_ccColor4B *)&v41);
if ( result )
{
if ( a3 )
{
a1->m_dialogObjects = a3;
cocos2d::CCObject::retain(a3);
}
v10 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v9);
cocos2d::CCDirector::getWinSize(v10);
v12 = cocos2d::CCDirector::sharedDirector(v11);
v13 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 144LL))(v12);
cocos2d::CCTouchDispatcher::registerForcePrio(v13, a1, 2);
LOBYTE(v14) = 1;
a1->setTouchEnabled(a1, v14);
LOBYTE(v15) = 1;
a1->setKeypadEnabled(a1, v15);
LOBYTE(v16) = 1;
a1->setKeyboardEnabled(a1, v16);
v17 = (cocos2d::CCLayer *)cocos2d::CCLayer::create();
a1->m_mainLayer = v17;
a1->addChild_1(a1, v17);
a1->m_mainLayer->setContentSize(a1->m_mainLayer, &stru_1406C1A40);
v18 = a1->m_mainLayer->__vftable;
cocos2d::CCPoint::CCPoint(&v41, v42 * 0.5, v43 * 0.5);
v18->setPosition_0(a1->m_mainLayer, v19);
v20 = cocos2d::CCString::createWithFormat("GJ_square%02d.png", a4);
CString = cocos2d::CCString::getCString(v20);
v47 = 0;
v48 = 0;
v22 = -1;
do
++v22;
while ( CString[v22] );
sub_14003A930(&v47, CString, v22);
v23 = (const char *)&v47;
if ( *((_QWORD *)&v48 + 1) > 0xFu )
v23 = (const char *)v47;
cocos2d::CCRect::CCRect(&v46, 0.0, 0.0, 80.0, 80.0);
v25 = cocos2d::extension::CCScale9Sprite::create(v23, v24);
v26 = v25->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v41, 380.0, 100.0);
v26->setContentSize(v25, v27);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v25, -2);
v28 = cocos2d::CCLabelBMFont::create(" ", (const char *)&qword_14052A4D8);
a1->m_characterLabel = v28;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v28, 2);
v29 = a1->m_characterLabel->__vftable;
cocos2d::CCPoint::CCPoint(&v41, 0.0, 1.0);
v29->setAnchorPoint(a1->m_characterLabel, v30);
v31 = a1->m_characterLabel->__vftable;
cocos2d::CCPoint::CCPoint(&v41, -93.0, 36.0);
v31->setPosition_0(a1->m_characterLabel, v32);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_characterLabel, 200.0, 0.5, 0.0);
cocos2d::CCRect::CCRect(&v45, 0.0, 0.0, 80.0, 80.0);
v33 = (struct cocos2d::CCRect *)cocos2d::CCRect::CCRect(&v46, &v45);
v34 = cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v33);
cocos2d::CCSize::CCSize(&v44, 280.0, 80.0);
v34->setContentSize(v34, &v44);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v34, -1);
v35 = v34->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(&v41, 40.0, 0.0);
v35->setPosition_0(v34, v36);
LOWORD(v41.x) = 0;
BYTE2(v41.x) = 0;
v34->setColor(&v34->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v41);
LOBYTE(v37) = 50;
v34->setOpacity(&v34->cocos2d::CCRGBAProtocol, v37);
v38 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_chatBtn_01_001.png");
a1->m_navButtonSprite = v38;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v38, 3);
v39 = a1->m_navButtonSprite->__vftable;
cocos2d::CCPoint::CCPoint(&v41, 0.0, -50.0);
v39->setPosition_0(a1->m_navButtonSprite, v40);
a1->m_navButtonSprite->setOpacity(&a1->m_navButtonSprite->cocos2d::CCRGBAProtocol, 0);
if ( a1->m_dialogObjects )
DialogLayer::displayNextObject(a1);
else
DialogLayer::displayDialogObject(a1, a2);
DialogLayer::updateNavButtonFrame(a1);
sub_14003A830((__int64)&v47);
return 1;
}
return result;
}