//
// SetupCountTriggerPopup::init from 0x953214 to 0x954208 (4084 bytes)
//
// 2 xrefs:
// > SetupCountTriggerPopup::create @ 0x9543f8
// > ??> @ 0x92c88
//
// 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 *v5; // x0
cocos2d::CCLabelBMFont *v6; // x22
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
const char *v8; // x6
cocos2d::CCNode *v9; // x0
CCMenuItemSpriteExtra *v10; // x0
cocos2d::CCNode *v11; // x21
void *v12; // x0
void *v13; // x0
int v14; // w24
cocos2d::CCMenu *m_buttonMenu; // x25
void (__fastcall *v16)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
float v17; // s0
float v18; // s1
int v19; // w25
void (*v20)(SetupCountTriggerPopup *, cocos2d::CCObject *); // x27
cocos2d::CCLabelBMFont *v21; // x21
void (__fastcall *v22)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCNode *v23; // x21
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // x2
CCTextInputNode *v25; // x21
void *v26; // x0
CCTextInputNode_vtbl *v27; // x1
cocos2d::CCSprite *v28; // x22
CCMenuItemSpriteExtra *v29; // x25
cocos2d::CCSprite *v30; // x25
CCMenuItemSpriteExtra *v31; // x25
void (__fastcall *v32)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
void *v33; // x0
bool m_touchTriggered; // w27
cocos2d::CCMenu *v35; // x25
cocos2d::CCLayer *m_mainLayer; // x24
void *v37; // x0
bool m_spawnTriggered; // w27
cocos2d::CCMenu *v39; // x25
cocos2d::CCLayer *v40; // x24
void *v41; // x0
bool m_multiTriggered; // w24
cocos2d::CCMenu *v43; // x21
cocos2d::CCLayer *v44; // x27
void *v45; // x0
_BOOL4 m_multiActivate; // w24
void *v47; // x0
_BOOL4 m_activateGroup; // w22
void *v49; // x21
unsigned int *v50; // x1
int v51; // w2
unsigned int *v52; // x1
int v53; // w2
unsigned int *v54; // x1
int v55; // w2
unsigned int *v56; // x25
int v57; // w0
unsigned int *v58; // x1
int v59; // w2
unsigned int *v60; // x1
int v61; // w2
unsigned int *v62; // x1
int v63; // w2
unsigned int *v64; // x1
int v65; // w2
unsigned int *v66; // x1
int v67; // w2
unsigned int *v68; // x1
int v69; // w2
float v70; // s0
float v71; // s1
float v72; // s0
float v73; // s1
bool v74; // [xsp+DFh] [xbp+AFh]
void (__fastcall *v75)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+E0h] [xbp+B0h]
cocos2d::ccColor3B v76; // [xsp+110h] [xbp+E0h]
float v77; // [xsp+118h] [xbp+E8h]
float v78; // [xsp+11Ch] [xbp+ECh]
__int64 v79; // [xsp+120h] [xbp+F0h] BYREF
cocos2d::CCPoint v80; // [xsp+128h] [xbp+F8h] BYREF
cocos2d::CCPoint v81; // [xsp+130h] [xbp+100h] BYREF
cocos2d::CCPoint v82; // [xsp+138h] [xbp+108h] BYREF
cocos2d::CCPoint v83; // [xsp+140h] [xbp+110h] BYREF
cocos2d::CCRect v84; // [xsp+148h] [xbp+118h] BYREF
cocos2d::CCRect v85; // [xsp+158h] [xbp+128h] BYREF
cocos2d::CCPoint v86; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v87; // 0:x2.16
cocos2d::SEL_MenuHandler v88; // 0:x2.16
cocos2d::SEL_MenuHandler v89; // 0:x2.16
cocos2d::CCRect v90; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v74 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 240.0, 1);
if ( !v74 )
return v74;
a1->determineStartValues(a1);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
v6 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v6);
v6->setScale(v6, 0.7);
setPosition = v6->setPosition;
cocos2d::CCPoint::CCPoint(&v85.origin, v77 * 0.5, (float)((float)(a1->m_height * 0.5) + (float)(v78 * 0.5)) - 18.0);
setPosition(v6, &v85.origin);
v9 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v8,
30.0);
v87.adj = 1320;
v87.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v10 = CCMenuItemSpriteExtra::create(v9, nullptr, v87);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v10);
sub_D153B8((int)&v84, "Help");
sub_D153B8(
(int)&v85,
"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 = (cocos2d::CCNode *)InfoAlertButton::create(1.0);
v12 = (void *)(*(_QWORD *)&v85.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v64 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL);
do
v65 = __ldaxr(v64);
while ( __stlxr(v65 - 1, v64) );
}
else
{
v65 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v65 - 1;
}
if ( v65 <= 0 )
operator delete(v12);
}
v13 = (void *)(*(_QWORD *)&v84.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v84.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v66 = (unsigned int *)(*(_QWORD *)&v84.origin - 8LL);
do
v67 = __ldaxr(v66);
while ( __stlxr(v67 - 1, v66) );
}
else
{
v67 = *(_DWORD *)(*(_QWORD *)&v84.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v84.origin - 8LL) = v67 - 1;
}
if ( v67 <= 0 )
operator delete(v13);
}
v14 = 0;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v11);
m_buttonMenu = a1->m_buttonMenu;
v16 = v11->setPosition;
cocos2d::CCPoint::CCPoint(
&v84.origin,
18.0 - (float)((float)(a1->m_width * 0.5) - (float)(v77 * 0.5)),
(float)((float)(a1->m_height * 0.5) + (float)(v78 * 0.5)) - 18.0);
v86 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v84.origin);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *, float, float))v16)(v11, &v85, v86.x, v86.y);
do
{
sub_D153B8((int)&v79, &byte_F288A0);
cocos2d::CCPoint::CCPoint(&v80);
if ( v14 )
{
if ( v14 == 1 )
{
sub_D1798C(&v79, "Target Count", 12);
cocos2d::CCPoint::CCPoint(&v85.origin, (float)(v77 * 0.5) + -70.0, (float)(v78 * 0.5) + -25.0);
cocos2d::CCPoint::operator=(&v80, v72, v73);
v19 = 1;
v20 = SetupCountTriggerPopup::onTargetCountArrow;
}
else
{
sub_D1798C(&v79, "Target ID", 9);
cocos2d::CCPoint::CCPoint(&v85.origin, (float)(v77 * 0.5) + 70.0, (float)(v78 * 0.5) + 40.0);
cocos2d::CCPoint::operator=(&v80, v17, v18);
v19 = 0;
v20 = SetupCountTriggerPopup::onTargetIDArrow;
}
}
else
{
sub_D1798C(&v79, "Item ID", 7);
cocos2d::CCPoint::CCPoint(&v85.origin, (float)(v77 * 0.5) + -70.0, (float)(v78 * 0.5) + 40.0);
cocos2d::CCPoint::operator=(&v80, v70, v71);
v19 = 0;
v20 = SetupCountTriggerPopup::onItemIDArrow;
}
v21 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v21);
v21->setScale(v21, 0.65);
v22 = v21->setPosition;
cocos2d::CCPoint::CCPoint(&v84.origin, 0.0, 30.0);
cocos2d::CCPoint::operator+(&v85, &v80, &v84);
v22(v21, &v85.origin);
cocos2d::CCRect::CCRect(&v84, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v85, &v84);
v23 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02b_small.png",
(const char *)&v85,
v90);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v23->__vftable[1].~CCNode_0)(v23, 100);
getTag = v23->__vftable[1].getTag;
LOWORD(v85.origin.x) = 0;
BYTE2(v85.origin.x) = 0;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))getTag)(v23, &v85);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v81, 50.0, 30.0);
v23->setContentSize(v23, (const cocos2d::CCSize *)&v81);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v23, -1);
v23->setPosition(v23, &v80);
v25 = CCTextInputNode::create(50.0, 40.0, "Num", "Thonburi");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v25, 20);
v25->setPosition(v25, &v80);
CCTextInputNode::setMaxLabelScale(v25, 0.6);
CCTextInputNode::setMaxLabelWidth(v25, 200.0);
v25->m_textField->setVisible(v25->m_textField, 0);
v25->m_maxLabelLength = 6;
if ( v19 )
{
sub_D153B8((int)&v83, "0123456789-");
CCTextInputNode::setAllowedChars((__int64)v25, (__int64)&v83);
v26 = (void *)(*(_QWORD *)&v83 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v83 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v54 = (unsigned int *)(*(_QWORD *)&v83 - 8LL);
do
v55 = __ldaxr(v54);
while ( __stlxr(v55 - 1, v54) );
}
else
{
v55 = *(_DWORD *)(*(_QWORD *)&v83 - 8LL);
*(_DWORD *)(*(_QWORD *)&v83 - 8LL) = v55 - 1;
}
if ( v55 <= 0 )
goto LABEL_27;
}
}
else
{
sub_D153B8((int)&v85, "0123456789");
CCTextInputNode::setAllowedChars((__int64)v25, (__int64)&v85);
v26 = (void *)(*(_QWORD *)&v85.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v50 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL);
do
v51 = __ldaxr(v50);
while ( __stlxr(v51 - 1, v50) );
}
else
{
v51 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v51 - 1;
}
if ( v51 <= 0 )
LABEL_27:
operator delete(v26);
}
}
v76.r = 120;
*(_WORD *)&v76.g = -3926;
CCTextInputNode::setLabelPlaceholderColor(v25, v76);
CCTextInputNode::setLabelPlaceholderScale(v25, 0.5);
v27 = v25->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v25->m_delegate = &a1->TextInputDelegate;
v25->m_numberInput = 1;
v27->setTag(v25, v14);
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v80);
v28 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
v28->setScale(v28, 1.1);
v88.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v88.adj = (size_t)v20;
v29 = CCMenuItemSpriteExtra::create(v28, nullptr, v88);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v29);
v29->setTag(v29, 1);
v75 = v29->setPosition;
cocos2d::CCPoint::CCPoint(&v83, -50.0, 0.0);
cocos2d::CCPoint::operator+(&v85, &v82, &v83);
v75(v29, &v85.origin);
CCMenuItemSpriteExtra::setSizeMult(v29, 2.0);
v30 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
v30->setScale(v30, 1.1);
v89.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v89.adj = (size_t)v20;
v31 = CCMenuItemSpriteExtra::create(v30, nullptr, v89);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v31);
v31->setTag(v31, 2);
v32 = v31->setPosition;
cocos2d::CCPoint::CCPoint(&v83, 50.0, 0.0);
cocos2d::CCPoint::operator+(&v85, &v82, &v83);
v32(v31, &v85.origin);
CCMenuItemSpriteExtra::setSizeMult(v31, 2.0);
if ( v14 )
{
if ( v14 == 1 )
a1->m_targetCountInput = v25;
else
a1->m_targetIDInput = v25;
}
else
{
a1->m_itemIDInput = v25;
}
v33 = (void *)(v79 - 24);
if ( (__int64 *)(v79 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v52 = (unsigned int *)(v79 - 8);
do
v53 = __ldaxr(v52);
while ( __stlxr(v53 - 1, v52) );
}
else
{
v53 = *(_DWORD *)(v79 - 8);
*(_DWORD *)(v79 - 8) = v53 - 1;
}
if ( v53 <= 0 )
operator delete(v33);
}
++v14;
}
while ( v14 != 3 );
SetupCountTriggerPopup::updateItemIDInputLabel(a1);
SetupCountTriggerPopup::updateTargetIDInputLabel(a1);
SetupCountTriggerPopup::updateCountTextInputLabel(a1);
cocos2d::CCPoint::CCPoint(
&v81,
20.0 - (float)((float)(a1->m_width * 0.5) - (float)(v77 * 0.5)),
60.0 - (float)((float)(a1->m_height * 0.5) - (float)(v78 * 0.5)));
sub_D153B8((int)&v84, "Touch\nTrigger");
m_touchTriggered = a1->m_touchTriggered;
v35 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v85.origin, &v81);
m_mainLayer = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v83, 8.0, 0.0);
a1->m_touchToggle = GameToolbox::createToggleButton(
0.7,
0.35,
110.0,
(__int64)&v84,
(void (__cdecl *)(cocos2d::CCObject *))SetupTriggerPopup::onTouchTriggered,
0,
m_touchTriggered,
v35,
&v85.origin,
a1,
m_mainLayer,
(float *)&v83,
(__int64)"bigFont.fnt",
0,
0,
nullptr);
v37 = (void *)(*(_QWORD *)&v84.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v84.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v68 = (unsigned int *)(*(_QWORD *)&v84.origin - 8LL);
do
v69 = __ldaxr(v68);
while ( __stlxr(v69 - 1, v68) );
}
else
{
v69 = *(_DWORD *)(*(_QWORD *)&v84.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v84.origin - 8LL) = v69 - 1;
}
if ( v69 <= 0 )
operator delete(v37);
}
sub_D153B8((int)&v85, "Spawn\nTrigger");
m_spawnTriggered = a1->m_spawnTriggered;
v39 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v82, 0.0, -35.0);
cocos2d::CCPoint::operator+(&v83, &v81, &v82);
v40 = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v84.origin, 8.0, 0.0);
a1->m_spawnToggle = GameToolbox::createToggleButton(
0.7,
0.35,
110.0,
(__int64)&v85,
(void (__cdecl *)(cocos2d::CCObject *))SetupTriggerPopup::onSpawnedByTrigger,
0,
m_spawnTriggered,
v39,
&v83,
a1,
v40,
(float *)&v84.origin,
(__int64)"bigFont.fnt",
0,
0,
nullptr);
v41 = (void *)(*(_QWORD *)&v85.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v62 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL);
do
v63 = __ldaxr(v62);
while ( __stlxr(v63 - 1, v62) );
}
else
{
v63 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v63 - 1;
}
if ( v63 <= 0 )
operator delete(v41);
}
sub_D153B8((int)&v85, "Multi\nTrigger");
m_multiTriggered = a1->m_multiTriggered;
v43 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v82, 200.0, 0.0);
cocos2d::CCPoint::operator+(&v83, &v81, &v82);
v44 = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v84.origin, 8.0, 0.0);
GameToolbox::createToggleButton(
0.7,
0.35,
110.0,
(__int64)&v85,
(void (__cdecl *)(cocos2d::CCObject *))SetupTriggerPopup::onMultiTrigger,
0,
m_multiTriggered,
v43,
&v83,
a1,
v44,
(float *)&v84.origin,
(__int64)"bigFont.fnt",
0,
0,
a1->m_multiTriggerContainer);
v45 = (void *)(*(_QWORD *)&v85.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v58 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL);
do
v59 = __ldaxr(v58);
while ( __stlxr(v59 - 1, v58) );
}
else
{
v59 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v59 - 1;
}
if ( v59 <= 0 )
operator delete(v45);
}
SetupTriggerPopup::updateMultiTriggerBtn(a1);
sub_D153B8((int)&v85, "Multi\nActivate");
m_multiActivate = a1->m_multiActivate;
cocos2d::CCPoint::CCPoint(&v83, 200.0, -35.0);
cocos2d::CCPoint::operator+(&v84, &v81, &v83);
SetupTriggerPopup::createToggleButton(a1, &v85, SetupCountTriggerPopup::onMultiActivate, 0, m_multiActivate, &v84);
v47 = (void *)(*(_QWORD *)&v85.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v60 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL);
do
v61 = __ldaxr(v60);
while ( __stlxr(v61 - 1, v60) );
}
else
{
v61 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v61 - 1;
}
if ( v61 <= 0 )
operator delete(v47);
}
sub_D153B8((int)&v85, "Activate\nGroup");
m_activateGroup = a1->m_activateGroup;
cocos2d::CCPoint::CCPoint(&v84.origin, (float)(v77 * 0.5) + 50.0, (float)(v78 * 0.5) + -20.0);
SetupTriggerPopup::createToggleButton(a1, &v85, SetupCountTriggerPopup::onEnableGroup, 0, m_activateGroup, &v84);
v49 = (void *)(*(_QWORD *)&v85.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) == &qword_124B6B0 )
goto LABEL_21;
if ( &pthread_create )
{
v56 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL);
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v57 - 1;
}
if ( v57 > 0 )
{
LABEL_21:
a1->m_disableTextDelegate = 0;
}
else
{
operator delete(v49);
a1->m_disableTextDelegate = 0;
}
return v74;
}