//
// DialogLayer::init from 0x1000868a8 to 0x100086c94 (1004 bytes)
//
// 1 xrefs:
// > DialogLayer::createDialogLayer @ 0x100086848
//
// 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
//
bool __fastcall DialogLayer::init(DialogLayer *a1, DialogObject *a2, cocos2d::CCArray *a3, int a4)
{
_BOOL4 v8; // w19
cocos2d::CCDirector *v9; // x0
cocos2d::CCDirector *v10; // x0
cocos2d::CCTouchDispatcher *v11; // x0
cocos2d::CCLayer *v12; // x0
__n128 v13; // q0
cocos2d::CCLayer *m_mainLayer; // x23
__n128 v15; // q1
cocos2d::CCString *v16; // x0
char *CString; // x0
void **v18; // x24
void **v19; // x0
cocos2d::extension::CCScale9Sprite *v20; // x22
__n128 v21; // q0
cocos2d::CCLabelBMFont *m_characterLabel; // x22
__n128 v23; // q1
__n128 v24; // q0
cocos2d::CCLabelBMFont *v25; // x22
__n128 v26; // q1
double v27; // d0
cocos2d::extension::CCScale9Sprite *v28; // x22
__n128 v29; // q0
__n128 v30; // q1
__n128 v31; // q0
cocos2d::CCSprite *m_navButtonSprite; // x22
__n128 v33; // q1
float v35; // s1
float v36; // s2
float v37; // s3
int v38; // [xsp+8h] [xbp-78h] BYREF
float v39[4]; // [xsp+10h] [xbp-70h] BYREF
float v40[4]; // [xsp+20h] [xbp-60h] BYREF
void *__p[2]; // [xsp+30h] [xbp-50h] BYREF
char v42; // [xsp+47h] [xbp-39h]
float v43; // [xsp+48h] [xbp-38h]
float v44; // [xsp+4Ch] [xbp-34h]
cocos2d::CCRect v45; // 0:kr10_16.16
cocos2d::CCRect v46; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
LODWORD(__p[0]) = -1778384896;
v8 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::ccColor4B *)__p);
if ( v8 )
{
if ( a3 )
{
a1->m_dialogObjects = a3;
cocos2d::CCObject::retain(a3);
}
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v9);
v10 = cocos2d::CCDirector::sharedDirector();
v11 = (cocos2d::CCTouchDispatcher *)((__int64 (__fastcall *)(cocos2d::CCDirector *))v10->getTouchDispatcher)(v10);
cocos2d::CCTouchDispatcher::registerForcePrio(v11, a1, 2);
((void (__fastcall *)(DialogLayer *, __int64))a1->setTouchEnabled)(a1, 1);
((void (__fastcall *)(DialogLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
((void (__fastcall *)(DialogLayer *, __int64))a1->setKeyboardEnabled)(a1, 1);
v12 = cocos2d::CCLayer::create();
a1->m_mainLayer = v12;
((void (__fastcall *)(DialogLayer *, cocos2d::CCLayer *))a1->addChild)(a1, v12);
v13 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, void *))a1->m_mainLayer->setContentSize)(
a1->m_mainLayer,
&unk_10086ADE8);
m_mainLayer = a1->m_mainLayer;
v13.n128_f32[0] = v43 * 0.5;
v15.n128_f32[0] = v44 * 0.5;
sub_100022980(v13, v15, __p);
((void (__fastcall *)(cocos2d::CCLayer *, void **))m_mainLayer->setPosition)(m_mainLayer, __p);
v16 = (cocos2d::CCString *)sub_100268F4C("GJ_square%02d.png", a4);
CString = (char *)cocos2d::CCString::getCString(v16);
sub_100009900(__p, CString);
LODWORD(m_mainLayer) = v42;
v18 = (void **)__p[0];
sub_100022990(v40, 0.0, 0.0, 80.0, 80.0);
if ( (int)m_mainLayer >= 0 )
v19 = __p;
else
v19 = v18;
v20 = cocos2d::extension::CCScale9Sprite::create((const char *)v19, v46);
sub_100022988(v40, 380.0, 100.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float *))v20->setContentSize)(v20, v40);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v20,
4294967294LL);
a1->m_characterLabel = cocos2d::CCLabelBMFont::create_1(" ", "bigFont.fnt");
v21 = ((__n128 (__fastcall *)(cocos2d::CCLayer *))a1->m_mainLayer->addChild_0)(a1->m_mainLayer);
m_characterLabel = a1->m_characterLabel;
v21.n128_u32[0] = 0;
v23.n128_u32[0] = 1.0;
sub_100022980(v21, v23, v40);
v24 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float *))m_characterLabel->setAnchorPoint)(
m_characterLabel,
v40);
v25 = a1->m_characterLabel;
v24.n128_u32[0] = -1027997696;
v26.n128_u32[0] = 1108344832;
sub_100022980(v24, v26, v40);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float *))v25->setPosition)(v25, v40);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_characterLabel, 200.0, 0.5, 0.0);
sub_100022990(v40, 0.0, 0.0, 80.0, 80.0);
v27 = sub_100022B98(v39, (__int64)v40);
v45.origin.x = *(float *)&v27;
v45.origin.y = v35;
v45.size.width = v36;
v45.size.height = v37;
v28 = cocos2d::extension::CCScale9Sprite::create("square02b_001.png", v45);
sub_100022988(v39, 280.0, 80.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float *))v28->setContentSize)(v28, v39);
v29 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v28,
0xFFFFFFFFLL);
v29.n128_u32[0] = 1109393408;
v30.n128_u32[0] = 0;
sub_100022980(v29, v30, &v38);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, int *))v28->setPosition)(v28, &v38);
BYTE2(v38) = 0;
LOWORD(v38) = 0;
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, int *))v28->setColor)(v28, &v38);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v28->setOpacity)(v28, 50);
a1->m_navButtonSprite = cocos2d::CCSprite::createWithSpriteFrameName("GJ_chatBtn_01_001.png");
v31 = ((__n128 (__fastcall *)(cocos2d::CCLayer *))a1->m_mainLayer->addChild_0)(a1->m_mainLayer);
m_navButtonSprite = a1->m_navButtonSprite;
v33.n128_u32[0] = -1035468800;
v31.n128_u32[0] = 0;
sub_100022980(v31, v33, &v38);
((void (__fastcall *)(cocos2d::CCSprite *, int *))m_navButtonSprite->setPosition)(m_navButtonSprite, &v38);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))a1->m_navButtonSprite->setOpacity)(a1->m_navButtonSprite, 0);
if ( a1->m_dialogObjects )
DialogLayer::displayNextObject(a1);
else
DialogLayer::displayDialogObject(a1, a2);
DialogLayer::updateNavButtonFrame(a1);
if ( v42 < 0 )
operator delete(__p[0]);
}
return v8;
}