//
// EditTriggersPopup::init from 0x14039a010 to 0x14039a37f (879 bytes)
//
// 3 xrefs:
// > EditTriggersPopup::create @ 0x140399fce
// > ??> @ 0x1409232a0
// > ??> @ 0x1409232ac
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:31:14 +0000
//
// Hidden C++ exception states: #wind=2
char __fastcall EditTriggersPopup::init(__int64 a1, int a2, int a3, int a4)
{
char result; // al
__int64 v6; // rcx
__int64 v7; // rax
struct cocos2d::CCLabelBMFont *v8; // rdi
__int64 v9; // rbx
__int64 v10; // rax
cocos2d::CCObject *v11; // rbx
cocos2d::CCObject *v12; // rax
__int64 *v13; // rsi
__int64 v14; // rdi
__int64 v15; // rbx
__int64 v16; // rax
__int64 v17; // rax
__int128 *v18; // [rsp+58h] [rbp-19h] BYREF
_BYTE v19[8]; // [rsp+60h] [rbp-11h] BYREF
__int128 v20; // [rsp+68h] [rbp-9h] BYREF
__int64 v21; // [rsp+78h] [rbp+7h]
__int64 v22; // [rsp+80h] [rbp+Fh]
__int128 v23; // [rsp+88h] [rbp+17h] BYREF
__int64 v24; // [rsp+98h] [rbp+27h]
__int64 v25; // [rsp+A0h] [rbp+2Fh]
float v26; // [rsp+F0h] [rbp+7Fh] BYREF
float v27; // [rsp+F4h] [rbp+83h]
result = SetupTriggerPopup::init(a1, a2, a3, a4, 1123024896, 1, 0);
if ( result )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, &v26);
v8 = cocos2d::CCLabelBMFont::create("Edit Triggers", "goldFont.fnt");
(*(void (__fastcall **)(__int64, struct cocos2d::CCLabelBMFont *))(*(_QWORD *)a1 + 464LL))(a1, v8);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v8 + 160LL))(v8);
v9 = *(_QWORD *)v8;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v18,
v26 * 0.5,
(float)((float)(*(float *)(a1 + 736) * 0.5) + (float)(v27 * 0.5)) - 18.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v9 + 184))(v8, v10);
v18 = (__int128 *)operator new(0x2C8u);
v11 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v18);
if ( v11 )
{
if ( ButtonSprite::init_1(
(__int64)v11,
(__int64)"OK",
40,
0,
1061997773,
1,
"goldFont.fnt",
(__int64)"GJ_button_01.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v11);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v11 + 8LL))(v11, 1);
LODWORD(v11) = 0;
}
}
v12 = CCMenuItemSpriteExtra::create((int)v11, 0, a1, (__int64)sub_14009D628);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v12);
v18 = &v20;
v20 = 0;
v21 = 0;
v22 = 0;
*(_QWORD *)&v20 = sub_14003D460(0xC0u);
v21 = 189;
v22 = 191;
strcpy(
(char *)v20,
"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.");
v23 = 0;
v24 = 4;
v25 = 15;
strcpy((char *)&v23, "Help");
v13 = (__int64 *)InfoAlertButton::create(&v23, &v20);
(*(void (__fastcall **)(_QWORD, __int64 *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v13);
v14 = *v13;
v15 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v18,
(float)((float)(v26 * 0.5) - (float)(*(float *)(a1 + 732) * 0.5)) + 18.0,
(float)((float)(*(float *)(a1 + 736) * 0.5) + (float)(v27 * 0.5)) - 18.0);
cocos2d::CCNode::convertToNodeSpace(v15, v19, v16);
(*(void (__fastcall **)(__int64 *, __int64))(v14 + 184))(v13, v17);
*(_DWORD *)(a1 + 640) = -1;
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
return 1;
}
return result;
}