//
// SetupTeleportPopup::init from 0x54a69c to 0x54b07a (2526 bytes)
//
// 1 xrefs:
// > SetupTeleportPopup::create @ 0x54b208
//
// 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 SetupTeleportPopup::init(SetupTeleportPopup *a1, TeleportPortalObject *a2, cocos2d::CCArray *a3, int a4, bool a5)
{
cocos2d::CCDirector *v6; // r0
int v7; // r9
cocos2d::CCLabelBMFont *v8; // r6
cocos2d::CCArray *v9; // r0
cocos2d::CCArray *v10; // r0
char *v11; // r1
cocos2d::CCMenu *m_buttonMenu; // r10
cocos2d::CCLayer *m_mainLayer; // r8
CCMenuItemToggler *v14; // r10
cocos2d::CCLabelBMFont *v15; // r7
int v16; // r2
bool v17; // r3
void (__fastcall *toggleGroup)(SetupTriggerPopup *__hidden, int, bool); // r5
_BOOL4 v19; // r2
void (__fastcall *v20)(SetupTriggerPopup *__hidden, int, bool); // r5
float v21; // r0
_BOOL4 v23; // [sp+34h] [bp-78h]
void *v25; // [sp+5Ch] [bp-50h] BYREF
_BYTE v26[4]; // [sp+60h] [bp-4Ch] BYREF
cocos2d::CCSize v27; // [sp+64h] [bp-48h] BYREF
cocos2d::CCPoint v28; // [sp+6Ch] [bp-40h] BYREF
_BYTE v29[8]; // [sp+74h] [bp-38h] BYREF
cocos2d::CCPoint v30; // [sp+7Ch] [bp-30h] BYREF
cocos2d::CCPoint v31; // [sp+84h] [bp-28h] BYREF
cocos2d::CCPoint v32; // [sp+8Ch] [bp-20h] BYREF
cocos2d::CCPoint v33; // [sp+94h] [bp-18h] BYREF
cocos2d::CCPoint v34; // [sp+9Ch] [bp-10h] BYREF
v23 = SetupTriggerPopup::init(a1, a2, a3, 420.0, 280.0, 1);
if ( v23 )
{
a1->determineStartValues(a1);
sub_776584((int)&v34, "Setup Teleport");
SetupTriggerPopup::addTitle((int)a1);
sub_774008(&v34);
sub_776584((int)&v34, "OK");
SetupTriggerPopup::addCloseButton((unsigned int)a1, (ButtonSprite **)&v34);
sub_774008(&v34);
sub_776584((int)&v33, "Help");
sub_776584(
(int)&v34,
"Teleports to an object using Target GroupID.\n"
"Smooth Ease makes the camera move slower.\n"
"Static Force lets you specify an exit force.\n"
"Redirect Force exits based on input force.\n"
"Save Offset keeps the offset from entering when exiting.\n"
"Redirect Dash will rotate the dash to the exit rotation in platformer mode.");
SetupTriggerPopup::addHelpButton((int)a1, (int)&v33, (int)&v34, 1065353216);
sub_774008(&v34);
sub_774008(&v33);
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v27, v6);
cocos2d::CCPoint::CCPoint(&v28, v27.width * 0.5, (float)(v27.height * 0.5) + 75.0);
sub_776584((int)&v32, "Target GroupID:");
cocos2d::CCPoint::CCPoint(&v33, 0.0, 0.0);
cocos2d::CCPoint::operator+(&v34, &v28, &v33);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
51,
(int)&v32,
&v34,
(cocos2d::CCZone *)0x3F333333,
1,
Uint,
6,
1,
nullptr,
0.0,
0,
0,
0,
2,
0);
sub_774008(&v32);
cocos2d::CCPoint::CCPoint(&v34, 130.0, 42.0);
cocos2d::CCPoint::operator+(v29, &v28, &v34);
sub_776584((int)&v32, "Smooth\nEase");
cocos2d::CCPoint::CCPoint(&v33, 0.0, 0.0);
cocos2d::CCPoint::operator+(&v34, v29, &v33);
SetupTriggerPopup::createToggleValueControl(a1, 55, (int)&v32, &v34, 0, 0, 0, 0.78);
sub_774008(&v32);
sub_776584((int)&v32, "Save\nOffset");
cocos2d::CCPoint::CCPoint(&v33, 0.0, -24.0);
cocos2d::CCPoint::operator+(&v34, v29, &v33);
SetupTriggerPopup::createToggleValueControl(a1, 351, (int)&v32, &v34, 0, 0, 0, 0.78);
sub_774008(&v32);
sub_776584((int)&v32, "Ignore X");
cocos2d::CCPoint::CCPoint(&v33, 0.0, -48.0);
cocos2d::CCPoint::operator+(&v34, v29, &v33);
SetupTriggerPopup::createToggleValueControl(a1, 352, (int)&v32, &v34, 0, 0, 0, 0.78);
sub_774008(&v32);
sub_776584((int)&v32, "Ignore Y");
cocos2d::CCPoint::CCPoint(&v33, 0.0, -72.0);
cocos2d::CCPoint::operator+(&v34, v29, &v33);
SetupTriggerPopup::createToggleValueControl(a1, 353, (int)&v32, &v34, 0, 0, 0, 0.78);
sub_774008(&v32);
sub_776584((int)&v32, "Instant\nCamera");
cocos2d::CCPoint::CCPoint(&v33, 0.0, -96.0);
cocos2d::CCPoint::operator+(&v34, v29, &v33);
SetupTriggerPopup::createToggleValueControl(a1, 464, (int)&v32, &v34, 0, 0, 0, 0.78);
sub_774008(&v32);
sub_776584((int)&v32, "Snap\nGround");
cocos2d::CCPoint::CCPoint(&v33, 0.0, -120.0);
cocos2d::CCPoint::operator+(&v34, v29, &v33);
SetupTriggerPopup::createToggleValueControl(a1, 510, (int)&v32, &v34, 0, 0, 0, 0.78);
sub_774008(&v32);
sub_776584((int)&v32, "Redirect\nDash");
cocos2d::CCPoint::CCPoint(&v33, 0.0, -144.0);
cocos2d::CCPoint::operator+(&v34, v29, &v33);
SetupTriggerPopup::createToggleValueControl(a1, 591, (int)&v32, &v34, 0, 0, 0, 0.78);
sub_774008(&v32);
if ( a4 != 3022 )
{
cocos2d::CCPoint::CCPoint(
&v33,
(float)(v27.width * 0.5) + 120.0,
(float)((float)(v27.height * 0.5) - (float)(a1->m_height * 0.5)) + 24.0);
if ( a5 )
{
sub_776584((int)&v32, "NO Multi\nActivate");
cocos2d::CCPoint::CCPoint(&v34, &v33);
SetupTriggerPopup::createToggleValueControl(a1, 444, (int)&v32, &v34, 0, 0, 0, 1.0);
}
else
{
sub_776584((int)&v32, "Multi\nActivate");
cocos2d::CCPoint::CCPoint(&v34, &v33);
SetupTriggerPopup::createToggleValueControl(a1, 99, (int)&v32, &v34, 0, 0, 0, 1.0);
}
sub_774008(&v32);
}
v7 = 1;
cocos2d::CCPoint::CCPoint(
&v30,
(float)(v27.width * 0.5) - 140.0,
(float)((float)(a1->m_height * 0.5) + (float)(v27.height * 0.5)) - 20.0);
v8 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v8->setScale)(v8, 1056964608);
a1->m_mainLayer->addChild(a1->m_mainLayer, v8);
v9 = (cocos2d::CCArray *)((int (__fastcall *)(cocos2d::CCLabelBMFont *, cocos2d::CCPoint *))v8->setPosition)(
v8,
&v30);
v10 = (cocos2d::CCArray *)cocos2d::CCArray::create(v9);
a1->m_teleportGravityToggles = v10;
cocos2d::CCObject::retain(v10);
do
{
v25 = &unk_ACDDA8;
if ( v7 == 1 )
{
v11 = "Normal";
}
else if ( v7 == 2 )
{
v11 = "Flipped";
}
else
{
v11 = "Toggle";
}
sub_7753D4((int)&v25, v11);
sub_775C20(v26);
m_buttonMenu = a1->m_buttonMenu;
LODWORD(v34.x) = SetupTeleportPopup::onTeleportGravity;
v34.y = 0.0;
cocos2d::CCPoint::CCPoint(&v31, -25.0, (float)(-25 * v7));
cocos2d::CCPoint::operator+(&v32, &v30, &v31);
m_mainLayer = a1->m_mainLayer;
cocos2d::CCPoint::CCPoint(&v33, 6.0, 0.0);
v14 = GameToolbox::createToggleButton(
(int)v26,
LODWORD(v34.x),
LODWORD(v34.y),
0,
m_buttonMenu,
&v32,
a1,
m_mainLayer,
0.6,
0.35,
60.0,
(int)&v33,
(int)"bigFont.fnt",
0,
0,
nullptr);
sub_774008(v26);
v14->m_notClickable = 1;
v14->setTag(v14, v7);
cocos2d::CCArray::addObject(a1->m_teleportGravityToggles, v14);
++v7;
sub_774008(&v25);
}
while ( v7 != 4 );
cocos2d::CCPoint::CCPoint(&v33, -25.0, -60.0);
cocos2d::CCPoint::operator+(&v31, &v28, &v33);
v15 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v15->setScale)(v15, 1056964608);
a1->m_mainLayer->addChild(a1->m_mainLayer, v15);
v15->setPosition(v15, &v31);
sub_776584((int)v26, "Static\nForce");
cocos2d::CCPoint::CCPoint(&v32, -80.0, -30.0);
cocos2d::CCPoint::operator+(&v33, &v31, &v32);
SetupTriggerPopup::createToggleValueControl(a1, 345, (int)v26, &v33, 0, 0, 0, 1.0);
sub_774008(v26);
sub_776584((int)v26, "Redirect\nForce");
cocos2d::CCPoint::CCPoint(&v32, 20.0, -30.0);
cocos2d::CCPoint::operator+(&v33, &v31, &v32);
SetupTriggerPopup::createToggleValueControl(a1, 347, (int)v26, &v33, 0, 0, 0, 1.0);
sub_774008(v26);
cocos2d::CCPoint::CCPoint(&v33, v27.width * 0.5, (float)(v27.height * 0.5) - 60.0);
cocos2d::CCPoint::operator=((PlayerObject *)&v28, COERCE_FLOAT(&v33), v16, v17);
sub_776584((int)v26, "Force:");
cocos2d::CCPoint::CCPoint(&v32, -50.0, 0.0);
cocos2d::CCPoint::operator+(&v33, &v28, &v32);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
346,
(int)v26,
&v33,
(cocos2d::CCZone *)0x3F19999A,
0,
Float,
6,
0,
nullptr,
30.0,
0,
1,
0,
2,
0);
sub_774008(v26);
sub_776584((int)v26, "Additive");
cocos2d::CCPoint::CCPoint(&v32, 50.0, 0.0);
cocos2d::CCPoint::operator+(&v33, &v28, &v32);
SetupTriggerPopup::createToggleValueControl(a1, 443, (int)v26, &v33, 0, 0, 1, 1.0);
sub_774008(v26);
sub_776584((int)v26, "Min:");
cocos2d::CCPoint::CCPoint(&v32, -120.0, 0.0);
cocos2d::CCPoint::operator+(&v33, &v28, &v32);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
348,
(int)v26,
&v33,
(cocos2d::CCZone *)0x3F19999A,
0,
Float,
6,
0,
nullptr,
10.0,
0,
2,
0,
2,
0);
sub_774008(v26);
sub_776584((int)v26, "Max:");
cocos2d::CCPoint::CCPoint(&v32, 0.0, 0.0);
cocos2d::CCPoint::operator+(&v33, &v28, &v32);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
349,
(int)v26,
&v33,
(cocos2d::CCZone *)0x3F19999A,
0,
Float,
6,
0,
nullptr,
30.0,
0,
2,
0,
2,
0);
sub_774008(v26);
sub_776584((int)v26, "Mod:");
cocos2d::CCPoint::CCPoint(&v32, 120.0, 0.0);
cocos2d::CCPoint::operator+(&v33, &v28, &v32);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
350,
(int)v26,
&v33,
(cocos2d::CCZone *)0x3F19999A,
0,
Float,
6,
0,
nullptr,
2.0,
0,
2,
0,
2,
0);
sub_774008(v26);
if ( a4 == 3022 )
SetupTriggerPopup::createMultiTriggerItemsDefaultHorizontal(a1);
a1->updateDefaultTriggerValues(a1);
toggleGroup = a1->toggleGroup;
v19 = COERCE_FLOAT(((int (__fastcall *)(SetupTeleportPopup *, int))a1->getValue)(a1, 345)) != 0.0;
toggleGroup(a1, 1, v19);
v20 = a1->toggleGroup;
v21 = COERCE_FLOAT(((int (__fastcall *)(SetupTeleportPopup *, int))a1->getValue)(a1, 347));
v20(a1, 2, v21 != 0.0);
a1->m_disableTextDelegate = 0;
}
return v23;
}