//
// SetupInstantCountPopup::init from 0x4f78f8 to 0x4f80ee (2038 bytes)
//
// 1 xrefs:
// > SetupInstantCountPopup::create @ 0x4f82ae
//
// 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 SetupInstantCountPopup::init(SetupInstantCountPopup *a1, CountTriggerGameObject *a2, cocos2d::CCArray *a3)
{
cocos2d::CCDirector *v4; // r0
cocos2d::CCLabelBMFont *v5; // r4
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
ButtonSprite *v7; // r0
CCMenuItemSpriteExtra *v8; // r0
CCMenuItemSpriteExtra *v9; // r4
int v10; // r11
cocos2d::CCMenu *m_buttonMenu; // r7
void (__fastcall *v12)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r6
float width; // s15
int v14; // r2
bool v15; // r3
int v16; // r3
int v17; // r2
bool v18; // r3
int v19; // r4
int v20; // r2
bool v21; // r3
float v22; // r3
cocos2d::CCLabelBMFont *v23; // r6
void (__fastcall *v24)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCNode *v25; // r6
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // r2
CCTextInputNode *v27; // r6
cocos2d::CCRect *v28; // r0
cocos2d::CCSprite *v29; // r4
CCMenuItemSpriteExtra *v30; // r4
cocos2d::CCSprite *v31; // r4
CCMenuItemSpriteExtra *v32; // r7
_BOOL4 m_activateGroup; // r5
float v34; // r3
unsigned int m_mode; // r2
unsigned int v36; // r8
_BOOL4 v37; // r8
int v38; // r7
char *v40; // [sp+10h] [bp-A4h]
char *v41; // [sp+10h] [bp-A4h]
void (__fastcall *v42)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+14h] [bp-A0h]
_BOOL4 v43; // [sp+1Ch] [bp-98h]
void (__fastcall *v44)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+20h] [bp-94h]
cocos2d::ccColor3B v45; // [sp+44h] [bp-70h]
cocos2d::CCLabelBMFont *v46; // [sp+48h] [bp-6Ch] BYREF
cocos2d::CCSize v47; // [sp+4Ch] [bp-68h] BYREF
cocos2d::CCPoint v48; // [sp+54h] [bp-60h] BYREF
cocos2d::CCPoint v49; // [sp+5Ch] [bp-58h] BYREF
cocos2d::CCPoint v50; // [sp+64h] [bp-50h] BYREF
cocos2d::CCPoint v51; // [sp+6Ch] [bp-48h] BYREF
int v52; // [sp+74h] [bp-40h]
int v53; // [sp+78h] [bp-3Ch]
cocos2d::CCPoint v54; // [sp+7Ch] [bp-38h] BYREF
cocos2d::CCPoint v55; // [sp+84h] [bp-30h] BYREF
cocos2d::CCRect v56; // [sp+8Ch] [bp-28h] BYREF
cocos2d::CCRect v57; // [sp+9Ch] [bp-18h] BYREF
cocos2d::CCRect v58; // 0:r2.8,8:^0.8
v43 = SetupTriggerPopup::init(a1, a2, a3, 320.0, 280.0, 1);
if ( v43 )
{
a1->determineStartValues(a1);
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v47, 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(
&v57.origin,
v47.width * 0.5,
(float)((float)(a1->m_height * 0.5) + (float)(v47.height * 0.5)) - 18.0);
setPosition(v5, &v57.origin);
v7 = ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&word_28,
0,
0.8,
1,
"goldFont.fnt",
"GJ_button_01.png",
(const char *)0x41F00000,
COERCE_FLOAT(&GLOBAL_OFFSET_TABLE_));
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)&v56, "Help");
sub_776584(
(int)&v57,
"Disables objects using Target ID when an Item ID reaches a certain Target Count. The condi"
"tion is only checked once when the trigger is activated.\n"
"Equals, Larger, or Smaller specify which condition to use.\n"
"Activate Group makes the trigger enable and spawn the group instead.");
v9 = InfoAlertButton::create((int)&v56, (int)&v57, 1065353216);
sub_774008(&v57);
sub_774008(&v56);
v10 = 0;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v9);
m_buttonMenu = a1->m_buttonMenu;
v12 = v9->setPosition;
cocos2d::CCPoint::CCPoint(
&v56.origin,
(float)((float)(v47.width * 0.5) - (float)(a1->m_width * 0.5)) + 18.0,
(float)((float)(a1->m_height * 0.5) + (float)(v47.height * 0.5)) - 18.0);
cocos2d::CCNode::convertToNodeSpace(&v57.origin, m_buttonMenu, &v56.origin);
v12(v9, &v57.origin);
width = v47.width;
a1->m_joystickConnected = -1;
cocos2d::CCPoint::CCPoint(&v48, width * 0.5, (float)(v47.height * 0.5) + 25.0);
while ( 1 )
{
sub_776584((int)&v46, (char *)&unk_939830);
cocos2d::CCPoint::CCPoint(&v49);
if ( !v10 )
break;
if ( v10 != 1 )
{
sub_7753D4((int)&v46, "Target ID");
cocos2d::CCPoint::CCPoint(&v56.origin, 70.0, 40.0);
cocos2d::CCPoint::operator+(&v57, &v48, &v56);
cocos2d::CCPoint::operator=((PlayerObject *)&v49, COERCE_FLOAT(&v57), v20, v21);
v16 = -6516;
goto LABEL_8;
}
sub_7753D4((int)&v46, "Target Count");
cocos2d::CCPoint::CCPoint(&v56.origin, -70.0, -25.0);
cocos2d::CCPoint::operator+(&v57, &v48, &v56);
cocos2d::CCPoint::operator=((PlayerObject *)&v49, COERCE_FLOAT(&v57), v17, v18);
v19 = 1;
v50.x = *((float *)v40 - 1630);
v50.y = 0.0;
LABEL_9:
v23 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v23);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v23->setScale)(v23, 1059481190);
v24 = v23->setPosition;
cocos2d::CCPoint::CCPoint(&v56.origin, 0.0, 30.0);
cocos2d::CCPoint::operator+(&v57, &v49, &v56);
v24(v23, &v57.origin);
cocos2d::CCRect::CCRect(&v56, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v57, &v56);
v25 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02b_small.png",
(const char *)&v57,
v58);
((void (__fastcall *)(cocos2d::CCNode *, int))v25->__vftable[1].~CCNode_0)(v25, 100);
getTag = v25->__vftable[1].getTag;
LOWORD(v57.origin.x) = 0;
BYTE2(v57.origin.x) = 0;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))getTag)(v25, &v57);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v51, 50.0, 30.0);
v25->setContentSize(v25, (const cocos2d::CCSize *)&v51);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v25, -1);
v25->setPosition(v25, &v49);
v27 = 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,
v27,
20,
a1->m_mainLayer->addChild_0,
&dword_18,
"bigFont.fnt");
v27->setPosition(v27, &v49);
CCTextInputNode::setMaxLabelScale(v27, 0.6);
CCTextInputNode::setMaxLabelWidth(v27, 200.0);
v27->m_textField->setVisible(v27->m_textField, 0);
v27->m_maxLabelLength = 6;
if ( v19 )
{
sub_776584((int)&v55, "0123456789-");
CCTextInputNode::setAllowedChars((int)v27, (int)&v55);
v28 = (cocos2d::CCRect *)&v55;
}
else
{
sub_776584((int)&v57, "0123456789");
CCTextInputNode::setAllowedChars((int)v27, (int)&v57);
v28 = &v57;
}
sub_774008(v28);
*(_WORD *)&v45.r = -21896;
v45.b = -16;
CCTextInputNode::setLabelPlaceholderColor(v27, v45);
CCTextInputNode::setLabelPlaceholderScale(v27, 0.5);
v27->m_delegate = &a1->TextInputDelegate;
v27->m_numberInput = 1;
v27->setTag(v27, v10);
cocos2d::CCNode::convertToNodeSpace(&v54, a1->m_buttonMenu, &v49);
v29 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v29->setScale)(v29, 1066192077);
v30 = CCMenuItemSpriteExtra::create(
v29,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(LODWORD(v50.x), (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v30);
v30->setTag(v30, 1);
v42 = v30->setPosition;
cocos2d::CCPoint::CCPoint(&v55, -50.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v54, &v55);
v42(v30, &v57.origin);
CCMenuItemSpriteExtra::setSizeMult(v30, 2.0);
v31 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v31->setScale)(v31, 1066192077);
v32 = CCMenuItemSpriteExtra::create(
v31,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(LODWORD(v50.x), (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v32);
v32->setTag(v32, 2);
v44 = v32->setPosition;
cocos2d::CCPoint::CCPoint(&v55, 50.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v54, &v55);
v44(v32, &v57.origin);
CCMenuItemSpriteExtra::setSizeMult(v32, 2.0);
if ( v10 )
{
if ( v10 == 1 )
a1->m_targetCountInput = v27;
else
a1->m_targetIDInput = v27;
}
else
{
a1->m_itemIDInput = v27;
}
++v10;
sub_774008(&v46);
if ( v10 == 3 )
{
SetupInstantCountPopup::updateItemIDInputLabel(a1);
SetupInstantCountPopup::updateTargetIDInputLabel(a1);
SetupInstantCountPopup::updateCountTextInputLabel(a1);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
sub_776584((int)&v55, "Activate\nGroup");
m_activateGroup = a1->m_activateGroup;
v54.x = *((float *)v40 - 1628);
v54.y = 0.0;
cocos2d::CCPoint::CCPoint(&v56.origin, 50.0, -20.0);
cocos2d::CCPoint::operator+(&v57, &v48, &v56);
SetupTriggerPopup::createToggleButton(a1, &v55, LODWORD(v54.x), LODWORD(v54.y), m_activateGroup, &v57);
sub_774008(&v55);
cocos2d::CCPoint::CCPoint(&v49, (float)(v47.width * 0.5) - 28.0, (float)(v47.height * 0.5) - 42.0);
sub_776584((int)&v51, "Equals");
v34 = *((float *)v40 - 1627);
v55.y = 0.0;
m_mode = a1->m_mode;
v55.x = v34;
v36 = __clz(m_mode);
v41 = (char *)LODWORD(v34);
cocos2d::CCPoint::CCPoint(&v56.origin, -90.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v49, &v56);
a1->m_equalsToggler = (CCMenuItemToggler *)SetupTriggerPopup::createToggleButton(
a1,
&v51,
LODWORD(v55.x),
LODWORD(v55.y),
v36 >> 5,
&v57);
sub_774008(&v51);
a1->m_equalsToggler->setTag(a1->m_equalsToggler, 0);
a1->m_equalsToggler->m_notClickable = 1;
sub_776584((int)&v50, "Larger");
LODWORD(v56.origin.x) = v41;
v56.origin.y = 0.0;
v37 = a1->m_mode == 1;
cocos2d::CCPoint::CCPoint(&v51, 0.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v49, &v51);
a1->m_largerToggler = (CCMenuItemToggler *)SetupTriggerPopup::createToggleButton(
a1,
&v50,
LODWORD(v56.origin.x),
LODWORD(v56.origin.y),
v37,
&v57);
sub_774008(&v50);
a1->m_largerToggler->setTag(a1->m_largerToggler, 1);
a1->m_largerToggler->m_notClickable = 1;
sub_776584((int)&v46, "Smaller");
v38 = a1->m_mode;
LODWORD(v57.origin.x) = v41;
v57.origin.y = 0.0;
cocos2d::CCPoint::CCPoint(&v50, 90.0, 0.0);
cocos2d::CCPoint::operator+(&v51, &v49, &v50);
a1->m_smallerToggler = (CCMenuItemToggler *)SetupTriggerPopup::createToggleButton(
a1,
&v46,
LODWORD(v57.origin.x),
LODWORD(v57.origin.y),
v38 == 2,
&v51);
sub_774008(&v46);
a1->m_smallerToggler->setTag(a1->m_smallerToggler, 2);
a1->m_smallerToggler->m_notClickable = 1;
a1->m_disableTextDelegate = 0;
return v43;
}
}
sub_7753D4((int)&v46, "Item ID");
cocos2d::CCPoint::CCPoint(&v56.origin, -70.0, 40.0);
cocos2d::CCPoint::operator+(&v57, &v48, &v56);
cocos2d::CCPoint::operator=((PlayerObject *)&v49, COERCE_FLOAT(&v57), v14, v15);
v16 = -6524;
LABEL_8:
v19 = 0;
v22 = *(float *)&v40[v16];
v50.y = 0.0;
v50.x = v22;
goto LABEL_9;
}
return v43;
}