Skip to content

Commit a97f640

Browse files
committed
that was ub
1 parent 44bf6c2 commit a97f640

7 files changed

Lines changed: 38 additions & 24 deletions

File tree

src/hooks/Achievement.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
using namespace geode::prelude;
99
using namespace horrible::prelude;
1010

11+
inline static constexpr auto id = "achieve";
12+
1113
inline static Option const o = {
12-
"achieve",
14+
id,
1315
"Random Achievements",
1416
"Randomly play the achievement sound when clicking buttons.\n<cy>Credit: Cheeseworks</c>",
1517
category::randoms,
@@ -18,10 +20,10 @@ inline static Option const o = {
1820
HORRIBLE_REGISTER_OPTION(o);
1921

2022
class $modify(AchievementCCMenuItem, CCMenuItem) {
21-
HORRIBLE_DELEGATE_HOOKS(o.id);
23+
HORRIBLE_DELEGATE_HOOKS(id);
2224

2325
struct Fields {
24-
int chance = options::getChance(o.id);
26+
int chance = options::getChance(id);
2527
};
2628

2729
void activate() {

src/hooks/Dementia.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
using namespace geode::prelude;
99
using namespace horrible::prelude;
1010

11+
inline static constexpr auto id = "dementia";
12+
1113
inline static Option const o = {
12-
"dementia",
14+
id,
1315
"Dementia",
1416
"Chance of the player randomly teleports back. This is more like player lagging to be honest!\n<cy>Credit: imdissapearinghelp</c>",
1517
category::misc,
@@ -18,10 +20,10 @@ inline static Option const o = {
1820
HORRIBLE_REGISTER_OPTION(o);
1921

2022
class $modify(DementiaPlayerObject, PlayerObject) {
21-
HORRIBLE_DELEGATE_HOOKS(o.id);
23+
HORRIBLE_DELEGATE_HOOKS(id);
2224

2325
struct Fields {
24-
int chance = options::getChance(o.id);
26+
int chance = options::getChance(id);
2527

2628
int lastMusicTime = 0; // last music time in milliseconds
2729

src/hooks/GJBaseGameLayer/FakeCrash.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
using namespace geode::prelude;
88
using namespace horrible::prelude;
99

10+
inline static constexpr auto id = "fake_crash";
11+
1012
inline static Option const o = {
11-
"fake_crash",
13+
id,
1214
"Random Fake Crash",
1315
"While playing a level, there's a chance your game will fake a crash.\n<cy>Credit: Timered</c>",
1416
category::randoms,
@@ -17,10 +19,10 @@ inline static Option const o = {
1719
HORRIBLE_REGISTER_OPTION(o);
1820

1921
class $modify(FakeCrashGJBaseGameLayer, GJBaseGameLayer) {
20-
HORRIBLE_DELEGATE_HOOKS(o.id);
22+
HORRIBLE_DELEGATE_HOOKS(id);
2123

2224
struct Fields {
23-
int m_chance = options::getChance(o.id);
25+
int m_chance = options::getChance(id);
2426

2527
float m_lastTimeWarp = LevelTools::getLastTimewarp();
2628
bool m_inFakeCrash = false;

src/hooks/GJBaseGameLayer/RandomNoJump.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
using namespace geode::prelude;
88
using namespace horrible::prelude;
99

10+
inline static constexpr auto id = "no_jump";
11+
1012
inline static Option const o = {
11-
"no_jump",
13+
id,
1214
"Randomly Don't Jump",
1315
"When making an input in a level, there's a chance the player does not respond to it.\n<cy>Credit: GilanyKing12</c>",
1416
category::randoms,
@@ -17,10 +19,10 @@ inline static Option const o = {
1719
HORRIBLE_REGISTER_OPTION(o);
1820

1921
class $modify(NoJumpGJBaseGameLayer, GJBaseGameLayer) {
20-
HORRIBLE_DELEGATE_HOOKS(o.id);
22+
HORRIBLE_DELEGATE_HOOKS(id);
2123

2224
struct Fields {
23-
int chance = options::get(o.id);
25+
int chance = options::get(id);
2426
};
2527

2628
void handleButton(bool down, int button, bool isPlayer1) {

src/hooks/GJBaseGameLayer/TimewarpJump.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
using namespace geode::prelude;
88
using namespace horrible::prelude;
99

10+
inline static constexpr auto id = "timewarp_jump";
11+
1012
inline static Option const o = {
11-
"timewarp_jump",
13+
id,
1214
"Timewarp Jump",
1315
"When you jump, there's a chance time will briefly slow down or speed up.\n<cy>Credit: KGplayerA</c>",
1416
category::randoms,
@@ -17,7 +19,7 @@ inline static Option const o = {
1719
HORRIBLE_REGISTER_OPTION(o);
1820

1921
class $modify(TimewarpJumpGJBaseGameLayer, GJBaseGameLayer) {
20-
HORRIBLE_DELEGATE_HOOKS(o.id);
22+
HORRIBLE_DELEGATE_HOOKS(id);
2123

2224
void handleButton(bool down, int button, bool isPlayer1) {
2325
if (button == 1 && !down) {

src/hooks/Mock.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ using namespace horrible::prelude;
1111

1212
namespace fs = std::filesystem; // Shortcut for std::filesystem
1313

14+
inline static constexpr auto id = "mock";
15+
1416
inline static Option const o = {
15-
"mock",
17+
id,
1618
"Mock your 90%+ Fail",
1719
"Taunts you in the main me with a screenshot of one of your 90%-99% fails.\n<cy>Credit: Wuffin</c>",
1820
category::misc,
@@ -26,10 +28,10 @@ inline static Option const o = {
2628
HORRIBLE_REGISTER_OPTION(o);
2729

2830
class $modify(MockMenuLayer, MenuLayer) {
29-
HORRIBLE_DELEGATE_HOOKS(o.id);
31+
HORRIBLE_DELEGATE_HOOKS(id);
3032

3133
struct Fields {
32-
int chance = options::getChance(o.id);
34+
int chance = options::getChance(id);
3335
};
3436

3537
bool init() {
@@ -123,7 +125,7 @@ class $modify(MockMenuLayer, MenuLayer) {
123125
};
124126

125127
class $modify(MockPlayLayer, PlayLayer) {
126-
HORRIBLE_DELEGATE_HOOKS(o.id);
128+
HORRIBLE_DELEGATE_HOOKS(id);
127129

128130
void showNewBest(bool newReward, int orbs, int diamonds, bool demonKey, bool noRetry, bool noTitle) {
129131
int id = m_level->m_levelID;
@@ -162,11 +164,11 @@ class $modify(MockPlayLayer, PlayLayer) {
162164
auto mockConfigUnwr = mockConfig.unwrapOr(matjson::Value());
163165

164166
// overwrite this field (or add it) with the percent
165-
mockConfigUnwr[utils::numToString(o.id)] = percentage;
167+
mockConfigUnwr[utils::numToString(id)] = percentage;
166168

167169
toWrite = mockConfigUnwr;
168170
} else {
169-
toWrite = matjson::makeObject({ {utils::numToString(o.id), percentage} });
171+
toWrite = matjson::makeObject({ {utils::numToString(id), percentage} });
170172
};
171173

172174
if (!toWrite.isNull()) {
@@ -203,7 +205,7 @@ class $modify(MockPlayLayer, PlayLayer) {
203205
if (mockConfig.isOk()) {
204206
log::debug("Clearing mock record for {}", id);
205207
auto mockConfigUnwr = mockConfig.unwrapOr(matjson::Value());
206-
mockConfigUnwr[utils::numToString(o.id)].clear();
208+
mockConfigUnwr[utils::numToString(id)].clear();
207209

208210
auto const mockJson = file::writeToJson(mockConfigPath, mockConfigUnwr);
209211

src/hooks/Placebo.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
using namespace geode::prelude;
99
using namespace horrible::prelude;
1010

11+
inline static constexpr auto id = "placebo";
12+
1113
inline static Option const o = {
12-
"placebo",
14+
id,
1315
"Placebo",
1416
"A random chance that when you start a level, all the options you have enabled are disabled, or all the options you have disabled are enabled.\n<cy>Credit: tmdXD</c>",
1517
category::misc,
@@ -35,7 +37,7 @@ void placeboEffect() {
3537
};
3638

3739
class $modify(PlaceboLevelPage, LevelPage) {
38-
HORRIBLE_DELEGATE_HOOKS(o.id);
40+
HORRIBLE_DELEGATE_HOOKS(id);
3941

4042
void onPlay(CCObject * sender) {
4143
placeboEffect();
@@ -46,7 +48,7 @@ class $modify(PlaceboLevelPage, LevelPage) {
4648
};
4749

4850
class $modify(PlaceboLevelInfoLayer, LevelInfoLayer) {
49-
HORRIBLE_DELEGATE_HOOKS(o.id);
51+
HORRIBLE_DELEGATE_HOOKS(id);
5052

5153
void onPlay(CCObject * sender) {
5254
placeboEffect();

0 commit comments

Comments
 (0)