//
// DialogLayer::init from 0x4d615c to 0x4d641a (702 bytes)
//
// 1 xrefs:
// > DialogLayer::createDialogLayer @ 0x4d6500
//
// 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 DialogLayer::init(DialogLayer *a1, DialogObject *a2, cocos2d::CCArray *a3, int a4)
{
int v8; // r9
cocos2d::CCDirector *v9; // r0
cocos2d::CCDirector *v10; // r0
cocos2d::CCTouchDispatcher *v11; // r0
cocos2d::CCLayer *v12; // r0
DialogLayer_vtbl *v13; // r3
cocos2d::CCLayer *m_mainLayer; // r6
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCString *v16; // r0
char *CString; // r0
cocos2d::extension::CCScale9Sprite *v18; // r8
cocos2d::CCNode *v19; // r8
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r11
cocos2d::CCLabelBMFont *v21; // r0
cocos2d::CCLabelBMFont *m_characterLabel; // r8
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r11
cocos2d::CCLabelBMFont *v24; // r8
void (__fastcall *v25)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
cocos2d::CCNode *v26; // r6
void (__fastcall *v27)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // r2
cocos2d::CCSprite *v29; // r0
cocos2d::CCSprite *m_navButtonSprite; // r6
void (__fastcall *v31)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r8
float v33; // r2
float v34; // r3
cocos2d::extension::CCScale9Sprite *v35; // [sp+10h] [bp-3Ch] BYREF
cocos2d::CCSize v36; // [sp+14h] [bp-38h] BYREF
cocos2d::CCSize v37; // [sp+1Ch] [bp-30h] BYREF
cocos2d::CCRect v38; // [sp+24h] [bp-28h] BYREF
cocos2d::CCRect v39; // [sp+34h] [bp-18h] BYREF
cocos2d::CCSize v40; // 0:^0.8
cocos2d::CCRect v41; // 0:kr00_16.16
cocos2d::CCRect v42; // 0:r2.8,8:^0.8
v39.origin.x = -1.034e-25;
v8 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::_ccColor4B *)&v39);
if ( v8 )
{
if ( a3 )
{
a1->m_dialogObjects = a3;
cocos2d::CCObject::retain(a3);
}
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v36, v9);
v10 = cocos2d::CCDirector::sharedDirector();
v11 = v10->getTouchDispatcher(v10);
cocos2d::CCTouchDispatcher::registerForcePrio(v11, a1, 2);
a1->setTouchEnabled(a1, 1);
a1->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
v12 = cocos2d::CCLayer::create();
v13 = a1->cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_mainLayer = v12;
v13->addChild(a1, v12);
a1->m_mainLayer->setContentSize(a1->m_mainLayer, &stru_AC6DBC);
m_mainLayer = a1->m_mainLayer;
setPosition = m_mainLayer->setPosition;
cocos2d::CCPoint::CCPoint(&v39.origin, v36.width * 0.5, v36.height * 0.5);
setPosition(m_mainLayer, &v39.origin);
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"GJ_square%02d.png",
(const char *)a4);
CString = (char *)cocos2d::CCString::getCString(v16);
sub_776584((int)&v35, CString);
v18 = v35;
cocos2d::CCRect::CCRect(&v39, 0.0, 0.0, 80.0, 80.0);
v41.origin.x = v33;
v41.origin.y = v34;
v41.size = v40;
v19 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(v18, (const char *)&v39, v41);
setContentSize = v19->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v39, 380.0, 100.0);
setContentSize(v19, (const cocos2d::CCSize *)&v39);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v19, -2);
v21 = cocos2d::CCLabelBMFont::create();
a1->m_characterLabel = v21;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v21, 2);
m_characterLabel = a1->m_characterLabel;
setAnchorPoint = m_characterLabel->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v39.origin, 0.0, 1.0);
setAnchorPoint(m_characterLabel, &v39.origin);
v24 = a1->m_characterLabel;
v25 = v24->setPosition;
cocos2d::CCPoint::CCPoint(&v39.origin, -93.0, 36.0);
v25(v24, &v39.origin);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_characterLabel, 200.0, 0.5, 0.0);
cocos2d::CCRect::CCRect(&v38, 0.0, 0.0, 80.0, 80.0);
cocos2d::CCRect::CCRect(&v39, &v38);
v26 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02b_001.png",
(const char *)&v39,
v42);
cocos2d::CCSize::CCSize(&v37, 280.0, 80.0);
v26->setContentSize(v26, &v37);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v26, -1);
v27 = v26->setPosition;
cocos2d::CCPoint::CCPoint(&v39.origin, 40.0, 0.0);
v27(v26, &v39.origin);
getTag = v26->__vftable[1].getTag;
LOWORD(v39.origin.x) = 0;
BYTE2(v39.origin.x) = 0;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))getTag)(v26, &v39);
((void (__fastcall *)(cocos2d::CCNode *, int))v26->__vftable[1].~CCNode_0)(v26, 50);
v29 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_chatBtn_01_001.png");
a1->m_navButtonSprite = v29;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v29, 3);
m_navButtonSprite = a1->m_navButtonSprite;
v31 = m_navButtonSprite->setPosition;
cocos2d::CCPoint::CCPoint(&v39.origin, 0.0, -50.0);
v31(m_navButtonSprite, &v39.origin);
a1->m_navButtonSprite->setOpacity(a1->m_navButtonSprite, 0);
if ( a1->m_dialogObjects )
DialogLayer::displayNextObject(a1);
else
DialogLayer::displayDialogObject(a1, a2);
DialogLayer::updateNavButtonFrame(a1);
sub_774008(&v35);
}
return v8;
}