//
// SetupItemEditTriggerPopup::init from 0x14046ab60 to 0x14046bd42 (4578 bytes)
//
// 2 xrefs:
// > SetupItemEditTriggerPopup::create @ 0x14046ab19
// > ??> @ 0x1406db1bc
//
// 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
//
// Hidden C++ exception states: #wind=2
bool SetupItemEditTriggerPopup::init(SetupItemEditTriggerPopup *a1, ItemTriggerGameObject *a2, cocos2d::CCArray *a3)
{
bool result; // al
__int64 v5; // rdi
__int64 v6; // rax
_QWORD *v7; // r8
_OWORD *v8; // rcx
const char *v9; // rax
__int64 v10; // rdx
double v11; // xmm0_8
__int64 v12; // rcx
cocos2d::CCDirector *v13; // rax
double v14; // xmm0_8
int v15; // ebx
int v16; // r8d
int v17; // r9d
int v18; // r8d
int v19; // r9d
int v20; // r8d
int v21; // r9d
int v22; // r8d
int v23; // r9d
int v24; // r8d
int v25; // r9d
double CustomToggleValueControl; // xmm0_8
int v27; // ebx
int v28; // r8d
int v29; // r9d
int v30; // r8d
int v31; // r9d
int v32; // r8d
int v33; // r9d
int v34; // r8d
int v35; // r9d
int v36; // r8d
int v37; // r9d
int v38; // ebx
int v39; // r8d
int v40; // r9d
int v41; // r8d
int v42; // r9d
int v43; // r8d
int v44; // r9d
double v45; // xmm0_8
int v46; // esi
unsigned int v47; // r14d
ButtonSprite *v48; // r12
cocos2d::CCLabelBMFont *m_label; // rbx
__int64 v50; // rax
double v51; // xmm0_8
CCMenuItemSpriteExtra *v52; // rdi
const struct cocos2d::CCPoint *v53; // rdx
CCMenuItemSpriteExtra_vtbl *v54; // rbx
struct cocos2d::CCPoint v55; // rax
float v56; // xmm0_4
SetupItemEditTriggerPopup *v57; // rcx
struct cocos2d::CCRect *v58; // rax
struct cocos2d::extension::CCScale9Sprite *v59; // rdi
__int64 v60; // rdx
cocos2d::extension::CCScale9Sprite_vtbl *v61; // rbx
const cocos2d::CCSize *v62; // rax
cocos2d::CCLabelBMFont *v63; // rax
float v64; // xmm0_4
__int64 v65; // [rsp+80h] [rbp-88h]
__int64 v66; // [rsp+80h] [rbp-88h]
__int64 v67; // [rsp+80h] [rbp-88h]
cocos2d::CCPoint v68; // [rsp+88h] [rbp-80h] BYREF
unsigned __int128 v69; // [rsp+90h] [rbp-78h] BYREF
__int64 v70; // [rsp+A0h] [rbp-68h]
__int64 v71; // [rsp+A8h] [rbp-60h]
unsigned __int128 *v72; // [rsp+B0h] [rbp-58h] BYREF
char v73[8]; // [rsp+B8h] [rbp-50h] BYREF
__int128 v74; // [rsp+C0h] [rbp-48h] BYREF
__int64 v75; // [rsp+D0h] [rbp-38h]
__int64 v76; // [rsp+D8h] [rbp-30h]
float v77; // [rsp+E0h] [rbp-28h]
cocos2d::CCPoint v78; // [rsp+E8h] [rbp-20h] BYREF
cocos2d::CCSize v79; // [rsp+F0h] [rbp-18h] BYREF
CCMenuItemSpriteExtra *v80; // [rsp+100h] [rbp-8h]
char v81; // [rsp+110h] [rbp+8h] BYREF
char v82; // [rsp+1F0h] [rbp+E8h] BYREF
result = SetupTriggerPopup::init(a1, a2, a3, 420.0, 300.0, 1);
if ( result )
{
a1->m_disableTextDelegate = 1;
a1->determineStartValues(a1);
v69 = 0;
*(_QWORD *)&v69 = sub_14003AA10(0x20u);
v70 = 17;
v71 = 31;
strcpy((char *)v69, "Item Edit Trigger");
v5 = SetupTriggerPopup::addTitle(a1, &v69);
cocos2d::CCPoint::CCPoint(4.4382905e27, -85.0);
v6 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 200LL))(v5);
cocos2d::CCPoint::operator+(v6, &v68);
(*(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v5 + 184LL))(v5, &v68);
v69 = 0;
v70 = 2;
v71 = 15;
strcpy((char *)&v69, "OK");
SetupTriggerPopup::addCloseButton(a1, &v69);
v72 = &v69;
v69 = 0;
v70 = 0;
v71 = 15;
v7 = sub_14003AA10(0x1D0u);
*(_QWORD *)&v69 = v7;
v70 = 449;
v71 = 463;
v8 = v7;
v9 = "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.";
v10 = 3;
do
{
*v8 = *(_OWORD *)v9;
v8[1] = *((_OWORD *)v9 + 1);
v8[2] = *((_OWORD *)v9 + 2);
v8[3] = *((_OWORD *)v9 + 3);
v8[4] = *((_OWORD *)v9 + 4);
v8[5] = *((_OWORD *)v9 + 5);
v8[6] = *((_OWORD *)v9 + 6);
v8 += 8;
*(v8 - 1) = *((_OWORD *)v9 + 7);
v9 += 128;
--v10;
}
while ( v10 );
*v8 = *(_OWORD *)v9;
v8[1] = *((_OWORD *)v9 + 1);
v8[2] = *((_OWORD *)v9 + 2);
v8[3] = *((_OWORD *)v9 + 3);
*((_BYTE *)v8 + 64) = v9[64];
*((_BYTE *)v7 + 449) = 0;
v74 = 0;
v75 = 4;
v76 = 15;
strcpy((char *)&v74, "Help");
v11 = SetupTriggerPopup::addHelpButton(a1, &v74, &v69);
SetupTriggerPopup::createMultiTriggerItemsDefaultHorizontal(a1);
v13 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v12);
cocos2d::CCDirector::getWinSize(v13);
v14 = cocos2d::CCPoint::CCPoint(*(float *)&v11, v77 * 0.5);
v72 = &v69;
v70 = 7;
v71 = 15;
v69 = 0x3144496D657449uLL;
cocos2d::CCPoint::CCPoint(*(float *)&v14, -100.0);
cocos2d::CCPoint::operator+(&v82, &v68);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
80,
(unsigned int)&v69,
(unsigned int)&v68,
1061997773,
1,
2,
10,
1,
0,
1176255488,
0,
0,
1,
0,
0);
v15 = (int)a1->getValue(a1, 476);
v72 = (unsigned __int128 *)&v74;
v74 = 0;
v75 = 4;
v76 = 15;
strcpy((char *)&v74, "Item");
cocos2d::CCPoint::CCPoint(0.0, 20.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v16) = v15 == 1;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 1, v16, v17, (__int64)&v74, (__int64)&v68, 1, 0, 0);
v72 = &v69;
v69 = 0;
v70 = 5;
v71 = 15;
strcpy((char *)&v69, "Timer");
cocos2d::CCPoint::CCPoint(0.0, 62.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v18) = v15 == 2;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 2, v18, v19, (__int64)&v69, (__int64)&v68, 1, 0, 0);
v72 = &v69;
v69 = 0;
v70 = 6;
v71 = 15;
strcpy((char *)&v69, "Points");
cocos2d::CCPoint::CCPoint(0.0, 104.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v20) = v15 == 3;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 3, v20, v21, (__int64)&v69, (__int64)&v68, 1, 0, 0);
v72 = (unsigned __int128 *)&v74;
v74 = 0;
v75 = 4;
v76 = 15;
strcpy((char *)&v74, "Time");
cocos2d::CCPoint::CCPoint(0.0, 146.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v22) = v15 == 4;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 4, v22, v23, (__int64)&v74, (__int64)&v68, 1, 0, 0);
v72 = &v69;
v69 = 0;
v70 = 3;
v71 = 15;
LODWORD(v69) = 7631937;
cocos2d::CCPoint::CCPoint(0.0, 188.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v24) = v15 == 5;
CustomToggleValueControl = SetupTriggerPopup::createCustomToggleValueControl(
(_DWORD)a1,
5,
v24,
v25,
(__int64)&v69,
(__int64)&v68,
1,
0,
0);
v72 = &v69;
v70 = 7;
v71 = 15;
v69 = 0x3244496D657449uLL;
cocos2d::CCPoint::CCPoint(*(float *)&CustomToggleValueControl, -100.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v65) = 0;
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
95,
(unsigned int)&v69,
(unsigned int)&v68,
1061997773,
1,
2,
10,
1,
0,
1176255488,
0,
0,
1,
0,
v65);
v27 = (int)a1->getValue(a1, 477);
v72 = (unsigned __int128 *)&v74;
v74 = 0;
v75 = 4;
v76 = 15;
strcpy((char *)&v74, "Item");
cocos2d::CCPoint::CCPoint(0.0, 20.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v28) = v27 == 1;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 101, v28, v29, (__int64)&v74, (__int64)&v68, 1, 0, 0);
v72 = &v69;
v69 = 0;
v70 = 5;
v71 = 15;
strcpy((char *)&v69, "Timer");
cocos2d::CCPoint::CCPoint(0.0, 62.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v30) = v27 == 2;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 102, v30, v31, (__int64)&v69, (__int64)&v68, 1, 0, 0);
v72 = &v69;
v69 = 0;
v70 = 6;
v71 = 15;
strcpy((char *)&v69, "Points");
cocos2d::CCPoint::CCPoint(0.0, 104.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v32) = v27 == 3;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 103, v32, v33, (__int64)&v69, (__int64)&v68, 1, 0, 0);
v72 = (unsigned __int128 *)&v74;
v74 = 0;
v75 = 4;
v76 = 15;
strcpy((char *)&v74, "Time");
cocos2d::CCPoint::CCPoint(0.0, 146.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v34) = v27 == 4;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 104, v34, v35, (__int64)&v74, (__int64)&v68, 1, 0, 0);
v72 = &v69;
v69 = 0;
v70 = 3;
v71 = 15;
LODWORD(v69) = 7631937;
cocos2d::CCPoint::CCPoint(0.0, 188.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v36) = v27 == 5;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 105, v36, v37, (__int64)&v69, (__int64)&v68, 1, 0, 0);
v72 = (unsigned __int128 *)&v74;
v74 = 0;
v75 = 4;
v76 = 15;
strcpy((char *)&v74, "Mod:");
cocos2d::CCPoint::CCPoint(0.0, -100.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v66) = 0;
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
479,
(unsigned int)&v74,
(unsigned int)&v68,
1061997773,
0,
1,
10,
0,
-1073741824,
0x40000000,
0,
0,
1,
3,
v66);
v72 = &v69;
v70 = 13;
v71 = 15;
strcpy((char *)&v69, "Target\nItemID");
HIWORD(v69) = 0;
cocos2d::CCPoint::CCPoint(1.1446081e24, -100.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v67) = 0;
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
51,
(unsigned int)&v69,
(unsigned int)&v68,
1061997773,
1,
2,
10,
1,
0,
1176255488,
0,
0,
1,
0,
v67);
v38 = (int)a1->getValue(a1, 478);
v72 = (unsigned __int128 *)&v74;
v74 = 0;
v75 = 4;
v76 = 15;
strcpy((char *)&v74, "Item");
cocos2d::CCPoint::CCPoint(0.0, 20.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v39) = v38 == 1;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 1001, v39, v40, (__int64)&v74, (__int64)&v68, 1, 0, 0);
v72 = &v69;
v69 = 0;
v70 = 5;
v71 = 15;
strcpy((char *)&v69, "Timer");
cocos2d::CCPoint::CCPoint(0.0, 62.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v41) = v38 == 2;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 1002, v41, v42, (__int64)&v69, (__int64)&v68, 1, 0, 0);
v72 = &v69;
v69 = 0;
v70 = 6;
v71 = 15;
strcpy((char *)&v69, "Points");
cocos2d::CCPoint::CCPoint(0.0, 104.0);
cocos2d::CCPoint::operator+(&v82, &v68);
LOBYTE(v43) = v38 == 3;
v45 = SetupTriggerPopup::createCustomToggleValueControl(
(_DWORD)a1,
1003,
v43,
v44,
(__int64)&v69,
(__int64)&v68,
1,
0,
0);
cocos2d::CCPoint::CCPoint(*(float *)&v45, 2.0);
v46 = 0;
while ( 1 )
{
switch ( v46 )
{
case 1:
v47 = 481;
break;
case 2:
v47 = 482;
break;
case 3:
v47 = 578;
break;
case 4:
v47 = 579;
break;
case 5:
v47 = 485;
break;
default:
v47 = 480;
if ( v46 == 6 )
v47 = 486;
break;
}
v48 = ButtonSprite::create_1("+", 15, 15, 1.0, 1, "goldFont.fnt", "GJ_button_01.png", 0.0);
((void (__fastcall *)(ButtonSprite *))v48->setScale_0)(v48);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v48->m_label->setScale_0)(v48->m_label);
m_label = v48->m_label;
v50 = (__int64)m_label->getPosition_0(m_label);
v51 = cocos2d::CCPoint::operator+(v50, &v68);
m_label->setPosition_0(m_label, &v68);
v80 = (CCMenuItemSpriteExtra *)operator new(0x208u);
v52 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v80);
if ( !v52 )
goto LABEL_21;
if ( !CCMenuItemSpriteExtra::init(
v52,
v48,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)SetupItemEditTriggerPopup::onOpButton) )
break;
cocos2d::CCObject::autorelease(v52);
LABEL_22:
v52->setTag(v52, v47);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v52);
if ( (unsigned int)v46 >= 5 )
{
cocos2d::CCPoint::CCPoint(*(float *)&v51, (float)((float)(v46 - 2) * 42.0) + 20.0);
cocos2d::CCPoint::operator+(&v82, &v72);
v53 = (const struct cocos2d::CCPoint *)&v79;
}
else
{
cocos2d::CCPoint::CCPoint(*(float *)&v51, (float)((float)v46 * 42.0) + 20.0);
cocos2d::CCPoint::operator+(&v82, v73);
v53 = (const struct cocos2d::CCPoint *)&v81;
}
v54 = v52->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v55 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, v53);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v54->setPosition_0)(v52, v55);
v56 = a1->getValue(a1, v47);
SetupItemEditTriggerPopup::updateOpButton(v57, v52, (int)v56, v47);
if ( ++v46 >= 7 )
{
cocos2d::CCPoint::CCPoint(v56, v77 * 0.5);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v69, 0.0, 0.0, 80.0, 80.0);
v59 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v58);
LOBYTE(v60) = 50;
v59->setOpacity(&v59->cocos2d::CCRGBAProtocol, v60);
v59->setColor(&v59->cocos2d::CCRGBAProtocol, &stru_140529C5C);
v61 = v59->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize(&v79, 1520.0, 140.0);
v61->setContentSize(v59, v62);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v59, 1);
v59->setPosition_0(v59, &v78);
((void (__fastcall *)(struct cocos2d::extension::CCScale9Sprite *))v59->setScale_0)(v59);
v63 = cocos2d::CCLabelBMFont::create("T = (A + B) x M", "goldFont.fnt");
a1->m_formulaLabel = v63;
v64 = ((float (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v63,
2);
cocos2d::CCPoint::CCPoint(v64, 0.0);
cocos2d::CCPoint::operator+(&v78, &v72);
a1->m_formulaLabel->setPosition_0(a1->m_formulaLabel, (const cocos2d::CCPoint *)&v72);
SetupItemEditTriggerPopup::updateFormulaLabel(a1);
a1->updateDefaultTriggerValues(a1);
a1->m_disableTextDelegate = 0;
return 1;
}
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v52->~CCMenuItemSpriteExtra)(v52, 1);
LABEL_21:
v52 = nullptr;
goto LABEL_22;
}
return result;
}