//
// SetupItemEditTriggerPopup::init from 0x10057e250 to 0x10057f329 (4313 bytes)
//
// 1 xrefs:
// > SetupItemEditTriggerPopup::create @ 0x10057e20b
//
// 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 SetupItemEditTriggerPopup::init(
SetupItemEditTriggerPopup *a1,
ItemTriggerGameObject *a2,
cocos2d::CCArray *a3)
{
bool result; // al
cocos2d::CCLabelBMFont *v4; // rbx
unsigned __int64 *v5; // r14
SetupTriggerPopup *v6; // r14
int v7; // ebx
int v8; // ebx
int v9; // ebx
int v10; // r15d
SetupItemEditTriggerPopup *v11; // r12
float v12; // xmm0_4
float v13; // xmm1_4
int v14; // r14d
int v15; // ecx
ButtonSprite *v16; // rbx
cocos2d::CCLabelBMFont *m_label; // r14
unsigned __int64 *v18; // rax
CCMenuItemSpriteExtra *v19; // rbx
const cocos2d::CCPoint *m_buttonMenu; // r14
cocos2d::extension::CCScale9Sprite *v21; // rbx
cocos2d::CCLabelBMFont *v22; // rax
cocos2d::CCLabelBMFont *m_formulaLabel; // rbx
__int128 v24; // [rsp+38h] [rbp-268h] BYREF
void *v25; // [rsp+48h] [rbp-258h]
__int128 v26; // [rsp+50h] [rbp-250h] BYREF
void *v27; // [rsp+60h] [rbp-240h]
void *v28[3]; // [rsp+68h] [rbp-238h] BYREF
char v29; // [rsp+80h] [rbp-220h] BYREF
char v30[15]; // [rsp+81h] [rbp-21Fh] BYREF
void *v31; // [rsp+90h] [rbp-210h]
char v32; // [rsp+98h] [rbp-208h] BYREF
char v33[15]; // [rsp+99h] [rbp-207h] BYREF
void *v34; // [rsp+A8h] [rbp-1F8h]
__int128 v35; // [rsp+B0h] [rbp-1F0h] BYREF
void *v36; // [rsp+C0h] [rbp-1E0h]
__int128 v37; // [rsp+C8h] [rbp-1D8h] BYREF
void *v38; // [rsp+D8h] [rbp-1C8h]
__int128 v39; // [rsp+E0h] [rbp-1C0h] BYREF
void *v40; // [rsp+F0h] [rbp-1B0h]
__int128 v41; // [rsp+F8h] [rbp-1A8h] BYREF
void *v42; // [rsp+108h] [rbp-198h]
__int128 v43; // [rsp+110h] [rbp-190h] BYREF
void *v44; // [rsp+120h] [rbp-180h]
__int128 v45; // [rsp+128h] [rbp-178h] BYREF
void *v46; // [rsp+138h] [rbp-168h]
__int128 v47; // [rsp+140h] [rbp-160h] BYREF
void *v48; // [rsp+150h] [rbp-150h]
char v49; // [rsp+158h] [rbp-148h] BYREF
char v50[15]; // [rsp+159h] [rbp-147h] BYREF
void *v51; // [rsp+168h] [rbp-138h]
__int128 v52; // [rsp+170h] [rbp-130h] BYREF
void *v53; // [rsp+180h] [rbp-120h]
__int128 v54; // [rsp+188h] [rbp-118h] BYREF
void *v55; // [rsp+198h] [rbp-108h]
char v56; // [rsp+1A0h] [rbp-100h] BYREF
char v57[15]; // [rsp+1A1h] [rbp-FFh] BYREF
void *v58; // [rsp+1B0h] [rbp-F0h]
__int128 v59; // [rsp+1B8h] [rbp-E8h] BYREF
void *v60; // [rsp+1C8h] [rbp-D8h]
char v61; // [rsp+1D0h] [rbp-D0h] BYREF
char v62[15]; // [rsp+1D1h] [rbp-CFh] BYREF
void *v63; // [rsp+1E0h] [rbp-C0h]
__int128 v64; // [rsp+1E8h] [rbp-B8h] BYREF
void *v65; // [rsp+1F8h] [rbp-A8h]
char v66; // [rsp+200h] [rbp-A0h] BYREF
_BYTE v67[23]; // [rsp+201h] [rbp-9Fh] BYREF
__int128 v68; // [rsp+218h] [rbp-88h] BYREF
void *v69; // [rsp+228h] [rbp-78h]
unsigned __int64 v70; // [rsp+230h] [rbp-70h] BYREF
unsigned __int64 v71; // [rsp+238h] [rbp-68h] BYREF
unsigned __int64 v72; // [rsp+240h] [rbp-60h] BYREF
bool v73; // [rsp+24Bh] [rbp-55h]
float v74; // [rsp+24Ch] [rbp-54h]
double v75[2]; // [rsp+250h] [rbp-50h] BYREF
unsigned __int64 v76; // [rsp+260h] [rbp-40h] BYREF
SetupItemEditTriggerPopup *v77; // [rsp+268h] [rbp-38h]
unsigned __int64 v78[6]; // [rsp+270h] [rbp-30h] BYREF
double v79; // 0:xmm0_8.8
cocos2d::CCRect v80; // 0:xmm0_8.8,8:xmm1_8.8
result = SetupTriggerPopup::init(a1, a2, a3, 420.0, 300.0, 1);
if ( result )
{
v73 = result;
SetupTriggerPopup::preSetup(a1);
strcpy((char *)v28, "\"Item Edit Trigger");
v4 = SetupTriggerPopup::addTitle((__int64)a1, (__int64)v28);
v77 = a1;
if ( ((__int64)v28[0] & 1) != 0 )
operator delete(v28[2]);
v5 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v4->getPosition)(v4);
sub_10028CBE0((float *)&v72, -85.0, 0.0);
sub_10028CCE0(v75, v5, &v72);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))v4->setPosition)(v4, v75);
v29 = 4;
strcpy(v30, "OK");
v6 = v77;
SetupTriggerPopup::addCloseButton((__int64)v77, (__int64)&v29);
if ( (v29 & 1) != 0 )
operator delete(v31);
v32 = 8;
strcpy(v33, "Help");
v36 = operator new(0x1C8u);
*(_QWORD *)&v35 = 457;
*((_QWORD *)&v35 + 1) = 449;
strcpy(
(char *)v36,
"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((__int64)v6, (__int64)&v32, &v35, (__m128)0x3F800000u);
if ( (v35 & 1) != 0 )
operator delete(v36);
if ( (v32 & 1) != 0 )
operator delete(v34);
SetupTriggerPopup::createMultiTriggerItemsDefaultHorizontal(v77);
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v72);
sub_10028CBE0((float *)&v76, *(float *)&v72 * 0.5, (float)(*((float *)&v72 + 1) * 0.5) + 58.0);
v56 = 14;
strcpy(v57, "ItemID1");
sub_10028CBE0((float *)v78, -100.0, 45.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)v77,
80,
(__int64)&v56,
(float *)v75,
1,
Int,
0.80000001,
0.0,
9999.0,
10,
1,
0,
0,
1,
0,
0);
if ( (v56 & 1) != 0 )
operator delete(v58);
v74 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))v77->getValue)(v77, 476);
LOBYTE(v37) = 8;
strcpy((char *)&v37 + 1, "Item");
sub_10028CBE0((float *)v78, 20.0, 45.0);
sub_10028CCE0(v75, &v76, v78);
v7 = (int)v74;
SetupTriggerPopup::createCustomToggleValueControl((__int64)v77, 1, (int)v74 == 1, 1, &v37, (__int64)v75, 1, 0, 0);
if ( (v37 & 1) != 0 )
operator delete(v38);
strcpy((char *)&v39, "\nTimer");
sub_10028CBE0((float *)v78, 62.0, 45.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createCustomToggleValueControl((__int64)v77, 2, v7 == 2, 1, &v39, (__int64)v75, 1, 0, 0);
if ( (v39 & 1) != 0 )
operator delete(v40);
LOBYTE(v59) = 12;
strcpy((char *)&v59 + 1, "Points");
sub_10028CBE0((float *)v78, 104.0, 45.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createCustomToggleValueControl((__int64)v77, 3, v7 == 3, 1, &v59, (__int64)v75, 1, 0, 0);
if ( (v59 & 1) != 0 )
operator delete(v60);
LOBYTE(v41) = 8;
strcpy((char *)&v41 + 1, "Time");
sub_10028CBE0((float *)v78, 146.0, 45.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createCustomToggleValueControl((__int64)v77, 4, v7 == 4, 1, &v41, (__int64)v75, 1, 0, 0);
if ( (v41 & 1) != 0 )
operator delete(v42);
LOBYTE(v24) = 6;
*(_DWORD *)((char *)&v24 + 1) = 7631937;
sub_10028CBE0((float *)v78, 188.0, 45.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createCustomToggleValueControl((__int64)v77, 5, v7 == 5, 1, &v24, (__int64)v75, 1, 0, 0);
if ( (v24 & 1) != 0 )
operator delete(v25);
v61 = 14;
strcpy(v62, "ItemID2");
sub_10028CBE0((float *)v78, -100.0, 0.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)v77,
95,
(__int64)&v61,
(float *)v75,
1,
Int,
0.80000001,
0.0,
9999.0,
10,
1,
0,
0,
1,
0,
0);
if ( (v61 & 1) != 0 )
operator delete(v63);
v74 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))v77->getValue)(v77, 477);
LOBYTE(v43) = 8;
strcpy((char *)&v43 + 1, "Item");
sub_10028CBE0((float *)v78, 20.0, 0.0);
sub_10028CCE0(v75, &v76, v78);
v8 = (int)v74;
SetupTriggerPopup::createCustomToggleValueControl((__int64)v77, 101, (int)v74 == 1, 1, &v43, (__int64)v75, 1, 0, 0);
if ( (v43 & 1) != 0 )
operator delete(v44);
strcpy((char *)&v45, "\nTimer");
sub_10028CBE0((float *)v78, 62.0, 0.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createCustomToggleValueControl((__int64)v77, 102, v8 == 2, 1, &v45, (__int64)v75, 1, 0, 0);
if ( (v45 & 1) != 0 )
operator delete(v46);
LOBYTE(v64) = 12;
strcpy((char *)&v64 + 1, "Points");
sub_10028CBE0((float *)v78, 104.0, 0.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createCustomToggleValueControl((__int64)v77, 103, v8 == 3, 1, &v64, (__int64)v75, 1, 0, 0);
if ( (v64 & 1) != 0 )
operator delete(v65);
LOBYTE(v47) = 8;
strcpy((char *)&v47 + 1, "Time");
sub_10028CBE0((float *)v78, 146.0, 0.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createCustomToggleValueControl((__int64)v77, 104, v8 == 4, 1, &v47, (__int64)v75, 1, 0, 0);
if ( (v47 & 1) != 0 )
operator delete(v48);
LOBYTE(v26) = 6;
*(_DWORD *)((char *)&v26 + 1) = 7631937;
sub_10028CBE0((float *)v78, 188.0, 0.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createCustomToggleValueControl((__int64)v77, 105, v8 == 5, 1, &v26, (__int64)v75, 1, 0, 0);
if ( (v26 & 1) != 0 )
operator delete(v27);
v49 = 8;
strcpy(v50, "Mod:");
sub_10028CBE0((float *)v78, -100.0, -45.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)v77,
479,
(__int64)&v49,
(float *)v75,
0,
Float,
0.80000001,
-2.0,
2.0,
10,
0,
0,
0,
1,
3,
0);
if ( (v49 & 1) != 0 )
operator delete(v51);
v66 = 26;
strcpy(v67, "Target\nItemID");
sub_10028CBE0((float *)v78, -100.0, -90.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createValueControlAdvanced(
(__int64)v77,
51,
(__int64)&v66,
(float *)v75,
1,
Int,
0.80000001,
0.0,
9999.0,
10,
1,
0,
0,
1,
0,
0);
if ( (v66 & 1) != 0 )
operator delete(*(void **)&v67[15]);
v74 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))v77->getValue)(v77, 478);
LOBYTE(v52) = 8;
strcpy((char *)&v52 + 1, "Item");
sub_10028CBE0((float *)v78, 20.0, -90.0);
sub_10028CCE0(v75, &v76, v78);
v9 = (int)v74;
SetupTriggerPopup::createCustomToggleValueControl((__int64)v77, 1001, (int)v74 == 1, 1, &v52, (__int64)v75, 1, 0, 0);
if ( (v52 & 1) != 0 )
operator delete(v53);
strcpy((char *)&v54, "\nTimer");
sub_10028CBE0((float *)v78, 62.0, -90.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createCustomToggleValueControl((__int64)v77, 1002, v9 == 2, 1, &v54, (__int64)v75, 1, 0, 0);
if ( (v54 & 1) != 0 )
operator delete(v55);
LOBYTE(v68) = 12;
strcpy((char *)&v68 + 1, "Points");
sub_10028CBE0((float *)v78, 104.0, -90.0);
sub_10028CCE0(v75, &v76, v78);
SetupTriggerPopup::createCustomToggleValueControl((__int64)v77, 1003, v9 == 3, 1, &v68, (__int64)v75, 1, 0, 0);
if ( (v68 & 1) != 0 )
operator delete(v69);
sub_10028CBE0((float *)v78, 2.0, 2.0);
v10 = 0;
v11 = v77;
do
{
v15 = 480;
if ( (unsigned int)(v10 - 1) <= 5 )
v15 = dword_10081ECF8[v10 - 1];
v74 = *(float *)&v15;
v16 = sub_100092A60("+", 15, 15, 1, 1.0);
((void (__fastcall *)(ButtonSprite *, float))v16->setScale)(v16, 0.80000001);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v16->m_label->setScale)(v16->m_label, 1.1);
m_label = v16->m_label;
v18 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))m_label->getPosition)(m_label);
sub_10028CCE0(v75, v18, v78);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))m_label->setPosition)(m_label, v75);
v19 = CCMenuItemSpriteExtra::create(
v16,
nullptr,
v11,
(cocos2d::SEL_MenuHandler)(unsigned __int64)SetupItemEditTriggerPopup::onOpButton);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v19->setTag)(v19, LODWORD(v74));
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v11->m_buttonMenu->addChild)(
v11->m_buttonMenu,
v19);
m_buttonMenu = (const cocos2d::CCPoint *)v11->m_buttonMenu;
if ( (unsigned int)v10 > 4 )
{
v12 = (float)((float)(v10 - 2) * 42.0) + 20.0;
v13 = -90.0;
}
else
{
v12 = (float)((float)v10 * 42.0) + 20.0;
v13 = -45.0;
}
sub_10028CBE0((float *)&v71, v12, v13);
sub_10028CCE0((double *)&v70, &v76, &v71);
*(cocos2d::CCPoint *)&v79 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v75, m_buttonMenu);
((void (__fastcall *)(CCMenuItemSpriteExtra *, double *, double))v19->setPosition)(v19, v75, v79);
v14 = LODWORD(v74);
*(float *)&v79 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, _QWORD))v11->getValue)(v11, LODWORD(v74));
SetupItemEditTriggerPopup::updateOpButton(v11, v19, (int)*(float *)&v79, v14);
++v10;
}
while ( v10 != 7 );
sub_10028CBE0((float *)&v70, *(float *)&v72 * 0.5, (float)(0.5 * *((float *)&v72 + 1)) + -82.0);
v80.origin = 0;
v80.size = 0;
sub_10028CC00((__int64)v75, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v21 = cocos2d::extension::CCScale9Sprite::create_2("GJ_square01.png", v80);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v21->setOpacity)(v21, 50);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void *))v21->setColor)(v21, &unk_10081EB24);
sub_10028CBF0((float *)v75, 1520.0, 140.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, double *))v21->setContentSize)(v21, v75);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))v11->m_mainLayer->addChild_0)(
v11->m_mainLayer,
v21,
1);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, unsigned __int64 *))v21->setPosition)(v21, &v70);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float))v21->setScale)(v21, 0.25);
v22 = cocos2d::CCLabelBMFont::create_3("T = (A + B) x M", "goldFont.fnt");
v11->m_formulaLabel = v22;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))v11->m_mainLayer->addChild_0)(
v11->m_mainLayer,
v22,
2);
m_formulaLabel = v11->m_formulaLabel;
sub_10028CBE0((float *)&v71, 0.0, 1.0);
sub_10028CCE0(v75, &v70, &v71);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))m_formulaLabel->setPosition)(m_formulaLabel, v75);
SetupItemEditTriggerPopup::updateFormulaLabel(v11);
SetupTriggerPopup::postSetup(v11);
return v73;
}
return result;
}