//
// SetupCountTriggerPopup::init from 0x4f5fec to 0x4f68d2 (2278 bytes)
//
// 1 xrefs:
// > SetupCountTriggerPopup::create @ 0x4f6ab2
//
// 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 SetupCountTriggerPopup::init(SetupCountTriggerPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
cocos2d::CCDirector *v4; // r0
cocos2d::CCLabelBMFont *v5; // r5
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
ButtonSprite *v7; // r0
CCMenuItemSpriteExtra *v8; // r0
CCMenuItemSpriteExtra *v9; // r5
cocos2d::CCMenu *m_buttonMenu; // r8
void (__fastcall *v11)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r6
int v12; // r2
bool v13; // r3
float *v14; // r3
int v15; // r2
bool v16; // r3
int v17; // r8
int v18; // r2
bool v19; // r3
cocos2d::CCLabelBMFont *v20; // r5
void (__fastcall *v21)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCNode *v22; // r5
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // r2
CCTextInputNode *v24; // r5
cocos2d::CCRect *v25; // r0
cocos2d::CCSprite *v26; // r6
CCMenuItemSpriteExtra *v27; // r8
cocos2d::CCSprite *v28; // r8
CCMenuItemSpriteExtra *v29; // r8
bool m_touchTriggered; // r10
bool m_spawnTriggered; // r10
cocos2d::CCLayer *v32; // r9
bool m_multiTriggered; // r10
cocos2d::CCMenu *v34; // r9
cocos2d::CCLayer *v35; // r8
_BOOL4 m_activateGroup; // r7
float v38; // [sp+10h] [bp-BCh]
int v39; // [sp+30h] [bp-9Ch]
cocos2d::CCMenu *v40; // [sp+30h] [bp-9Ch]
cocos2d::CCMenu *v41; // [sp+30h] [bp-9Ch]
_BOOL4 m_multiActivate; // [sp+30h] [bp-9Ch]
cocos2d::CCLayer *m_mainLayer; // [sp+34h] [bp-98h]
_BOOL4 v44; // [sp+3Ch] [bp-90h]
void (__fastcall *v45)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+40h] [bp-8Ch]
void (__fastcall *v46)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+40h] [bp-8Ch]
cocos2d::ccColor3B v47; // [sp+64h] [bp-68h]
cocos2d::CCLabelBMFont *v48; // [sp+68h] [bp-64h] BYREF
cocos2d::CCSize v49; // [sp+6Ch] [bp-60h] BYREF
cocos2d::CCPoint v50; // [sp+74h] [bp-58h] BYREF
cocos2d::CCPoint v51; // [sp+7Ch] [bp-50h] BYREF
int v52; // [sp+84h] [bp-48h]
int v53; // [sp+88h] [bp-44h]
cocos2d::CCSize v54; // [sp+8Ch] [bp-40h] BYREF
cocos2d::CCPoint v55; // [sp+94h] [bp-38h] BYREF
cocos2d::CCPoint v56; // [sp+9Ch] [bp-30h] BYREF
cocos2d::CCRect v57; // [sp+A4h] [bp-28h] BYREF
cocos2d::CCRect v58; // [sp+B4h] [bp-18h] BYREF
cocos2d::CCRect v59; // 0:r2.8,8:^0.8
v44 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 240.0, 1);
if ( v44 )
{
a1->determineStartValues(a1);
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v49, v4);
v5 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v5->setScale)(v5, 1060320051);
setPosition = v5->setPosition;
cocos2d::CCPoint::CCPoint(
&v58.origin,
v49.width * 0.5,
(float)((float)(a1->m_height * 0.5) + (float)(v49.height * 0.5)) - 18.0);
setPosition(v5, &v58.origin);
v7 = ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&word_28,
0,
0.8,
1,
"goldFont.fnt",
"GJ_button_01.png",
(const char *)0x41F00000,
v38);
v52 = 660;
v53 = 1;
v8 = CCMenuItemSpriteExtra::create(v7, nullptr, (cocos2d::SEL_MenuHandler)((unsigned int)a1 | 0x29400000000LL));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v8);
sub_776584((int)&v57, "Help");
sub_776584(
(int)&v58,
"Disable objects using Target ID when an Item ID reaches a certain Target Count. The condit"
"ion is checked constantly.\n"
"Activate Group makes the trigger enable and spawn the group instead.\n"
"Multi Activate allows the trigger to activate more than once.");
v9 = InfoAlertButton::create((int)&v57, (int)&v58, 1065353216);
sub_774008(&v58);
sub_774008(&v57);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v9);
m_buttonMenu = a1->m_buttonMenu;
v11 = v9->setPosition;
cocos2d::CCPoint::CCPoint(
&v57.origin,
(float)((float)(v49.width * 0.5) - (float)(a1->m_width * 0.5)) + 18.0,
(float)((float)(a1->m_height * 0.5) + (float)(v49.height * 0.5)) - 18.0);
cocos2d::CCNode::convertToNodeSpace(&v58.origin, m_buttonMenu, &v57.origin);
v11(v9, &v58.origin);
v39 = 0;
while ( 1 )
{
sub_776584((int)&v48, (char *)&unk_939830);
cocos2d::CCPoint::CCPoint(&v50);
if ( !v39 )
break;
if ( v39 != 1 )
{
sub_7753D4((int)&v48, "Target ID");
cocos2d::CCPoint::CCPoint(&v58.origin, (float)(v49.width * 0.5) + 70.0, (float)(v49.height * 0.5) + 40.0);
cocos2d::CCPoint::operator=((PlayerObject *)&v50, COERCE_FLOAT(&v58), v18, v19);
v14 = (float *)&SetupCountTriggerPopup::onTargetIDArrow;
goto LABEL_8;
}
sub_7753D4((int)&v48, "Target Count");
cocos2d::CCPoint::CCPoint(&v58.origin, (float)(v49.width * 0.5) - 70.0, (float)(v49.height * 0.5) - 25.0);
cocos2d::CCPoint::operator=((PlayerObject *)&v50, COERCE_FLOAT(&v58), v15, v16);
v17 = 1;
LODWORD(v51.x) = SetupCountTriggerPopup::onTargetCountArrow;
v51.y = 0.0;
LABEL_9:
v20 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v20);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v20->setScale)(v20, 1059481190);
v21 = v20->setPosition;
cocos2d::CCPoint::CCPoint(&v57.origin, 0.0, 30.0);
cocos2d::CCPoint::operator+(&v58, &v50, &v57);
v21(v20, &v58.origin);
cocos2d::CCRect::CCRect(&v57, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v58, &v57);
v22 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02b_small.png",
(const char *)&v58,
v59);
((void (__fastcall *)(cocos2d::CCNode *, int))v22->__vftable[1].~CCNode_0)(v22, 100);
getTag = v22->__vftable[1].getTag;
LOWORD(v58.origin.x) = 0;
BYTE2(v58.origin.x) = 0;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))getTag)(v22, &v58);
cocos2d::CCSize::CCSize(&v54, 50.0, 30.0);
v22->setContentSize(v22, &v54);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v22, -1);
v22->setPosition(v22, &v50);
v24 = CCTextInputNode::create(50.0, 40.0, "Num", "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,
v24,
20,
a1->m_mainLayer->addChild_0,
&dword_18,
"bigFont.fnt");
v24->setPosition(v24, &v50);
CCTextInputNode::setMaxLabelScale(v24, 0.6);
CCTextInputNode::setMaxLabelWidth(v24, 200.0);
v24->m_textField->setVisible(v24->m_textField, 0);
v24->m_maxLabelLength = 6;
if ( v17 )
{
sub_776584((int)&v56, "0123456789-");
CCTextInputNode::setAllowedChars((int)v24, (int)&v56);
v25 = (cocos2d::CCRect *)&v56;
}
else
{
sub_776584((int)&v58, "0123456789");
CCTextInputNode::setAllowedChars((int)v24, (int)&v58);
v25 = &v58;
}
sub_774008(v25);
*(_WORD *)&v47.r = -21896;
v47.b = -16;
CCTextInputNode::setLabelPlaceholderColor(v24, v47);
CCTextInputNode::setLabelPlaceholderScale(v24, 0.5);
v24->m_delegate = &a1->TextInputDelegate;
v24->m_numberInput = 1;
v24->setTag(v24, v39);
cocos2d::CCNode::convertToNodeSpace(&v55, a1->m_buttonMenu, &v50);
v26 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v26->setScale)(v26, 1066192077);
v27 = CCMenuItemSpriteExtra::create(
v26,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(LODWORD(v51.x), (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v27);
v27->setTag(v27, 1);
v45 = v27->setPosition;
cocos2d::CCPoint::CCPoint(&v56, -50.0, 0.0);
cocos2d::CCPoint::operator+(&v58, &v55, &v56);
v45(v27, &v58.origin);
CCMenuItemSpriteExtra::setSizeMult(v27, 2.0);
v28 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v28->setScale)(v28, 1066192077);
v29 = CCMenuItemSpriteExtra::create(
v28,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(LODWORD(v51.x), (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v29);
v29->setTag(v29, 2);
v46 = v29->setPosition;
cocos2d::CCPoint::CCPoint(&v56, 50.0, 0.0);
cocos2d::CCPoint::operator+(&v58, &v55, &v56);
v46(v29, &v58.origin);
CCMenuItemSpriteExtra::setSizeMult(v29, 2.0);
if ( v39 )
{
if ( v39 == 1 )
a1->m_targetCountInput = v24;
else
a1->m_targetIDInput = v24;
}
else
{
a1->m_itemIDInput = v24;
}
sub_774008(&v48);
if ( ++v39 == 3 )
{
SetupCountTriggerPopup::updateItemIDInputLabel(a1);
SetupCountTriggerPopup::updateTargetIDInputLabel(a1);
SetupCountTriggerPopup::updateCountTextInputLabel(a1);
cocos2d::CCPoint::CCPoint(
&v50,
(float)((float)(v49.width * 0.5) - (float)(a1->m_width * 0.5)) + 20.0,
(float)((float)(v49.height * 0.5) - (float)(a1->m_height * 0.5)) + 60.0);
sub_776584((int)&v56, "Touch\nTrigger");
m_touchTriggered = a1->m_touchTriggered;
LODWORD(v54.width) = SetupTriggerPopup::onTouchTriggered;
v54.height = 0.0;
v40 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v58.origin, &v50);
m_mainLayer = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v57.origin, 8.0, 0.0);
a1->m_touchToggle = GameToolbox::createToggleButton(
(int)&v56,
LODWORD(v54.width),
LODWORD(v54.height),
m_touchTriggered,
v40,
&v58.origin,
a1,
m_mainLayer,
0.7,
0.35,
110.0,
(int)&v57,
(int)"bigFont.fnt",
0,
0,
nullptr);
sub_774008(&v56);
sub_776584((int)&v51, "Spawn\nTrigger");
m_spawnTriggered = a1->m_spawnTriggered;
LODWORD(v55.x) = SetupTriggerPopup::onSpawnedByTrigger;
v55.y = 0.0;
v41 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v56, 0.0, -35.0);
cocos2d::CCPoint::operator+(&v57, &v50, &v56);
v32 = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v58.origin, 8.0, 0.0);
a1->m_spawnToggle = GameToolbox::createToggleButton(
(int)&v51,
LODWORD(v55.x),
LODWORD(v55.y),
m_spawnTriggered,
v41,
&v57.origin,
a1,
v32,
0.7,
0.35,
110.0,
(int)&v58,
(int)"bigFont.fnt",
0,
0,
nullptr);
sub_774008(&v51);
sub_776584((int)&v48, "Multi\nTrigger");
m_multiTriggered = a1->m_multiTriggered;
v34 = a1->m_buttonMenu;
LODWORD(v56.x) = SetupTriggerPopup::onMultiTrigger;
v56.y = 0.0;
cocos2d::CCPoint::CCPoint(&v51, 200.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v50, &v51);
v35 = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v58.origin, 8.0, 0.0);
GameToolbox::createToggleButton(
(int)&v48,
LODWORD(v56.x),
LODWORD(v56.y),
m_multiTriggered,
v34,
&v57.origin,
a1,
v35,
0.7,
0.35,
110.0,
(int)&v58,
(int)"bigFont.fnt",
0,
0,
a1->m_multiTriggerContainer);
sub_774008(&v48);
SetupTriggerPopup::updateMultiTriggerBtn(a1);
sub_776584((int)&v48, "Multi\nActivate");
LODWORD(v57.origin.x) = SetupCountTriggerPopup::onMultiActivate;
v57.origin.y = 0.0;
m_multiActivate = a1->m_multiActivate;
cocos2d::CCPoint::CCPoint(&v51, 200.0, -35.0);
cocos2d::CCPoint::operator+(&v58, &v50, &v51);
SetupTriggerPopup::createToggleButton(
a1,
&v48,
LODWORD(v57.origin.x),
LODWORD(v57.origin.y),
m_multiActivate,
&v58);
sub_774008(&v48);
sub_776584((int)&v48, "Activate\nGroup");
m_activateGroup = a1->m_activateGroup;
LODWORD(v58.origin.x) = SetupCountTriggerPopup::onEnableGroup;
v58.origin.y = 0.0;
cocos2d::CCPoint::CCPoint(&v51, (float)(v49.width * 0.5) + 50.0, (float)(v49.height * 0.5) - 20.0);
SetupTriggerPopup::createToggleButton(
a1,
&v48,
LODWORD(v58.origin.x),
LODWORD(v58.origin.y),
m_activateGroup,
&v51);
sub_774008(&v48);
a1->m_disableTextDelegate = 0;
return v44;
}
}
sub_7753D4((int)&v48, "Item ID");
cocos2d::CCPoint::CCPoint(&v58.origin, (float)(v49.width * 0.5) - 70.0, (float)(v49.height * 0.5) + 40.0);
cocos2d::CCPoint::operator=((PlayerObject *)&v50, COERCE_FLOAT(&v58), v12, v13);
v14 = (float *)&SetupCountTriggerPopup::onItemIDArrow;
LABEL_8:
v51.x = *v14;
v17 = 0;
v51.y = 0.0;
goto LABEL_9;
}
return v44;
}