//
// SetupObjectTogglePopup::init from 0x8e92d8 to 0x8e9f48 (3184 bytes)
//
// 2 xrefs:
// > SetupObjectTogglePopup::create @ 0x8ea104
// > ??> @ 0xbf2e0
//
// 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 SetupObjectTogglePopup::init(SetupObjectTogglePopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3, bool a4)
{
bool v6; // w26
EffectGameObject *m_gameObject; // x0
void *v9; // x0
void *v10; // x0
cocos2d::CCPoint v11; // x1
void *v12; // x0
unsigned int *v13; // x1
int v14; // w2
void *v15; // x0
void *v16; // x0
void *v17; // x0
cocos2d::CCDirector *v18; // x0
float v19; // s3
float v20; // s4
void *v21; // x0
float v22; // s2
void *v23; // x0
char *v24; // x1
void *v25; // x0
void *v26; // x0
void *v27; // x0
unsigned int *v28; // x1
float v29; // s2
cocos2d::CCPoint v30; // x1
void *v31; // x0
float v32; // s2
void *v33; // x0
float v34; // s2
void *v35; // x0
unsigned int *v36; // x1
int v37; // w2
float v38; // s2
unsigned int *v39; // x1
int v40; // w2
unsigned int *v41; // x1
int v42; // w2
unsigned int *v43; // x20
int v44; // w1
unsigned int *v45; // x1
int v46; // w2
unsigned int *v47; // x1
int v48; // w2
unsigned int *v49; // x1
int v50; // w2
unsigned int *v51; // x1
int v52; // w2
unsigned int *v53; // x1
int v54; // w2
unsigned int *v55; // x1
int v56; // w2
unsigned int *v57; // x1
unsigned int *v58; // x1
int v59; // w2
unsigned int *v60; // x1
int v61; // w2
unsigned int *v62; // x1
int v63; // w2
unsigned int *v64; // x1
_QWORD v65[2]; // [xsp+30h] [xbp+0h] BYREF
_BOOL4 v66; // [xsp+ACh] [xbp+7Ch]
float v67; // [xsp+B8h] [xbp+88h]
float v68; // [xsp+BCh] [xbp+8Ch]
cocos2d::CCPoint v69; // [xsp+C0h] [xbp+90h] BYREF
cocos2d::CCPoint v70; // [xsp+C8h] [xbp+98h] BYREF
cocos2d::CCPoint v71; // [xsp+D0h] [xbp+A0h] BYREF
cocos2d::CCPoint v72; // [xsp+D8h] [xbp+A8h] BYREF
cocos2d::CCPoint v73; // [xsp+E0h] [xbp+B0h] BYREF
cocos2d::CCPoint v74; // 0:s0.4,4:s1.4
cocos2d::CCPoint v75; // 0:s0.4,4:s1.4
cocos2d::CCPoint v76; // 0:s0.4,4:s1.4
cocos2d::CCPoint v77; // 0:s0.4,4:s1.4
cocos2d::CCPoint v78; // 0:s0.4,4:s1.4
cocos2d::CCPoint v79; // 0:s0.4,4:s1.4
v66 = a4;
v6 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 240.0, 1);
if ( !v6 )
return v6;
SetupTriggerPopup::preSetup(a1);
m_gameObject = a1->m_gameObject;
if ( m_gameObject && m_gameObject->m_objectID == 1812 )
{
sub_D153B8((int)&v73, "On Death Trigger");
SetupTriggerPopup::addTitle(a1, (std::string)&v73);
v15 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v60 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v61 = __ldaxr(v60);
while ( __stlxr(v61 - 1, v60) );
}
else
{
v61 = *(_DWORD *)(*(_QWORD *)&v73 - 8LL);
*(_DWORD *)(*(_QWORD *)&v73 - 8LL) = v61 - 1;
}
if ( v61 <= 0 )
operator delete(v15);
}
sub_D153B8((int)&v72, "Help");
sub_D153B8(
(unsigned int)v65 + 176,
"Works like a Toggle + Spawn trigger that is activated upon player death.\n"
"Disable using a Stop trigger.");
SetupTriggerPopup::addHelpButton(a1, (std::string)&v72, (std::string)&v73, 1.0);
v16 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v58 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v59 = __ldaxr(v58);
while ( __stlxr(v59 - 1, v58) );
}
else
{
v59 = *(_DWORD *)(*(_QWORD *)&v73 - 8LL);
*(_DWORD *)(*(_QWORD *)&v73 - 8LL) = v59 - 1;
}
if ( v59 <= 0 )
operator delete(v16);
}
v11 = v72;
v12 = (void *)(*(_QWORD *)&v72 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v72 - 24LL) == &qword_124B6B0 )
goto LABEL_17;
if ( !&pthread_create )
goto LABEL_95;
v57 = (unsigned int *)(*(_QWORD *)&v72 - 8LL);
do
v14 = __ldaxr(v57);
while ( __stlxr(v14 - 1, v57) );
LABEL_33:
if ( v14 <= 0 )
operator delete(v12);
goto LABEL_17;
}
if ( a2 && a2->getType(a2) == CustomRing )
{
if ( a2->m_objectID == 3643 )
v24 = "Toggle Block";
else
v24 = "Toggle Orb";
sub_D153B8((int)&v70, v24);
sub_D18D28(&v71);
SetupTriggerPopup::addTitle(a1, (std::string)&v71);
v25 = (void *)(*(_QWORD *)&v71 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v71 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v51 = (unsigned int *)(*(_QWORD *)&v71 - 8LL);
do
v52 = __ldaxr(v51);
while ( __stlxr(v52 - 1, v51) );
}
else
{
v52 = *(_DWORD *)(*(_QWORD *)&v71 - 8LL);
*(_DWORD *)(*(_QWORD *)&v71 - 8LL) = v52 - 1;
}
if ( v52 <= 0 )
operator delete(v25);
}
sub_D153B8((int)&v72, "Help");
sub_D153B8(
(int)&v73,
"Disables Group ID if the player clicks within the hitbox.\n"
"Use Activate Group to activate and spawn instead.\n"
"Claim Touch disables player jump, rings, and click buffering.\n"
"Spawn Only makes the group spawn and not toggle on or off.");
SetupTriggerPopup::addHelpButton(a1, (std::string)&v72, (std::string)&v73, 1.0);
v26 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v53 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v54 = __ldaxr(v53);
while ( __stlxr(v54 - 1, v53) );
}
else
{
v54 = *(_DWORD *)(*(_QWORD *)&v73 - 8LL);
*(_DWORD *)(*(_QWORD *)&v73 - 8LL) = v54 - 1;
}
if ( v54 <= 0 )
operator delete(v26);
}
v27 = (void *)(*(_QWORD *)&v72 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v72 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v49 = (unsigned int *)(*(_QWORD *)&v72 - 8LL);
do
v50 = __ldaxr(v49);
while ( __stlxr(v50 - 1, v49) );
}
else
{
v50 = *(_DWORD *)(*(_QWORD *)&v72 - 8LL);
*(_DWORD *)(*(_QWORD *)&v72 - 8LL) = v50 - 1;
}
if ( v50 <= 0 )
operator delete(v27);
}
v11 = v70;
v12 = (void *)(*(_QWORD *)&v70 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v70 - 24LL) == &qword_124B6B0 )
goto LABEL_17;
if ( !&pthread_create )
goto LABEL_95;
v28 = (unsigned int *)(*(_QWORD *)&v70 - 8LL);
do
v14 = __ldaxr(v28);
while ( __stlxr(v14 - 1, v28) );
goto LABEL_33;
}
sub_D153B8((int)&v73, "Toggle Group");
SetupTriggerPopup::addTitle(a1, (std::string)&v73);
v9 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *(_DWORD *)(*(_QWORD *)&v73 - 8LL);
*(_DWORD *)(*(_QWORD *)&v73 - 8LL) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v9);
}
sub_D153B8((int)&v72, "Help");
sub_D153B8(
(unsigned int)v65 + 176,
"Toggles off a group of objects.\n"
"Use Activate Group to toggle on instead.\n"
"Objects that are toggled off are invisible and untouchable.\n"
"Triggers that are toggled off do not activate.");
SetupTriggerPopup::addHelpButton(a1, (std::string)&v72, (std::string)&v73, 1.0);
v10 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v62 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v63 = __ldaxr(v62);
while ( __stlxr(v63 - 1, v62) );
}
else
{
v63 = *(_DWORD *)(*(_QWORD *)&v73 - 8LL);
*(_DWORD *)(*(_QWORD *)&v73 - 8LL) = v63 - 1;
}
if ( v63 <= 0 )
operator delete(v10);
}
v11 = v72;
v12 = (void *)(*(_QWORD *)&v72 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v72 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(*(_QWORD *)&v72 - 8LL);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
goto LABEL_33;
}
LABEL_95:
v14 = *(_DWORD *)(*(_QWORD *)&v11 - 8LL);
*(_DWORD *)(*(_QWORD *)&v11 - 8LL) = v14 - 1;
goto LABEL_33;
}
LABEL_17:
sub_D153B8((int)&v73, "OK");
SetupTriggerPopup::addCloseButton(a1, (std::string)&v73);
v17 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v45 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v46 = __ldaxr(v45);
while ( __stlxr(v46 - 1, v45) );
}
else
{
v46 = *(_DWORD *)(*(_QWORD *)&v73 - 8LL);
*(_DWORD *)(*(_QWORD *)&v73 - 8LL) = v46 - 1;
}
if ( v46 <= 0 )
operator delete(v17);
}
v18 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v18);
cocos2d::CCPoint::CCPoint(&v69, v67 * 0.5, (float)(v68 * 0.5) + 30.0);
sub_D153B8((int)&v72, "Group ID");
cocos2d::CCPoint::CCPoint(&v73, &v69);
v74.y = 0.0;
v74.x = 0.9;
SetupTriggerPopup::createValueControlAdvanced(
a1,
51,
(std::string)&v72,
v74,
100.0,
(bool)&v73,
Float,
3,
6,
v19,
v20,
1,
0,
GoldLabel,
0,
2,
0);
v21 = (void *)(*(_QWORD *)&v72 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v72 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v47 = (unsigned int *)(*(_QWORD *)&v72 - 8LL);
do
v48 = __ldaxr(v47);
while ( __stlxr(v48 - 1, v47) );
}
else
{
v48 = *(_DWORD *)(*(_QWORD *)&v72 - 8LL);
*(_DWORD *)(*(_QWORD *)&v72 - 8LL) = v48 - 1;
}
if ( v48 <= 0 )
operator delete(v21);
}
cocos2d::CCPoint::CCPoint(
&v70,
20.0 - (float)((float)(a1->m_width * 0.5) - (float)(v67 * 0.5)),
60.0 - (float)((float)(a1->m_height * 0.5) - (float)(v68 * 0.5)));
if ( a2 && a2->getType(a2) == CustomRing )
{
if ( a2->getType(a2) != CustomRing )
goto LABEL_22;
if ( v66 )
{
sub_D153B8((int)&v73, "NO Multi\nActivate");
cocos2d::CCPoint::CCPoint(&v71, 0.0, -35.0);
cocos2d::CCPoint::operator+(&v72, &v70, &v71);
v76.x = 1.0;
SetupTriggerPopup::createToggleValueControl(a1, 444, (std::string)&v73, v76, (bool)&v72, 0, 0, v29);
v30 = v73;
v31 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) == &qword_124B6B0 )
goto LABEL_38;
if ( &pthread_create )
{
v64 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v40 = __ldaxr(v64);
while ( __stlxr(v40 - 1, v64) );
goto LABEL_49;
}
}
else
{
sub_D153B8((int)&v73, "Multi\nActivate");
cocos2d::CCPoint::CCPoint(&v71, 0.0, -35.0);
cocos2d::CCPoint::operator+(&v72, &v70, &v71);
v79.x = 1.0;
SetupTriggerPopup::createToggleValueControl(a1, 99, (std::string)&v73, v79, (bool)&v72, 0, 0, v38);
v30 = v73;
v31 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) == &qword_124B6B0 )
{
LABEL_38:
sub_D153B8((int)&v73, "Claim Touch");
cocos2d::CCPoint::CCPoint(&v71, 0.0, 0.0);
cocos2d::CCPoint::operator+(&v72, &v70, &v71);
v77.x = 1.0;
SetupTriggerPopup::createToggleValueControl(a1, 445, (std::string)&v73, v77, (bool)&v72, 0, 0, v32);
v33 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v55 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v56 = __ldaxr(v55);
while ( __stlxr(v56 - 1, v55) );
}
else
{
v56 = *(_DWORD *)(*(_QWORD *)&v73 - 8LL);
*(_DWORD *)(*(_QWORD *)&v73 - 8LL) = v56 - 1;
}
if ( v56 <= 0 )
operator delete(v33);
}
sub_D153B8((int)&v73, "Spawn\nOnly");
cocos2d::CCPoint::CCPoint(
&v72,
(float)((float)(a1->m_width * 0.5) + (float)(v67 * 0.5)) - 65.0,
(float)(60.0 - (float)((float)(a1->m_height * 0.5) - (float)(v68 * 0.5))) - 35.0);
v78.x = 1.0;
SetupTriggerPopup::createToggleValueControl(a1, 504, (std::string)&v73, v78, (bool)&v72, 0, 0, v34);
v35 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v36 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *(_DWORD *)(*(_QWORD *)&v73 - 8LL);
*(_DWORD *)(*(_QWORD *)&v73 - 8LL) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(v35);
}
goto LABEL_22;
}
if ( &pthread_create )
{
v39 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
LABEL_49:
if ( v40 <= 0 )
operator delete(v31);
goto LABEL_38;
}
}
v40 = *(_DWORD *)(*(_QWORD *)&v30 - 8LL);
*(_DWORD *)(*(_QWORD *)&v30 - 8LL) = v40 - 1;
goto LABEL_49;
}
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
LABEL_22:
sub_D153B8((int)&v73, "Activate Group");
cocos2d::CCPoint::CCPoint(&v72, (float)(v67 * 0.5) + -50.0, (float)(v68 * 0.5) + -20.0);
v75.x = 1.0;
SetupTriggerPopup::createToggleValueControl(a1, 56, (std::string)&v73, v75, (bool)&v72, 0, 0, v22);
v23 = (void *)(*(_QWORD *)&v73 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v73 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v43 = (unsigned int *)(*(_QWORD *)&v73 - 8LL);
do
v44 = __ldaxr(v43);
while ( __stlxr(v44 - 1, v43) );
}
else
{
v44 = *(_DWORD *)(*(_QWORD *)&v73 - 8LL);
*(_DWORD *)(*(_QWORD *)&v73 - 8LL) = v44 - 1;
}
if ( v44 <= 0 )
operator delete(v23);
}
SetupTriggerPopup::postSetup(a1);
return v6;
}