//
// SetupShakePopup::init from 0x4f9714 to 0x4f9cfe (1514 bytes)
//
// 1 xrefs:
// > SetupShakePopup::create @ 0x4f9eae
//
// 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 SetupShakePopup::init(SetupShakePopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
cocos2d::CCDirector *v4; // r0
cocos2d::CCLabelBMFont *v5; // r6
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
ButtonSprite *v7; // r0
CCMenuItemSpriteExtra *v8; // r0
CCMenuItemSpriteExtra *v9; // r6
cocos2d::CCMenu *m_buttonMenu; // r9
void (__fastcall *v11)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
int v12; // r9
int v13; // r2
float m_interval; // s16
int v15; // r2
bool v16; // r3
int v17; // r2
bool v18; // r3
cocos2d::CCLabelBMFont *v19; // r8
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCNode *v21; // r8
const char *v22; // r2
CCTextInputNode *v23; // r6
void (__fastcall *v24)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
int v25; // r0
Slider *v26; // r8
CCTextInputNode_vtbl *v27; // r3
SliderThumb *v28; // r0
float v29; // s15
SliderThumb *v30; // r0
float v31; // s16
SliderThumb *Thumb; // r0
float v34; // [sp+10h] [bp-94h]
_BOOL4 v35; // [sp+14h] [bp-90h]
void (__fastcall *v36)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+18h] [bp-8Ch]
void (__fastcall *v37)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+18h] [bp-8Ch]
cocos2d::ccColor3B v38; // [sp+3Ch] [bp-68h]
cocos2d::CCLabelBMFont *v39; // [sp+40h] [bp-64h] BYREF
cocos2d::CCSize v40; // [sp+44h] [bp-60h] BYREF
cocos2d::CCPoint v41; // [sp+4Ch] [bp-58h] BYREF
cocos2d::CCPoint v42; // [sp+54h] [bp-50h] BYREF
cocos2d::CCSize v43; // [sp+5Ch] [bp-48h] BYREF
cocos2d::CCPoint v44; // [sp+64h] [bp-40h] BYREF
int v45; // [sp+6Ch] [bp-38h]
int v46; // [sp+70h] [bp-34h]
void (*v47)(SetupShakePopup *, cocos2d::CCObject *); // [sp+74h] [bp-30h]
int v48; // [sp+78h] [bp-2Ch]
cocos2d::CCRect v49; // [sp+7Ch] [bp-28h] BYREF
cocos2d::CCRect v50; // [sp+8Ch] [bp-18h] BYREF
cocos2d::CCRect v51; // 0:r2.8,8:^0.8
v35 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 285.0, 1);
if ( v35 )
{
a1->determineStartValues(a1);
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v40, v4);
v5 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v5->setScale)(v5, 1056964608);
setPosition = v5->setPosition;
cocos2d::CCPoint::CCPoint(
&v50.origin,
v40.width * 0.5,
(float)((float)(a1->m_height * 0.5) + (float)(v40.height * 0.5)) - 14.0);
setPosition(v5, &v50.origin);
v7 = ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&word_28,
0,
0.8,
1,
"goldFont.fnt",
"GJ_button_01.png",
(const char *)0x41F00000,
v34);
v45 = 660;
v46 = 1;
v8 = CCMenuItemSpriteExtra::create(v7, nullptr, (cocos2d::SEL_MenuHandler)((unsigned int)a1 | 0x29400000000LL));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v8);
sub_776584((int)&v49, "Help");
sub_776584(
(int)&v50,
"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.");
v9 = InfoAlertButton::create((int)&v49, (int)&v50, 1065353216);
sub_774008(&v50);
sub_774008(&v49);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v9);
m_buttonMenu = a1->m_buttonMenu;
v11 = v9->setPosition;
cocos2d::CCPoint::CCPoint(
&v49.origin,
(float)((float)(v40.width * 0.5) - (float)(a1->m_width * 0.5)) + 18.0,
(float)((float)(a1->m_height * 0.5) + (float)(v40.height * 0.5)) - 18.0);
cocos2d::CCNode::convertToNodeSpace(&v50.origin, m_buttonMenu, &v49.origin);
v12 = 0;
v11(v9, &v50.origin);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
cocos2d::CCPoint::CCPoint(&v41, v40.width * 0.5, (float)(v40.height * 0.5) + 95.0);
while ( 1 )
{
cocos2d::CCPoint::CCPoint(&v42);
v39 = (cocos2d::CCLabelBMFont *)&unk_ACDDA8;
if ( v12 )
{
if ( v12 == 1 )
{
cocos2d::CCPoint::CCPoint(&v49.origin, 0.0, -60.0);
cocos2d::CCPoint::operator+(&v50, &v41, &v49);
cocos2d::CCPoint::operator=((PlayerObject *)&v42, COERCE_FLOAT(&v50), v15, v16);
sub_7753D4((int)&v39, "Interval: ");
m_interval = a1->m_interval;
}
else
{
cocos2d::CCPoint::CCPoint(&v49.origin, 0.0, -120.0);
cocos2d::CCPoint::operator+(&v50, &v41, &v49);
cocos2d::CCPoint::operator=((PlayerObject *)&v42, COERCE_FLOAT(&v50), v17, v18);
sub_7753D4((int)&v39, "Duration: ");
m_interval = a1->m_duration;
}
}
else
{
cocos2d::CCPoint::operator=((PlayerObject *)&v42, COERCE_FLOAT(&v41), v13, (bool)&unk_ACDDA8);
sub_7753D4((int)&v39, "Strength: ");
m_interval = a1->m_strength;
}
v19 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v19->setScale)(v19, 1060320051);
v19->setPosition(v19, &v42);
setAnchorPoint = v19->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v50.origin, 1.0, 0.5);
setAnchorPoint(v19, &v50.origin);
a1->m_mainLayer->addChild(a1->m_mainLayer, v19);
cocos2d::CCRect::CCRect(&v49, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v50, &v49);
v21 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02_small.png",
(const char *)&v50,
v51);
((void (__fastcall *)(cocos2d::CCNode *, int))v21->__vftable[1].~CCNode_0)(v21, 100);
cocos2d::CCSize::CCSize(&v43, 70.0, 30.0);
v21->setContentSize(v21, &v43);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v21, -1);
v36 = v21->setPosition;
cocos2d::CCPoint::CCPoint(&v44, 45.0, 0.0);
cocos2d::CCPoint::operator+(&v50, &v42, &v44);
v36(v21, &v50.origin);
if ( m_interval == -99999.0 )
v22 = "Mixed";
else
v22 = "Num";
v23 = CCTextInputNode::create(50.0, 40.0, v22, "Thonburi");
((void (__fastcall *)(cocos2d::CCLayer *, CCTextInputNode *, int, void (__fastcall *)(cocos2d::CCNode *__hidden, cocos2d::CCNode *, int), int *, const char *))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v23,
20,
a1->m_mainLayer->addChild_0,
&dword_18,
"bigFont.fnt");
v24 = v23->setPosition;
v25 = (int)v21->getPosition(v21);
v24(v23, (const cocos2d::CCPoint *)v25);
CCTextInputNode::setMaxLabelScale(v23, 0.6);
CCTextInputNode::setMaxLabelWidth(v23, 200.0);
v23->m_textField->setVisible(v23->m_textField, 0);
v23->m_maxLabelLength = 4;
sub_776584((int)&v50, "0123456789.");
CCTextInputNode::setAllowedChars((int)v23, (int)&v50);
sub_774008(&v50);
*(_WORD *)&v38.r = -21896;
v38.b = -16;
CCTextInputNode::setLabelPlaceholderColor(v23, v38);
CCTextInputNode::setLabelPlaceholderScale(v23, 0.5);
v23->m_numberInput = 1;
v23->m_delegate = &a1->TextInputDelegate;
v47 = SetupShakePopup::sliderChanged;
v48 = 0;
v26 = (Slider *)Slider::create(a1, (unsigned int)SetupShakePopup::sliderChanged, 0, 0.8);
Slider::setBarVisibility(v26, 0);
a1->m_mainLayer->addChild(a1->m_mainLayer, v26);
v37 = v26->setPosition;
cocos2d::CCPoint::CCPoint(&v44, 0.0, -32.0);
cocos2d::CCPoint::operator+(&v50, &v42, &v44);
v37(v26, &v50.origin);
v27 = v23->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v12 )
{
if ( v12 != 1 )
{
a1->m_durationInput = v23;
v27->setTag(v23, 5);
a1->m_durationSlider = v26;
Thumb = Slider::getThumb(v26);
Thumb->setTag(Thumb, 3);
v31 = m_interval * 0.5;
goto LABEL_17;
}
a1->m_intervalInput = v23;
v27->setTag(v23, 8);
a1->m_intervalSlider = v26;
v30 = Slider::getThumb(v26);
v30->setTag(v30, 7);
v29 = 0.1;
}
else
{
a1->m_strengthInput = v23;
v27->setTag(v23, 6);
a1->m_strengthSlider = v26;
v28 = Slider::getThumb(v26);
v28->setTag(v28, 4);
v29 = 5.0;
}
v31 = m_interval / v29;
LABEL_17:
if ( v31 >= 1.0 )
{
v31 = 1.0;
}
else if ( v31 <= 0.0 )
{
v31 = 0.0;
}
Slider::setValue(v26, v31);
++v12;
sub_774008(&v39);
if ( v12 == 3 )
{
SetupShakePopup::updateShakeLabel(a1, 0);
SetupShakePopup::updateDurLabel(a1, 0);
SetupShakePopup::updateIntervalLabel(a1, 0);
a1->m_disableTextDelegate = 0;
return v35;
}
}
}
return v35;
}