//
// SetupEndPopup::init from 0x1002ad0fc to 0x1002ad8c8 (1996 bytes)
//
// 1 xrefs:
// > SetupEndPopup::create @ 0x1002ad0ac
//
// 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 __fastcall SetupEndPopup::init(SetupEndPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
_BOOL4 v5; // w20
cocos2d::CCDirector *v6; // x0
cocos2d::CCLabelBMFont *v7; // x23
__n128 v8; // q0
__n128 v9; // q1
ButtonSprite *v10; // x0
CCMenuItemSpriteExtra *v11; // x0
char *v12; // x22
__n128 v13; // q0
cocos2d::CCMenu *m_buttonMenu; // x23
__n128 v15; // q1
__n128 v16; // q0
__n128 v17; // q1
cocos2d::CCLabelBMFont *v18; // x22
__n128 v19; // q0
__n128 v20; // q1
double v21; // d0
double v22; // d0
cocos2d::extension::CCScale9Sprite *v23; // x22
CCTextInputNode *v24; // x0
CCTextInputNode *m_groupIDInput; // x22
CCTextInputNode *v26; // x8
cocos2d::CCSprite *v27; // x23
CCMenuItemSpriteExtra *v28; // x23
__n128 v29; // q0
__n128 v30; // q1
double v31; // d0
cocos2d::CCSprite *v32; // x23
CCMenuItemSpriteExtra *v33; // x22
__n128 v34; // q0
__n128 v35; // q1
double v36; // d0
__n128 v37; // q0
__n128 v38; // q1
bool m_multiActivate; // w21
__n128 v40; // q1
__n128 v41; // q0
bool m_reversed; // w21
__n128 v43; // q0
__n128 v44; // q1
bool m_lockY; // w21
__n128 v46; // q0
__n128 v47; // q1
float v49; // s1
float v50; // s2
float v51; // s3
void *v52[2]; // [xsp+0h] [xbp-120h] BYREF
char v53; // [xsp+17h] [xbp-109h]
void *v54[2]; // [xsp+18h] [xbp-108h] BYREF
char v55; // [xsp+2Fh] [xbp-F1h]
float32x2_t v56; // [xsp+30h] [xbp-F0h] BYREF
void *v57[2]; // [xsp+38h] [xbp-E8h] BYREF
char v58; // [xsp+4Fh] [xbp-D1h]
float32x2_t v59; // [xsp+50h] [xbp-D0h] BYREF
float32x2_t v60; // [xsp+58h] [xbp-C8h] BYREF
float32x2_t v61; // [xsp+60h] [xbp-C0h] BYREF
std::string __p; // [xsp+68h] [xbp-B8h] BYREF
float32x2_t v63[2]; // [xsp+80h] [xbp-A0h] BYREF
float32x2_t v64[2]; // [xsp+90h] [xbp-90h] BYREF
float32x2_t v65; // [xsp+A0h] [xbp-80h] BYREF
void *v66[2]; // [xsp+A8h] [xbp-78h] BYREF
char v67; // [xsp+BFh] [xbp-61h]
void *v68[2]; // [xsp+C0h] [xbp-60h] BYREF
char v69; // [xsp+D7h] [xbp-49h]
float v70; // [xsp+D8h] [xbp-48h]
float v71; // [xsp+DCh] [xbp-44h]
cocos2d::CCPoint v72; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v73; // 0:x3.16
cocos2d::SEL_MenuHandler v74; // 0:x3.16
cocos2d::SEL_MenuHandler v75; // 0:x3.16
cocos2d::CCRect v76; // 0:kr20_16.16
v5 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 240.0, 1);
if ( v5 )
{
((void (__fastcall *)(SetupEndPopup *))a1->determineStartValues)(a1);
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v6);
v7 = cocos2d::CCLabelBMFont::create_1("End Trigger", "goldFont.fnt");
((void (__fastcall *)(SetupEndPopup *, cocos2d::CCLabelBMFont *))a1->addChild)(a1, v7);
v8 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v7->setScale)(v7, 0.7);
v8.n128_f32[0] = v70 * 0.5;
v9.n128_f32[0] = (float)((float)(v71 * 0.5) + (float)(a1->m_height * 0.5)) + -18.0;
sub_100022980(v8, v9, v64);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v7->setPosition)(v7, v64);
v10 = ButtonSprite::create_1("OK", 40, 0, 0.8, 1, "goldFont.fnt", "GJ_button_01.png", 30.0);
v73.ptr = (void (__cdecl *)(cocos2d::CCObject *))1320;
v73.adj = 1;
v11 = CCMenuItemSpriteExtra::create(v10, nullptr, a1, v73);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v11);
sub_100009900(v68, "Help");
sub_100009900(
v66,
"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.");
v12 = InfoAlertButton::create((__int64)v68, (__int64)v66, 1.0);
if ( v67 < 0 )
operator delete(v66[0]);
if ( v69 < 0 )
operator delete(v68[0]);
v13 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, char *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v12);
m_buttonMenu = a1->m_buttonMenu;
v13.n128_f32[0] = (float)((float)(v70 * 0.5) - (float)(a1->m_width * 0.5)) + 18.0;
v15.n128_f32[0] = (float)((float)(v71 * 0.5) + (float)(a1->m_height * 0.5)) + -18.0;
sub_100022980(v13, v15, v63);
v72 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, (const cocos2d::CCPoint *)v63);
v16 = ((__n128 (__fastcall *)(char *, float32x2_t *, float, float))*(_QWORD *)(*(_QWORD *)v12 + 184LL))(
v12,
v64,
v72.x,
v72.y);
v16.n128_f32[0] = v70 * 0.5;
v17.n128_f32[0] = (float)(v71 * 0.5) + 30.0;
sub_100022980(v16, v17, &v65);
v18 = cocos2d::CCLabelBMFont::create_1("Group ID", "goldFont.fnt");
((void (__fastcall *)(SetupEndPopup *, cocos2d::CCLabelBMFont *))a1->addChild)(a1, v18);
v19 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v18->setScale)(v18, 0.7);
v20.n128_u32[0] = 1107820544;
v19.n128_u32[0] = 0;
sub_100022980(v19, v20, v63);
*(float32x2_t *)&v21 = sub_1000229DC(&v65, v63, v64);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *, double))v18->setPosition)(v18, v64, v21);
sub_100022990((float *)v64, 0.0, 0.0, 40.0, 40.0);
v22 = sub_100022B98(v63, (__int64)v64);
v76.origin.x = *(float *)&v22;
v76.origin.y = v49;
v76.size.width = v50;
v76.size.height = v51;
v23 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v76);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v23->setOpacity)(v23, 100);
v63[0].i8[2] = 0;
v63[0].i16[0] = 0;
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v23->setColor)(v23, v63);
sub_100022988((float *)v63, 50.0, 30.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v23->setContentSize)(v23, v63);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v23,
0xFFFFFFFFLL);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v23->setPosition)(v23, &v65);
v24 = CCTextInputNode::create(50.0, 40.0, "Num", "Thonburi", 24, "bigFont.fnt");
a1->m_groupIDInput = v24;
((void (__fastcall *)(cocos2d::CCLayer *, CCTextInputNode *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v24,
20);
((void (__fastcall *)(CCTextInputNode *, float32x2_t *))a1->m_groupIDInput->setPosition)(a1->m_groupIDInput, &v65);
CCTextInputNode::setMaxLabelScale(a1->m_groupIDInput, 0.6);
CCTextInputNode::setMaxLabelWidth(a1->m_groupIDInput, 200.0);
((void (__fastcall *)(cocos2d::CCTextFieldTTF *, _QWORD))a1->m_groupIDInput->m_textField->setVisible)(
a1->m_groupIDInput->m_textField,
0);
m_groupIDInput = a1->m_groupIDInput;
m_groupIDInput->m_maxLabelLength = 6;
sub_100009900(&__p, "0123456789");
CCTextInputNode::setAllowedChars((std::string *)m_groupIDInput, &__p);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
CCTextInputNode::setLabelPlaceholderColor(a1->m_groupIDInput, (cocos2d::ccColor3B)-1004936);
CCTextInputNode::setLabelPlaceholderScale(a1->m_groupIDInput, 0.5);
v26 = a1->m_groupIDInput;
v26->m_delegate = &a1->TextInputDelegate;
v26->m_numberInput = 1;
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const cocos2d::CCPoint *)&v65);
v27 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v27->setScale)(v27, 1.1);
v74.ptr = (void (__cdecl *)(cocos2d::CCObject *))SetupEndPopup::onTargetIDArrow;
v74.adj = 0;
v28 = CCMenuItemSpriteExtra::create(v27, nullptr, a1, v74);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v28);
v29 = ((__n128 (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v28->setTag)(v28, 1);
v29.n128_u32[0] = -1035468800;
v30.n128_u32[0] = 0;
sub_100022980(v29, v30, &v59);
*(float32x2_t *)&v31 = sub_1000229DC(&v61, &v59, &v60);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v28->setPosition)(v28, &v60, v31);
CCMenuItemSpriteExtra::setSizeMult(v28, 2.0);
v32 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v32->setScale)(v32, 1.1);
v75.ptr = (void (__cdecl *)(cocos2d::CCObject *))SetupEndPopup::onTargetIDArrow;
v75.adj = 0;
v33 = CCMenuItemSpriteExtra::create(v32, nullptr, a1, v75);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v33);
v34 = ((__n128 (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v33->setTag)(v33, 2);
v34.n128_u32[0] = 1112014848;
v35.n128_u32[0] = 0;
sub_100022980(v34, v35, &v59);
*(float32x2_t *)&v36 = sub_1000229DC(&v61, &v59, &v60);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v33->setPosition)(v33, &v60, v36);
CCMenuItemSpriteExtra::setSizeMult(v33, 2.0);
SetupEndPopup::updateTextInputLabel(a1);
v37.n128_f32[0] = (float)((float)(v70 * 0.5) - (float)(a1->m_width * 0.5)) + 20.0;
v38.n128_f32[0] = (float)((float)(v71 * 0.5) - (float)(a1->m_height * 0.5)) + 60.0;
sub_100022980(v37, v38, &v60);
if ( a2 && ((unsigned int (__fastcall *)(EffectGameObject *))a2->getType)(a2) == 36 )
{
if ( ((unsigned int (__fastcall *)(EffectGameObject *))a2->getType)(a2) == 36 )
{
sub_100009900(v57, "Multi\nActivate");
m_multiActivate = a1->m_multiActivate;
v40.n128_u32[0] = -1039400960;
v41.n128_u32[0] = 0;
sub_100022980(v41, v40, &v56);
sub_1000229DC(&v60, &v56, &v59);
SetupTriggerPopup::createToggleButton(
(__int64)a1,
(__int64)v57,
(void (__cdecl *)(cocos2d::CCObject *))SetupEndPopup::onMultiActivate,
0,
m_multiActivate,
(__int64 *)&v59);
if ( v58 < 0 )
operator delete(v57[0]);
}
}
else
{
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
}
sub_100009900(v54, "Reversed");
m_reversed = a1->m_reversed;
v43.n128_f32[0] = (float)(v70 * 0.5) + -50.0;
v44.n128_f32[0] = (float)(v71 * 0.5) + -20.0;
sub_100022980(v43, v44, &v59);
SetupTriggerPopup::createToggleButton(
(__int64)a1,
(__int64)v54,
(void (__cdecl *)(cocos2d::CCObject *))SetupEndPopup::onReversed,
0,
m_reversed,
(__int64 *)&v59);
if ( v55 < 0 )
operator delete(v54[0]);
sub_100009900(v52, "Lock Y");
m_lockY = a1->m_lockY;
v46.n128_f32[0] = (float)(v70 * 0.5) + 50.0;
v47.n128_f32[0] = (float)(v71 * 0.5) + -20.0;
sub_100022980(v46, v47, &v59);
SetupTriggerPopup::createToggleButton(
(__int64)a1,
(__int64)v52,
(void (__cdecl *)(cocos2d::CCObject *))SetupEndPopup::onLockY,
0,
m_lockY,
(__int64 *)&v59);
if ( v53 < 0 )
operator delete(v52[0]);
a1->m_disableTextDelegate = 0;
}
return v5;
}