//
// GJFollowCommandLayer::init from 0x4dbc10 to 0x4dc792 (2946 bytes)
//
// 1 xrefs:
// > GJFollowCommandLayer::create @ 0x4dc952
//
// 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 GJFollowCommandLayer::init(GJFollowCommandLayer *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
cocos2d::CCDirector *v4; // r0
cocos2d::CCLabelBMFont *v5; // r7
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
const char *v7; // r1
ButtonSprite *v8; // r0
CCMenuItemSpriteExtra *v9; // r0
CCMenuItemSpriteExtra *v10; // r7
cocos2d::CCMenu *m_buttonMenu; // r10
void (__fastcall *v12)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCLabelBMFont *v13; // r7
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCNode *v15; // r7
void (__fastcall *v16)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
const char *v17; // r2
CCTextInputNode *v18; // r0
CCTextInputNode *m_moveTimeInput; // r9
void (__fastcall *v20)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
int v21; // r0
CCTextInputNode *v22; // r7
CCTextInputNode *v23; // r3
Slider *v24; // r0
Slider *m_moveTimeSlider; // r9
void (__fastcall *v26)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
float v27; // s15
int v28; // r9
void (*v29)(GJFollowCommandLayer *, cocos2d::CCObject *); // r3
float v30; // s15
cocos2d::CCLabelBMFont *v31; // r8
cocos2d::CCNode *v32; // r8
float m_yMod; // s18
const char *v34; // r2
CCTextInputNode *v35; // r6
int v36; // r0
CCTextInputNode_vtbl *v37; // r3
Slider *v38; // r6
float v39; // s15
int v40; // r10
int v41; // r2
bool v42; // r3
int v43; // r9
int m_followGroupID; // r7
int v45; // r2
bool v46; // r3
cocos2d::CCLabelBMFont *v47; // r6
cocos2d::CCNode *v48; // r6
const char *v49; // r2
CCTextInputNode *v50; // r6
cocos2d::CCSprite *v51; // r6
CCMenuItemSpriteExtra *v52; // r6
void (__fastcall *v53)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCSprite *v54; // r6
CCMenuItemSpriteExtra *v55; // r6
void (__fastcall *v56)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
TextInputDelegate *v58; // [sp+Ch] [bp-C8h]
_BOOL4 v59; // [sp+10h] [bp-C4h]
void (__fastcall *v60)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+18h] [bp-BCh]
char *v61; // [sp+28h] [bp-ACh]
char *v62; // [sp+28h] [bp-ACh]
char *v63; // [sp+28h] [bp-ACh]
void (__fastcall *v64)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+2Ch] [bp-A8h]
cocos2d::ccColor3B v65; // [sp+3Ch] [bp-98h]
cocos2d::ccColor3B v66; // [sp+40h] [bp-94h]
cocos2d::ccColor3B v67; // [sp+44h] [bp-90h]
cocos2d::CCLabelBMFont *v68; // [sp+48h] [bp-8Ch] BYREF
cocos2d::CCSize v69; // [sp+4Ch] [bp-88h] BYREF
cocos2d::CCPoint v70; // [sp+54h] [bp-80h] BYREF
cocos2d::CCSize v71; // [sp+5Ch] [bp-78h] BYREF
cocos2d::CCPoint v72; // [sp+64h] [bp-70h] BYREF
void (*v73)(GJFollowCommandLayer *, cocos2d::CCObject *); // [sp+6Ch] [bp-68h]
unsigned int v74; // [sp+70h] [bp-64h]
cocos2d::CCPoint v75; // [sp+74h] [bp-60h] BYREF
cocos2d::CCPoint v76; // [sp+7Ch] [bp-58h] BYREF
cocos2d::CCPoint v77; // [sp+84h] [bp-50h] BYREF
int v78; // [sp+8Ch] [bp-48h]
int v79; // [sp+90h] [bp-44h]
void (*v80)(GJFollowCommandLayer *, cocos2d::CCObject *); // [sp+94h] [bp-40h]
int v81; // [sp+98h] [bp-3Ch]
cocos2d::CCRect v82; // [sp+9Ch] [bp-38h] BYREF
cocos2d::CCRect v83; // [sp+ACh] [bp-28h] BYREF
cocos2d::CCRect v84; // [sp+BCh] [bp-18h] BYREF
cocos2d::CCRect v85; // 0:r2.8,8:^0.8
cocos2d::CCRect v86; // 0:r2.8,8:^0.8
v59 = SetupTriggerPopup::init(a1, a2, a3, 430.0, 310.0, 1);
if ( v59 )
{
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v69, v4);
v5 = cocos2d::CCLabelBMFont::create();
setPosition = v5->setPosition;
cocos2d::CCPoint::CCPoint(
&v84.origin,
v69.width * 0.5,
(float)((float)(a1->m_height * 0.5) + (float)(v69.height * 0.5)) - 15.0);
setPosition(v5, &v84.origin);
a1->m_mainLayer->addChild(a1->m_mainLayer, v5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v5->setScale)(v5, 1058642330);
v8 = ButtonSprite::create((ButtonSprite *)"OK", v7);
v78 = 660;
v79 = 1;
v9 = CCMenuItemSpriteExtra::create(v8, nullptr, (cocos2d::SEL_MenuHandler)((unsigned int)a1 | 0x29400000000LL));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v9);
sub_776584((int)&v83, "Help");
sub_776584(
(int)&v84,
"Make a group of objects follow a target object.\n"
"Target Group ID is the group of objects that follow the object using Follow Group ID. Make sure th"
"at this group only contains one object or has a group ID parent.");
v10 = InfoAlertButton::create((int)&v83, (int)&v84, 1065353216);
sub_774008(&v84);
sub_774008(&v83);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v10);
m_buttonMenu = a1->m_buttonMenu;
v12 = v10->setPosition;
cocos2d::CCPoint::CCPoint(
&v83.origin,
(float)((float)(v69.width * 0.5) - (float)(a1->m_width * 0.5)) + 18.0,
(float)((float)(a1->m_height * 0.5) + (float)(v69.height * 0.5)) - 18.0);
cocos2d::CCNode::convertToNodeSpace(&v84.origin, m_buttonMenu, &v83.origin);
v12(v10, &v84.origin);
a1->determineStartValues(a1);
cocos2d::CCPoint::CCPoint(&v70, (float)(v69.width * 0.5) - 105.0, v69.height * 0.5);
v13 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v13->setScale)(v13, 1058642330);
v13->setPosition(v13, &v70);
setAnchorPoint = v13->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v84.origin, 1.0, 0.5);
setAnchorPoint(v13, &v84.origin);
a1->m_mainLayer->addChild(a1->m_mainLayer, v13);
cocos2d::CCRect::CCRect(&v82, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v84, &v82);
v15 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02_small.png",
(const char *)&v84,
v85);
((void (__fastcall *)(cocos2d::CCNode *, int))v15->__vftable[1].~CCNode_0)(v15, 100);
cocos2d::CCSize::CCSize(&v71, 70.0, 30.0);
v15->setContentSize(v15, &v71);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v15, -1);
v16 = v15->setPosition;
cocos2d::CCPoint::CCPoint(&v83.origin, 45.0, 0.0);
cocos2d::CCPoint::operator+(&v84, &v70, &v83);
v16(v15, &v84.origin);
if ( a1->m_moveTime == -99999.0 )
v17 = "Mixed";
else
v17 = "Num";
v18 = CCTextInputNode::create(50.0, 40.0, v17, "Thonburi");
a1->m_moveTimeInput = v18;
((void (__fastcall *)(cocos2d::CCLayer *, CCTextInputNode *, int, void (__fastcall *)(cocos2d::CCNode *__hidden, cocos2d::CCNode *, int), int *, const char *))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v18,
20,
a1->m_mainLayer->addChild_0,
&dword_18,
"bigFont.fnt");
m_moveTimeInput = a1->m_moveTimeInput;
v20 = m_moveTimeInput->setPosition;
v21 = (int)v15->getPosition(v15);
v20(m_moveTimeInput, (const cocos2d::CCPoint *)v21);
CCTextInputNode::setMaxLabelScale(a1->m_moveTimeInput, 0.6);
CCTextInputNode::setMaxLabelWidth(a1->m_moveTimeInput, 200.0);
a1->m_moveTimeInput->m_textField->setVisible(a1->m_moveTimeInput->m_textField, 0);
v22 = a1->m_moveTimeInput;
v22->m_maxLabelLength = 4;
sub_776584((int)&v84, "0123456789.");
CCTextInputNode::setAllowedChars((int)v22, (int)&v84);
sub_774008(&v84);
*(_WORD *)&v65.r = -21896;
v65.b = -16;
CCTextInputNode::setLabelPlaceholderColor(a1->m_moveTimeInput, v65);
CCTextInputNode::setLabelPlaceholderScale(a1->m_moveTimeInput, 0.5);
v23 = a1->m_moveTimeInput;
v23->m_numberInput = 1;
v23->m_delegate = &a1->TextInputDelegate;
v58 = &a1->TextInputDelegate;
a1->m_moveTimeInput->setTag(a1->m_moveTimeInput, 3);
v81 = 0;
v80 = GJFollowCommandLayer::sliderChanged;
v24 = (Slider *)Slider::create(a1, (unsigned int)GJFollowCommandLayer::sliderChanged, 0, 0.8);
a1->m_moveTimeSlider = v24;
Slider::setBarVisibility(v24, 0);
a1->m_mainLayer->addChild(a1->m_mainLayer, a1->m_moveTimeSlider);
m_moveTimeSlider = a1->m_moveTimeSlider;
v26 = m_moveTimeSlider->setPosition;
cocos2d::CCPoint::CCPoint(&v83.origin, 0.0, -32.0);
cocos2d::CCPoint::operator+(&v84, &v70, &v83);
v26(m_moveTimeSlider, &v84.origin);
v27 = a1->m_moveTime / 10.0;
if ( v27 >= 1.0 )
{
v27 = 1.0;
}
else if ( v27 <= 0.0 )
{
v27 = 0.0;
}
v28 = 0;
Slider::setValue(a1->m_moveTimeSlider, v27);
GJFollowCommandLayer::updateDurLabel(a1, 0);
v29 = GJFollowCommandLayer::sliderXModChanged;
while ( 1 )
{
v74 = 0;
v30 = -105.0;
v73 = v29;
if ( v28 )
v30 = 105.0;
cocos2d::CCPoint::CCPoint(&v75, v30 + (float)(v69.width * 0.5), (float)(v69.height * 0.5) + 95.0);
v31 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v31->setScale)(v31, 1060320051);
v31->setPosition(v31, &v75);
v61 = (char *)v31->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v84.origin, 1.0, 0.5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, cocos2d::CCRect *))v61)(v31, &v84);
a1->m_mainLayer->addChild(a1->m_mainLayer, v31);
cocos2d::CCRect::CCRect(&v83, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v84, &v83);
v32 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02_small.png",
(const char *)&v84,
v86);
((void (__fastcall *)(cocos2d::CCNode *, int))v32->__vftable[1].~CCNode_0)(v32, 100);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v76, 70.0, 30.0);
v32->setContentSize(v32, (const cocos2d::CCSize *)&v76);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v32, -1);
v64 = v32->setPosition;
cocos2d::CCPoint::CCPoint(&v77, 45.0, 0.0);
cocos2d::CCPoint::operator+(&v84, &v75, &v77);
v64(v32, &v84.origin);
if ( v28 )
m_yMod = a1->m_yMod;
else
m_yMod = a1->m_xMod;
v34 = "Mixed";
if ( m_yMod != -99999.0 )
v34 = "Num";
v35 = CCTextInputNode::create(60.0, 40.0, v34, "Thonburi");
((void (__fastcall *)(cocos2d::CCLayer *, CCTextInputNode *, int, void (__fastcall *)(cocos2d::CCNode *__hidden, cocos2d::CCNode *, int), int *, const char *))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v35,
20,
a1->m_mainLayer->addChild_0,
&dword_18,
"bigFont.fnt");
v62 = (char *)v35->setPosition;
v36 = (int)v32->getPosition(v32);
((void (__fastcall *)(CCTextInputNode *, int))v62)(v35, v36);
CCTextInputNode::setMaxLabelScale(v35, 0.6);
CCTextInputNode::setMaxLabelWidth(v35, 200.0);
v35->m_textField->setVisible(v35->m_textField, 0);
v35->m_maxLabelLength = 5;
sub_776584((int)&v84, "0123456789.-");
CCTextInputNode::setAllowedChars((int)v35, (int)&v84);
sub_774008(&v84);
*(_WORD *)&v66.r = -21896;
v66.b = -16;
CCTextInputNode::setLabelPlaceholderColor(v35, v66);
CCTextInputNode::setLabelPlaceholderScale(v35, 0.5);
v35->m_numberInput = 1;
v35->m_delegate = v58;
v37 = v35->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v28 )
{
a1->m_yModInput = v35;
v37->setTag(v35, 1);
}
else
{
a1->m_xModInput = v35;
v37->setTag(v35, 0);
}
v38 = (Slider *)Slider::create(a1, (unsigned int)v73, v74, 0.8);
Slider::setBarVisibility(v38, 0);
a1->m_mainLayer->addChild(a1->m_mainLayer, v38);
v63 = (char *)v38->setPosition;
cocos2d::CCPoint::CCPoint(&v77, 0.0, -32.0);
cocos2d::CCPoint::operator+(&v84, &v75, &v77);
((void (__fastcall *)(Slider *, cocos2d::CCRect *))v63)(v38, &v84);
v39 = 0.5;
if ( m_yMod != -99999.0 )
v39 = (float)(m_yMod * 0.5) + 0.5;
Slider::setValue(v38, v39);
if ( v28 )
a1->m_yModSlider = v38;
else
a1->m_xModSlider = v38;
v29 = GJFollowCommandLayer::sliderYModChanged;
if ( v28 )
break;
v28 = 1;
}
v40 = 0;
SetupTriggerPopup::createMultiTriggerItemsDefaultVertical(a1);
while ( 1 )
{
cocos2d::CCPoint::CCPoint(&v72);
v68 = (cocos2d::CCLabelBMFont *)&unk_ACDDA8;
if ( v40 )
{
cocos2d::CCPoint::CCPoint(&v84.origin, (float)(v69.width * 0.5) + 160.0, (float)(v69.height * 0.5) - 70.0);
cocos2d::CCPoint::operator=((PlayerObject *)&v72, COERCE_FLOAT(&v84), v45, v46);
sub_7753D4((int)&v68, "Follow\nGroup ID");
v43 = 4;
m_followGroupID = a1->m_followGroupID;
v73 = GJFollowCommandLayer::onUpdateGroupID2;
}
else
{
cocos2d::CCPoint::CCPoint(&v84.origin, (float)(v69.width * 0.5) + 80.0, (float)(v69.height * 0.5) - 70.0);
cocos2d::CCPoint::operator=((PlayerObject *)&v72, COERCE_FLOAT(&v84), v41, v42);
sub_7753D4((int)&v68, "Target\nGroup ID");
v43 = 2;
m_followGroupID = a1->m_targetGroupID;
v73 = GJFollowCommandLayer::onUpdateGroupID;
}
v74 = 0;
v47 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v47->setScale)(v47, 1056964608);
a1->m_mainLayer->addChild(a1->m_mainLayer, v47);
v60 = v47->setPosition;
cocos2d::CCPoint::CCPoint(&v83.origin, 0.0, 75.0);
cocos2d::CCPoint::operator+(&v84, &v72, &v83);
v60(v47, &v84.origin);
cocos2d::CCRect::CCRect(&v83, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v84, &v83);
v48 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02_small.png",
(const char *)&v84,
v86);
((void (__fastcall *)(cocos2d::CCNode *, int))v48->__vftable[1].~CCNode_0)(v48, 100);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v75, 50.0, 30.0);
v48->setContentSize(v48, (const cocos2d::CCSize *)&v75);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v48, -1);
v48->setPosition(v48, &v72);
v49 = "Mixed";
if ( m_followGroupID != -99999 )
v49 = "Num";
v50 = CCTextInputNode::create(50.0, 40.0, v49, "Thonburi");
((void (__fastcall *)(cocos2d::CCLayer *, CCTextInputNode *, int, void (__fastcall *)(cocos2d::CCNode *__hidden, cocos2d::CCNode *, int), int *, const char *))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v50,
20,
a1->m_mainLayer->addChild_0,
&dword_18,
"bigFont.fnt");
v50->setPosition(v50, &v72);
CCTextInputNode::setMaxLabelScale(v50, 0.6);
CCTextInputNode::setMaxLabelWidth(v50, 80.0);
v50->m_textField->setVisible(v50->m_textField, 0);
v50->m_maxLabelLength = 6;
sub_776584((int)&v84, "0123456789");
CCTextInputNode::setAllowedChars((int)v50, (int)&v84);
sub_774008(&v84);
*(_WORD *)&v67.r = -21896;
v67.b = -16;
CCTextInputNode::setLabelPlaceholderColor(v50, v67);
CCTextInputNode::setLabelPlaceholderScale(v50, 0.5);
v50->m_delegate = v58;
v50->m_numberInput = 1;
v50->setTag(v50, v43);
if ( v40 )
a1->m_followIDInput = v50;
else
a1->m_targetIDInput = v50;
cocos2d::CCNode::convertToNodeSpace(&v76, a1->m_buttonMenu, &v72);
v51 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v51->setScale)(v51, 1068708659);
((void (__fastcall *)(cocos2d::CCSprite *, int))v51->setRotation)(v51, 1119092736);
v52 = CCMenuItemSpriteExtra::create(
v51,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__((unsigned int)v73, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v52);
v52->setTag(v52, 1);
v53 = v52->setPosition;
cocos2d::CCPoint::CCPoint(&v77, 0.0, 40.0);
cocos2d::CCPoint::operator+(&v84, &v76, &v77);
v53(v52, &v84.origin);
CCMenuItemSpriteExtra::setSizeMult(v52, 2.0);
v54 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v54->setScale)(v54, 1068708659);
((void (__fastcall *)(cocos2d::CCSprite *, int))v54->setRotation)(v54, 1119092736);
v55 = CCMenuItemSpriteExtra::create(
v54,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__((unsigned int)v73, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v55);
v55->setTag(v55, 2);
v56 = v55->setPosition;
cocos2d::CCPoint::CCPoint(&v77, 0.0, -40.0);
cocos2d::CCPoint::operator+(&v84, &v76, &v77);
v56(v55, &v84.origin);
CCMenuItemSpriteExtra::setSizeMult(v55, 2.0);
sub_774008(&v68);
if ( v40 )
break;
v40 = 1;
}
GJFollowCommandLayer::updateTextInputLabel(a1);
GJFollowCommandLayer::updateTextInputLabel2(a1);
GJFollowCommandLayer::updateXModLabel(a1);
GJFollowCommandLayer::updateYModLabel(a1);
a1->m_disableTextDelegate = 0;
}
return v59;
}