//
// SetupGradientPopup::init from 0x550cf8 to 0x5516b0 (2488 bytes)
//
// 1 xrefs:
// > SetupGradientPopup::create @ 0x551852
//
// 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 SetupGradientPopup::init(SetupGradientPopup *a1, GradientTriggerObject *a2, cocos2d::CCArray *a3)
{
cocos2d::CCDirector *v4; // r0
ButtonSprite *v5; // r0
CCMenuItemSpriteExtra *v6; // r0
cocos2d::CCArray *v7; // r0
cocos2d::CCArray *v8; // r0
int v9; // r8
cocos2d::CCLabelBMFont *v10; // r7
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r9
int v12; // s15
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCLabelBMFont *v14; // r5
void (__fastcall *v15)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCLabelBMFont *v16; // r0
cocos2d::CCLabelBMFont *m_blendingLabel; // r7
void (__fastcall *v18)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
int v19; // r5
cocos2d::CCSprite *v20; // r5
CCMenuItemSpriteExtra *v21; // r9
cocos2d::CCSprite *v22; // r9
CCMenuItemSpriteExtra *v23; // r8
cocos2d::CCMenu *v24; // r11
const cocos2d::CCPoint *v25; // r9
int v26; // r6
cocos2d::CCArray *v27; // r0
cocos2d::CCArray *v28; // r0
cocos2d::CCArray *v29; // r0
cocos2d::CCArray *v30; // r9
cocos2d::CCArray *v31; // r8
ButtonSprite *v32; // r7
CCMenuItemSpriteExtra *v33; // r11
cocos2d::CCArray *v35; // r0
cocos2d::CCMenu *v36; // r6
cocos2d::CCMenu *v37; // r6
bool v39; // [sp+0h] [bp-A4h]
float v40; // [sp+10h] [bp-94h]
float v41; // [sp+10h] [bp-94h]
_BOOL4 v42; // [sp+30h] [bp-74h]
char *v43; // [sp+34h] [bp-70h]
char *v44; // [sp+34h] [bp-70h]
char *v45; // [sp+38h] [bp-6Ch]
cocos2d::CCMenu *m_buttonMenu; // [sp+40h] [bp-64h]
cocos2d::CCSize v47; // [sp+4Ch] [bp-58h] BYREF
cocos2d::CCPoint v48; // [sp+54h] [bp-50h] BYREF
cocos2d::CCPoint v49; // [sp+5Ch] [bp-48h] BYREF
cocos2d::CCPoint v50; // [sp+64h] [bp-40h] BYREF
cocos2d::CCPoint v51; // [sp+6Ch] [bp-38h] BYREF
cocos2d::CCPoint v52; // [sp+74h] [bp-30h] BYREF
int v53; // [sp+7Ch] [bp-28h]
int v54; // [sp+80h] [bp-24h]
const char *v55[2]; // [sp+84h] [bp-20h] BYREF
cocos2d::CCPoint v56; // [sp+8Ch] [bp-18h] BYREF
cocos2d::CCPoint v57; // [sp+94h] [bp-10h] BYREF
v42 = SetupTriggerPopup::init(a1, a2, a3, 420.0, 290.0, 1);
if ( v42 )
{
a1->determineStartValues(a1);
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v47, v4);
sub_776584((int)&v57, "Setup Gradient Effect");
SetupTriggerPopup::addTitle((int)a1);
sub_774008(&v57);
sub_776584((int)&v56, "Help");
sub_776584(
(int)&v57,
"Creates a gradient with set colors in a given area.\n"
"U, D, L, and R must be set to a group at each side of the area.\n"
"Use Vertex Mode to set corners of the area instead.\n"
"Blending changes the gradient method.\n"
"Use ID to give a gradient a unique identifier that can be used to disable it with another of these triggers.");
SetupTriggerPopup::addHelpButton((int)a1, (int)&v56, (int)&v57, 1065353216);
sub_774008(&v57);
sub_774008(&v56);
v5 = ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&word_28,
0,
0.8,
1,
"goldFont.fnt",
"GJ_button_01.png",
(const char *)0x41F00000,
v40);
v53 = 660;
v54 = 1;
v6 = CCMenuItemSpriteExtra::create(v5, nullptr, (cocos2d::SEL_MenuHandler)((unsigned int)a1 | 0x29400000000LL));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v6);
cocos2d::CCPoint::CCPoint(&v48, (float)(v47.width * 0.5) - 20.0, (float)(v47.height * 0.5) + 90.0);
sub_776584((int)v55, " ");
cocos2d::CCPoint::CCPoint(&v56, -135.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v48, &v56);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
203,
(int)v55,
&v57,
(cocos2d::CCZone *)0x3F333333,
1,
Int,
5,
0,
nullptr,
0.0,
0,
0,
0,
2,
0);
sub_774008(v55);
sub_776584((int)v55, " ");
cocos2d::CCPoint::CCPoint(&v56, -45.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v48, &v56);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
204,
(int)v55,
&v57,
(cocos2d::CCZone *)0x3F333333,
1,
Int,
5,
0,
nullptr,
0.0,
0,
0,
0,
2,
0);
sub_774008(v55);
sub_776584((int)v55, " ");
cocos2d::CCPoint::CCPoint(&v56, 45.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v48, &v56);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
205,
(int)v55,
&v57,
(cocos2d::CCZone *)0x3F333333,
1,
Int,
5,
0,
nullptr,
0.0,
0,
0,
0,
2,
0);
sub_774008(v55);
sub_776584((int)v55, " ");
cocos2d::CCPoint::CCPoint(&v56, 135.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v48, &v56);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
206,
(int)v55,
&v57,
(cocos2d::CCZone *)0x3F333333,
1,
Int,
5,
0,
nullptr,
0.0,
0,
0,
0,
2,
0);
v7 = (cocos2d::CCArray *)sub_774008(v55);
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
v9 = 0;
a1->m_gradientLabels = v8;
cocos2d::CCObject::retain(v8);
do
{
v10 = cocos2d::CCLabelBMFont::create();
setAnchorPoint = v10->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v57, 1.0, 0.5);
setAnchorPoint(v10, &v57);
a1->m_mainLayer->addChild(a1->m_mainLayer, v10);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v10->setScale)(v10, 1056964608);
v12 = v9++;
setPosition = v10->setPosition;
cocos2d::CCPoint::CCPoint(&v56, (float)((float)v12 - 1.5) * 90.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v48, &v56);
setPosition(v10, &v57);
cocos2d::CCArray::addObject(a1->m_gradientLabels, v10);
}
while ( v9 != 4 );
SetupGradientPopup::updateGradientLabels(a1, 0);
sub_776584((int)&v56, "Vertex\nMode");
cocos2d::CCPoint::CCPoint(
&v57,
(float)((float)(a1->m_width * 0.5) + (float)(v47.width * 0.5)) - 72.0,
(float)((float)(a1->m_height * 0.5) + (float)(v47.height * 0.5)) - 20.0);
SetupTriggerPopup::createToggleValueControl(a1, 207, (int)&v56, &v57, 0, 0, 0, 1.0);
sub_774008(&v56);
cocos2d::CCPoint::CCPoint(&v49, (float)(v47.width * 0.5) + 145.0, (float)(v47.height * 0.5) + 40.0);
sub_776584((int)&v56, "Disable");
cocos2d::CCPoint::CCPoint(&v57, &v49);
SetupTriggerPopup::createToggleValueControl(a1, 208, (int)&v56, &v57, 0, 0, 0, 0.8);
sub_774008(&v56);
sub_776584((int)v55, "Disable\nAll");
cocos2d::CCPoint::CCPoint(&v56, 0.0, -25.0);
cocos2d::CCPoint::operator+(&v57, &v49, &v56);
SetupTriggerPopup::createToggleValueControl(a1, 508, (int)v55, &v57, 0, 0, 0, 0.8);
sub_774008(v55);
sub_776584((int)&v56, "Preview\nOpacity");
cocos2d::CCPoint::CCPoint(
&v57,
(float)((float)(a1->m_width * 0.5) + (float)(v47.width * 0.5)) - 72.0,
(float)((float)(v47.height * 0.5) - (float)(a1->m_height * 0.5)) + 40.0);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
456,
(int)&v56,
&v57,
(cocos2d::CCZone *)0x3F266666,
0,
Float,
5,
0,
nullptr,
0.0,
0,
0,
0,
2,
0);
sub_774008(&v56);
cocos2d::CCPoint::CCPoint(&v50, (float)(v47.width * 0.5) - 20.0, (float)(v47.height * 0.5) + 60.0);
sub_776584((int)v55, "ID");
cocos2d::CCPoint::CCPoint(&v56, 75.0, -25.0);
cocos2d::CCPoint::operator+(&v57, &v50, &v56);
SetupTriggerPopup::createValueControlAdvanced(
(unsigned int)a1,
209,
(int)v55,
&v57,
(cocos2d::CCZone *)0x3F333333,
1,
Int,
3,
1,
nullptr,
0.0,
0,
0,
0,
2,
0);
sub_774008(v55);
cocos2d::CCPoint::CCPoint(&v56, 95.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v50, &v56);
sub_776584((int)v55, (char *)&unk_939830);
SetupTriggerPopup::createPlusButton(a1, 209, &v57, 1061997773, v55, 0, 0);
sub_774008(v55);
v14 = cocos2d::CCLabelBMFont::create();
v15 = v14->setPosition;
cocos2d::CCPoint::CCPoint(&v56, -85.0, 0.0);
cocos2d::CCPoint::operator+(&v57, &v50, &v56);
v15(v14, &v57);
a1->m_mainLayer->addChild(a1->m_mainLayer, v14);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v14->setScale)(v14, 1058642330);
v16 = cocos2d::CCLabelBMFont::create();
a1->m_blendingLabel = v16;
a1->m_mainLayer->addChild(a1->m_mainLayer, v16);
m_blendingLabel = a1->m_blendingLabel;
v18 = m_blendingLabel->setPosition;
v19 = (int)v14->getPosition(v14);
cocos2d::CCPoint::CCPoint(&v56, 0.0, -25.0);
cocos2d::CCPoint::operator+(&v57, v19, &v56);
v18(m_blendingLabel, &v57);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))a1->m_blendingLabel->setScale)(a1->m_blendingLabel, 1056964608);
SetupGradientPopup::updateBlendingLabel(a1);
v20 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
cocos2d::CCSprite::setFlipX(v20, 1);
((void (__fastcall *)(cocos2d::CCSprite *, int))v20->setScale)(v20, 1058642330);
v55[0] = (const char *)SetupGradientPopup::onBlending;
v55[1] = nullptr;
v21 = CCMenuItemSpriteExtra::create(
v20,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SetupGradientPopup::onBlending, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v21);
v43 = (char *)v21->setPosition;
m_buttonMenu = a1->m_buttonMenu;
v45 = (char *)a1->m_blendingLabel->getPosition(a1->m_blendingLabel);
cocos2d::CCPoint::CCPoint(&v52, 75.0, 0.0);
cocos2d::CCPoint::operator+(&v56, v45, &v52);
cocos2d::CCNode::convertToNodeSpace(&v57, m_buttonMenu, &v56);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *))v43)(v21, &v57);
CCMenuItemSpriteExtra::setSizeMult(v21, 1.4);
v21->setTag(v21, 1);
v22 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v22->setScale)(v22, 1058642330);
LODWORD(v56.x) = SetupGradientPopup::onBlending;
v56.y = 0.0;
v23 = CCMenuItemSpriteExtra::create(
v22,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SetupGradientPopup::onBlending, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v23);
v24 = a1->m_buttonMenu;
v44 = (char *)v23->setPosition;
v25 = a1->m_blendingLabel->getPosition(a1->m_blendingLabel);
cocos2d::CCPoint::CCPoint(&v51, -75.0, 0.0);
cocos2d::CCPoint::operator+(&v52, v25, &v51);
cocos2d::CCNode::convertToNodeSpace(&v57, v24, &v52);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *))v44)(v23, &v57);
v26 = 1;
CCMenuItemSpriteExtra::setSizeMult(v23, 1.4);
v23->setTag(v23, 0);
SetupTriggerPopup::createMultiTriggerItemsCorner(a1);
v28 = (cocos2d::CCArray *)cocos2d::CCArray::create(v27);
a1->m_layerButtons = v28;
cocos2d::CCObject::retain(v28);
v30 = (cocos2d::CCArray *)cocos2d::CCArray::create(v29);
v31 = (cocos2d::CCArray *)cocos2d::CCArray::create(v30);
do
{
SetupShaderEffectPopup::zLayerToString((SetupShaderEffectPopup *)&v52, v26);
v32 = ButtonSprite::create(
(ButtonSprite *)LODWORD(v52.x),
(const char *)off_DC,
0,
0.3,
0,
"bigFont.fnt",
"GJ_button_04.png",
(const char *)0x41C80000,
v41);
sub_774008(&v52);
cocos2d::CCArray::addObject(a1->m_layerButtons, v32);
LODWORD(v57.x) = SetupGradientPopup::onZLayer;
v57.y = 0.0;
v33 = CCMenuItemSpriteExtra::create(
v32,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SetupGradientPopup::onZLayer, (unsigned int)a1));
v33->setTag(v33, v26);
v32->setTag(v32, v26);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v33);
if ( v26++ <= 7 )
v35 = v30;
else
v35 = v31;
cocos2d::CCArray::addObject(v35, v33);
}
while ( v26 != 16 );
SetupGradientPopup::updateZLayerButtons(a1);
v36 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v51, (float)(v47.width * 0.5) - 20.0, (float)(v47.height * 0.5) - 10.0);
cocos2d::CCNode::convertToNodeSpace(&v52, v36, &v51);
GameToolbox::alignItemsHorisontally(v30, 8.0, (cocos2d::CCPoint)(unsigned int)&v52, 0);
v37 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v51, (float)(v47.width * 0.5) - 20.0, (float)(v47.height * 0.5) - 50.0);
cocos2d::CCNode::convertToNodeSpace(&v52, v37, &v51);
GameToolbox::alignItemsHorisontally(v31, 8.0, (cocos2d::CCPoint)(unsigned int)&v52, v39);
a1->updateDefaultTriggerValues(a1);
a1->m_disableTextDelegate = 0;
}
return v42;
}