//
// EditTriggersPopup::init from 0x8c7374 to 0x8c76c4 (848 bytes)
//
// 2 xrefs:
// > EditTriggersPopup::create @ 0x8c7864
// > ??> @ 0x821a0
//
// 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 EditTriggersPopup::init(EditTriggersPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
bool v4; // w21
cocos2d::CCDirector *v6; // x0
cocos2d::CCLabelBMFont *v7; // x23
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
const char *v9; // x6
cocos2d::CCNode *v10; // x0
CCMenuItemSpriteExtra *v11; // x0
cocos2d::CCNode *v12; // x25
void *v13; // x0
void *v14; // x0
cocos2d::CCMenu *m_buttonMenu; // x26
void (__fastcall *v16)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
unsigned int *v17; // x1
int v18; // w2
unsigned int *v19; // x1
int v20; // w2
float v21; // [xsp+80h] [xbp+80h]
float v22; // [xsp+84h] [xbp+84h]
cocos2d::CCPoint v23; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCPoint v24; // [xsp+90h] [xbp+90h] BYREF
std::string v25; // 0:x2.8
cocos2d::CCPoint v26; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v27; // 0:x2.16
v4 = SetupTriggerPopup::init(a1, a2, a3, 330.0, 120.0, 1);
if ( v4 )
{
a1->determineStartValues(a1);
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v6);
v7 = cocos2d::CCLabelBMFont::create();
a1->addChild(a1, v7);
v7->setScale(v7, 0.7);
setPosition = v7->setPosition;
cocos2d::CCPoint::CCPoint(&v24, v21 * 0.5, (float)((float)(a1->m_height * 0.5) + (float)(v22 * 0.5)) - 18.0);
setPosition(v7, &v24);
v10 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v9,
30.0);
v27.adj = 1320;
v27.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v11 = CCMenuItemSpriteExtra::create(v10, nullptr, v27);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v11);
sub_D153B8((int)&v23, "Help");
sub_D153B8(
(int)&v24,
"Edit attributes of the selected triggers.\n"
"Touch Triggers makes the object activate on player touch.\n"
"Spawn Triggered makes the triggers activate from a spawn trigger.");
v12 = (cocos2d::CCNode *)InfoAlertButton::create((InfoAlertButton *)&v23, (std::string)&v24, v25, 1.0);
v13 = (void *)(*(_QWORD *)&v24 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v24 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v17 = (unsigned int *)(*(_QWORD *)&v24 - 8LL);
do
v18 = __ldaxr(v17);
while ( __stlxr(v18 - 1, v17) );
}
else
{
v18 = *(_DWORD *)(*(_QWORD *)&v24 - 8LL);
*(_DWORD *)(*(_QWORD *)&v24 - 8LL) = v18 - 1;
}
if ( v18 <= 0 )
operator delete(v13);
}
v14 = (void *)(*(_QWORD *)&v23 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v23 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(*(_QWORD *)&v23 - 8LL);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *(_DWORD *)(*(_QWORD *)&v23 - 8LL);
*(_DWORD *)(*(_QWORD *)&v23 - 8LL) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v14);
}
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v12);
m_buttonMenu = a1->m_buttonMenu;
v16 = v12->setPosition;
cocos2d::CCPoint::CCPoint(
&v23,
18.0 - (float)((float)(a1->m_width * 0.5) - (float)(v21 * 0.5)),
(float)((float)(a1->m_height * 0.5) + (float)(v22 * 0.5)) - 18.0);
v26 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v23);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCPoint *, float, float))v16)(v12, &v24, v26.x, v26.y);
a1->m_joystickConnected = -1;
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
}
return v4;
}