//
// SetupCollisionTriggerPopup::init from 0x94ff14 to 0x950cf4 (3552 bytes)
//
// 2 xrefs:
// > SetupCollisionTriggerPopup::create @ 0x950ee4
// > ??> @ 0x50340
//
// 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 SetupCollisionTriggerPopup::init(SetupCollisionTriggerPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
cocos2d::CCDirector *v5; // x0
cocos2d::CCLabelBMFont *v6; // x21
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
const char *v8; // x6
cocos2d::CCNode *v9; // x0
CCMenuItemSpriteExtra *v10; // x0
cocos2d::CCNode *v11; // x21
void *v12; // x0
void *v13; // x0
int v14; // w23
cocos2d::CCMenu *m_buttonMenu; // x25
void (__fastcall *v16)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
float v17; // s0
float v18; // s1
void (*v19)(SetupCollisionTriggerPopup *, cocos2d::CCObject *); // x26
cocos2d::CCLabelBMFont *v20; // x21
void (__fastcall *v21)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCNode *v22; // x21
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // x2
CCTextInputNode *v24; // x21
void *v25; // x0
CCTextInputNode_vtbl *v26; // x1
cocos2d::CCSprite *v27; // x24
CCMenuItemSpriteExtra *v28; // x24
cocos2d::CCSprite *v29; // x24
CCMenuItemSpriteExtra *v30; // x24
void (__fastcall *v31)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
void *v32; // x0
_BOOL8 v33; // x1
_BOOL4 m_activateGroup; // w23
void *v35; // x0
_BOOL4 m_triggerOnExit; // w23
void *v37; // x0
_BOOL4 m_targetP1; // w23
void *v39; // x0
_BOOL4 m_targetP2; // w23
void *v41; // x0
_BOOL4 m_targetPP; // w23
void *v43; // x26
unsigned int *v44; // x1
int v45; // w2
unsigned int *v46; // x1
int v47; // w2
unsigned int *v48; // x24
int v49; // w0
unsigned int *v50; // x1
int v51; // w2
unsigned int *v52; // x1
int v53; // w2
unsigned int *v54; // x1
int v55; // w2
unsigned int *v56; // x1
int v57; // w2
unsigned int *v58; // x1
int v59; // w2
unsigned int *v60; // x1
int v61; // w2
float v62; // s0
float v63; // s1
float v64; // s0
float v65; // s1
bool v66; // [xsp+B7h] [xbp+B7h]
void (__fastcall *v67)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+B8h] [xbp+B8h]
cocos2d::ccColor3B v68; // [xsp+D0h] [xbp+D0h]
float v69; // [xsp+D8h] [xbp+D8h]
float v70; // [xsp+DCh] [xbp+DCh]
__int64 v71; // [xsp+E0h] [xbp+E0h] BYREF
cocos2d::CCPoint v72; // [xsp+E8h] [xbp+E8h] BYREF
cocos2d::CCSize v73; // [xsp+F0h] [xbp+F0h] BYREF
char v74[8]; // [xsp+F8h] [xbp+F8h] BYREF
cocos2d::CCPoint v75; // [xsp+100h] [xbp+100h] BYREF
cocos2d::CCRect v76; // [xsp+108h] [xbp+108h] BYREF
cocos2d::CCRect v77; // [xsp+118h] [xbp+118h] BYREF
cocos2d::CCPoint v78; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v79; // 0:x2.16
cocos2d::SEL_MenuHandler v80; // 0:x2.16
cocos2d::SEL_MenuHandler v81; // 0:x2.16
cocos2d::CCRect v82; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v66 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 280.0, 1);
if ( v66 )
{
a1->determineStartValues(a1);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
v6 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v6);
v6->setScale(v6, 0.7);
setPosition = v6->setPosition;
cocos2d::CCPoint::CCPoint(&v77.origin, v69 * 0.5, (float)((float)(a1->m_height * 0.5) + (float)(v70 * 0.5)) - 18.0);
setPosition(v6, &v77.origin);
v9 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v8,
30.0);
v79.adj = 1320;
v79.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v10 = CCMenuItemSpriteExtra::create(v9, nullptr, v79);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v10);
sub_D153B8((int)&v76, "Help");
sub_D153B8(
(int)&v77,
"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 = (cocos2d::CCNode *)InfoAlertButton::create(1.0);
v12 = (void *)(*(_QWORD *)&v77.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v54 = (unsigned int *)(*(_QWORD *)&v77.origin - 8LL);
do
v55 = __ldaxr(v54);
while ( __stlxr(v55 - 1, v54) );
}
else
{
v55 = *(_DWORD *)(*(_QWORD *)&v77.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v77.origin - 8LL) = v55 - 1;
}
if ( v55 <= 0 )
operator delete(v12);
}
v13 = (void *)(*(_QWORD *)&v76.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v76.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v56 = (unsigned int *)(*(_QWORD *)&v76.origin - 8LL);
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = *(_DWORD *)(*(_QWORD *)&v76.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v76.origin - 8LL) = v57 - 1;
}
if ( v57 <= 0 )
operator delete(v13);
}
v14 = 0;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v11);
m_buttonMenu = a1->m_buttonMenu;
v16 = v11->setPosition;
cocos2d::CCPoint::CCPoint(
&v76.origin,
18.0 - (float)((float)(a1->m_width * 0.5) - (float)(v69 * 0.5)),
(float)((float)(a1->m_height * 0.5) + (float)(v70 * 0.5)) - 18.0);
v78 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v76.origin);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *, float, float))v16)(v11, &v77, v78.x, v78.y);
a1->m_joystickConnected = -1;
do
{
sub_D153B8((int)&v71, &byte_F288A0);
cocos2d::CCPoint::CCPoint(&v72);
if ( v14 )
{
if ( v14 == 1 )
{
sub_D1798C(&v71, "BlockB ID", 9);
cocos2d::CCPoint::CCPoint(&v77.origin, (float)(v69 * 0.5) + 70.0, (float)(v70 * 0.5) + 30.0);
cocos2d::CCPoint::operator=(&v72, v64, v65);
v19 = SetupCollisionTriggerPopup::onItemID2Arrow;
}
else
{
sub_D1798C(&v71, "Target ID", 9);
cocos2d::CCPoint::CCPoint(&v77.origin, (float)(v69 * 0.5) + -70.0, (float)(v70 * 0.5) + -35.0);
cocos2d::CCPoint::operator=(&v72, v17, v18);
v19 = SetupCollisionTriggerPopup::onTargetIDArrow;
}
}
else
{
sub_D1798C(&v71, "BlockA ID", 9);
cocos2d::CCPoint::CCPoint(&v77.origin, (float)(v69 * 0.5) + -70.0, (float)(v70 * 0.5) + 30.0);
cocos2d::CCPoint::operator=(&v72, v62, v63);
v19 = SetupCollisionTriggerPopup::onItemIDArrow;
}
v20 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v20);
v20->setScale(v20, 0.65);
v21 = v20->setPosition;
cocos2d::CCPoint::CCPoint(&v76.origin, 0.0, 30.0);
cocos2d::CCPoint::operator+(&v77, &v72, &v76);
v21(v20, &v77.origin);
cocos2d::CCRect::CCRect(&v76, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v77, &v76);
v22 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02b_small.png",
(const char *)&v77,
v82);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v22->__vftable[1].~CCNode_0)(v22, 100);
getTag = v22->__vftable[1].getTag;
LOWORD(v77.origin.x) = 0;
BYTE2(v77.origin.x) = 0;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))getTag)(v22, &v77);
cocos2d::CCSize::CCSize(&v73, 50.0, 30.0);
v22->setContentSize(v22, &v73);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v22, -1);
v22->setPosition(v22, &v72);
v24 = CCTextInputNode::create(50.0, 40.0, "Num", "Thonburi");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v24, 20);
v24->setPosition(v24, &v72);
CCTextInputNode::setMaxLabelScale(v24, 0.6);
CCTextInputNode::setMaxLabelWidth(v24, 200.0);
v24->m_textField->setVisible(v24->m_textField, 0);
v24->m_maxLabelLength = 6;
sub_D153B8((int)&v77, "0123456789");
CCTextInputNode::setAllowedChars((__int64)v24, (__int64)&v77);
v25 = (void *)(*(_QWORD *)&v77.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(*(_QWORD *)&v77.origin - 8LL);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *(_DWORD *)(*(_QWORD *)&v77.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v77.origin - 8LL) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v25);
}
v68.r = 120;
*(_WORD *)&v68.g = -3926;
CCTextInputNode::setLabelPlaceholderColor(v24, v68);
CCTextInputNode::setLabelPlaceholderScale(v24, 0.5);
v26 = v24->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v24->m_delegate = &a1->TextInputDelegate;
v24->m_numberInput = 1;
v26->setTag(v24, v14);
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v72);
v27 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
v27->setScale(v27, 1.1);
v80.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v80.adj = (size_t)v19;
v28 = CCMenuItemSpriteExtra::create(v27, nullptr, v80);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v28);
v28->setTag(v28, 1);
v67 = v28->setPosition;
cocos2d::CCPoint::CCPoint(&v75, -50.0, 0.0);
cocos2d::CCPoint::operator+(&v77, v74, &v75);
v67(v28, &v77.origin);
CCMenuItemSpriteExtra::setSizeMult(v28, 2.0);
v29 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
v29->setScale(v29, 1.1);
v81.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v81.adj = (size_t)v19;
v30 = CCMenuItemSpriteExtra::create(v29, nullptr, v81);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v30);
v30->setTag(v30, 2);
v31 = v30->setPosition;
cocos2d::CCPoint::CCPoint(&v75, 50.0, 0.0);
cocos2d::CCPoint::operator+(&v77, v74, &v75);
v31(v30, &v77.origin);
CCMenuItemSpriteExtra::setSizeMult(v30, 2.0);
if ( v14 )
{
if ( v14 == 1 )
a1->m_blockBInput = v24;
else
a1->m_targetIDInput = v24;
}
else
{
a1->m_blockAInput = v24;
}
v32 = (void *)(v71 - 24);
if ( (__int64 *)(v71 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = (unsigned int *)(v71 - 8);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *(_DWORD *)(v71 - 8);
*(_DWORD *)(v71 - 8) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v32);
}
++v14;
}
while ( v14 != 3 );
v33 = 0;
if ( !a1->m_targetP1 )
v33 = !a1->m_targetP2;
a1->m_blockAInput->setTouchEnabled(a1->m_blockAInput, v33);
SetupCollisionTriggerPopup::updateItemIDInputLabel(a1);
SetupCollisionTriggerPopup::updateItemID2InputLabel(a1);
SetupCollisionTriggerPopup::updateTargetIDInputLabel(a1);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
sub_D153B8((int)&v77, "Activate\nGroup");
m_activateGroup = a1->m_activateGroup;
cocos2d::CCPoint::CCPoint(&v76.origin, (float)(v69 * 0.5) + 50.0, (float)(v70 * 0.5) + -20.0);
SetupTriggerPopup::createToggleButton(a1, &v77, SetupCollisionTriggerPopup::onEnableGroup, 0, m_activateGroup, &v76);
v35 = (void *)(*(_QWORD *)&v77.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v58 = (unsigned int *)(*(_QWORD *)&v77.origin - 8LL);
do
v59 = __ldaxr(v58);
while ( __stlxr(v59 - 1, v58) );
}
else
{
v59 = *(_DWORD *)(*(_QWORD *)&v77.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v77.origin - 8LL) = v59 - 1;
}
if ( v59 <= 0 )
operator delete(v35);
}
sub_D153B8((int)&v77, "Trigger\nOn Exit");
m_triggerOnExit = a1->m_triggerOnExit;
cocos2d::CCPoint::CCPoint(&v76.origin, (float)(v69 * 0.5) + 50.0, (float)(v70 * 0.5) + -50.0);
SetupTriggerPopup::createToggleButton(
a1,
&v77,
SetupCollisionTriggerPopup::onActivateOnExit,
0,
m_triggerOnExit,
&v76);
v37 = (void *)(*(_QWORD *)&v77.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v60 = (unsigned int *)(*(_QWORD *)&v77.origin - 8LL);
do
v61 = __ldaxr(v60);
while ( __stlxr(v61 - 1, v60) );
}
else
{
v61 = *(_DWORD *)(*(_QWORD *)&v77.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v77.origin - 8LL) = v61 - 1;
}
if ( v61 <= 0 )
operator delete(v37);
}
sub_D153B8((int)&v77, "P1");
m_targetP1 = a1->m_targetP1;
cocos2d::CCPoint::CCPoint(&v76.origin, (float)(v69 * 0.5) + -70.0, (float)((float)(v70 * 0.5) + 40.0) + 50.0);
SetupTriggerPopup::createToggleButton(a1, &v77, SetupCollisionTriggerPopup::onTargetP1, 0, m_targetP1, &v76);
v39 = (void *)(*(_QWORD *)&v77.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v50 = (unsigned int *)(*(_QWORD *)&v77.origin - 8LL);
do
v51 = __ldaxr(v50);
while ( __stlxr(v51 - 1, v50) );
}
else
{
v51 = *(_DWORD *)(*(_QWORD *)&v77.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v77.origin - 8LL) = v51 - 1;
}
if ( v51 <= 0 )
operator delete(v39);
}
sub_D153B8((int)&v77, "P2");
m_targetP2 = a1->m_targetP2;
cocos2d::CCPoint::CCPoint(&v76.origin, v69 * 0.5, (float)((float)(v70 * 0.5) + 40.0) + 50.0);
SetupTriggerPopup::createToggleButton(a1, &v77, SetupCollisionTriggerPopup::onTargetP2, 0, m_targetP2, &v76);
v41 = (void *)(*(_QWORD *)&v77.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v52 = (unsigned int *)(*(_QWORD *)&v77.origin - 8LL);
do
v53 = __ldaxr(v52);
while ( __stlxr(v53 - 1, v52) );
}
else
{
v53 = *(_DWORD *)(*(_QWORD *)&v77.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v77.origin - 8LL) = v53 - 1;
}
if ( v53 <= 0 )
operator delete(v41);
}
sub_D153B8((int)&v77, "PP");
m_targetPP = a1->m_targetPP;
cocos2d::CCPoint::CCPoint(&v76.origin, (float)(v69 * 0.5) + 70.0, (float)((float)(v70 * 0.5) + 40.0) + 50.0);
SetupTriggerPopup::createToggleButton(a1, &v77, SetupCollisionTriggerPopup::onTargetPP, 0, m_targetPP, &v76);
v43 = (void *)(*(_QWORD *)&v77.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v77.origin - 24LL) == &qword_124B6B0 )
goto LABEL_22;
if ( &pthread_create )
{
v48 = (unsigned int *)(*(_QWORD *)&v77.origin - 8LL);
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = *(_DWORD *)(*(_QWORD *)&v77.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v77.origin - 8LL) = v49 - 1;
}
if ( v49 > 0 )
{
LABEL_22:
a1->m_disableTextDelegate = 0;
}
else
{
operator delete(v43);
a1->m_disableTextDelegate = 0;
}
}
return v66;
}