//
// SetupEndPopup::init from 0x505d2c to 0x506390 (1636 bytes)
//
// 1 xrefs:
// > SetupEndPopup::create @ 0x506450
//
// 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 SetupEndPopup::init(SetupEndPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
cocos2d::CCDirector *v4; // r0
cocos2d::CCLabelBMFont *v5; // r6
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
ButtonSprite *v7; // r0
CCMenuItemSpriteExtra *v8; // r0
CCMenuItemSpriteExtra *v9; // r7
cocos2d::CCMenu *m_buttonMenu; // r10
void (__fastcall *v11)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCLabelBMFont *v12; // r10
void (__fastcall *v13)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCNode *v14; // r6
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // r3
CCTextInputNode *v16; // r0
CCTextInputNode *m_groupIDInput; // r6
cocos2d::CCMenu *v18; // r1
cocos2d::CCSprite *v19; // r11
CCMenuItemSpriteExtra *v20; // r11
cocos2d::CCSprite *v21; // r11
CCMenuItemSpriteExtra *v22; // r11
void (__fastcall *v23)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r6
_BOOL4 m_multiActivate; // r8
_BOOL4 m_reversed; // r8
_BOOL4 m_lockY; // r7
int v29; // [sp+10h] [bp-9Ch]
_BOOL4 v30; // [sp+14h] [bp-98h]
void (__fastcall *v31)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+1Ch] [bp-90h]
cocos2d::ccColor3B v32; // [sp+24h] [bp-88h]
_BYTE v33[4]; // [sp+28h] [bp-84h] BYREF
cocos2d::CCSize v34; // [sp+2Ch] [bp-80h] BYREF
cocos2d::CCPoint v35; // [sp+34h] [bp-78h] BYREF
cocos2d::CCSize v36; // [sp+3Ch] [bp-70h] BYREF
cocos2d::CCPoint v37; // [sp+44h] [bp-68h] BYREF
cocos2d::CCPoint v38; // [sp+4Ch] [bp-60h] BYREF
cocos2d::CCPoint v39; // [sp+54h] [bp-58h] BYREF
int v40; // [sp+5Ch] [bp-50h]
int v41; // [sp+60h] [bp-4Ch]
void (*v42)(SetupEndPopup *, cocos2d::CCObject *); // [sp+64h] [bp-48h]
int v43; // [sp+68h] [bp-44h]
void (*v44)(SetupEndPopup *, cocos2d::CCObject *); // [sp+6Ch] [bp-40h]
int v45; // [sp+70h] [bp-3Ch]
void (*v46)(SetupEndPopup *, cocos2d::CCObject *); // [sp+74h] [bp-38h]
int v47; // [sp+78h] [bp-34h]
cocos2d::CCPoint v48; // [sp+7Ch] [bp-30h] BYREF
cocos2d::CCRect v49; // [sp+84h] [bp-28h] BYREF
cocos2d::CCRect v50; // [sp+94h] [bp-18h] BYREF
cocos2d::CCRect v51; // 0:r2.8,8:^0.8
v30 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 240.0, (int)&dword_0 + 1);
if ( v30 )
{
a1->determineStartValues(a1);
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v34, v4);
v5 = cocos2d::CCLabelBMFont::create();
a1->addChild(a1, v5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v5->setScale)(v5, 1060320051);
setPosition = v5->setPosition;
cocos2d::CCPoint::CCPoint(
&v50.origin,
v34.width * 0.5,
(float)((float)(a1->m_height * 0.5) + (float)(v34.height * 0.5)) - 18.0);
setPosition(v5, &v50.origin);
v7 = ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&word_28,
0,
0.8,
(_BOOL4)&dword_0 + 1,
"goldFont.fnt",
"GJ_button_01.png",
COERCE_CONST_CHAR_(30.0),
*(float *)&a2);
v40 = 660;
v41 = 1;
v8 = CCMenuItemSpriteExtra::create(v7, nullptr, (cocos2d::SEL_MenuHandler)((unsigned int)a1 | 0x29400000000LL));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v8);
sub_776584((int)&v49, "Help");
sub_776584(
(int)&v50,
"Sets a specific object given by Group ID to be the end of the level when the game type is Classic."
" This essentially spawns the endwall at a set location.\n"
"Use Reversed if gameplay is reverse at the end.\n"
"Lock Y locks the endwall to the ground instead of the group's Y position.");
v9 = InfoAlertButton::create((int)&v49, (int)&v50, 1065353216);
sub_774008(&v50);
sub_774008(&v49);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v9);
m_buttonMenu = a1->m_buttonMenu;
v11 = v9->setPosition;
cocos2d::CCPoint::CCPoint(
&v49.origin,
(float)((float)(v34.width * 0.5) - (float)(a1->m_width * 0.5)) + 18.0,
(float)((float)(a1->m_height * 0.5) + (float)(v34.height * 0.5)) - 18.0);
cocos2d::CCNode::convertToNodeSpace(&v50.origin, m_buttonMenu, &v49.origin);
v11(v9, &v50.origin);
cocos2d::CCPoint::CCPoint(&v35, v34.width * 0.5, (float)(v34.height * 0.5) + 30.0);
v12 = cocos2d::CCLabelBMFont::create();
a1->addChild(a1, v12);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v12->setScale)(v12, 1060320051);
v13 = v12->setPosition;
cocos2d::CCPoint::CCPoint(&v49.origin, 0.0, 34.0);
cocos2d::CCPoint::operator+(&v50, &v35, &v49);
v13(v12, &v50.origin);
cocos2d::CCRect::CCRect(&v49, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v50, &v49);
v14 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02b_small.png",
(const char *)&v50,
v51);
((void (__fastcall *)(cocos2d::CCNode *, int))v14->__vftable[1].~CCNode_0)(v14, 100);
getTag = v14->__vftable[1].getTag;
LOWORD(v50.origin.x) = 0;
BYTE2(v50.origin.x) = 0;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))getTag)(v14, &v50);
cocos2d::CCSize::CCSize(&v36, 50.0, 30.0);
v14->setContentSize(v14, &v36);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v14, -1);
v14->setPosition(v14, &v35);
v16 = CCTextInputNode::create(50.0, 40.0, "Num", "Thonburi");
a1->m_groupIDInput = v16;
((void (__fastcall *)(cocos2d::CCLayer *, CCTextInputNode *, int, void (__fastcall *)(cocos2d::CCNode *__hidden, cocos2d::CCNode *, int), int *, const char *))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v16,
20,
a1->m_mainLayer->addChild_0,
&dword_18,
"bigFont.fnt");
a1->m_groupIDInput->setPosition(a1->m_groupIDInput, &v35);
CCTextInputNode::setMaxLabelScale(a1->m_groupIDInput, 0.6);
CCTextInputNode::setMaxLabelWidth(a1->m_groupIDInput, 200.0);
a1->m_groupIDInput->m_textField->setVisible(a1->m_groupIDInput->m_textField, 0);
m_groupIDInput = a1->m_groupIDInput;
m_groupIDInput->m_maxLabelLength = 6;
sub_776584((int)&v50, "0123456789");
CCTextInputNode::setAllowedChars((int)m_groupIDInput, (int)&v50);
sub_774008(&v50);
*(_WORD *)&v32.r = -21896;
v32.b = -16;
CCTextInputNode::setLabelPlaceholderColor(a1->m_groupIDInput, v32);
CCTextInputNode::setLabelPlaceholderScale(a1->m_groupIDInput, 0.5);
a1->m_groupIDInput->m_delegate = &a1->TextInputDelegate;
v18 = a1->m_buttonMenu;
a1->m_groupIDInput->m_numberInput = 1;
cocos2d::CCNode::convertToNodeSpace(&v37, v18, &v35);
v19 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v19->setScale)(v19, 1066192077);
v43 = 0;
v42 = SetupEndPopup::onTargetIDArrow;
v20 = CCMenuItemSpriteExtra::create(
v19,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SetupEndPopup::onTargetIDArrow, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v20);
v20->setTag(v20, 1);
v31 = v20->setPosition;
cocos2d::CCPoint::CCPoint(&v48, -50.0, 0.0);
cocos2d::CCPoint::operator+(&v50, &v37, &v48);
v31(v20, &v50.origin);
CCMenuItemSpriteExtra::setSizeMult(v20, 2.0);
v21 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v21->setScale)(v21, 1066192077);
v44 = SetupEndPopup::onTargetIDArrow;
v45 = 0;
v22 = CCMenuItemSpriteExtra::create(
v21,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SetupEndPopup::onTargetIDArrow, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v22);
v22->setTag(v22, 2);
v23 = v22->setPosition;
cocos2d::CCPoint::CCPoint(&v48, 50.0, 0.0);
cocos2d::CCPoint::operator+(&v50, &v37, &v48);
v23(v22, &v50.origin);
CCMenuItemSpriteExtra::setSizeMult(v22, 2.0);
SetupEndPopup::updateTextInputLabel(a1);
cocos2d::CCPoint::CCPoint(
&v38,
(float)((float)(v34.width * 0.5) - (float)(a1->m_width * 0.5)) + 20.0,
(float)((float)(v34.height * 0.5) - (float)(a1->m_height * 0.5)) + 60.0);
if ( v29 && (*(int (__fastcall **)(int))(*(_DWORD *)v29 + 892))(v29) == 36 )
{
if ( (*(int (__fastcall **)(int))(*(_DWORD *)v29 + 892))(v29) == 36 )
{
sub_776584((int)&v39, "Multi\nActivate");
v47 = 0;
m_multiActivate = a1->m_multiActivate;
v46 = SetupEndPopup::onMultiActivate;
cocos2d::CCPoint::CCPoint(&v48, 0.0, -35.0);
cocos2d::CCPoint::operator+(&v50, &v38, &v48);
SetupTriggerPopup::createToggleButton(a1, &v39, v46, v47, m_multiActivate, &v50);
sub_774008(&v39);
}
}
else
{
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
}
sub_776584((int)&v39, "Reversed");
m_reversed = a1->m_reversed;
LODWORD(v48.x) = SetupEndPopup::onReversed;
v48.y = 0.0;
cocos2d::CCPoint::CCPoint(&v50.origin, (float)(v34.width * 0.5) - 50.0, (float)(v34.height * 0.5) - 20.0);
SetupTriggerPopup::createToggleButton(a1, &v39, LODWORD(v48.x), LODWORD(v48.y), m_reversed, &v50);
sub_774008(&v39);
sub_776584((int)v33, "Lock Y");
m_lockY = a1->m_lockY;
LODWORD(v50.origin.x) = SetupEndPopup::onLockY;
v50.origin.y = 0.0;
cocos2d::CCPoint::CCPoint(&v39, (float)(v34.width * 0.5) + 50.0, (float)(v34.height * 0.5) - 20.0);
SetupTriggerPopup::createToggleButton(a1, v33, LODWORD(v50.origin.x), LODWORD(v50.origin.y), m_lockY, &v39);
sub_774008(v33);
a1->m_disableTextDelegate = 0;
}
return v30;
}