Skip to content

Commit

Permalink
Add MoreOptionsLayer ids to mac (#43)
Browse files Browse the repository at this point in the history
* GauntletSelectLayer, LevelPage, LevelSelectLayer and MoreOptionsLayer

* GauntletNode, missing GauntletSelectLayer nodeIDs and typo fixe

* Fix duplicate node and MOL on android

* Fix epic compiler error

* sorru

* GauntletSelectLayer conflict

* Disable MoreOptionsLayer for MacOS

* Remove constexpr from stl arrays

* Add NodeIDs to MoreOptionsLayer (thanks @Prevter for the screenshots)

* Wrong variable name

* comma
  • Loading branch information
SpaghettDev authored Apr 13, 2024
1 parent 4cc3eb6 commit 0ef288c
Showing 1 changed file with 102 additions and 48 deletions.
150 changes: 102 additions & 48 deletions src/MoreOptionsLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ using namespace geode::node_ids;
"togglers-menu",
"gameplay-options-layer-1",
"gameplay-options-layer-2",
#ifndef GEODE_IS_MACOS
"practice-options-layer",
#endif
"performance-options-layer",
"audio-options-layer",
"other-options-layer",
#ifdef GEODE_IS_MACOS
"options-options-layer",
#endif
"music-offset-label",
"music-offset-background",
"music-offset-input"
Expand All @@ -34,10 +39,7 @@ using namespace geode::node_ids;
"disable-orb-scale", "disable-trigger-orb-scale",
"disable-explosion-shake", "disable-gravity-effect"
};
#elif defined(GEODE_IS_MACOS)
std::array<std::string, 0> gameplayMenu1NodeNames{
};
#else
#elif defined(GEODE_IS_WINDOWS) || defined(GEODE_IS_MACOS)
std::array<std::string, 10> gameplayMenu1NodeNames{
"auto-retry", "enable-faster-reset",
"show-in-game-cursor", "lock-in-game-cursor",
Expand All @@ -60,10 +62,7 @@ using namespace geode::node_ids;
"switch-dash-fire-color", "switch-wave-trail-color",
"flip-2-player-controls", "always-limit-controls"
};
#elif defined(GEODE_IS_MACOS)
std::array<std::string, 10> gameplayMenu2NodeNames{
};
#else
#elif defined(GEODE_IS_WINDOWS) || defined(GEODE_IS_MACOS)
std::array<std::string, 10> gameplayMenu2NodeNames{
"disable-explosion-shake", "disable-gravity-effect",
"default-mini-icon", "switch-spider-teleport-color",
Expand All @@ -87,24 +86,29 @@ using namespace geode::node_ids;
"enable-normal-music-in-editor", "show-hitboxes",
"disable-player-hitbox"
};
#elif defined(GEODE_IS_MACOS)
std::array<std::string, 0> practiceMenuNodeNames{
};
#else
#elif defined(GEODE_IS_WINDOWS)
std::array<std::string, 8> practiceMenuNodeNames{
"hide-practice-buttons", "hide-attempts",
"enable-auto-checkpoints", "enable-quick-checkpoints",
"enable-death-effect", "enable-normal-music-in-editor",
"show-hitboxes", "disable-player-hitbox"
};
#elif defined(GEODE_IS_MACOS)
std::array<std::string, 6> practiceMenuNodeNames{
"hide-practice-buttons", "hide-attempts",
"enable-auto-checkpoints", "enable-quick-checkpoints",
"enable-death-effect", "enable-normal-music-in-editor"
};
#endif
#ifndef GEODE_IS_MACOS
if (auto practiceMenu = m_mainLayer->getChildByID("practice-options-layer")) {
auto nodes = CCArrayExt<CCLabelBMFont*>(practiceMenu->getChildren());

for (int i = 0; i < nodes.size(); i++) {
nodes[i]->setID(practiceMenuNodeNames.at(i) + "-label");
}
}
#endif

#ifdef GEODE_IS_ANDROID
std::array<std::string, 9> performanceMenuNodeNames{
Expand All @@ -114,16 +118,19 @@ using namespace geode::node_ids;
"disable-level-saving", "save-gauntlets",
"disable-shader-anti-aliasing"
};
#elif defined(GEODE_IS_MACOS)
std::array<std::string, 0> performanceMenuNodeNames{
};
#else
#elif defined(GEODE_IS_WINDOWS)
std::array<std::string, 8> performanceMenuNodeNames{
"increase-draw-capacity", "enable-low-detail",
"disable-high-object-alert", "enable-extra-ldm",
"increase-maximum-levels", "disable-level-saving",
"save-gauntlets", "disable-shader-anti-aliasing"
};
#elif defined(GEODE_IS_MACOS)
std::array<std::string, 6> performanceMenuNodeNames{
"hide-practice-buttons", "hide-attempts",
"enable-auto-checkpoints", "enable-quick-checkpoints",
"enable-death-effect", "enable-normal-music-in-editor"
};
#endif
if (auto performanceMenu = m_mainLayer->getChildByID("performance-options-layer")) {
auto nodes = CCArrayExt<CCLabelBMFont*>(performanceMenu->getChildren());
Expand All @@ -138,15 +145,20 @@ using namespace geode::node_ids;
"disable-song-alert", "no-song-limit",
"reduce-quality", "audio-fix-01"
};
#elif defined(GEODE_IS_MACOS)
std::array<std::string, 0> audioMenuNodeNames{
};
#else
#elif defined(GEODE_IS_WINDOWS)
std::array<std::string, 5> audioMenuNodeNames{
"change-custom-songs-location", "disable-song-alert",
"no-song-limit", "reduce-quality",
"audio-fix-01"
};
#elif defined(GEODE_IS_MACOS)
// rob really messed up here
std::array<std::string, 8> audioMenuNodeNames{
"increase-draw-capacity", "enable-low-detail",
"disable-high-object-alert", "enable-extra-ldm",
"increase-maximum-levels", "disable-level-saving",
"save-gauntlets", "disable-shader-anti-aliasing"
};
#endif
if (auto audioMenu = m_mainLayer->getChildByID("audio-options-layer")) {
auto nodes = CCArrayExt<CCLabelBMFont*>(audioMenu->getChildren());
Expand All @@ -164,17 +176,20 @@ using namespace geode::node_ids;
"show-leaderboard-percentage", "do-not",
"confirm-exit", "fast-menu"
};
#elif defined(GEODE_IS_MACOS)
std::array<std::string, 0> otherMenuNodeNames{
};
#else
#elif defined(GEODE_IS_WINDOWS)
std::array<std::string, 10> otherMenuNodeNames{
"more-comments", "load-comments",
"new-completed-filter", "increase-local-levels-per-page",
"manual-level-order", "percentage-decimals",
"show-leaderboard-percentage", "do-not",
"confirm-exit", "fast-menu"
};
#elif defined(GEODE_IS_MACOS)
std::array<std::string, 5> otherMenuNodeNames{
"change-custom-songs-location", "disable-song-alert",
"no-song-limit", "reduce-quality",
"audio-fix-01"
};
#endif
if (auto otherMenu = m_mainLayer->getChildByID("other-options-layer")) {
auto nodes = CCArrayExt<CCLabelBMFont*>(otherMenu->getChildren());
Expand All @@ -184,92 +199,131 @@ using namespace geode::node_ids;
}
}

#ifdef GEODE_IS_MACOS
std::array<std::string, 8> optionsMenuNodeNames{
"more-comments", "load-comments",
"new-completed-filter", "increase-local-levels-per-page",
"manual-level-order", "percentage-decimals",
"show-leaderboard-percentage", "do-not"
};

if (auto optionsMenu = m_mainLayer->getChildByID("options-options-layer")) {
auto nodes = CCArrayExt<CCLabelBMFont*>(optionsMenu->getChildren());

for (int i = 0; i < nodes.size(); i++) {
nodes[i]->setID(optionsMenuNodeNames.at(i) + "-label");
}
}
#endif


#ifdef GEODE_IS_ANDROID
constexpr std::array<std::pair<int, int>, 6> pageIdxToObjectIdxStartEnd{
std::make_pair(0, 20), // 10 togglers * 2 (multiplied by 2 to account for the toggler and the info icon)
std::make_pair(20, 32), // 6 togglers * 2
std::make_pair(32, 46), // 7 togglers * 2
std::make_pair(46, 64), // 9 togglers * 2
std::make_pair(64, 72), // 4 togglers * 2
std::make_pair(72, 91) // 10 togglers * 2 - 1 (because we are indexing by 2, in the last iteration, i == 90, so i+1 == 91, which is the last info icon)
std::make_pair(0, 20), // 10 togglers * 2 (multiplied by 2 to account for the toggler and the info icon)
std::make_pair(20, 32), // 6 * 2
std::make_pair(32, 46), // 7 * 2
std::make_pair(46, 64), // 9 * 2
std::make_pair(64, 72), // 4 * 2
std::make_pair(72, 91) // 10 * 2 - 1 (because we are indexing by 2, in the last iteration, i+1 == 91, which is the last info icon)
};
#elif defined(GEODE_IS_MACOS)
constexpr std::array<std::pair<int, int>, 0> pageIdxToObjectIdxStartEnd{

#elif defined(GEODE_IS_WINDOWS)
constexpr std::array<std::pair<int, int>, 6> pageIdxToObjectIdxStartEnd{
std::make_pair(0, 20), // 10 * 2
std::make_pair(20, 40), // 10 * 2
std::make_pair(40, 56), // 8 * 2
std::make_pair(56, 72), // 8 * 2
std::make_pair(72, 82), // 5 * 2
std::make_pair(82, 101) // 10 * 2 - 1
};
#else
#elif defined(GEODE_IS_MACOS)
constexpr std::array<std::pair<int, int>, 6> pageIdxToObjectIdxStartEnd{
std::make_pair(0, 20), // 10 togglers * 2
std::make_pair(20, 40), // 10 togglers * 2
std::make_pair(40, 56), // 8 togglers * 2
std::make_pair(56, 72), // 8 togglers * 2
std::make_pair(72, 82), // 5 togglers * 2
std::make_pair(82, 101) // 10 togglers * 2 - 1
std::make_pair(0, 20), // 10 * 2
std::make_pair(20, 40), // 10 * 2
std::make_pair(40, 52), // 6 * 2
std::make_pair(52, 68), // 8 * 2
std::make_pair(68, 78), // 5 * 2
std::make_pair(78, 93) // 8 * 2 - 1
};
#endif

if (auto togglersMenu = m_mainLayer->getChildByID("togglers-menu")) {
auto nodes = CCArrayExt<CCNode*>(togglersMenu->getChildren());
std::size_t pageIdx = 0;
std::size_t arrayIdx = 0;

for (int i = pageIdxToObjectIdxStartEnd[0].first; i < pageIdxToObjectIdxStartEnd[0].second; i += 2) {
for (int i = pageIdxToObjectIdxStartEnd[pageIdx].first; i < pageIdxToObjectIdxStartEnd[pageIdx].second; i += 2) {
nodes[i]->setID(gameplayMenu1NodeNames[arrayIdx] + "-toggler");
nodes[i + 1]->setID(gameplayMenu1NodeNames[arrayIdx] + "-info");

arrayIdx++;
}

pageIdx++;
arrayIdx = 0;
for (int i = pageIdxToObjectIdxStartEnd[1].first; i < pageIdxToObjectIdxStartEnd[1].second; i += 2) {
for (int i = pageIdxToObjectIdxStartEnd[pageIdx].first; i < pageIdxToObjectIdxStartEnd[pageIdx].second; i += 2) {
nodes[i]->setID(gameplayMenu2NodeNames[arrayIdx] + "-toggler");
nodes[i + 1]->setID(gameplayMenu2NodeNames[arrayIdx] + "-info");

arrayIdx++;
}

#ifndef GEODE_IS_MACOS
pageIdx++;
arrayIdx = 0;
for (int i = pageIdxToObjectIdxStartEnd[2].first; i < pageIdxToObjectIdxStartEnd[2].second; i += 2) {
for (int i = pageIdxToObjectIdxStartEnd[pageIdx].first; i < pageIdxToObjectIdxStartEnd[pageIdx].second; i += 2) {
nodes[i]->setID(practiceMenuNodeNames[arrayIdx] + "-toggler");
nodes[i + 1]->setID(practiceMenuNodeNames[arrayIdx] + "-info");

arrayIdx++;
}
#endif

pageIdx++;
arrayIdx = 0;
for (int i = pageIdxToObjectIdxStartEnd[3].first; i < pageIdxToObjectIdxStartEnd[3].second; i += 2) {
for (int i = pageIdxToObjectIdxStartEnd[pageIdx].first; i < pageIdxToObjectIdxStartEnd[pageIdx].second; i += 2) {
nodes[i]->setID(performanceMenuNodeNames[arrayIdx] + "-toggler");
nodes[i + 1]->setID(performanceMenuNodeNames[arrayIdx] + "-info");

arrayIdx++;
}

pageIdx++;
arrayIdx = 0;
for (int i = pageIdxToObjectIdxStartEnd[4].first; i < pageIdxToObjectIdxStartEnd[4].second; i += 2) {
for (int i = pageIdxToObjectIdxStartEnd[pageIdx].first; i < pageIdxToObjectIdxStartEnd[pageIdx].second; i += 2) {
nodes[i]->setID(audioMenuNodeNames[arrayIdx] + "-toggler");
nodes[i + 1]->setID(audioMenuNodeNames[arrayIdx] + "-info");

arrayIdx++;
}

pageIdx++;
arrayIdx = 0;
for (int i = pageIdxToObjectIdxStartEnd[5].first; i < pageIdxToObjectIdxStartEnd[5].second; i += 2) {
for (int i = pageIdxToObjectIdxStartEnd[pageIdx].first; i < pageIdxToObjectIdxStartEnd[pageIdx].second; i += 2) {
nodes[i]->setID(otherMenuNodeNames[arrayIdx] + "-toggler");
nodes[i + 1]->setID(otherMenuNodeNames[arrayIdx] + "-info");

arrayIdx++;
}

#ifdef GEODE_IS_MACOS
pageIdx++;
arrayIdx = 0;
for (int i = pageIdxToObjectIdxStartEnd[pageIdx].first; i < pageIdxToObjectIdxStartEnd[pageIdx].second; i += 2) {
nodes[i]->setID(optionsMenuNodeNames[arrayIdx] + "-toggler");
nodes[i + 1]->setID(optionsMenuNodeNames[arrayIdx] + "-info");
}
#endif

setIDs(
togglersMenu,
pageIdxToObjectIdxStartEnd[5].second + 1,
pageIdxToObjectIdxStartEnd[pageIdx].second + 1,
"saved-songs-button",
"fmod-debug-button",
"parental-control-button",
"close-button",
"left-arrow-button",
"right-arrow-button"
#ifndef GEODE_IS_ANDROID // sorry
#ifndef GEODE_IS_ANDROID // comma on new line
, "key-bindings-button"
#endif
);
Expand Down

0 comments on commit 0ef288c

Please sign in to comment.