//
// SetupGravityTriggerPopup::init from 0xa21f30 to 0xa22604 (1748 bytes)
//
// 2 xrefs:
// > SetupGravityTriggerPopup::create @ 0xa23788
// > ??> @ 0xa5ac8
//
// 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 SetupGravityTriggerPopup::init(SetupGravityTriggerPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
bool v4; // w25
cocos2d::CCPoint *p_m_textOffset; // x0
__int64 v7; // x2
__int64 v8; // x3
__int64 v9; // x4
__int64 v10; // x5
const char *v11; // x6
cocos2d::CCPoint *v12; // x0
cocos2d::CCPoint *v13; // x0
void *v14; // x0
cocos2d::CCDirector *v15; // x0
float v16; // s3
float v17; // s4
cocos2d::CCPoint *v18; // x0
cocos2d::CCPoint *v19; // x0
cocos2d::CCPoint *v20; // x0
cocos2d::CCPoint *v21; // x0
unsigned int *p_m_caption; // x1
int m_data; // w2
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x1
int v27; // w2
unsigned int *v28; // x1
int v29; // w2
unsigned int *v30; // x1
int v31; // w2
unsigned int *v32; // x1
int v33; // w2
unsigned int *v34; // x1
int v35; // w2
unsigned int *v36; // x20
int v37; // w1
_QWORD v38[2]; // [xsp+30h] [xbp+0h] BYREF
float v39; // [xsp+B0h] [xbp+80h]
float v40; // [xsp+B4h] [xbp+84h]
cocos2d::CCPoint v41; // [xsp+B8h] [xbp+88h] BYREF
cocos2d::CCPoint v42; // [xsp+C0h] [xbp+90h] BYREF
cocos2d::CCPoint v43; // [xsp+C8h] [xbp+98h] BYREF
ButtonSprite *v44; // [xsp+D0h] [xbp+A0h] BYREF
cocos2d::CCPoint v45; // 0:s0.4,4:s1.4
v4 = SetupTriggerPopup::init(a1, a2, a3, 320.0, 240.0, 1);
if ( v4 )
{
a1->determineStartValues(a1);
sub_D153B8((unsigned int)v38 + 160, "Gravity Trigger");
SetupTriggerPopup::addTitle((__int64)a1);
p_m_textOffset = &v44[-1].m_textOffset;
if ( &v44[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_caption = (unsigned int *)&v44[-1].m_caption;
do
m_data = __ldaxr(p_m_caption);
while ( __stlxr(m_data - 1, p_m_caption) );
}
else
{
m_data = (int)v44[-1].m_caption.m_data.m_data;
LODWORD(v44[-1].m_caption.m_data.m_data) = m_data - 1;
}
if ( m_data <= 0 )
operator delete(p_m_textOffset);
}
sub_D153B8((unsigned int)v38 + 160, "OK");
SetupTriggerPopup::addCloseButton((__int64)a1, &v44, v7, v8, v9, v10, v11);
v12 = &v44[-1].m_textOffset;
if ( &v44[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)&v44[-1].m_caption;
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = (int)v44[-1].m_caption.m_data.m_data;
LODWORD(v44[-1].m_caption.m_data.m_data) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v12);
}
sub_D153B8((int)&v43, "Help");
sub_D153B8(
(int)&v44,
"Changes the gameplay gravity.\n"
"P1 is player 1 and P2 is player 2.\n"
"PT targets the player that touches the trigger.");
SetupTriggerPopup::addHelpButton((__int64)a1, 1.0);
v13 = &v44[-1].m_textOffset;
if ( &v44[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)&v44[-1].m_caption;
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = (int)v44[-1].m_caption.m_data.m_data;
LODWORD(v44[-1].m_caption.m_data.m_data) = v29 - 1;
}
if ( v29 <= 0 )
operator delete(v13);
}
v14 = (void *)(*(_QWORD *)&v43 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v43 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)(*(_QWORD *)&v43 - 8LL);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *(_DWORD *)(*(_QWORD *)&v43 - 8LL);
*(_DWORD *)(*(_QWORD *)&v43 - 8LL) = v33 - 1;
}
if ( v33 <= 0 )
operator delete(v14);
}
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v15 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v15);
cocos2d::CCPoint::CCPoint(&v41, v39 * 0.5, (float)(v40 * 0.5) + 50.0);
sub_D153B8((int)&v44, "Gravity");
cocos2d::CCPoint::CCPoint(&v42, 0.0, 0.0);
cocos2d::CCPoint::operator+(&v43, &v41, &v42);
v45.x = 0.65;
v45.y = 0.1;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x94u,
v45,
2.0,
v16,
v17,
(std::string)&v44,
&v43,
(InputValueType)0,
Float,
6,
0,
0,
0,
0,
2,
0);
v18 = &v44[-1].m_textOffset;
if ( &v44[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)&v44[-1].m_caption;
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = (int)v44[-1].m_caption.m_data.m_data;
LODWORD(v44[-1].m_caption.m_data.m_data) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v18);
}
sub_D153B8((int)&v44, "P1");
cocos2d::CCPoint::CCPoint(&v42, -75.0, -60.0);
cocos2d::CCPoint::operator+(&v43, &v41, &v42);
SetupTriggerPopup::createToggleValueControl(a1, 138, 1.0, (__int64)&v44, &v43, 0, 0, 0);
v19 = &v44[-1].m_textOffset;
if ( &v44[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v34 = (unsigned int *)&v44[-1].m_caption;
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = (int)v44[-1].m_caption.m_data.m_data;
LODWORD(v44[-1].m_caption.m_data.m_data) = v35 - 1;
}
if ( v35 <= 0 )
operator delete(v19);
}
sub_D153B8((int)&v44, "P2");
cocos2d::CCPoint::CCPoint(&v42, 0.0, -60.0);
cocos2d::CCPoint::operator+(&v43, &v41, &v42);
SetupTriggerPopup::createToggleValueControl(a1, 200, 1.0, (__int64)&v44, &v43, 0, 0, 0);
v20 = &v44[-1].m_textOffset;
if ( &v44[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)&v44[-1].m_caption;
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = (int)v44[-1].m_caption.m_data.m_data;
LODWORD(v44[-1].m_caption.m_data.m_data) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v20);
}
sub_D153B8((int)&v44, "PT");
cocos2d::CCPoint::CCPoint(&v42, 75.0, -60.0);
cocos2d::CCPoint::operator+(&v43, &v41, &v42);
SetupTriggerPopup::createToggleValueControl(a1, 201, 1.0, (__int64)&v44, &v43, 0, 0, 0);
v21 = &v44[-1].m_textOffset;
if ( &v44[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v36 = (unsigned int *)&v44[-1].m_caption;
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = (int)v44[-1].m_caption.m_data.m_data;
LODWORD(v44[-1].m_caption.m_data.m_data) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(v21);
}
a1->updateDefaultTriggerValues(a1);
a1->m_disableTextDelegate = 0;
}
return v4;
}