//
// SetupShakePopup::init from 0x1003a90fc to 0x1003a9890 (1940 bytes)
//
// 1 xrefs:
// > SetupShakePopup::create @ 0x1003a90ac
//
// 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 SetupShakePopup::init(SetupShakePopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
_BOOL4 v4; // w21
cocos2d::CCDirector *v5; // x0
cocos2d::CCLabelBMFont *v6; // x20
__n128 v7; // q0
__n128 v8; // q1
ButtonSprite *v9; // x0
CCMenuItemSpriteExtra *v10; // x0
char *v11; // x20
__n128 v12; // q0
cocos2d::CCMenu *m_buttonMenu; // x21
__n128 v14; // q1
__n128 v15; // q0
__n128 v16; // q1
int v17; // w21
__n128 v18; // q0
__n128 v19; // q1
float *p_m_strength; // x8
float v21; // s11
std::string *v22; // x0
cocos2d::CCLabelBMFont *v23; // x20
__n128 v24; // q0
__n128 v25; // q1
double v26; // d0
cocos2d::extension::CCScale9Sprite *v27; // x28
__n128 v28; // q0
__n128 v29; // q1
double v30; // d0
const char *v31; // x0
CCTextInputNode *v32; // x20
__int64 v33; // x0
Slider *v34; // x28
__n128 v35; // q0
__n128 v36; // q1
double v37; // d0
int v38; // w25
SliderThumb *Thumb; // x0
float v40; // s0
SliderThumb *v41; // x0
SliderThumb *v42; // x0
_BOOL4 v43; // w8
_BOOL4 v44; // w9
float v45; // s1
float v47; // s1
float v48; // s2
float v49; // s3
bool v50; // [xsp+0h] [xbp-160h]
std::string v51; // [xsp+20h] [xbp-140h] BYREF
float32x2_t v52; // [xsp+38h] [xbp-128h] BYREF
float32x2_t v53; // [xsp+40h] [xbp-120h] BYREF
float32x2_t v54[2]; // [xsp+48h] [xbp-118h] BYREF
float32x2_t v55[2]; // [xsp+58h] [xbp-108h] BYREF
std::string v56; // [xsp+68h] [xbp-F8h] BYREF
float32x2_t v57; // [xsp+80h] [xbp-E0h] BYREF
float32x2_t v58; // [xsp+88h] [xbp-D8h] BYREF
void *__p[2]; // [xsp+90h] [xbp-D0h] BYREF
char v60; // [xsp+A7h] [xbp-B9h]
void *v61[2]; // [xsp+A8h] [xbp-B8h] BYREF
char v62; // [xsp+BFh] [xbp-A1h]
float v63; // [xsp+C0h] [xbp-A0h]
float v64; // [xsp+C4h] [xbp-9Ch]
cocos2d::CCPoint v65; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v66; // 0:x1.16
cocos2d::SEL_MenuHandler v67; // 0:x3.16
cocos2d::CCRect v68; // 0:kr10_16.16
v4 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 285.0, 1);
if ( v4 )
{
((void (__fastcall *)(SetupShakePopup *))a1->determineStartValues)(a1);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
v6 = cocos2d::CCLabelBMFont::create_1("Setup Shake", "bigFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v6);
v7 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v6->setScale)(v6, 0.5);
v7.n128_f32[0] = v63 * 0.5;
v8.n128_f32[0] = (float)((float)(v64 * 0.5) + (float)(a1->m_height * 0.5)) + -14.0;
sub_100022980(v7, v8, &v56);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))v6->setPosition)(v6, &v56);
v9 = ButtonSprite::create_1("OK", 40, 0, 0.8, 1, "goldFont.fnt", "GJ_button_01.png", 30.0);
v67.ptr = (void (__cdecl *)(cocos2d::CCObject *))1320;
v67.adj = 1;
v10 = CCMenuItemSpriteExtra::create(v9, nullptr, a1, v67);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v10);
sub_100009900(v61, "Help");
sub_100009900(
__p,
"Shakes the screen for a set duration.\n"
"Strength is how intense the shake is.\n"
"Interval is how often the screen shakes. Leaving this at 0 means that every frame shakes.\n"
"Avoid overusing this effect as it can cause bad gameplay.");
v11 = InfoAlertButton::create((__int64)v61, (__int64)__p, 1.0);
if ( v60 < 0 )
operator delete(__p[0]);
v50 = v4;
if ( v62 < 0 )
operator delete(v61[0]);
v12 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, char *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v11);
m_buttonMenu = a1->m_buttonMenu;
v12.n128_f32[0] = (float)((float)(v63 * 0.5) - (float)(a1->m_width * 0.5)) + 18.0;
v14.n128_f32[0] = (float)((float)(v64 * 0.5) + (float)(a1->m_height * 0.5)) + -18.0;
sub_100022980(v12, v14, v55);
v65 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, (const cocos2d::CCPoint *)v55);
(*(void (__fastcall **)(char *, std::string *, float, float))(*(_QWORD *)v11 + 184LL))(v11, &v56, v65.x, v65.y);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v15.n128_f32[0] = v63 * 0.5;
v16.n128_f32[0] = (float)(v64 * 0.5) + 95.0;
sub_100022980(v15, v16, &v58);
v17 = 1;
do
{
sub_1000229B0(&v57);
memset(&v56, 0, sizeof(v56));
if ( v17 == 1 )
{
sub_1000229D0(&v57, (double *)&v58);
std::string::assign(&v56, "Strength: ");
p_m_strength = &a1->m_strength;
}
else if ( v17 )
{
v19.n128_u32[0] = -1024458752;
v18.n128_u32[0] = 0;
sub_100022980(v18, v19, v54);
sub_1000229DC(&v58, v54, v55);
sub_1000229D0(&v57, (double *)v55);
std::string::assign(&v56, "Duration: ");
p_m_strength = &a1->m_duration;
}
else
{
v19.n128_u32[0] = -1032847360;
v18.n128_u32[0] = 0;
sub_100022980(v18, v19, v54);
sub_1000229DC(&v58, v54, v55);
sub_1000229D0(&v57, (double *)v55);
std::string::assign(&v56, "Interval: ");
p_m_strength = &a1->m_interval;
}
v21 = *p_m_strength;
if ( (v56.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v22 = &v56;
else
v22 = (std::string *)v56.__r_.__value_.__r.__words[0];
v23 = cocos2d::CCLabelBMFont::create_1((const char *)v22, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v23->setScale)(v23, 0.7);
v24 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v23->setPosition)(v23, &v57);
v24.n128_u32[0] = 1.0;
v25.n128_u32[0] = 0.5;
sub_100022980(v24, v25, v55);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v23->setAnchorPoint)(v23, v55);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(
a1->m_mainLayer,
v23);
sub_100022990((float *)v55, 0.0, 0.0, 40.0, 40.0);
v26 = sub_100022B98(v54, (__int64)v55);
v68.origin.x = *(float *)&v26;
v68.origin.y = v47;
v68.size.width = v48;
v68.size.height = v49;
v27 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v68);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v27->setOpacity)(v27, 100);
sub_100022988((float *)v54, 70.0, 30.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v27->setContentSize)(v27, v54);
v28 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v27,
0xFFFFFFFFLL);
v28.n128_u32[0] = 1110704128;
v29.n128_u32[0] = 0;
sub_100022980(v28, v29, &v52);
*(float32x2_t *)&v30 = sub_1000229DC(&v57, &v52, &v53);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *, double))v27->setPosition)(
v27,
&v53,
v30);
if ( v21 == -99999.0 )
v31 = "Mixed";
else
v31 = "Num";
v32 = CCTextInputNode::create(50.0, 40.0, v31, "Thonburi", 24, "bigFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, CCTextInputNode *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v32,
20);
v33 = ((__int64 (__fastcall *)(cocos2d::extension::CCScale9Sprite *))v27->getPosition)(v27);
((void (__fastcall *)(CCTextInputNode *, __int64))v32->setPosition)(v32, v33);
CCTextInputNode::setMaxLabelScale(v32, 0.6);
CCTextInputNode::setMaxLabelWidth(v32, 200.0);
((void (__fastcall *)(cocos2d::CCTextFieldTTF *, _QWORD))v32->m_textField->setVisible)(v32->m_textField, 0);
v32->m_maxLabelLength = 4;
sub_100009900(&v51, "0123456789.");
CCTextInputNode::setAllowedChars((std::string *)v32, &v51);
if ( SHIBYTE(v51.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v51.__r_.__value_.__l.__data_);
CCTextInputNode::setLabelPlaceholderColor(v32, (cocos2d::ccColor3B)-1004936);
CCTextInputNode::setLabelPlaceholderScale(v32, 0.5);
v32->m_numberInput = 1;
v32->m_delegate = &a1->TextInputDelegate;
v66.ptr = (void (__cdecl *)(cocos2d::CCObject *))SetupShakePopup::sliderChanged;
v66.adj = 0;
v34 = Slider::create_1(a1, v66, 0.8);
Slider::setBarVisibility(v34, 0);
v35 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, Slider *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v34);
v35.n128_u32[0] = 0;
v36.n128_u64[0] = 0xC2000000C2000000LL;
sub_100022980(v35, v36, &v52);
*(float32x2_t *)&v37 = sub_1000229DC(&v57, &v52, &v53);
((void (__fastcall *)(Slider *, float32x2_t *, double))v34->setPosition)(v34, &v53, v37);
v38 = v17 - 1;
if ( v17 == 1 )
{
a1->m_strengthInput = v32;
((void (__fastcall *)(CCTextInputNode *, __int64))v32->setTag)(v32, 6);
a1->m_strengthSlider = v34;
Thumb = Slider::getThumb(v34);
((void (__fastcall *)(SliderThumb *, __int64))Thumb->setTag)(Thumb, 4);
v40 = v21 / 5.0;
}
else if ( v17 )
{
a1->m_durationInput = v32;
((void (__fastcall *)(CCTextInputNode *, __int64))v32->setTag)(v32, 5);
a1->m_durationSlider = v34;
v41 = Slider::getThumb(v34);
((void (__fastcall *)(SliderThumb *, __int64))v41->setTag)(v41, 3);
v40 = v21 * 0.5;
}
else
{
a1->m_intervalInput = v32;
((void (__fastcall *)(CCTextInputNode *, __int64))v32->setTag)(v32, 8);
a1->m_intervalSlider = v34;
v42 = Slider::getThumb(v34);
((void (__fastcall *)(SliderThumb *, __int64))v42->setTag)(v42, 7);
v40 = v21 / 0.1;
}
v43 = v40 >= 1.0;
v44 = v40 > 0.0 || v40 >= 1.0;
if ( v40 <= 0.0 )
v43 = 1;
if ( v44 )
v45 = 1.0;
else
v45 = 0.0;
if ( v43 )
v40 = v45;
Slider::setValue(v34, v40);
if ( SHIBYTE(v56.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v56.__r_.__value_.__l.__data_);
--v17;
}
while ( v38 != -2 );
SetupShakePopup::updateShakeLabel(a1, 0);
SetupShakePopup::updateDurLabel(a1, 0);
SetupShakePopup::updateIntervalLabel(a1, 0);
a1->m_disableTextDelegate = 0;
LOBYTE(v4) = v50;
}
return v4;
}