//
// UIPOptionsLayer::init from 0x4a9644 to 0x4a9a18 (980 bytes)
//
// 0 xrefs:
//
// 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 UIPOptionsLayer::init(UIPOptionsLayer *a1)
{
_BOOL4 v2; // r9
void (__fastcall *setColor)(cocos2d::CCLayerColor *__hidden, const cocos2d::ccColor3B *); // r3
cocos2d::CCDirector *v4; // r0
cocos2d::CCMenu *v5; // r0
ButtonSprite *v6; // r0
CCMenuItemSpriteExtra *v7; // r6
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
ButtonSprite *v9; // r0
CCMenuItemSpriteExtra *v10; // r10
void (__fastcall *v11)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
int v12; // r6
float v13; // s18
cocos2d::CCNode *v14; // r0
cocos2d::CCNode_vtbl *v15; // r3
cocos2d::CCSprite *v16; // r10
cocos2d::CCSprite *v17; // r8
cocos2d::CCArray *v18; // r0
cocos2d::CCArray *v19; // r6
GameManager *v20; // r0
float v21; // s17
cocos2d::CCDirector *v22; // r0
float v23; // r0
int v24; // r2
bool v25; // r3
bool v27; // [sp+0h] [bp-7Ch]
float v28; // [sp+10h] [bp-6Ch]
float v29; // [sp+10h] [bp-6Ch]
cocos2d::CCMenu *m_buttonMenu; // [sp+34h] [bp-48h]
char v31[4]; // [sp+40h] [bp-3Ch] BYREF
cocos2d::CCSize v32; // [sp+44h] [bp-38h] BYREF
cocos2d::CCPoint v33; // [sp+4Ch] [bp-30h] BYREF
cocos2d::CCPoint v34; // [sp+54h] [bp-28h] BYREF
cocos2d::CCPoint v35; // [sp+5Ch] [bp-20h] BYREF
int v36; // [sp+64h] [bp-18h]
int v37; // [sp+68h] [bp-14h]
cocos2d::CCPoint v38; // [sp+6Ch] [bp-10h] BYREF
v2 = SetupTriggerPopup::init(a1, nullptr, nullptr, 400.0, 280.0, 1);
if ( v2 )
{
SetupTriggerPopup::preSetup(a1);
setColor = a1->setColor;
LOWORD(v38.x) = 17459;
BYTE2(v38.x) = -103;
setColor(a1, (const cocos2d::ccColor3B *)&v38);
a1->setOpacity(a1, 255);
a1->m_noElasticity = 1;
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v32, v4);
v5 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v5;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v5, 10);
v6 = ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&word_28,
0,
0.8,
1,
"goldFont.fnt",
"GJ_button_01.png",
COERCE_CONST_CHAR_(30.0),
v28);
v36 = 660;
v37 = 1;
v7 = CCMenuItemSpriteExtra::create(v6, nullptr, (cocos2d::SEL_MenuHandler)((unsigned int)a1 | 0x29400000000LL));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v7);
setPosition = v7->setPosition;
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v35, (float)(v32.width * 0.5) - 40.0, v32.height - 30.0);
cocos2d::CCNode::convertToNodeSpace(&v38, m_buttonMenu, &v35);
setPosition(v7, &v38);
v9 = ButtonSprite::create(
(ButtonSprite *)"Reset",
(const char *)&word_28,
0,
0.8,
1,
"goldFont.fnt",
"GJ_button_05.png",
COERCE_CONST_CHAR_(30.0),
v29);
LODWORD(v38.x) = UIPOptionsLayer::onReset;
v38.y = 0.0;
v10 = CCMenuItemSpriteExtra::create(
v9,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(UIPOptionsLayer::onReset, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v10);
v11 = v10->setPosition;
v12 = (int)v7->getPosition(v7);
cocos2d::CCPoint::CCPoint(&v34, 80.0, 0.0);
cocos2d::CCPoint::operator+(&v35, v12, &v34);
v11(v10, &v35);
SetupTriggerPopup::toggleBG(a1, 0);
cocos2d::CCPoint::CCPoint(&v33, v32.width * 0.5, v32.height - 70.0);
sub_776584((int)v31, "Opacity:");
cocos2d::CCPoint::CCPoint(&v34, 0.0, -75.0);
cocos2d::CCPoint::operator+(&v35, &v33, &v34);
SetupTriggerPopup::createValueControlAdvanced(
(int)a1,
-29,
(int)v31,
(int)&v35,
0.8,
0,
1,
4,
0,
nullptr,
1.0,
0,
0,
1,
2,
0);
sub_774008(v31);
v13 = GameManager::sharedState()->m_practiceOpacity * 255.0;
v14 = cocos2d::CCNode::create();
v15 = v14->__vftable;
a1->m_practiceNode = v14;
v15->setContentSize(v14, &stru_AC6978);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_practiceNode, 9);
v16 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_checkpointBtn_001.png");
v16->setOpacity(v16, (unsigned int)v13);
a1->m_practiceNode->addChild(a1->m_practiceNode, v16);
v17 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_removeCheckBtn_001.png");
v17->setOpacity(v17, (unsigned int)v13);
v18 = (cocos2d::CCArray *)((int (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *))a1->m_practiceNode->addChild)(
a1->m_practiceNode,
v17);
v19 = (cocos2d::CCArray *)cocos2d::CCArray::create(v18);
cocos2d::CCArray::addObject(v19, v16);
cocos2d::CCArray::addObject(v19, v17);
v20 = GameManager::sharedState();
cocos2d::CCPoint::CCPoint(&v34, &v20->m_practicePos);
if ( v34.x == 0.0 && v34.y == 0.0 )
{
v21 = v32.width * 0.5;
v22 = cocos2d::CCDirector::sharedDirector();
v23 = COERCE_FLOAT(cocos2d::CCDirector::getScreenBottom(v22));
cocos2d::CCPoint::CCPoint(&v35, v21, v23 + 40.0);
cocos2d::CCPoint::operator=((PlayerObject *)&v34, COERCE_FLOAT(&v35), v24, v25);
}
a1->m_practiceNode->setPosition(a1->m_practiceNode, &v34);
cocos2d::CCPoint::CCPoint(&v35, &stru_AC6980);
GameToolbox::alignItemsHorisontally(v19, 10.0, (cocos2d::CCPoint)(unsigned int)&v35, v27);
SetupTriggerPopup::postSetup(a1);
}
return v2;
}