//
// GameOptionsLayer::setupOptions from 0x4b4da4 to 0x4b52d0 (1324 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
//
void GameOptionsLayer::setupOptions(GameOptionsLayer *a1)
{
cocos2d::CCDirector *v2; // r0
GameManager *v3; // r0
bool GameVariable; // r0
GameManager *v5; // r0
bool v6; // r0
GameManager *v7; // r0
GameManager *v8; // r0
bool v9; // r0
GameManager *v10; // r0
bool v11; // r0
GameManager *v12; // r0
bool v13; // r0
GameManager *v14; // r0
bool v15; // r0
GameManager *v16; // r0
bool v17; // r0
GameManager *v18; // r0
bool v19; // r0
GameManager *v20; // r0
bool v21; // r0
cocos2d::CCArray *v22; // r0
cocos2d::CCArray *v23; // r9
GameStatsManager *v24; // r0
bool isItemEnabled; // r11
cocos2d::CCLayer *m_mainLayer; // r10
float m_maxLabelScale; // s17
float m_maxLabelWidth; // s16
CCMenuItemToggler *v29; // r10
GameStatsManager *v30; // r0
int v31; // r0
int v32; // r9
CCMenuItemSpriteExtra *v33; // r0
int v34; // r0
cocos2d::CCLayer *v35; // r11
GameManager *v36; // r0
float v37; // s18
CCMenuItemToggler *v38; // r8
cocos2d::CCArray *v39; // r0
cocos2d::CCMenu *v40; // r8
const char *v41; // r1
ButtonSprite *v42; // r11
CCMenuItemSpriteExtra *v43; // r11
const char *v44; // r1
ButtonSprite *v45; // r5
CCMenuItemSpriteExtra *v46; // r5
void (__fastcall *v47)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r4
cocos2d::CCPoint *setPosition; // [sp+30h] [bp-64h]
cocos2d::CCMenu *m_buttonMenu; // [sp+34h] [bp-60h]
bool v50; // [sp+34h] [bp-60h]
cocos2d::CCMenu *v51; // [sp+38h] [bp-5Ch]
cocos2d::CCSize v52; // [sp+44h] [bp-50h] BYREF
cocos2d::CCPoint v53; // [sp+4Ch] [bp-48h] BYREF
cocos2d::CCPoint v54; // [sp+54h] [bp-40h] BYREF
cocos2d::CCPoint v55; // [sp+5Ch] [bp-38h] BYREF
cocos2d::CCPoint v56; // [sp+64h] [bp-30h] BYREF
void (*v57)(GameOptionsLayer *, cocos2d::CCObject *); // [sp+6Ch] [bp-28h]
unsigned int v58; // [sp+70h] [bp-24h]
void (*v59)(GJOptionsLayer *, cocos2d::CCObject *); // [sp+74h] [bp-20h] BYREF
unsigned int v60; // [sp+78h] [bp-1Ch]
cocos2d::CCPoint v61; // [sp+7Ch] [bp-18h] BYREF
cocos2d::CCPoint v62; // [sp+84h] [bp-10h] BYREF
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v52, v2);
a1->m_offset = 32.0;
a1->m_gap = 37.0;
a1->m_togglesPerPage = 12;
v3 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v3, "0026");
GJOptionsLayer::addToggle(a1, "Auto-Retry", 1, GameVariable, (const char *)&unk_939830);
v5 = GameManager::sharedState();
v6 = GameManager::getGameVariable(v5, "0027");
GJOptionsLayer::addToggle(a1, "Auto-Checkpoints", 2, v6, (const char *)&unk_939830);
v7 = GameManager::sharedState();
GJOptionsLayer::addToggle(a1, "Show Progress Bar", 3, v7->m_showProgressBar, (const char *)&unk_939830);
v8 = GameManager::sharedState();
v9 = GameManager::getGameVariable(v8, "0040");
GJOptionsLayer::addToggle(a1, "Show Percentage", 4, v9, (const char *)&unk_939830);
v10 = GameManager::sharedState();
v11 = GameManager::getGameVariable(v10, "0145");
GJOptionsLayer::addToggle(a1, "Show Time", 7, v11, (const char *)&unk_939830);
v12 = GameManager::sharedState();
v13 = GameManager::getGameVariable(v12, "0144");
GJOptionsLayer::addToggle(a1, "Audio Visualizer", 5, v13, (const char *)&unk_939830);
v14 = GameManager::sharedState();
v15 = GameManager::getGameVariable(v14, "0109");
GJOptionsLayer::addToggle(a1, "Show Info Label", 6, v15, (const char *)&unk_939830);
v16 = GameManager::sharedState();
v17 = GameManager::getGameVariable(v16, "0146");
GJOptionsLayer::addToggle(a1, "Disable Checkpoints", 8, v17, (const char *)&unk_939830);
v18 = GameManager::sharedState();
v19 = GameManager::getGameVariable(v18, "0166");
GJOptionsLayer::addToggle(a1, "Show Hitboxes", 9, v19, "Shows hitboxes while in practice mode.");
v20 = GameManager::sharedState();
v21 = GameManager::getGameVariable(v20, "0179");
GJOptionsLayer::addToggle(
a1,
"Hitbox On Death",
11,
v21,
"Shows hitboxes upon death in both normal and practice mode.");
v23 = (cocos2d::CCArray *)cocos2d::CCArray::create(v22);
GJOptionsLayer::nextPosition(&v53, a1, 0);
sub_776584((int)&v59, "Practice Music Sync");
v57 = GameOptionsLayer::onPracticeMusicSync;
v58 = 0;
v24 = GameStatsManager::sharedState();
isItemEnabled = GameStatsManager::isItemEnabled(v24, GJItem, 17);
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v62, &v53);
m_mainLayer = a1->m_mainLayer;
m_maxLabelScale = a1->m_maxLabelScale;
m_maxLabelWidth = a1->m_maxLabelWidth;
cocos2d::CCPoint::CCPoint(&v61, 8.0, 0.0);
v29 = GameToolbox::createToggleButton(
(int)&v59,
(unsigned int)v57,
v58,
isItemEnabled,
m_buttonMenu,
&v62,
a1,
m_mainLayer,
0.8,
m_maxLabelScale,
m_maxLabelWidth,
(int)&v61,
(int)"bigFont.fnt",
0,
0,
v23);
sub_774008(&v59);
v30 = GameStatsManager::sharedState();
if ( !GameStatsManager::isItemUnlocked(v30, GJItem, 17) )
{
v31 = cocos2d::CCArray::objectAtIndex(v23, 1u);
v29->m_notClickable = 1;
LOWORD(v62.x) = -26986;
BYTE2(v62.x) = -106;
v32 = v31;
v33 = CCMenuItemToggler::activeItem(v29);
v34 = (int)v33->getNormalImage(v33);
(*(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v34 + 472))(v34, &v62);
(*(void (__fastcall **)(int, cocos2d::CCPoint *))(*(_DWORD *)v32 + 528))(v32, &v62);
}
if ( GameManager::sharedState()->m_playLayer
&& GameManager::sharedState()->m_playLayer->m_level
&& GameManager::sharedState()->m_playLayer->m_level->m_levelType == Editor )
{
++a1->m_toggleCount;
GJOptionsLayer::incrementCountForPage(a1, 0);
v35 = GJOptionsLayer::layerForPage(a1, 0);
GJOptionsLayer::nextPosition(&v56, a1, 0);
sub_776584((int)&v55, "Ignore Damage");
v59 = GJOptionsLayer::onToggle;
v60 = 0;
v36 = GameManager::sharedState();
v50 = GameManager::getGameVariable(v36, "0173");
v51 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v62, &v56);
v37 = a1->m_maxLabelWidth;
cocos2d::CCPoint::CCPoint(&v61, 8.0, 0.0);
v38 = GameToolbox::createToggleButton(
(int)&v55,
(unsigned int)v59,
v60,
v50,
v51,
&v62,
a1,
v35,
0.8,
0.5,
v37,
(int)&v61,
(int)"goldFont.fnt",
0,
0,
nullptr);
sub_774008(&v55);
v38->setTag(v38, 10);
CCMenuItemToggler::setSizeMult(v38, 1.0);
v39 = GJOptionsLayer::objectsForPage(a1, 0);
cocos2d::CCArray::addObject(v39, v38);
v38->setVisible(v38, 0);
v35->setVisible(v35, 0);
}
v40 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(
&v62,
v52.width * 0.5,
(float)((float)(v52.height * 0.5) - (float)(a1->m_height * 0.5)) + 26.0);
cocos2d::CCNode::convertToNodeSpace(&v54, v40, &v62);
v42 = ButtonSprite::create((ButtonSprite *)"Platformer UI", v41);
((void (__fastcall *)(ButtonSprite *, int))v42->setScale)(v42, 1060320051);
v61.y = 0.0;
LODWORD(v61.x) = GameOptionsLayer::onUIOptions;
v43 = CCMenuItemSpriteExtra::create(
v42,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GameOptionsLayer::onUIOptions, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v43);
setPosition = (cocos2d::CCPoint *)v43->setPosition;
cocos2d::CCPoint::CCPoint(&v56, -80.0, 0.0);
cocos2d::CCPoint::operator+(&v62, &v54, &v56);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *))setPosition)(v43, &v62);
v45 = ButtonSprite::create((ButtonSprite *)"Practice UI", v44);
((void (__fastcall *)(ButtonSprite *, int))v45->setScale)(v45, 1060320051);
v62.y = 0.0;
LODWORD(v62.x) = GameOptionsLayer::onUIPOptions;
v46 = CCMenuItemSpriteExtra::create(
v45,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(GameOptionsLayer::onUIPOptions, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v46);
v47 = v46->setPosition;
cocos2d::CCPoint::CCPoint(&v55, 80.0, 0.0);
cocos2d::CCPoint::operator+(&v56, &v54, &v55);
v47(v46, &v56);
}