//
// SetupItemCompareTriggerPopup::init from 0x14046d3a0 to 0x14046e66a (4810 bytes)
//
// 2 xrefs:
// > SetupItemCompareTriggerPopup::create @ 0x14046d359
// > ??> @ 0x1406db240
//
// 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=4
bool SetupItemCompareTriggerPopup::init(
SetupItemCompareTriggerPopup *a1,
ItemTriggerGameObject *a2,
cocos2d::CCArray *a3)
{
bool result; // al
__int64 v5; // rdi
__int64 v6; // rax
unsigned int v7; // esi
_QWORD *v8; // r8
_OWORD *v9; // rcx
const char *v10; // rax
__int64 v11; // rdx
double v12; // xmm0_8
__int64 v13; // rcx
cocos2d::CCDirector *v14; // rax
double v15; // xmm0_8
int v16; // ebx
int v17; // r8d
int v18; // r9d
int v19; // r8d
int v20; // r9d
int v21; // r8d
int v22; // r9d
int v23; // r8d
int v24; // r9d
int v25; // r8d
int v26; // r9d
double CustomToggleValueControl; // xmm0_8
int v28; // ebx
int v29; // r8d
int v30; // r9d
int v31; // r8d
int v32; // r9d
int v33; // r8d
int v34; // r9d
int v35; // r8d
int v36; // r9d
int v37; // r8d
int v38; // r9d
double ValueControlAdvanced; // xmm0_8
double v40; // xmm0_8
float v41; // xmm6_4
unsigned int v42; // r14d
int v43; // edx
ButtonSprite *v44; // r12
cocos2d::CCLabelBMFont *m_label; // rbx
__int64 v46; // rax
double v47; // xmm0_8
CCMenuItemSpriteExtra *v48; // rdi
CCMenuItemSpriteExtra_vtbl *v49; // rbx
const struct cocos2d::CCPoint *v50; // rdx
struct cocos2d::CCPoint v51; // rax
float v52; // xmm0_4
SetupItemCompareTriggerPopup *v53; // rcx
struct cocos2d::CCRect *v54; // rax
struct cocos2d::extension::CCScale9Sprite *v55; // rdi
__int64 v56; // rdx
cocos2d::extension::CCScale9Sprite_vtbl *v57; // rbx
const cocos2d::CCSize *v58; // rax
cocos2d::CCLabelBMFont *v59; // rax
float v60; // xmm0_4
__int64 v61; // [rsp+80h] [rbp-88h]
__int64 v62; // [rsp+80h] [rbp-88h]
__int64 v63; // [rsp+80h] [rbp-88h]
__int64 v64; // [rsp+80h] [rbp-88h]
__int64 v65; // [rsp+80h] [rbp-88h]
__int64 v66; // [rsp+80h] [rbp-88h]
unsigned __int128 v67; // [rsp+88h] [rbp-80h] BYREF
__int64 v68; // [rsp+98h] [rbp-70h]
__int64 v69; // [rsp+A0h] [rbp-68h]
unsigned __int128 *v70; // [rsp+A8h] [rbp-60h] BYREF
char v71[8]; // [rsp+B0h] [rbp-58h] BYREF
CCMenuItemSpriteExtra *v72; // [rsp+B8h] [rbp-50h]
__int128 v73; // [rsp+C0h] [rbp-48h] BYREF
__int64 v74; // [rsp+D0h] [rbp-38h]
__int64 v75; // [rsp+D8h] [rbp-30h]
float v76; // [rsp+E0h] [rbp-28h]
cocos2d::CCPoint v77; // [rsp+E8h] [rbp-20h] BYREF
char v78; // [rsp+100h] [rbp-8h] BYREF
unsigned __int128 *v79; // [rsp+200h] [rbp+F8h] BYREF
result = SetupTriggerPopup::init(a1, a2, a3, 430.0, 310.0, 1);
if ( result )
{
a1->m_disableTextDelegate = 1;
a1->determineStartValues(a1);
v68 = 12;
v69 = 15;
strcpy((char *)&v67, "Item Compare");
BYTE13(v67) = 0;
HIWORD(v67) = 0;
v5 = SetupTriggerPopup::addTitle(a1, &v67);
cocos2d::CCPoint::CCPoint(4.4382905e27, -85.0);
v6 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v5 + 200LL))(v5);
cocos2d::CCPoint::operator+(v6, &v79);
(*(void (__fastcall **)(__int64, unsigned __int128 **))(*(_QWORD *)v5 + 184LL))(v5, &v79);
v67 = 0;
v68 = 2;
v69 = 15;
strcpy((char *)&v67, "OK");
SetupTriggerPopup::addCloseButton(a1, &v67);
v79 = &v67;
v67 = 0;
v7 = 0;
v68 = 0;
v69 = 15;
v8 = sub_14003AA10(0x220u);
*(_QWORD *)&v67 = v8;
v68 = 532;
v69 = 543;
v9 = v8;
v10 = "Activates TrueID or FalseID based on comparison of ItemID1 and ItemID2.\n"
"Use Item, Timer, Points, Time, or Att to specify type.\n"
"Mod1 and Mod2 are modifiers for the two Item IDs.\n"
"The first operator button sets interaction between ItemID1 and Mod 1 and similar for the second.\n"
"The third sets how the two values are compared.\n"
"Button 4/5 can be used to force values positive or negative.\n"
"Tol allows the result to be off a certain amount.\n"
"Click NA to switch to different rounding functions.";
v11 = 4;
do
{
*v9 = *(_OWORD *)v10;
v9[1] = *((_OWORD *)v10 + 1);
v9[2] = *((_OWORD *)v10 + 2);
v9[3] = *((_OWORD *)v10 + 3);
v9[4] = *((_OWORD *)v10 + 4);
v9[5] = *((_OWORD *)v10 + 5);
v9[6] = *((_OWORD *)v10 + 6);
v9 += 8;
*(v9 - 1) = *((_OWORD *)v10 + 7);
v10 += 128;
--v11;
}
while ( v11 );
*v9 = *(_OWORD *)v10;
*((_DWORD *)v9 + 4) = *((_DWORD *)v10 + 4);
*((_BYTE *)v8 + 532) = 0;
v73 = 0;
v74 = 4;
v75 = 15;
strcpy((char *)&v73, "Help");
v12 = SetupTriggerPopup::addHelpButton(a1, &v73, &v67);
SetupTriggerPopup::createMultiTriggerItemsDefaultHorizontal(a1);
v14 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v13);
cocos2d::CCDirector::getWinSize(v14);
v15 = cocos2d::CCPoint::CCPoint(*(float *)&v12, v76 * 0.5);
v70 = &v67;
v68 = 7;
v69 = 15;
v67 = 0x3144496D657449uLL;
cocos2d::CCPoint::CCPoint(*(float *)&v15, -100.0);
cocos2d::CCPoint::operator+(v71, &v79);
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
80,
(unsigned int)&v67,
(unsigned int)&v79,
1061997773,
1,
2,
10,
1,
0,
1176255488,
0,
0,
1,
0,
0);
LODWORD(v79) = 80;
*(_BYTE *)sub_1400CDBF0((__int64 *)&a1->m_shouldLimitValues, (int *)&v79) = 1;
v16 = (int)a1->getValue(a1, 476);
v72 = (CCMenuItemSpriteExtra *)&v73;
v73 = 0;
v74 = 4;
v75 = 15;
strcpy((char *)&v73, "Item");
cocos2d::CCPoint::CCPoint(0.0, 20.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v17) = v16 == 1;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 1, v17, v18, (__int64)&v73, (__int64)&v79, 1, 0, 0);
v72 = (CCMenuItemSpriteExtra *)&v67;
v67 = 0;
v68 = 5;
v69 = 15;
strcpy((char *)&v67, "Timer");
cocos2d::CCPoint::CCPoint(0.0, 62.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v19) = v16 == 2;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 2, v19, v20, (__int64)&v67, (__int64)&v79, 1, 0, 0);
v72 = (CCMenuItemSpriteExtra *)&v67;
v67 = 0;
v68 = 6;
v69 = 15;
strcpy((char *)&v67, "Points");
cocos2d::CCPoint::CCPoint(0.0, 104.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v21) = v16 == 3;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 3, v21, v22, (__int64)&v67, (__int64)&v79, 1, 0, 0);
v72 = (CCMenuItemSpriteExtra *)&v73;
v73 = 0;
v74 = 4;
v75 = 15;
strcpy((char *)&v73, "Time");
cocos2d::CCPoint::CCPoint(0.0, 146.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v23) = v16 == 4;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 4, v23, v24, (__int64)&v73, (__int64)&v79, 1, 0, 0);
v72 = (CCMenuItemSpriteExtra *)&v67;
v67 = 0;
v68 = 3;
v69 = 15;
LODWORD(v67) = 7631937;
cocos2d::CCPoint::CCPoint(0.0, 188.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v25) = v16 == 5;
CustomToggleValueControl = SetupTriggerPopup::createCustomToggleValueControl(
(_DWORD)a1,
5,
v25,
v26,
(__int64)&v67,
(__int64)&v79,
1,
0,
0);
v72 = (CCMenuItemSpriteExtra *)&v67;
v68 = 7;
v69 = 15;
v67 = 0x3244496D657449uLL;
cocos2d::CCPoint::CCPoint(*(float *)&CustomToggleValueControl, -100.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v61) = 0;
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
95,
(unsigned int)&v67,
(unsigned int)&v79,
1061997773,
1,
2,
10,
1,
0,
1176255488,
0,
0,
1,
0,
v61);
LODWORD(v79) = 95;
*(_BYTE *)sub_1400CDBF0((__int64 *)&a1->m_shouldLimitValues, (int *)&v79) = 1;
v28 = (int)a1->getValue(a1, 477);
v72 = (CCMenuItemSpriteExtra *)&v73;
v73 = 0;
v74 = 4;
v75 = 15;
strcpy((char *)&v73, "Item");
cocos2d::CCPoint::CCPoint(0.0, 20.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v29) = v28 == 1;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 101, v29, v30, (__int64)&v73, (__int64)&v79, 1, 0, 0);
v72 = (CCMenuItemSpriteExtra *)&v67;
v67 = 0;
v68 = 5;
v69 = 15;
strcpy((char *)&v67, "Timer");
cocos2d::CCPoint::CCPoint(0.0, 62.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v31) = v28 == 2;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 102, v31, v32, (__int64)&v67, (__int64)&v79, 1, 0, 0);
v72 = (CCMenuItemSpriteExtra *)&v67;
v67 = 0;
v68 = 6;
v69 = 15;
strcpy((char *)&v67, "Points");
cocos2d::CCPoint::CCPoint(0.0, 104.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v33) = v28 == 3;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 103, v33, v34, (__int64)&v67, (__int64)&v79, 1, 0, 0);
v72 = (CCMenuItemSpriteExtra *)&v73;
v73 = 0;
v74 = 4;
v75 = 15;
strcpy((char *)&v73, "Time");
cocos2d::CCPoint::CCPoint(0.0, 146.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v35) = v28 == 4;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 104, v35, v36, (__int64)&v73, (__int64)&v79, 1, 0, 0);
v72 = (CCMenuItemSpriteExtra *)&v67;
v67 = 0;
v68 = 3;
v69 = 15;
LODWORD(v67) = 7631937;
cocos2d::CCPoint::CCPoint(0.0, 188.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v37) = v28 == 5;
SetupTriggerPopup::createCustomToggleValueControl((_DWORD)a1, 105, v37, v38, (__int64)&v67, (__int64)&v79, 1, 0, 0);
v72 = (CCMenuItemSpriteExtra *)&v67;
v67 = 0;
v68 = 5;
v69 = 15;
strcpy((char *)&v67, "Mod1:");
cocos2d::CCPoint::CCPoint(0.0, -100.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v62) = 0;
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
479,
(unsigned int)&v67,
(unsigned int)&v79,
1061997773,
0,
1,
10,
0,
-1073741824,
0x40000000,
0,
0,
1,
3,
v62);
v72 = (CCMenuItemSpriteExtra *)&v67;
v67 = 0;
v68 = 5;
v69 = 15;
strcpy((char *)&v67, "Mod2:");
cocos2d::CCPoint::CCPoint(0.0, 100.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v63) = 0;
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
483,
(unsigned int)&v67,
(unsigned int)&v79,
1061997773,
0,
1,
10,
0,
-1073741824,
0x40000000,
0,
0,
1,
3,
v63);
v72 = (CCMenuItemSpriteExtra *)&v67;
v67 = 0;
v68 = 6;
v69 = 15;
strcpy((char *)&v67, "TrueID");
cocos2d::CCPoint::CCPoint(0.0, -100.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v64) = 0;
ValueControlAdvanced = SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
51,
(unsigned int)&v67,
(unsigned int)&v79,
1061997773,
1,
2,
10,
1,
0,
1176255488,
0,
0,
1,
0,
v64);
v72 = (CCMenuItemSpriteExtra *)&v67;
v68 = 7;
v69 = 15;
v67 = 0x444965736C6146uLL;
cocos2d::CCPoint::CCPoint(*(float *)&ValueControlAdvanced, 100.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v65) = 0;
SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
71,
(unsigned int)&v67,
(unsigned int)&v79,
1061997773,
1,
2,
10,
1,
0,
1176255488,
0,
0,
1,
0,
v65);
v72 = (CCMenuItemSpriteExtra *)&v67;
v67 = 0;
v68 = 6;
v69 = 15;
strcpy((char *)&v67, "Tol+-:");
cocos2d::CCPoint::CCPoint(0.0, -100.0);
cocos2d::CCPoint::operator+(v71, &v79);
LOBYTE(v66) = 0;
v40 = SetupTriggerPopup::createValueControlAdvanced(
(_DWORD)a1,
484,
(unsigned int)&v67,
(unsigned int)&v79,
1061997773,
0,
1,
10,
0,
0,
1065353216,
0,
0,
1,
3,
v66);
cocos2d::CCPoint::CCPoint(*(float *)&v40, 2.0);
while ( 1 )
{
v41 = 0.0;
v42 = 480;
switch ( v7 )
{
case 1u:
v42 = 481;
break;
case 2u:
v42 = 482;
break;
case 3u:
v42 = 578;
break;
case 4u:
v42 = 579;
break;
case 5u:
v42 = 485;
v41 = 15.0;
break;
case 6u:
v42 = 486;
v41 = 36.0;
break;
}
v43 = 50;
if ( v7 < 5 )
v43 = 15;
v44 = ButtonSprite::create_1("+", v43, 15, 0.40000001, 1, "goldFont.fnt", "GJ_button_01.png", 0.0);
((void (__fastcall *)(ButtonSprite *))v44->setScale_0)(v44);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v44->m_label->setScale_0)(v44->m_label);
m_label = v44->m_label;
v46 = (__int64)m_label->getPosition_0(m_label);
v47 = cocos2d::CCPoint::operator+(v46, &v79);
m_label->setPosition_0(m_label, (const cocos2d::CCPoint *)&v79);
v72 = (CCMenuItemSpriteExtra *)operator new(0x208u);
v48 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v72);
if ( !v48 )
goto LABEL_23;
if ( !CCMenuItemSpriteExtra::init(
v48,
v44,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)SetupItemCompareTriggerPopup::onOpButton) )
break;
cocos2d::CCObject::autorelease(v48);
LABEL_24:
v48->setTag(v48, v42);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v48);
if ( v7 < 5 )
{
cocos2d::CCPoint::CCPoint(*(float *)&v47, (float)((float)(int)v7 * 42.0) + 20.0);
cocos2d::CCPoint::operator+(v71, &v70);
v49 = v48->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v50 = (const struct cocos2d::CCPoint *)&v67;
}
else
{
v49 = v48->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(
(float)(v76 * 0.5) + 75.0,
(float)((float)(int)(50 * (v7 % 5)) + (float)((float)(v76 * 0.5) + 75.0)) + v41);
v50 = (const struct cocos2d::CCPoint *)&v78;
}
v51 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, v50);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v49->setPosition_0)(v48, v51);
v52 = a1->getValue(a1, v42);
SetupItemCompareTriggerPopup::updateOpButton(v53, v48, (int)v52, v42);
if ( (int)++v7 >= 7 )
{
cocos2d::CCPoint::CCPoint(v52, (float)(v76 * 0.5) - 80.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v67, 0.0, 0.0, 80.0, 80.0);
v55 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v54);
LOBYTE(v56) = 50;
v55->setOpacity(&v55->cocos2d::CCRGBAProtocol, v56);
v55->setColor(&v55->cocos2d::CCRGBAProtocol, &stru_140529C5C);
v57 = v55->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v79, 960.0, 88.0);
v57->setContentSize(v55, v58);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v55, 1);
v55->setPosition_0(v55, &v77);
((void (__fastcall *)(struct cocos2d::extension::CCScale9Sprite *))v55->setScale_0)(v55);
v59 = cocos2d::CCLabelBMFont::create(" ", "goldFont.fnt");
a1->m_formulaLabel = v59;
v60 = ((float (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v59,
2);
cocos2d::CCPoint::CCPoint(v60, 0.0);
cocos2d::CCPoint::operator+(&v77, &v79);
a1->m_formulaLabel->setPosition_0(a1->m_formulaLabel, (const cocos2d::CCPoint *)&v79);
SetupItemCompareTriggerPopup::updateFormulaLabel(a1);
a1->updateDefaultTriggerValues(a1);
a1->m_disableTextDelegate = 0;
return 1;
}
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v48->~CCMenuItemSpriteExtra)(v48, 1);
LABEL_23:
v48 = nullptr;
goto LABEL_24;
}
return result;
}