//
// SetupEventLinkPopup::init from 0x578284 to 0x578542 (702 bytes)
//
// 1 xrefs:
// > SetupEventLinkPopup::create @ 0x57860a
//
// 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 SetupEventLinkPopup::init(SetupEventLinkPopup *a1, EventLinkTrigger *a2, cocos2d::CCArray *a3)
{
_BOOL4 v4; // r10
cocos2d::CCDirector *v5; // r0
cocos2d::CCSprite *v6; // r4
CCMenuItemSpriteExtra *v7; // r4
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
cocos2d::CCMenu *m_buttonMenu; // [sp+34h] [bp-40h]
cocos2d::CCSize v11; // [sp+3Ch] [bp-38h] BYREF
cocos2d::CCPoint v12; // [sp+44h] [bp-30h] BYREF
cocos2d::CCPoint v13; // [sp+4Ch] [bp-28h] BYREF
cocos2d::CCPoint v14; // [sp+54h] [bp-20h] BYREF
cocos2d::CCPoint v15; // [sp+5Ch] [bp-18h] BYREF
cocos2d::CCPoint v16; // [sp+64h] [bp-10h] BYREF
v4 = SetupTriggerPopup::init(a1, a2, a3, 380.0, 280.0, 1);
if ( v4 )
{
SetupTriggerPopup::preSetup(a1);
sub_776584((int)&v16, "Event Link");
SetupTriggerPopup::addTitle((int)a1);
sub_774008(&v16);
sub_776584((int)&v16, "OK");
SetupTriggerPopup::addCloseButton((unsigned int)a1, (ButtonSprite **)&v16);
sub_774008(&v16);
sub_776584((int)&v15, "Help");
sub_776584(
(int)&v16,
"Activates Group ID upon a specified player action. Select one or multiple from the top right menu.\n"
"Extra ID makes the action only apply if the player interacts with a corresponding object, for example if M"
"aterial ID matches.\n"
"Extra ID2: 0 = All, 1 = P1, 2 = P2");
SetupTriggerPopup::addHelpButton((int)a1, (int)&v15, (int)&v16, 1065353216);
sub_774008(&v16);
sub_774008(&v15);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v11, v5);
cocos2d::CCPoint::CCPoint(&v12, v11.width * 0.5, v11.height * 0.5);
sub_776584((int)&v14, "Group ID:");
cocos2d::CCPoint::CCPoint(&v15, -80.0, 40.0);
cocos2d::CCPoint::operator+(&v16, &v12, &v15);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
51,
(int)&v14,
&v16,
(cocos2d::CCZone *)0x3F4CCCCD,
1,
Int,
10,
1,
nullptr,
9999.0,
0,
0,
0,
0,
0);
sub_774008(&v14);
sub_776584((int)&v14, "Extra ID:");
cocos2d::CCPoint::CCPoint(&v15, 80.0, 40.0);
cocos2d::CCPoint::operator+(&v16, &v12, &v15);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
447,
(int)&v14,
&v16,
(cocos2d::CCZone *)0x3F4CCCCD,
1,
Int,
10,
1,
nullptr,
9999.0,
0,
0,
0,
0,
0);
sub_774008(&v14);
sub_776584((int)&v14, "Extra ID2:");
cocos2d::CCPoint::CCPoint(&v15, 80.0, -40.0);
cocos2d::CCPoint::operator+(&v16, &v12, &v15);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
525,
(int)&v14,
&v16,
(cocos2d::CCZone *)0x3F4CCCCD,
1,
Int,
10,
1,
nullptr,
9999.0,
0,
0,
0,
0,
0);
sub_774008(&v14);
v6 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_menuBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v6->setScale)(v6, 1057803469);
LODWORD(v16.x) = SetupEventLinkPopup::onSelectEvent;
v16.y = 0.0;
v7 = CCMenuItemSpriteExtra::create(
v6,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SetupEventLinkPopup::onSelectEvent, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v7);
setPosition = v7->setPosition;
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v13, (float)(a1->m_width * 0.5) - 22.0, (float)(a1->m_height * 0.5) - 22.0);
cocos2d::CCPoint::operator+(&v14, &v12, &v13);
cocos2d::CCNode::convertToNodeSpace(&v15, m_buttonMenu, &v14);
setPosition(v7, &v15);
SetupTriggerPopup::postSetup(a1);
}
return v4;
}