//
// SetupCollisionTriggerPopup::init from 0x10022f5c8 to 0x10022ffc8 (2560 bytes)
//
// 1 xrefs:
// > SetupCollisionTriggerPopup::create @ 0x10022f578
//
// 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 SetupCollisionTriggerPopup::init(
SetupCollisionTriggerPopup *a1,
EffectGameObject *a2,
cocos2d::CCArray *a3)
{
_BOOL4 v4; // w0
cocos2d::CCDirector *v5; // x0
cocos2d::CCLabelBMFont *v6; // x21
__n128 v7; // q0
__n128 v8; // q1
ButtonSprite *v9; // x0
CCMenuItemSpriteExtra *v10; // x0
char *v11; // x20
__n128 v12; // q0
cocos2d::CCMenu *m_buttonMenu; // x21
__n128 v14; // q1
__int64 v15; // x21
__n128 v16; // q0
__n128 v17; // q1
void (__cdecl *v18)(cocos2d::CCObject *); // x24
__n128 v19; // q0
__n128 v20; // q1
__n128 v21; // q0
__n128 v22; // q1
std::string *v23; // x0
cocos2d::CCLabelBMFont *v24; // x25
__n128 v25; // q0
__n128 v26; // q1
double v27; // d0
double v28; // d0
cocos2d::extension::CCScale9Sprite *v29; // x25
CCTextInputNode *v30; // x25
cocos2d::CCSprite *v31; // x26
CCMenuItemSpriteExtra *v32; // x26
__n128 v33; // q0
__n128 v34; // q1
double v35; // d0
cocos2d::CCSprite *v36; // x26
CCMenuItemSpriteExtra *v37; // x24
__n128 v38; // q0
__n128 v39; // q1
double v40; // d0
__int64 v41; // x8
CCTextInputNode **p_m_blockAInput; // x8
bool v43; // w8
bool m_activateGroup; // w20
__n128 v45; // q0
__n128 v46; // q1
bool m_triggerOnExit; // w20
__n128 v48; // q0
__n128 v49; // q1
__n128 v50; // q0
bool m_targetP1; // w20
__n128 v52; // q1
bool m_targetP2; // w20
__n128 v54; // q0
__n128 v55; // q1
__n128 v56; // q0
bool m_targetPP; // w20
__n128 v58; // q1
float v59; // s1
float v60; // s2
float v61; // s3
bool v63; // [xsp+4h] [xbp-1ACh]
void *v64[2]; // [xsp+8h] [xbp-1A8h] BYREF
char v65; // [xsp+1Fh] [xbp-191h]
void *v66[2]; // [xsp+20h] [xbp-190h] BYREF
char v67; // [xsp+37h] [xbp-179h]
void *v68[2]; // [xsp+38h] [xbp-178h] BYREF
char v69; // [xsp+4Fh] [xbp-161h]
void *v70[2]; // [xsp+50h] [xbp-160h] BYREF
char v71; // [xsp+67h] [xbp-149h]
void *v72[2]; // [xsp+68h] [xbp-148h] BYREF
char v73; // [xsp+7Fh] [xbp-131h]
float32x2_t v74; // [xsp+80h] [xbp-130h] BYREF
float32x2_t v75; // [xsp+88h] [xbp-128h] BYREF
float32x2_t v76; // [xsp+90h] [xbp-120h] BYREF
std::string __p; // [xsp+98h] [xbp-118h] BYREF
float32x2_t v78[2]; // [xsp+B0h] [xbp-100h] BYREF
float32x2_t v79[2]; // [xsp+C0h] [xbp-F0h] BYREF
float32x2_t v80; // [xsp+D0h] [xbp-E0h] BYREF
std::string v81; // [xsp+D8h] [xbp-D8h] BYREF
void *v82[2]; // [xsp+F0h] [xbp-C0h] BYREF
char v83; // [xsp+107h] [xbp-A9h]
void *v84[2]; // [xsp+108h] [xbp-A8h] BYREF
char v85; // [xsp+11Fh] [xbp-91h]
float v86; // [xsp+120h] [xbp-90h]
float v87; // [xsp+124h] [xbp-8Ch]
cocos2d::CCPoint v88; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v89; // 0:x3.16
cocos2d::SEL_MenuHandler v90; // 0:x3.16
cocos2d::SEL_MenuHandler v91; // 0:x3.16
cocos2d::CCRect v92; // 0:kr20_16.16
v4 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 280.0, 1);
if ( v4 )
{
v63 = v4;
((void (__fastcall *)(SetupCollisionTriggerPopup *))a1->determineStartValues)(a1);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
v6 = cocos2d::CCLabelBMFont::create_1("Collision Trigger", "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v6);
v7 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v6->setScale)(v6, 0.7);
v7.n128_f32[0] = v86 * 0.5;
v8.n128_f32[0] = (float)((float)(v87 * 0.5) + (float)(a1->m_height * 0.5)) + -18.0;
sub_100022980(v7, v8, &v81);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v6->setPosition)(v6, &v81);
v9 = ButtonSprite::create_1("OK", 40, 0, 0.8, 1, "goldFont.fnt", "GJ_button_01.png", 30.0);
v89.ptr = (void (__cdecl *)(cocos2d::CCObject *))1320;
v89.adj = 1;
v10 = CCMenuItemSpriteExtra::create(v9, nullptr, a1, v89);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v10);
sub_100009900(v84, "Help");
sub_100009900(
v82,
"Disables Target ID when Collision Blocks using BlockA ID and BlockB ID collide. This condition is "
"checked constantly. Make sure that one of the blocks have Dynamic Block enabled.\n"
"Use Activate Group to activate and spawn instead.\n"
"P1 and P2 makes collision trigger upon the respective player touching BlockB ID.\n"
"PP triggers when both players collide.\n"
"Trigger On Exit makes it activate after collision between the blocks ends and not when it starts. ");
v11 = InfoAlertButton::create((__int64)v84, (__int64)v82, 1.0);
if ( v83 < 0 )
operator delete(v82[0]);
if ( v85 < 0 )
operator delete(v84[0]);
v12 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, char *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v11);
m_buttonMenu = a1->m_buttonMenu;
v12.n128_f32[0] = (float)((float)(v86 * 0.5) - (float)(a1->m_width * 0.5)) + 18.0;
v14.n128_f32[0] = (float)((float)(v87 * 0.5) + (float)(a1->m_height * 0.5)) + -18.0;
sub_100022980(v12, v14, v79);
v88 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, (const cocos2d::CCPoint *)v79);
(*(void (__fastcall **)(char *, std::string *, float, float))(*(_QWORD *)v11 + 184LL))(v11, &v81, v88.x, v88.y);
v15 = 0;
a1->m_joystickConnected = -1;
do
{
sub_100009900(&v81, "");
sub_1000229B0(&v80);
if ( (_DWORD)v15 )
{
if ( (_DWORD)v15 == 1 )
{
std::string::assign(&v81, "BlockB ID");
v16.n128_f32[0] = (float)(v86 * 0.5) + 70.0;
v17.n128_f32[0] = (float)(v87 * 0.5) + 30.0;
sub_100022980(v16, v17, v79);
sub_1000229D0(&v80, (double *)v79);
v18 = (void (__cdecl *)(cocos2d::CCObject *))SetupCollisionTriggerPopup::onItemID2Arrow;
}
else
{
std::string::assign(&v81, "Target ID");
v21.n128_f32[0] = (float)(v86 * 0.5) + -70.0;
v22.n128_f32[0] = (float)(v87 * 0.5) + -35.0;
sub_100022980(v21, v22, v79);
sub_1000229D0(&v80, (double *)v79);
v18 = (void (__cdecl *)(cocos2d::CCObject *))SetupCollisionTriggerPopup::onTargetIDArrow;
}
}
else
{
std::string::assign(&v81, "BlockA ID");
v19.n128_f32[0] = (float)(v86 * 0.5) + -70.0;
v20.n128_f32[0] = (float)(v87 * 0.5) + 30.0;
sub_100022980(v19, v20, v79);
sub_1000229D0(&v80, (double *)v79);
v18 = (void (__cdecl *)(cocos2d::CCObject *))SetupCollisionTriggerPopup::onItemIDArrow;
}
if ( (v81.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v23 = &v81;
else
v23 = (std::string *)v81.__r_.__value_.__r.__words[0];
v24 = cocos2d::CCLabelBMFont::create_1((const char *)v23, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(
a1->m_mainLayer,
v24);
v25 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v24->setScale)(v24, 0.65);
v25.n128_u32[0] = 0;
v26.n128_u32[0] = 30.0;
sub_100022980(v25, v26, v78);
*(float32x2_t *)&v27 = sub_1000229DC(&v80, v78, v79);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *, double))v24->setPosition)(v24, v79, v27);
sub_100022990((float *)v79, 0.0, 0.0, 40.0, 40.0);
v28 = sub_100022B98(v78, (__int64)v79);
v92.origin.x = *(float *)&v28;
v92.origin.y = v59;
v92.size.width = v60;
v92.size.height = v61;
v29 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v92);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v29->setOpacity)(v29, 100);
v78[0].i8[2] = 0;
v78[0].i16[0] = 0;
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v29->setColor)(v29, v78);
sub_100022988((float *)v78, 50.0, 30.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v29->setContentSize)(v29, v78);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v29,
0xFFFFFFFFLL);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v29->setPosition)(v29, &v80);
v30 = CCTextInputNode::create(50.0, 40.0, "Num", "Thonburi", 24, "bigFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, CCTextInputNode *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v30,
20);
((void (__fastcall *)(CCTextInputNode *, float32x2_t *))v30->setPosition)(v30, &v80);
CCTextInputNode::setMaxLabelScale(v30, 0.6);
CCTextInputNode::setMaxLabelWidth(v30, 200.0);
((void (__fastcall *)(cocos2d::CCTextFieldTTF *, _QWORD))v30->m_textField->setVisible)(v30->m_textField, 0);
v30->m_maxLabelLength = 6;
sub_100009900(&__p, "0123456789");
CCTextInputNode::setAllowedChars((std::string *)v30, &__p);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
CCTextInputNode::setLabelPlaceholderColor(v30, (cocos2d::ccColor3B)-1004936);
CCTextInputNode::setLabelPlaceholderScale(v30, 0.5);
v30->m_delegate = &a1->TextInputDelegate;
v30->m_numberInput = 1;
((void (__fastcall *)(CCTextInputNode *, __int64))v30->setTag)(v30, v15);
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const cocos2d::CCPoint *)&v80);
v31 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v31->setScale)(v31, 1.1);
v90.ptr = v18;
v90.adj = 0;
v32 = CCMenuItemSpriteExtra::create(v31, nullptr, a1, v90);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v32);
v33 = ((__n128 (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v32->setTag)(v32, 1);
v33.n128_u32[0] = -1035468800;
v34.n128_u32[0] = 0;
sub_100022980(v33, v34, &v74);
*(float32x2_t *)&v35 = sub_1000229DC(&v76, &v74, &v75);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v32->setPosition)(v32, &v75, v35);
CCMenuItemSpriteExtra::setSizeMult(v32, 2.0);
v36 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v36->setScale)(v36, 1.1);
v91.ptr = v18;
v91.adj = 0;
v37 = CCMenuItemSpriteExtra::create(v36, nullptr, a1, v91);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v37);
v38 = ((__n128 (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v37->setTag)(v37, 2);
v38.n128_u32[0] = 1112014848;
v39.n128_u32[0] = 0;
sub_100022980(v38, v39, &v74);
*(float32x2_t *)&v40 = sub_1000229DC(&v76, &v74, &v75);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v37->setPosition)(v37, &v75, v40);
CCMenuItemSpriteExtra::setSizeMult(v37, 2.0);
v41 = 960;
if ( (_DWORD)v15 == 1 )
v41 = 952;
p_m_blockAInput = (CCTextInputNode **)((char *)a1 + v41);
if ( !(_DWORD)v15 )
p_m_blockAInput = &a1->m_blockAInput;
*p_m_blockAInput = v30;
if ( SHIBYTE(v81.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v81.__r_.__value_.__l.__data_);
v15 = (unsigned int)(v15 + 1);
}
while ( (_DWORD)v15 != 3 );
v43 = !a1->m_targetP1 && !a1->m_targetP2;
((void (__fastcall *)(CCTextInputNode *, bool))a1->m_blockAInput->setTouchEnabled)(a1->m_blockAInput, v43);
SetupCollisionTriggerPopup::updateItemIDInputLabel(a1);
SetupCollisionTriggerPopup::updateItemID2InputLabel(a1);
SetupCollisionTriggerPopup::updateTargetIDInputLabel(a1);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
sub_100009900(v72, "Activate\nGroup");
m_activateGroup = a1->m_activateGroup;
v45.n128_f32[0] = (float)(v86 * 0.5) + 50.0;
v46.n128_f32[0] = (float)(v87 * 0.5) + -20.0;
sub_100022980(v45, v46, &v81);
SetupTriggerPopup::createToggleButton(
(__int64)a1,
(__int64)v72,
(void (__cdecl *)(cocos2d::CCObject *))SetupCollisionTriggerPopup::onEnableGroup,
0,
m_activateGroup,
(__int64 *)&v81);
if ( v73 < 0 )
operator delete(v72[0]);
sub_100009900(v70, "Trigger\nOn Exit");
m_triggerOnExit = a1->m_triggerOnExit;
v48.n128_f32[0] = (float)(v86 * 0.5) + 50.0;
v49.n128_f32[0] = (float)(v87 * 0.5) + -50.0;
sub_100022980(v48, v49, &v81);
SetupTriggerPopup::createToggleButton(
(__int64)a1,
(__int64)v70,
(void (__cdecl *)(cocos2d::CCObject *))SetupCollisionTriggerPopup::onActivateOnExit,
0,
m_triggerOnExit,
(__int64 *)&v81);
if ( v71 < 0 )
operator delete(v70[0]);
sub_100009900(v68, "P1");
v50.n128_f32[0] = (float)(v86 * 0.5) + -70.0;
m_targetP1 = a1->m_targetP1;
v52.n128_f32[0] = (float)((float)(v87 * 0.5) + 40.0) + 50.0;
sub_100022980(v50, v52, &v81);
SetupTriggerPopup::createToggleButton(
(__int64)a1,
(__int64)v68,
(void (__cdecl *)(cocos2d::CCObject *))SetupCollisionTriggerPopup::onTargetP1,
0,
m_targetP1,
(__int64 *)&v81);
if ( v69 < 0 )
operator delete(v68[0]);
sub_100009900(v66, "P2");
m_targetP2 = a1->m_targetP2;
v54.n128_f32[0] = v86 * 0.5;
v55.n128_f32[0] = (float)((float)(v87 * 0.5) + 40.0) + 50.0;
sub_100022980(v54, v55, &v81);
SetupTriggerPopup::createToggleButton(
(__int64)a1,
(__int64)v66,
(void (__cdecl *)(cocos2d::CCObject *))SetupCollisionTriggerPopup::onTargetP2,
0,
m_targetP2,
(__int64 *)&v81);
if ( v67 < 0 )
operator delete(v66[0]);
sub_100009900(v64, "PP");
v56.n128_f32[0] = (float)(v86 * 0.5) + 70.0;
m_targetPP = a1->m_targetPP;
v58.n128_f32[0] = (float)((float)(v87 * 0.5) + 40.0) + 50.0;
sub_100022980(v56, v58, &v81);
SetupTriggerPopup::createToggleButton(
(__int64)a1,
(__int64)v64,
(void (__cdecl *)(cocos2d::CCObject *))SetupCollisionTriggerPopup::onTargetPP,
0,
m_targetPP,
(__int64 *)&v81);
if ( v65 < 0 )
operator delete(v64[0]);
a1->m_disableTextDelegate = 0;
LOBYTE(v4) = v63;
}
return v4;
}