Skip to content

Commit b176882

Browse files
committed
Cleanup to release on index!
1 parent c0d7864 commit b176882

File tree

11 files changed

+86
-61
lines changed

11 files changed

+86
-61
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [1.6.0-beta.2] - 2024-02-04
9+
10+
### Changed
11+
12+
- assets/GD-Roulette.png
13+
- Removed 1 unnecessary objectAtIndex
14+
15+
### Fixed
16+
17+
- Crash when on a fresh install of GD-Roulette
18+
819
## [1.6.0-beta.1] - 2024-02-04
920

1021
### Added

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,47 @@
11
# GD-Roulette
2-
A Geometry Dash Roulette.
32

4-
<details>
3+
A Geometry Dash Level Roulette.
4+
5+
<details open>
56
<summary>Image of the roulette</summary>
67
<br>
78
<img src="./assets/GD-Roulette.png" width="720"/>
89
</details>
910

10-
## How to install
11-
1. Download the latest release from the the [Releases tab](https://github.com/SpaghettDev/GD-Roulette/releases)
12-
1. Copy the contents of the resources.zip from the downloaded release into the "Resources" folder of your Geometry Dash installation.
13-
2. Then grab GD-Roulette.dll from the downloaded release and use you preferred injector to inject it into GeometryDash.exe
11+
## How to install (from Geode)
1412

15-
## Errors
16-
<details open>
17-
<summary>Error Image</summary>
18-
<br>
19-
<img src="./assets/Resources-Error.png" width="480"/>
20-
</details>
13+
1. Get [Geode](https://geode-sdk.org)
14+
2. Click the Geode button
15+
3. Click the download tab, find GD-Roulette, and click Install!
16+
17+
You'll now find the roulette button after clicking the Create button on the main menu.
2118

22-
If you're getting the error above then you haven't installed the roulette correctly...
23-
<br/>
24-
Please follow the instructions in the [How to install](#how-to-install) part.
19+
## How to install (from Releases)
20+
21+
1. Download the latest release's GD-Roulette.geode file
22+
2. Copy it to `Geometry Dash/geode/mods`
2523

2624
## How to build
25+
2726
Run the following commands in your preferred terminal:
27+
2828
```sh
2929
git clone https://github.com/SpaghettDev/GD-Roulette
3030
cd GD-Roulette
3131
mkdir build
3232
cd build
3333
cmake ..
3434
```
35+
3536
Then open the generated solution in Visual Studio.
3637

3738
**Make sure to compile in Release Mode! Otherwise the solution will not compile.**
3839

3940
## Credits
41+
4042
- SpaghettDev ([@SpaghettDev](https://github.com/SpaghettDev)): Creator & maintainer.
41-
- Skyue1 ([@Skyue1](https://github.com/Skyue1)): Added the featured/epic glow, and other stuff.
43+
- qwix ([@qwix456](https://github.com/qwix456)): Added the featured/epic glow, and other stuff.
4244
- iAndyHD3 ([@iAndyHD3](https://github.com/iAndyHD3)): Helped with issues.
43-
- Cvolton ([@Cvolton](https://github.com/Cvolton)): Helped with issues. And the buttons (RL_blankBtn_001).
45+
- Cvolton ([@Cvolton](https://github.com/Cvolton)): Helped with issues.
4446
- Alphalaneous ([@Alphatism](https://github.com/Alphatism)): Helped with issues.
47+
- mat ([@matcool](https://github.com/matcool)): Helped with Geode issues.

assets/GD-Roulette.png

58.6 KB
Loading

assets/Resources-Error.png

-128 KB
Binary file not shown.

assets/resources.zip

-3.78 MB
Binary file not shown.

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"win": "2.204",
55
"android": "2.205"
66
},
7-
"version": "v1.6.0-beta.1",
7+
"version": "v1.6.0-beta.2",
88
"id": "spaghettdev.gd-roulette",
99
"name": "GD-Roulette",
1010
"developer": "SpaghettDev",

src/layers/CreatorLayer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,24 @@ class $modify(RouletteButton, CreatorLayer)
1919
{
2020
if (!CreatorLayer::init()) return false;
2121

22-
auto layer = static_cast<CCMenu*>(this->getChildren()->objectAtIndex(1));
2322
auto menu = CCMenu::create();
2423
menu->setID("creator-layer-menu"_spr);
2524
menu->setPosition({ .0f, .0f });
2625
this->addChild(menu);
2726

2827
// Loader::get()->isModLoaded("absolllute.megahack")
2928

29+
// this is, well uhhh, very awful
3030
auto rouletteButton = CCMenuItemSpriteExtra::create(
3131
CCSprite::create("RL_blankBtn_001.png"_spr),
32-
layer,
32+
this,
3333
menu_selector(RouletteButton::onRouletteButton)
3434
);
3535
auto rouletteSprite = CCSprite::create("RL_btn_001.png"_spr);
3636
rouletteSprite->setScale(.725f);
3737
rouletteSprite->setPosition({ 22.25f, 23.75f });
3838
rouletteButton->addChild(rouletteSprite);
3939
rouletteButton->setPosition({ 25.f, 160.f });
40-
rouletteButton->setScale(.9f);
4140

4241
menu->addChild(rouletteButton);
4342

src/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "roulette/manager/RouletteManager.hpp"
12
#include <Geode/Geode.hpp>
23

34
using namespace geode::prelude;

src/roulette/layers/RouletteInfoLayer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ void RouletteInfoLayer::onToggleButton(CCObject* sender)
108108

109109
auto button = static_cast<CCMenuItemToggler*>(sender);
110110
auto parent = static_cast<CCMenu*>(button->getParent());
111-
auto ind = roulette::utils::getIndexOf(g_rouletteManager.selectedListArr->as_array(), true);
111+
auto ind = roulette::utils::getIndexOf(g_rouletteManager.getFromSaveContainer("selected-list-array").as_array(), true);
112112

113-
g_rouletteManager.selectedListArr->as_array().at(ind) = false;
114-
g_rouletteManager.selectedListArr->as_array().at(button->getTag()) = true;
113+
g_rouletteManager.getFromSaveContainer("selected-list-array").as_array().at(ind) = false;
114+
g_rouletteManager.getFromSaveContainer("selected-list-array").as_array().at(button->getTag()) = true;
115115

116116
// purely visual, "toggles" the difficulty face based on the selected list (demon for demon list, insane for challenge list, and previous difficulty for normal list)
117117
switch (button->getTag())
@@ -191,7 +191,7 @@ CCMenuItemToggler* RouletteInfoLayer::createToggler(int tag, const char* labelTe
191191
// button->setSizeMult(1.2f);
192192
button->setTag(tag);
193193
button->setVisible(visible);
194-
button->toggle(g_rouletteManager.selectedListArr->as_array().at(tag).as<bool>());
194+
button->toggle(g_rouletteManager.getFromSaveContainer("selected-list-array").as_array().at(tag).as<bool>());
195195
m_buttonMenu->addChild(button);
196196

197197
auto label = roulette::utils::createTextLabel(labelText, { point.x + 20, point.y }, .5f, m_buttonMenu);

src/roulette/layers/RouletteLayer.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ bool RouletteLayer::init()
131131
plusButton->setPosition({ 135.f, -20.f });
132132
plusButton->setSizeMult(1.2f);
133133
plusButton->setTag(11);
134-
plusButton->setVisible(g_rouletteManager.getArrayState(g_rouletteManager.difficultyArr, 5));
134+
plusButton->setVisible(g_rouletteManager.getArrayState(g_rouletteManager.getFromSaveContainer("difficulty-array"), 5));
135135
m_pMainMenu->addChild(plusButton);
136136

137137
auto startButtonText = CCLabelBMFont::create("Start", "bigFont.fnt");
@@ -347,7 +347,7 @@ bool RouletteLayer::init()
347347
m_pErrorMenu->addChild(errorResetButton);
348348

349349

350-
if (g_rouletteManager.getArrayState(g_rouletteManager.difficultyArr, 5))
350+
if (g_rouletteManager.getArrayState(g_rouletteManager.getFromSaveContainer("difficulty-array"), 5))
351351
{
352352
if (RouletteLayer::m_plus_button_state)
353353
{
@@ -356,7 +356,7 @@ bool RouletteLayer::init()
356356
}
357357

358358
for (int i = 6; i < 11; i++)
359-
if (g_rouletteManager.getArrayState(g_rouletteManager.demonDifficultyArr, i - 6))
359+
if (g_rouletteManager.getArrayState(g_rouletteManager.getFromSaveContainer("demon-difficulty-array"), i - 6))
360360
static_cast<CCMenuItemSpriteExtra*>(
361361
m_pMainMenu->getChildByTag(i)
362362
)->setColor({ 255, 255, 255 });
@@ -423,7 +423,7 @@ void RouletteLayer::onInfoButton(CCObject*)
423423
void RouletteLayer::onDifficultyChosen(CCObject* sender)
424424
{
425425
if (
426-
auto ind = roulette::utils::getIndexOf(g_rouletteManager.selectedListArr->as_array(), true);
426+
auto ind = roulette::utils::getIndexOf(g_rouletteManager.getFromSaveContainer("selected-list-array").as_array(), true);
427427
ind != 0
428428
)
429429
return;
@@ -434,41 +434,41 @@ void RouletteLayer::onDifficultyChosen(CCObject* sender)
434434
// check if difficultyButton is one of the demon types and not a regular difficulty
435435
if (tag > 5 && (tag < 10 || tag > 5))
436436
{
437-
int ind = roulette::utils::getIndexOf(g_rouletteManager.demonDifficultyArr->as_array(), true);
437+
int ind = roulette::utils::getIndexOf(g_rouletteManager.getFromSaveContainer("demon-difficulty-array").as_array(), true);
438438
static_cast<CCMenuItemSpriteExtra*>(
439439
m_pMainMenu->getChildByTag(ind + 6)
440440
)->setColor({ 125, 125, 125 });
441441

442-
g_rouletteManager.demonDifficultyArr->as_array().at(ind) = false;
443-
g_rouletteManager.demonDifficultyArr->as_array().at(tag - 6) = true;
442+
g_rouletteManager.getFromSaveContainer("demon-difficulty-array").as_array().at(ind) = false;
443+
g_rouletteManager.getFromSaveContainer("demon-difficulty-array").as_array().at(tag - 6) = true;
444444
}
445445
else
446446
{
447447
if (m_plus_button_state && tag != 5)
448448
onPlusButton(nullptr);
449449

450-
int ind = roulette::utils::getIndexOf(g_rouletteManager.difficultyArr->as_array(), true);
450+
int ind = roulette::utils::getIndexOf(g_rouletteManager.getFromSaveContainer("difficulty-array").as_array(), true);
451451
static_cast<CCMenuItemSpriteExtra*>(
452452
m_pMainMenu->getChildByTag(ind)
453453
)->setColor({ 125, 125, 125 });
454454

455-
g_rouletteManager.difficultyArr->as_array().at(ind) = false;
456-
g_rouletteManager.difficultyArr->as_array().at(tag) = true;
455+
g_rouletteManager.getFromSaveContainer("difficulty-array").as_array().at(ind) = false;
456+
g_rouletteManager.getFromSaveContainer("difficulty-array").as_array().at(tag) = true;
457457
g_rouletteManager.previousDifficulty = tag;
458458
}
459459

460460
difficultyButton->setColor({ 255, 255, 255 });
461461

462462
// demon
463-
m_pMainMenu->getChildByTag(11)->setVisible(g_rouletteManager.getArrayState(g_rouletteManager.difficultyArr, 5));
463+
m_pMainMenu->getChildByTag(11)->setVisible(g_rouletteManager.getArrayState(g_rouletteManager.getFromSaveContainer("difficulty-array"), 5));
464464
}
465465

466466
void RouletteLayer::onStartButton(CCObject*)
467467
{
468468
m_pMainMenu->setVisible(false);
469469

470-
int diffInd = roulette::utils::getIndexOf(g_rouletteManager.difficultyArr->as_array(), true);
471-
int demonInd = roulette::utils::getIndexOf(g_rouletteManager.demonDifficultyArr->as_array(), true);
470+
int diffInd = roulette::utils::getIndexOf(g_rouletteManager.getFromSaveContainer("difficulty-array").as_array(), true);
471+
int demonInd = roulette::utils::getIndexOf(g_rouletteManager.getFromSaveContainer("demon-difficulty-array").as_array(), true);
472472
int difficulty = diffInd == 5 ? (demonInd + 6) : (diffInd + 1);
473473

474474
getRandomListLevel(difficulty, m_level, m_list_fetcher_error);
@@ -586,8 +586,8 @@ void RouletteLayer::onNextButton(CCObject*)
586586
m_pPlayingMenu->getChildByTag(20)
587587
)->setString(fmt::format("{}%", g_rouletteManager.levelPercentageGoal).c_str());
588588

589-
int diffInd = roulette::utils::getIndexOf(g_rouletteManager.difficultyArr->as_array(), true);
590-
int demonInd = roulette::utils::getIndexOf(g_rouletteManager.demonDifficultyArr->as_array(), true);
589+
int diffInd = roulette::utils::getIndexOf(g_rouletteManager.getFromSaveContainer("difficulty-array").as_array(), true);
590+
int demonInd = roulette::utils::getIndexOf(g_rouletteManager.getFromSaveContainer("demon-difficulty-array").as_array(), true);
591591
int difficulty = diffInd == 5 ? (demonInd + 6) : (diffInd + 1);
592592

593593
getRandomListLevel(difficulty, m_level, m_list_fetcher_error);
@@ -637,7 +637,7 @@ void RouletteLayer::onResetButton(CCObject*)
637637
m_pMainMenu->getChildByTag(12)->setVisible(true);
638638
m_pMainMenu->getChildByTag(12)->setPositionY(-85.f);
639639

640-
if (g_rouletteManager.getArrayState(g_rouletteManager.difficultyArr, 5))
640+
if (g_rouletteManager.getArrayState(g_rouletteManager.getFromSaveContainer("difficulty-array"), 5))
641641
{
642642
m_plus_button_state = true;
643643
onPlusButton(nullptr);
@@ -664,8 +664,8 @@ void RouletteLayer::onSkipButton(CCObject*)
664664

665665
onNextLevel(false, true, -125.f);
666666

667-
int diffInd = roulette::utils::getIndexOf(g_rouletteManager.difficultyArr->as_array(), true);
668-
int demonInd = roulette::utils::getIndexOf(g_rouletteManager.demonDifficultyArr->as_array(), true);
667+
int diffInd = roulette::utils::getIndexOf(g_rouletteManager.getFromSaveContainer("difficulty-array").as_array(), true);
668+
int demonInd = roulette::utils::getIndexOf(g_rouletteManager.getFromSaveContainer("demon-difficulty-array").as_array(), true);
669669
int difficulty = diffInd == 5 ? (demonInd + 6) : (diffInd + 1);
670670

671671
getRandomListLevel(difficulty, m_level, m_list_fetcher_error);
@@ -719,8 +719,8 @@ void RouletteLayer::finishLevelRoulette()
719719
m_pPlayingMenu->getChildByTag(3)->getChildren()->objectAtIndex(0)
720720
)->setString(("ID: " + m_level.get<std::string>("id")).c_str());
721721

722-
auto diffInd = roulette::utils::getIndexOf(g_rouletteManager.difficultyArr->as_array(), true);
723-
auto demonInd = roulette::utils::getIndexOf(g_rouletteManager.demonDifficultyArr->as_array(), true);
722+
auto diffInd = roulette::utils::getIndexOf(g_rouletteManager.getFromSaveContainer("difficulty-array").as_array(), true);
723+
auto demonInd = roulette::utils::getIndexOf(g_rouletteManager.getFromSaveContainer("demon-difficulty-array").as_array(), true);
724724
int difficultyTag = m_difficulty_to_tag.at(m_level.get<std::string>("difficulty"));
725725

726726
if (int coins = m_level.get<int>("coins"); coins > 0)
@@ -810,7 +810,7 @@ void RouletteLayer::onNextLevel(bool levelTextVisible, bool enableLoadingCircle,
810810

811811
void RouletteLayer::getRandomListLevel(int difficulty, matjson::Value& list, std::string& error)
812812
{
813-
int listType = roulette::utils::getIndexOf(g_rouletteManager.selectedListArr->as_array(), true);
813+
int listType = roulette::utils::getIndexOf(g_rouletteManager.getFromSaveContainer("selected-list-array").as_array(), true);
814814
std::thread getListThread;
815815

816816
switch (listType)
@@ -853,12 +853,12 @@ CCMenuItemSpriteExtra* RouletteLayer::createDifficultyButton(int tag, CCNode* sp
853853
button->setTag(tag);
854854
if (isDemon)
855855
{
856-
if (!g_rouletteManager.getArrayState(g_rouletteManager.difficultyArr, tag - 6))
856+
if (!g_rouletteManager.getArrayState(g_rouletteManager.getFromSaveContainer("difficulty-array"), tag - 6))
857857
button->setColor({ 125, 125, 125 });
858858
}
859859
else
860860
{
861-
if (!g_rouletteManager.getArrayState(g_rouletteManager.difficultyArr, tag))
861+
if (!g_rouletteManager.getArrayState(g_rouletteManager.getFromSaveContainer("difficulty-array"), tag))
862862
button->setColor({ 125, 125, 125 });
863863
}
864864
button->setVisible(visible);

0 commit comments

Comments
 (0)