//
// SetupItemEditTriggerPopup::init from 0x57ab68 to 0x57b586 (2590 bytes)
//
// 1 xrefs:
// > SetupItemEditTriggerPopup::create @ 0x57b63c
//
// 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 SetupItemEditTriggerPopup::init(SetupItemEditTriggerPopup *a1, ItemTriggerGameObject *a2, cocos2d::CCArray *a3)
{
cocos2d::CCLabelBMFont *v4; // r6
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
int v6; // r9
cocos2d::CCDirector *v7; // r0
int v8; // s15
int v9; // s15
int v10; // s15
int v11; // r6
int v12; // r8
ButtonSprite *v13; // r9
cocos2d::CCLabelBMFont *m_label; // r11
void (__fastcall *v15)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
int v16; // r0
CCMenuItemSpriteExtra *v17; // r9
cocos2d::CCMenu *m_buttonMenu; // r11
float v19; // r2
float v20; // r1
float v21; // r0
cocos2d::CCNode *v22; // r6
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r8
cocos2d::CCLabelBMFont *v24; // r0
cocos2d::CCLabelBMFont *m_formulaLabel; // r6
void (__fastcall *v26)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCPoint v28; // [sp+4h] [bp-90h]
cocos2d::CCPoint v29; // [sp+4h] [bp-90h]
cocos2d::CCPoint v30; // [sp+4h] [bp-90h]
cocos2d::CCPoint v31; // [sp+4h] [bp-90h]
cocos2d::CCPoint v32; // [sp+4h] [bp-90h]
cocos2d::CCPoint v33; // [sp+4h] [bp-90h]
cocos2d::CCPoint v34; // [sp+4h] [bp-90h]
cocos2d::CCPoint v35; // [sp+4h] [bp-90h]
cocos2d::CCPoint v36; // [sp+4h] [bp-90h]
cocos2d::CCPoint v37; // [sp+4h] [bp-90h]
cocos2d::CCPoint v38; // [sp+4h] [bp-90h]
cocos2d::CCPoint v39; // [sp+4h] [bp-90h]
cocos2d::CCPoint v40; // [sp+4h] [bp-90h]
_BOOL4 v41; // [sp+34h] [bp-60h]
void (__fastcall *v42)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+44h] [bp-50h]
cocos2d::CCSize v43; // [sp+4Ch] [bp-48h] BYREF
cocos2d::CCPoint v44; // [sp+54h] [bp-40h] BYREF
cocos2d::CCPoint v45; // [sp+5Ch] [bp-38h] BYREF
cocos2d::CCPoint v46; // [sp+64h] [bp-30h] BYREF
cocos2d::CCPoint v47; // [sp+6Ch] [bp-28h] BYREF
cocos2d::CCPoint v48; // [sp+74h] [bp-20h] BYREF
cocos2d::CCRect v49; // [sp+7Ch] [bp-18h] BYREF
cocos2d::CCRect v50; // 0:r2.8,8:^0.8
v41 = SetupTriggerPopup::init(a1, a2, a3, 420.0, 300.0, 1);
if ( v41 )
{
SetupTriggerPopup::preSetup(a1);
sub_776584((int)&v49, "Item Edit Trigger");
v4 = SetupTriggerPopup::addTitle((int)a1);
sub_774008(&v49);
setPosition = v4->setPosition;
v6 = (int)v4->getPosition(v4);
cocos2d::CCPoint::CCPoint(&v48, -85.0, 0.0);
cocos2d::CCPoint::operator+(&v49, v6, &v48);
setPosition(v4, &v49.origin);
sub_776584((int)&v49, "OK");
SetupTriggerPopup::addCloseButton((unsigned int)a1, (ButtonSprite **)&v49);
sub_774008(&v49);
sub_776584((int)&v48, "Help");
sub_776584(
(int)&v49,
"Edits Target ItemID using operations on ItemID1 and ItemID2.\n"
"Use Item, Timer, Points, Time, or Att to specify type.\n"
"The first operator button sets the interaction with target.\n"
"The second sets interaction between the two initial IDs.\n"
"The third sets how Mod interacts with the equation.\n"
"Button 4/5 are used to force the values positive or negative.\n"
"Click the NA button to switch to different rounding functions.");
SetupTriggerPopup::addHelpButton((int)a1, (int)&v48, (int)&v49, 1065353216);
sub_774008(&v49);
sub_774008(&v48);
SetupTriggerPopup::createMultiTriggerItemsDefaultHorizontal(a1);
v7 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v43, v7);
cocos2d::CCPoint::CCPoint(&v44, v43.width * 0.5, (float)(v43.height * 0.5) + 58.0);
sub_776584((int)&v47, "ItemID1");
cocos2d::CCPoint::CCPoint(&v48, -100.0, 45.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
80,
(int)&v47,
&v49.origin,
(cocos2d::CCZone *)0x3F4CCCCD,
1,
Int,
10,
1,
nullptr,
9999.0,
0,
0,
1,
0,
0);
sub_774008(&v47);
v8 = (int)a1->getValue(a1, 476);
sub_776584((int)&v47, "Item");
cocos2d::CCPoint::CCPoint(&v48, 20.0, 45.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
LODWORD(v28.x) = &v49;
LODWORD(v28.y) = 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 1, v8 == 1, 1, (std::string)&v47, v28, 0, 0);
sub_774008(&v47);
sub_776584((int)&v47, "Timer");
cocos2d::CCPoint::CCPoint(&v48, 62.0, 45.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
LODWORD(v29.x) = &v49;
LODWORD(v29.y) = 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 2, v8 == 2, 1, (std::string)&v47, v29, 0, 0);
sub_774008(&v47);
sub_776584((int)&v47, "Points");
cocos2d::CCPoint::CCPoint(&v48, 104.0, 45.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
LODWORD(v30.x) = &v49;
LODWORD(v30.y) = 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 3, v8 == 3, 1, (std::string)&v47, v30, 0, 0);
sub_774008(&v47);
sub_776584((int)&v47, "Time");
cocos2d::CCPoint::CCPoint(&v48, 146.0, 45.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
LODWORD(v31.x) = &v49;
LODWORD(v31.y) = 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 4, v8 == 4, 1, (std::string)&v47, v31, 0, 0);
sub_774008(&v47);
sub_776584((int)&v47, "Att");
cocos2d::CCPoint::CCPoint(&v48, 188.0, 45.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
LODWORD(v32.x) = &v49;
LODWORD(v32.y) = 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 5, v8 == 5, 1, (std::string)&v47, v32, 0, 0);
sub_774008(&v47);
sub_776584((int)&v47, "ItemID2");
cocos2d::CCPoint::CCPoint(&v48, -100.0, 0.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
95,
(int)&v47,
&v49.origin,
(cocos2d::CCZone *)0x3F4CCCCD,
1,
Int,
10,
1,
nullptr,
9999.0,
0,
0,
1,
0,
0);
sub_774008(&v47);
v9 = (int)a1->getValue(a1, 477);
sub_776584((int)&v47, "Item");
cocos2d::CCPoint::CCPoint(&v48, 20.0, 0.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
LODWORD(v33.x) = &v49;
LODWORD(v33.y) = 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 101, v9 == 1, 1, (std::string)&v47, v33, 0, 0);
sub_774008(&v47);
sub_776584((int)&v47, "Timer");
cocos2d::CCPoint::CCPoint(&v48, 62.0, 0.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
LODWORD(v34.x) = &v49;
LODWORD(v34.y) = 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 102, v9 == 2, 1, (std::string)&v47, v34, 0, 0);
sub_774008(&v47);
sub_776584((int)&v47, "Points");
cocos2d::CCPoint::CCPoint(&v48, 104.0, 0.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
LODWORD(v35.x) = &v49;
LODWORD(v35.y) = 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 103, v9 == 3, 1, (std::string)&v47, v35, 0, 0);
sub_774008(&v47);
sub_776584((int)&v47, "Time");
cocos2d::CCPoint::CCPoint(&v48, 146.0, 0.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
LODWORD(v36.x) = &v49;
LODWORD(v36.y) = 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 104, v9 == 4, 1, (std::string)&v47, v36, 0, 0);
sub_774008(&v47);
sub_776584((int)&v47, "Att");
cocos2d::CCPoint::CCPoint(&v48, 188.0, 0.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
LODWORD(v37.x) = &v49;
LODWORD(v37.y) = 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 105, v9 == 5, 1, (std::string)&v47, v37, 0, 0);
sub_774008(&v47);
sub_776584((int)&v47, "Mod:");
cocos2d::CCPoint::CCPoint(&v48, -100.0, -45.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
479,
(int)&v47,
&v49.origin,
(cocos2d::CCZone *)0x3F4CCCCD,
0,
Float,
10,
0,
(cocos2d::CCFloat *)0xC0000000,
2.0,
0,
0,
1,
3,
0);
sub_774008(&v47);
sub_776584((int)&v47, "Target\nItemID");
cocos2d::CCPoint::CCPoint(&v48, -100.0, -90.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
51,
(int)&v47,
&v49.origin,
(cocos2d::CCZone *)0x3F4CCCCD,
1,
Int,
10,
1,
nullptr,
9999.0,
0,
0,
1,
0,
0);
sub_774008(&v47);
v10 = (int)a1->getValue(a1, 478);
sub_776584((int)&v47, "Item");
cocos2d::CCPoint::CCPoint(&v48, 20.0, -90.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
LODWORD(v38.x) = &v49;
LODWORD(v38.y) = 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 1001, v10 == 1, 1, (std::string)&v47, v38, 0, 0);
sub_774008(&v47);
sub_776584((int)&v47, "Timer");
cocos2d::CCPoint::CCPoint(&v48, 62.0, -90.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
LODWORD(v39.x) = &v49;
LODWORD(v39.y) = 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 1002, v10 == 2, 1, (std::string)&v47, v39, 0, 0);
sub_774008(&v47);
sub_776584((int)&v47, "Points");
cocos2d::CCPoint::CCPoint(&v48, 104.0, -90.0);
cocos2d::CCPoint::operator+(&v49, &v44, &v48);
LODWORD(v40.x) = &v49;
LODWORD(v40.y) = 1;
SetupTriggerPopup::createCustomToggleValueControl(a1, 1003, v10 == 3, 1, (std::string)&v47, v40, 0, 0);
v11 = 0;
sub_774008(&v47);
cocos2d::CCPoint::CCPoint(&v45, 2.0, 2.0);
do
{
switch ( v11 )
{
case 1:
v12 = 481;
break;
case 2:
v12 = 482;
break;
case 3:
v12 = 578;
break;
case 4:
v12 = 579;
break;
case 5:
v12 = 485;
break;
case 6:
v12 = 486;
break;
default:
v12 = 480;
break;
}
v13 = ButtonSprite::create(
(ButtonSprite *)"+",
&byte_9[6],
(int)&byte_9[6],
1.0,
COERCE_FLOAT(1),
SLOBYTE(v50.size.height));
((void (__fastcall *)(ButtonSprite *, int))v13->setScale)(v13, 1061997773);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v13->m_label->setScale)(v13->m_label, 1066192077);
m_label = v13->m_label;
v15 = m_label->setPosition;
v16 = (int)m_label->getPosition(m_label);
cocos2d::CCPoint::operator+(&v49, v16, &v45);
v15(m_label, &v49.origin);
LODWORD(v48.x) = SetupItemEditTriggerPopup::onOpButton;
v48.y = 0.0;
v17 = CCMenuItemSpriteExtra::create(
v13,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SetupItemEditTriggerPopup::onOpButton, (unsigned int)a1));
v17->setTag(v17, v12);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v17);
m_buttonMenu = a1->m_buttonMenu;
v42 = v17->setPosition;
if ( v11 > 4 )
{
v19 = -90.0;
v20 = (float)((float)(v11 - 2) * 42.0) + 20.0;
}
else
{
v19 = -45.0;
v20 = (float)((float)v11 * 42.0) + 20.0;
}
cocos2d::CCPoint::CCPoint(&v46, v20, v19);
cocos2d::CCPoint::operator+(&v47, &v44, &v46);
++v11;
cocos2d::CCNode::convertToNodeSpace(&v49.origin, m_buttonMenu, &v47);
v42(v17, &v49.origin);
v21 = a1->getValue(a1, v12);
SetupItemEditTriggerPopup::updateOpButton(a1, v17, (int)v21, v12);
}
while ( v11 != 7 );
cocos2d::CCPoint::CCPoint(&v46, v43.width * 0.5, (float)(v43.height * 0.5) - 82.0);
cocos2d::CCRect::CCRect(&v49, 0.0, 0.0, 80.0, 80.0);
v22 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v49,
v50);
((void (__fastcall *)(cocos2d::CCNode *, int))v22->__vftable[1].~CCNode_0)(v22, 50);
((void (__fastcall *)(cocos2d::CCNode *, void *))v22->__vftable[1].getTag)(v22, &unk_9ADA24);
setContentSize = v22->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v49, 1520.0, 140.0);
setContentSize(v22, (const cocos2d::CCSize *)&v49);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v22, 1);
v22->setPosition(v22, &v46);
((void (__fastcall *)(cocos2d::CCNode *, int))v22->setScale)(v22, 1048576000);
v24 = cocos2d::CCLabelBMFont::create();
a1->m_formulaLabel = v24;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v24, 2);
m_formulaLabel = a1->m_formulaLabel;
v26 = m_formulaLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v47, 0.0, 1.0);
cocos2d::CCPoint::operator+(&v49, &v46, &v47);
v26(m_formulaLabel, &v49.origin);
SetupItemEditTriggerPopup::updateFormulaLabel(a1);
SetupTriggerPopup::postSetup(a1);
}
return v41;
}