//
// SetupCountTriggerPopup::init from 0x1000f3b58 to 0x1000f4640 (2792 bytes)
//
// 1 xrefs:
// > SetupCountTriggerPopup::create @ 0x1000f3b08
//
// 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 SetupCountTriggerPopup::init(SetupCountTriggerPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
_BOOL4 v4; // w0
cocos2d::CCDirector *v5; // x0
cocos2d::CCLabelBMFont *v6; // x21
__n128 v7; // q0
__n128 v8; // q1
ButtonSprite *v9; // x0
CCMenuItemSpriteExtra *v10; // x0
__int64 v11; // x20
__n128 v12; // q0
cocos2d::CCMenu *m_buttonMenu; // x21
__n128 v14; // q1
__int64 v15; // x22
__n128 v16; // q0
__n128 v17; // q1
int v18; // w25
void (__cdecl *v19)(cocos2d::CCObject *); // x21
__n128 v20; // q0
__n128 v21; // q1
__n128 v22; // q0
__n128 v23; // q1
std::string *v24; // x0
cocos2d::CCLabelBMFont *v25; // x23
__n128 v26; // q0
__n128 v27; // q1
double v28; // d0
double v29; // d0
cocos2d::extension::CCScale9Sprite *v30; // x23
CCTextInputNode *v31; // x23
void **v32; // x8
cocos2d::CCSprite *v33; // x25
CCMenuItemSpriteExtra *v34; // x25
__n128 v35; // q0
__n128 v36; // q1
double v37; // d0
cocos2d::CCSprite *v38; // x25
CCMenuItemSpriteExtra *v39; // x21
__n128 v40; // q0
__n128 v41; // q1
double v42; // d0
__int64 v43; // x8
__n128 v44; // q0
__n128 v45; // q1
bool m_touchTriggered; // w20
cocos2d::CCMenu *v47; // x21
cocos2d::CCLayer *m_mainLayer; // x22
__n128 v49; // q0
__n128 v50; // q1
bool m_spawnTriggered; // w20
cocos2d::CCMenu *v52; // x21
__n128 v53; // q1
__n128 v54; // q0
__n128 v55; // q0
cocos2d::CCLayer *v56; // x22
__n128 v57; // q1
bool m_multiTriggered; // w20
cocos2d::CCMenu *v59; // x21
__n128 v60; // q0
__n128 v61; // q1
__n128 v62; // q0
cocos2d::CCLayer *v63; // x22
__n128 v64; // q1
_BOOL8 m_multiActivate; // x20
__n128 v66; // q0
__n128 v67; // q1
double v68; // d0
_BOOL8 m_activateGroup; // x20
__n128 v70; // q0
__n128 v71; // q1
double v72; // d0
float v73; // s1
float v74; // s2
float v75; // s3
bool v77; // [xsp+2Ch] [xbp-1C4h]
void *v78[2]; // [xsp+30h] [xbp-1C0h] BYREF
char v79; // [xsp+47h] [xbp-1A9h]
void *v80[2]; // [xsp+48h] [xbp-1A8h] BYREF
char v81; // [xsp+5Fh] [xbp-191h]
void *v82[2]; // [xsp+60h] [xbp-190h] BYREF
char v83; // [xsp+77h] [xbp-179h]
void *v84[2]; // [xsp+78h] [xbp-178h] BYREF
char v85; // [xsp+8Fh] [xbp-161h]
void *__p[2]; // [xsp+90h] [xbp-160h] BYREF
char v87; // [xsp+A7h] [xbp-149h]
float32x2_t v88; // [xsp+A8h] [xbp-148h] BYREF
float32x2_t v89; // [xsp+B0h] [xbp-140h] BYREF
float32x2_t v90; // [xsp+B8h] [xbp-138h] BYREF
_QWORD v91[2]; // [xsp+C0h] [xbp-130h] BYREF
char v92; // [xsp+D7h] [xbp-119h]
_QWORD v93[2]; // [xsp+D8h] [xbp-118h] BYREF
char v94; // [xsp+EFh] [xbp-101h]
float32x2_t v95[2]; // [xsp+F0h] [xbp-100h] BYREF
float32x2_t v96[2]; // [xsp+100h] [xbp-F0h] BYREF
float32x2_t v97; // [xsp+110h] [xbp-E0h] BYREF
std::string v98; // [xsp+118h] [xbp-D8h] BYREF
void *v99[2]; // [xsp+130h] [xbp-C0h] BYREF
char v100; // [xsp+147h] [xbp-A9h]
void *v101[2]; // [xsp+148h] [xbp-A8h] BYREF
char v102; // [xsp+15Fh] [xbp-91h]
float v103; // [xsp+160h] [xbp-90h]
float v104; // [xsp+164h] [xbp-8Ch]
cocos2d::CCPoint v105; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v106; // 0:x3.16
cocos2d::SEL_MenuHandler v107; // 0:x3.16
cocos2d::SEL_MenuHandler v108; // 0:x3.16
cocos2d::CCRect v109; // 0:kr20_16.16
v4 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 240.0, 1);
if ( !v4 )
return v4;
v77 = v4;
((void (__fastcall *)(SetupCountTriggerPopup *))a1->determineStartValues)(a1);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
v6 = cocos2d::CCLabelBMFont::create_1("Count Trigger", "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v6);
v7 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v6->setScale)(v6, 0.7);
v7.n128_f32[0] = v103 * 0.5;
v8.n128_f32[0] = (float)((float)(v104 * 0.5) + (float)(a1->m_height * 0.5)) + -18.0;
sub_100022980(v7, v8, &v98);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v6->setPosition)(v6, &v98);
v9 = ButtonSprite::create_1("OK", 40, 0, 0.8, 1, "goldFont.fnt", "GJ_button_01.png", 30.0);
v106.ptr = (void (__cdecl *)(cocos2d::CCObject *))1320;
v106.adj = 1;
v10 = CCMenuItemSpriteExtra::create(v9, nullptr, a1, v106);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v10);
sub_100009900(v101, "Help");
sub_100009900(
v99,
"Disable objects using Target ID when an Item ID reaches a certain Target Count. The conditio"
"n 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.");
v11 = InfoAlertButton::create(v101, v99, 1.0);
if ( v100 < 0 )
operator delete(v99[0]);
if ( v102 < 0 )
operator delete(v101[0]);
v12 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, __int64))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v11);
m_buttonMenu = a1->m_buttonMenu;
v12.n128_f32[0] = (float)((float)(v103 * 0.5) - (float)(a1->m_width * 0.5)) + 18.0;
v14.n128_f32[0] = (float)((float)(v104 * 0.5) + (float)(a1->m_height * 0.5)) + -18.0;
sub_100022980(v12, v14, v96);
v105 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, (const cocos2d::CCPoint *)v96);
(*(void (__fastcall **)(__int64, std::string *, float, float))(*(_QWORD *)v11 + 184LL))(v11, &v98, v105.x, v105.y);
v15 = 0;
do
{
sub_100009900(&v98, "");
sub_1000229B0(&v97);
if ( (_DWORD)v15 )
{
if ( (_DWORD)v15 == 1 )
{
std::string::assign(&v98, "Target Count");
v16.n128_f32[0] = (float)(v103 * 0.5) + -70.0;
v17.n128_f32[0] = (float)(v104 * 0.5) + -25.0;
sub_100022980(v16, v17, v96);
sub_1000229D0(&v97, (double *)v96);
v18 = 1;
v19 = (void (__cdecl *)(cocos2d::CCObject *))SetupCountTriggerPopup::onTargetCountArrow;
}
else
{
std::string::assign(&v98, "Target ID");
v22.n128_f32[0] = (float)(v103 * 0.5) + 70.0;
v23.n128_f32[0] = (float)(v104 * 0.5) + 40.0;
sub_100022980(v22, v23, v96);
sub_1000229D0(&v97, (double *)v96);
v18 = 0;
v19 = (void (__cdecl *)(cocos2d::CCObject *))SetupCountTriggerPopup::onTargetIDArrow;
}
}
else
{
std::string::assign(&v98, "Item ID");
v20.n128_f32[0] = (float)(v103 * 0.5) + -70.0;
v21.n128_f32[0] = (float)(v104 * 0.5) + 40.0;
sub_100022980(v20, v21, v96);
sub_1000229D0(&v97, (double *)v96);
v18 = 0;
v19 = (void (__cdecl *)(cocos2d::CCObject *))SetupCountTriggerPopup::onItemIDArrow;
}
if ( (v98.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v24 = &v98;
else
v24 = (std::string *)v98.__r_.__value_.__r.__words[0];
v25 = cocos2d::CCLabelBMFont::create_1((const char *)v24, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v25);
v26 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v25->setScale)(v25, 0.65);
v26.n128_u32[0] = 0;
v27.n128_u32[0] = 30.0;
sub_100022980(v26, v27, v95);
*(float32x2_t *)&v28 = sub_1000229DC(&v97, v95, v96);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *, double))v25->setPosition)(v25, v96, v28);
sub_100022990((float *)v96, 0.0, 0.0, 40.0, 40.0);
v29 = sub_100022B98(v95, (__int64)v96);
v109.origin.x = *(float *)&v29;
v109.origin.y = v73;
v109.size.width = v74;
v109.size.height = v75;
v30 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v109);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v30->setOpacity)(v30, 100);
v95[0].i8[2] = 0;
v95[0].i16[0] = 0;
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v30->setColor)(v30, v95);
sub_100022988((float *)v95, 50.0, 30.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v30->setContentSize)(v30, v95);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v30,
0xFFFFFFFFLL);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v30->setPosition)(v30, &v97);
v31 = CCTextInputNode::create(50.0, 40.0, "Num", "Thonburi", 24, "bigFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, CCTextInputNode *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v31,
20);
((void (__fastcall *)(CCTextInputNode *, float32x2_t *))v31->setPosition)(v31, &v97);
CCTextInputNode::setMaxLabelScale(v31, 0.6);
CCTextInputNode::setMaxLabelWidth(v31, 200.0);
((void (__fastcall *)(cocos2d::CCTextFieldTTF *, _QWORD))v31->m_textField->setVisible)(v31->m_textField, 0);
v31->m_maxLabelLength = 6;
if ( v18 )
{
sub_100009900(v93, "0123456789-");
CCTextInputNode::setAllowedChars(v31, v93);
if ( (v94 & 0x80000000) == 0 )
goto LABEL_21;
v32 = (void **)v93;
}
else
{
sub_100009900(v91, "0123456789");
CCTextInputNode::setAllowedChars(v31, v91);
if ( (v92 & 0x80000000) == 0 )
goto LABEL_21;
v32 = (void **)v91;
}
operator delete(*v32);
LABEL_21:
CCTextInputNode::setLabelPlaceholderColor(v31, (cocos2d::ccColor3B)-1004936);
CCTextInputNode::setLabelPlaceholderScale(v31, 0.5);
v31->m_delegate = &a1->TextInputDelegate;
v31->m_numberInput = 1;
((void (__fastcall *)(CCTextInputNode *, __int64))v31->setTag)(v31, v15);
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const cocos2d::CCPoint *)&v97);
v33 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v33->setScale)(v33, 1.1);
v107.ptr = v19;
v107.adj = 0;
v34 = CCMenuItemSpriteExtra::create(v33, nullptr, a1, v107);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v34);
v35 = ((__n128 (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v34->setTag)(v34, 1);
v35.n128_u32[0] = -1035468800;
v36.n128_u32[0] = 0;
sub_100022980(v35, v36, &v88);
*(float32x2_t *)&v37 = sub_1000229DC(&v90, &v88, &v89);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v34->setPosition)(v34, &v89, v37);
CCMenuItemSpriteExtra::setSizeMult(v34, 2.0);
v38 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v38->setScale)(v38, 1.1);
v108.ptr = v19;
v108.adj = 0;
v39 = CCMenuItemSpriteExtra::create(v38, nullptr, a1, v108);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v39);
v40 = ((__n128 (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v39->setTag)(v39, 2);
v40.n128_u32[0] = 1112014848;
v41.n128_u32[0] = 0;
sub_100022980(v40, v41, &v88);
*(float32x2_t *)&v42 = sub_1000229DC(&v90, &v88, &v89);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v39->setPosition)(v39, &v89, v42);
CCMenuItemSpriteExtra::setSizeMult(v39, 2.0);
v43 = 952;
if ( (_DWORD)v15 == 1 )
v43 = 960;
if ( !(_DWORD)v15 )
v43 = 944;
*(SetupCountTriggerPopup_vtbl **)((char *)&a1->SetupTriggerPopup::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable
+ v43) = (SetupCountTriggerPopup_vtbl *)v31;
if ( SHIBYTE(v98.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v98.__r_.__value_.__l.__data_);
v15 = (unsigned int)(v15 + 1);
}
while ( (_DWORD)v15 != 3 );
SetupCountTriggerPopup::updateItemIDInputLabel(a1);
SetupCountTriggerPopup::updateTargetIDInputLabel(a1);
SetupCountTriggerPopup::updateCountTextInputLabel(a1);
v44.n128_f32[0] = (float)((float)(v103 * 0.5) - (float)(a1->m_width * 0.5)) + 20.0;
v45.n128_f32[0] = (float)((float)(v104 * 0.5) - (float)(a1->m_height * 0.5)) + 60.0;
sub_100022980(v44, v45, &v98);
sub_100009900(__p, "Touch\nTrigger");
m_touchTriggered = a1->m_touchTriggered;
v47 = a1->m_buttonMenu;
sub_1000229B8((__int64 *)v96, (__int64 *)&v98);
m_mainLayer = a1->m_mainLayer;
v49.n128_u32[0] = 8.0;
v50.n128_u32[0] = 0;
sub_100022980(v49, v50, v95);
a1->m_touchToggle = GameToolbox::createToggleButton(
(const char *)__p,
(void (__cdecl *)(cocos2d::CCObject *))SetupTriggerPopup::onTouchTriggered,
0,
m_touchTriggered,
v47,
(cocos2d::CCPoint *)v96,
a1,
m_mainLayer,
0.7,
0.35,
110.0,
(float *)v95,
"bigFont.fnt",
0,
0,
0);
if ( v87 < 0 )
operator delete(__p[0]);
sub_100009900(v84, "Spawn\nTrigger");
m_spawnTriggered = a1->m_spawnTriggered;
v52 = a1->m_buttonMenu;
v53.n128_u32[0] = -1039400960;
v54.n128_u32[0] = 0;
sub_100022980(v54, v53, v95);
v55.n128_f32[1] = sub_1000229DC((float32x2_t *)&v98, v95, v96).f32[1];
v56 = a1->m_mainLayer;
v55.n128_u32[0] = 8.0;
v57.n128_u32[0] = 0;
sub_100022980(v55, v57, &v97);
a1->m_spawnToggle = GameToolbox::createToggleButton(
(const char *)v84,
(void (__cdecl *)(cocos2d::CCObject *))SetupTriggerPopup::onSpawnedByTrigger,
0,
m_spawnTriggered,
v52,
(cocos2d::CCPoint *)v96,
a1,
v56,
0.7,
0.35,
110.0,
(float *)&v97,
"bigFont.fnt",
0,
0,
0);
if ( v85 < 0 )
operator delete(v84[0]);
sub_100009900(v82, "Multi\nTrigger");
m_multiTriggered = a1->m_multiTriggered;
v59 = a1->m_buttonMenu;
v60.n128_u32[0] = 1128792064;
v61.n128_u32[0] = 0;
sub_100022980(v60, v61, v95);
v62.n128_f32[1] = sub_1000229DC((float32x2_t *)&v98, v95, v96).f32[1];
v63 = a1->m_mainLayer;
v62.n128_u32[0] = 8.0;
v64.n128_u32[0] = 0;
sub_100022980(v62, v64, &v97);
GameToolbox::createToggleButton(
(const char *)v82,
(void (__cdecl *)(cocos2d::CCObject *))SetupTriggerPopup::onMultiTrigger,
0,
m_multiTriggered,
v59,
(cocos2d::CCPoint *)v96,
a1,
v63,
0.7,
0.35,
110.0,
(float *)&v97,
"bigFont.fnt",
0,
0,
(__int64)a1->m_multiTriggerContainer);
if ( v83 < 0 )
operator delete(v82[0]);
SetupTriggerPopup::updateMultiTriggerBtn(a1);
sub_100009900(v80, "Multi\nActivate");
m_multiActivate = a1->m_multiActivate;
v66.n128_u32[0] = 1128792064;
v67.n128_u32[0] = -1039400960;
sub_100022980(v66, v67, v95);
*(float32x2_t *)&v68 = sub_1000229DC((float32x2_t *)&v98, v95, v96);
SetupTriggerPopup::createToggleButton(a1, v80, SetupCountTriggerPopup::onMultiActivate, 0, m_multiActivate, v96, v68);
if ( v81 < 0 )
operator delete(v80[0]);
sub_100009900(v78, "Activate\nGroup");
m_activateGroup = a1->m_activateGroup;
v70.n128_f32[0] = (float)(v103 * 0.5) + 50.0;
v71.n128_f32[0] = (float)(v104 * 0.5) + -20.0;
sub_100022980(v70, v71, v96);
SetupTriggerPopup::createToggleButton(a1, v78, SetupCountTriggerPopup::onEnableGroup, 0, m_activateGroup, v96, v72);
if ( v79 < 0 )
operator delete(v78[0]);
a1->m_disableTextDelegate = 0;
LOBYTE(v4) = v77;
return v4;
}