//
// SetupCollisionTriggerPopup::init from 0x140418330 to 0x1404191a0 (3696 bytes)
//
// 2 xrefs:
// > SetupCollisionTriggerPopup::create @ 0x1404182ed
// > ??> @ 0x1406d908c
//
// 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=5
bool SetupCollisionTriggerPopup::init(SetupCollisionTriggerPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
bool result; // al
__int64 v5; // rcx
cocos2d::CCDirector *v6; // rax
struct cocos2d::CCLabelBMFont *v7; // rdi
cocos2d::CCLabelBMFont_vtbl *v8; // rbx
const cocos2d::CCPoint *v9; // rax
ButtonSprite *v10; // rbx
CCMenuItemSpriteExtra *v11; // rax
_BYTE *v12; // rax
_BYTE *v13; // rcx
const char *v14; // rdx
__int64 v15; // r8
char *v16; // rdi
__int64 v17; // rbx
struct cocos2d::CCPoint v18; // rax
int i; // r15d
double v20; // xmm0_8
unsigned __int64 v21; // rdi
void **v22; // rbx
unsigned __int64 v23; // rcx
__int64 v24; // rbx
_QWORD *v25; // r14
void *v26; // rcx
__int64 v27; // rax
void (*v28)(SetupCollisionTriggerPopup *, cocos2d::CCObject *); // r14
void **v29; // rbx
unsigned __int64 v30; // rcx
__int64 v31; // rbx
_QWORD *v32; // r14
void *v33; // rcx
__int64 v34; // rax
void **v35; // rbx
unsigned __int64 v36; // rcx
__int64 v37; // rbx
_QWORD *v38; // r14
void *v39; // rcx
__int64 v40; // rax
void **v41; // rcx
struct cocos2d::CCLabelBMFont *v42; // rbx
float v43; // xmm0_4
struct cocos2d::CCRect *v44; // rax
struct cocos2d::extension::CCScale9Sprite *v45; // rdi
__int64 v46; // rdx
const char *v47; // r9
CCTextInputNode *v48; // rdi
struct cocos2d::CCSprite *v49; // rbx
cocos2d::CCNode *v50; // rbx
float v51; // xmm0_4
struct cocos2d::CCSprite *v52; // rbx
cocos2d::CCNode *v53; // rbx
float v54; // xmm0_4
_BOOL8 v55; // rdx
__int64 v56; // rax
__int64 v57; // rax
__int64 v58; // rax
__int64 v59; // rax
__int64 v60; // rax
int v61; // [rsp+28h] [rbp-E0h]
float v62; // [rsp+58h] [rbp-B0h]
__int16 v63; // [rsp+64h] [rbp-A4h] BYREF
char v64; // [rsp+66h] [rbp-A2h]
__int16 v65; // [rsp+68h] [rbp-A0h]
cocos2d::CCPoint v66; // [rsp+70h] [rbp-98h] BYREF
ButtonSprite *v67; // [rsp+78h] [rbp-90h] BYREF
void **v68; // [rsp+88h] [rbp-80h]
struct cocos2d::CCPoint v69; // [rsp+90h] [rbp-78h] BYREF
struct cocos2d::CCPoint v70; // [rsp+98h] [rbp-70h] BYREF
_QWORD Src[4]; // [rsp+A0h] [rbp-68h] BYREF
cocos2d::CCPoint v72; // [rsp+C0h] [rbp-48h] BYREF
cocos2d::CCSize v73[2]; // [rsp+C8h] [rbp-40h] BYREF
cocos2d::CCRect v74; // [rsp+D8h] [rbp-30h] BYREF
__int64 v75; // [rsp+E8h] [rbp-20h]
__int64 v76; // [rsp+F0h] [rbp-18h]
cocos2d::CCRect v77; // [rsp+118h] [rbp+10h] BYREF
void *v78[2]; // [rsp+128h] [rbp+20h] BYREF
__int64 v79; // [rsp+138h] [rbp+30h]
unsigned __int64 v80; // [rsp+140h] [rbp+38h]
result = SetupTriggerPopup::init(a1, a2, a3, 300.0, 280.0, 1);
if ( result )
{
a1->determineStartValues(a1);
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6);
v7 = cocos2d::CCLabelBMFont::create("Collision Trigger", "goldFont.fnt");
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v7);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v7->setScale_0)(v7);
v8 = v7->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(a1->m_height * 0.5, v62 * 0.5);
v8->setPosition_0(v7, v9);
v67 = (ButtonSprite *)operator new(0x2C0u);
v10 = ButtonSprite::ButtonSprite(v67);
if ( v10 )
{
if ( ButtonSprite::init_1(v10, "OK", 40, 0, 0.80000001, 1, "goldFont.fnt", "GJ_button_01.png", 30.0) )
{
cocos2d::CCObject::autorelease(v10);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v10->~ButtonSprite)(v10, 1);
v10 = nullptr;
}
}
v11 = CCMenuItemSpriteExtra::create(v10, nullptr, a1, (cocos2d::SEL_MenuHandler *)sub_14009BEF0);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v11);
v67 = (ButtonSprite *)v78;
*(_OWORD *)v78 = 0;
v79 = 0;
v80 = 15;
v12 = sub_14003AA10(0x1F0u);
v78[0] = v12;
v79 = 495;
v80 = 495;
v13 = v12;
v14 = "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. ";
v15 = 3;
do
{
*(_OWORD *)v13 = *(_OWORD *)v14;
*((_OWORD *)v13 + 1) = *((_OWORD *)v14 + 1);
*((_OWORD *)v13 + 2) = *((_OWORD *)v14 + 2);
*((_OWORD *)v13 + 3) = *((_OWORD *)v14 + 3);
*((_OWORD *)v13 + 4) = *((_OWORD *)v14 + 4);
*((_OWORD *)v13 + 5) = *((_OWORD *)v14 + 5);
*((_OWORD *)v13 + 6) = *((_OWORD *)v14 + 6);
v13 += 128;
*((_OWORD *)v13 - 1) = *((_OWORD *)v14 + 7);
v14 += 128;
--v15;
}
while ( v15 );
*(_OWORD *)v13 = *(_OWORD *)v14;
*((_OWORD *)v13 + 1) = *((_OWORD *)v14 + 1);
*((_OWORD *)v13 + 2) = *((_OWORD *)v14 + 2);
*((_OWORD *)v13 + 3) = *((_OWORD *)v14 + 3);
*((_OWORD *)v13 + 4) = *((_OWORD *)v14 + 4);
*((_OWORD *)v13 + 5) = *((_OWORD *)v14 + 5);
*((_QWORD *)v13 + 12) = *((_QWORD *)v14 + 12);
*((_DWORD *)v13 + 26) = *((_DWORD *)v14 + 26);
*((_WORD *)v13 + 54) = *((_WORD *)v14 + 54);
v13[110] = v14[110];
v12[495] = 0;
v74 = 0;
v75 = 4;
v76 = 15;
strcpy((char *)&v74, "Help");
v16 = InfoAlertButton::create((__int64)&v74, (__int64)v78);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, (cocos2d::CCNode *)v16);
v17 = *(_QWORD *)v16;
cocos2d::CCPoint::CCPoint(a1->m_width * 0.5, (float)((float)(v62 * 0.5) - (float)(a1->m_width * 0.5)) + 18.0);
v18 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v70);
(*(void (__fastcall **)(char *, struct cocos2d::CCPoint))(v17 + 184))(v16, v18);
a1->m_joystickConnected = -1;
for ( i = 0; i < 3; ++i )
{
*(_OWORD *)v78 = 0;
v79 = 0;
v80 = 15;
LOBYTE(v78[0]) = 0;
v20 = cocos2d::CCPoint::CCPoint(&v66);
v21 = v80;
if ( i )
{
if ( i == 1 )
{
if ( v80 < 9 )
{
v30 = v80 >> 1;
if ( v80 <= 0x7FFFFFFFFFFFFFFFLL - (v80 >> 1) )
{
v31 = 15;
if ( v30 + v80 > 0xF )
v31 = v30 + v80;
}
else
{
v31 = 0x7FFFFFFFFFFFFFFFLL;
}
v32 = sub_14003AA10(v31 + 1);
v79 = 9;
v80 = v31;
LODWORD(v20) = *(_DWORD *)"BlockB ID";
*v32 = *(_QWORD *)"BlockB ID";
*((_WORD *)v32 + 4) = (unsigned __int8)aBlockbId[8];
if ( v21 > 0xF )
{
v33 = v78[0];
if ( v21 + 1 >= 0x1000 )
{
v33 = *((void **)v78[0] - 1);
if ( (unsigned __int64)((char *)v78[0] - (char *)v33 - 8) > 0x1F )
goto LABEL_66;
}
j_j_free(v33);
}
v78[0] = v32;
}
else
{
v29 = v78;
if ( v80 > 0xF )
v29 = (void **)v78[0];
v79 = 9;
memmove(v29, "BlockB ID", 9u);
*((_BYTE *)v29 + 9) = 0;
}
cocos2d::CCPoint::CCPoint(*(float *)&v20, (float)(v62 * 0.5) + 70.0);
cocos2d::CCPoint::operator=(&v66, v34);
v28 = SetupCollisionTriggerPopup::onItemID2Arrow;
}
else
{
if ( v80 < 9 )
{
v36 = v80 >> 1;
if ( v80 <= 0x7FFFFFFFFFFFFFFFLL - (v80 >> 1) )
{
v37 = 15;
if ( v80 + v36 > 0xF )
v37 = v80 + v36;
}
else
{
v37 = 0x7FFFFFFFFFFFFFFFLL;
}
v38 = sub_14003AA10(v37 + 1);
v79 = 9;
v80 = v37;
LODWORD(v20) = *(_DWORD *)"Target ID";
*v38 = *(_QWORD *)"Target ID";
*((_WORD *)v38 + 4) = (unsigned __int8)aTargetId[8];
if ( v21 > 0xF )
{
v39 = v78[0];
if ( v21 + 1 >= 0x1000 )
{
v39 = *((void **)v78[0] - 1);
if ( (unsigned __int64)((char *)v78[0] - (char *)v39 - 8) > 0x1F )
LABEL_66:
invalid_parameter_noinfo_noreturn();
}
j_j_free(v39);
}
v78[0] = v38;
}
else
{
v35 = v78;
if ( v80 > 0xF )
v35 = (void **)v78[0];
v79 = 9;
memmove(v35, "Target ID", 9u);
*((_BYTE *)v35 + 9) = 0;
}
cocos2d::CCPoint::CCPoint(*(float *)&v20, (float)(v62 * 0.5) - 70.0);
cocos2d::CCPoint::operator=(&v66, v40);
v28 = SetupCollisionTriggerPopup::onTargetIDArrow;
}
}
else
{
if ( v80 < 9 )
{
v23 = v80 >> 1;
if ( v80 <= 0x7FFFFFFFFFFFFFFFLL - (v80 >> 1) )
{
v24 = 15;
if ( v80 + v23 > 0xF )
v24 = v80 + v23;
}
else
{
v24 = 0x7FFFFFFFFFFFFFFFLL;
}
v25 = sub_14003AA10(v24 + 1);
v79 = 9;
v80 = v24;
LODWORD(v20) = *(_DWORD *)"BlockA ID";
*v25 = *(_QWORD *)"BlockA ID";
*((_WORD *)v25 + 4) = (unsigned __int8)aBlockaId[8];
if ( v21 > 0xF )
{
v26 = v78[0];
if ( v21 + 1 >= 0x1000 )
{
v26 = *((void **)v78[0] - 1);
if ( (unsigned __int64)((char *)v78[0] - (char *)v26 - 8) > 0x1F )
goto LABEL_66;
}
j_j_free(v26);
}
v78[0] = v25;
}
else
{
v22 = v78;
if ( v80 > 0xF )
v22 = (void **)v78[0];
v79 = 9;
memmove(v22, "BlockA ID", 9u);
*((_BYTE *)v22 + 9) = 0;
}
cocos2d::CCPoint::CCPoint(*(float *)&v20, (float)(v62 * 0.5) - 70.0);
cocos2d::CCPoint::operator=(&v66, v27);
v28 = SetupCollisionTriggerPopup::onItemIDArrow;
}
v41 = v78;
if ( v80 > 0xF )
v41 = (void **)v78[0];
v42 = cocos2d::CCLabelBMFont::create((const char *)v41, "goldFont.fnt");
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v42);
v43 = ((float (__fastcall *)(struct cocos2d::CCLabelBMFont *))v42->setScale_0)(v42);
cocos2d::CCPoint::CCPoint(v43, 0.0);
cocos2d::CCPoint::operator+(&v66, &v72);
v42->setPosition_0(v42, &v72);
cocos2d::CCRect::CCRect(&v77, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v74, &v77);
v45 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v44);
LOBYTE(v46) = 100;
v45->setOpacity(&v45->cocos2d::CCRGBAProtocol, v46);
v63 = 0;
v64 = 0;
v45->setColor(&v45->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v63);
cocos2d::CCSize::CCSize(v73, 50.0, 30.0);
v45->setContentSize(v45, v73);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v45, -1);
v45->setPosition_0(v45, &v66);
v48 = CCTextInputNode::create(50.0, 40.0, "Num", v47, v61, (const char *)&qword_14052A4D8);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v48, 20);
v48->setPosition_0(v48, &v66);
v48->m_maxLabelScale = 0.60000002;
CCTextInputNode::refreshLabel(v48);
v48->m_maxLabelWidth = 200.0;
CCTextInputNode::refreshLabel(v48);
v48->m_textField->setVisible(v48->m_textField, 0);
v48->m_maxLabelLength = 6;
Src[1] = 14648;
Src[2] = 10;
Src[3] = 15;
Src[0] = 0x3736353433323130LL;
v73[1] = (cocos2d::CCSize)Src;
if ( &v48->m_allowedChars != (std::string *)Src )
sub_14003CCE0((void **)&v48->m_allowedChars, Src, 0xAu);
sub_14003A830((__int64)Src);
v65 = -21896;
*(_WORD *)&v48->m_placeholderColor.r = -21896;
v48->m_placeholderColor.b = -16;
CCTextInputNode::refreshLabel(v48);
v48->m_placeholderScale = 0.5;
CCTextInputNode::refreshLabel(v48);
v48->m_delegate = &a1->TextInputDelegate;
v48->m_numberInput = 1;
v48->setTag(v48, i);
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v69);
v49 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v49->setScale_0)(v49);
v50 = CCMenuItemSpriteExtra::create(v49, nullptr, a1, (cocos2d::SEL_MenuHandler *)v28);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v50);
v51 = ((float (__fastcall *)(cocos2d::CCNode *, __int64))v50->setTag)(v50, 1);
cocos2d::CCPoint::CCPoint(v51, -50.0);
cocos2d::CCPoint::operator+(&v69, &v70);
v50->setPosition_0(v50, &v70);
v50[1].m_unknown5 = 0x40000000;
v52 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v52->setScale_0)(v52);
v53 = CCMenuItemSpriteExtra::create(v52, nullptr, a1, (cocos2d::SEL_MenuHandler *)v28);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v53);
v54 = ((float (__fastcall *)(cocos2d::CCNode *, __int64))v53->setTag)(v53, 2);
cocos2d::CCPoint::CCPoint(v54, 50.0);
cocos2d::CCPoint::operator+(&v69, &v67);
v53->setPosition_0(v53, (const cocos2d::CCPoint *)&v67);
v53[1].m_unknown5 = 0x40000000;
if ( i )
{
if ( i == 1 )
a1->m_blockBInput = v48;
else
a1->m_targetIDInput = v48;
}
else
{
a1->m_blockAInput = v48;
}
sub_14003A830((__int64)v78);
}
if ( a1->m_targetP1 || a1->m_targetP2 )
v55 = 0;
else
LOBYTE(v55) = 1;
a1->m_blockAInput->setTouchEnabled(a1->m_blockAInput, v55);
SetupCollisionTriggerPopup::updateItemIDInputLabel(a1);
SetupCollisionTriggerPopup::updateItemID2InputLabel(a1);
SetupCollisionTriggerPopup::updateTargetIDInputLabel(a1);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v68 = v78;
v79 = 14;
v80 = 15;
strcpy((char *)v78, "Activate\nGroup");
HIBYTE(v78[1]) = 0;
cocos2d::CCPoint::CCPoint(1.8465413e25, (float)(v62 * 0.5) + 50.0);
SetupTriggerPopup::createToggleButton(
(_DWORD)a1,
(unsigned int)v78,
(unsigned int)SetupCollisionTriggerPopup::onEnableGroup,
a1->m_activateGroup,
v56);
v68 = v78;
v79 = 15;
v80 = 15;
strcpy((char *)v78, "Trigger\nOn Exit");
cocos2d::CCPoint::CCPoint(1.1024204e24, (float)(v62 * 0.5) + 50.0);
SetupTriggerPopup::createToggleButton(
(_DWORD)a1,
(unsigned int)v78,
(unsigned int)SetupCollisionTriggerPopup::onActivateOnExit,
a1->m_triggerOnExit,
v57);
v68 = v78;
*(_OWORD *)v78 = 0;
v79 = 2;
v80 = 15;
strcpy((char *)v78, "P1");
cocos2d::CCPoint::CCPoint(0.0, (float)(v62 * 0.5) - 70.0);
SetupTriggerPopup::createToggleButton(
(_DWORD)a1,
(unsigned int)v78,
(unsigned int)SetupCollisionTriggerPopup::onTargetP1,
a1->m_targetP1,
v58);
v68 = v78;
*(_OWORD *)v78 = 0;
v79 = 2;
v80 = 15;
strcpy((char *)v78, "P2");
cocos2d::CCPoint::CCPoint(0.0, v62 * 0.5);
SetupTriggerPopup::createToggleButton(
(_DWORD)a1,
(unsigned int)v78,
(unsigned int)SetupCollisionTriggerPopup::onTargetP2,
a1->m_targetP2,
v59);
v68 = v78;
*(_OWORD *)v78 = 0;
v79 = 2;
v80 = 15;
strcpy((char *)v78, "PP");
cocos2d::CCPoint::CCPoint(0.0, (float)(v62 * 0.5) + 70.0);
SetupTriggerPopup::createToggleButton(
(_DWORD)a1,
(unsigned int)v78,
(unsigned int)SetupCollisionTriggerPopup::onTargetPP,
a1->m_targetPP,
v60);
a1->m_disableTextDelegate = 0;
return 1;
}
return result;
}