Skip to content

Commit 6ab5cd1

Browse files
committed
options reorganized
1 parent b4d1254 commit 6ab5cd1

35 files changed

Lines changed: 65 additions & 26 deletions

CONTRIBUTING.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,49 @@ You're free to fork our repository and [open a pull request](../../pulls/) if yo
66

77
Before opening or marking your pull request as ready for review, please be sure to test your build and make sure it is stable and not conflicting with the upstream repository. Try not to diverge from our current code styling and practices in your fork.
88

9+
### Guidelines
10+
This section mainly covers contributions for new options to Horrible Menu. For other pull requests, we simply ask that you justify your changes in detail when opening your request.
11+
12+
Every whole word in an option ID must be separated specifically by underscores (`_`), to keep things consistent!
13+
```txt
14+
your_option
15+
```
16+
17+
Always define a `THIS_ID` macro in an option's source file to keep things consistent and maintainable in case things change.
18+
```cpp
19+
#define THIS_ID "your_option"
20+
```
21+
22+
If you create your own option for the mod, we recommend adding your name to the end of the description with the following format.
23+
```txt
24+
created by {your preferred name}
25+
```
26+
Or, if it's someone else's idea, use this format.
27+
```txt
28+
suggested by {their preferred name}
29+
```
30+
31+
> [!INFO]
32+
> Your credits in the in-game credits pop-up will be automatically added by our maintainers if deemed meaningful enough - at least one functional option should qualify. Please refrain from modifying that code! We'll make sure your contribution(s) is/are credited appropriately!
33+
34+
Keep includes clean, make sure your IDE isn't configured to automatically add them, or things start to look messy!
35+
```cpp
36+
// Include internal utility headers
37+
#include <Utils.h>
38+
39+
// Include Geode headers
40+
#include <Geode/Geode.hpp>
41+
42+
// Whatever layer(s) are being hooked
43+
#include <Geode/modify/PlayerObject.hpp>
44+
45+
// Include namespaces
46+
using namespace geode::prelude;
47+
using namespace horrible::prelude;
48+
49+
// Then get to writing!
50+
```
51+
952
## Reporting Issues
1053
If you found a bug or want to make a suggestion, you're welcome to [open an issue](../../issues/) describing your case. Please be sure to provide as many details as possible. If you're having issues with crashing, please always provide a crashlog.
1154

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ class $modify(DoubleJumpPlayerObject, PlayerObject) {
2323
int m_jumps = 0;
2424
};
2525

26-
bool init(int player, int ship, GJBaseGameLayer* gameLayer, CCLayer* layer, bool playLayer) {
27-
if (!PlayerObject::init(player, ship, gameLayer, layer, playLayer)) return false;
28-
29-
auto f = m_fields.self();
30-
31-
return true;
32-
};
33-
3426
bool pushButton(PlayerButton p0) {
3527
auto f = m_fields.self();
3628

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ using namespace horrible::prelude;
1010
#define THIS_ID "gambler"
1111

1212
static auto const o = Option::create(THIS_ID)
13-
->setName("Gambler")
13+
->setName("Ending Gamble")
1414
->setDescription("When reaching 95% in a level, you have a chance at randomly being blasted way far back.\n<cl>suggested by Timered</c>")
1515
->setCategory(category::misc)
1616
->setSillyTier(SillyTier::Medium)
@@ -39,15 +39,15 @@ class $modify(GamblerPlayLayer, PlayLayer) {
3939

4040
// ensure that triggered is reset on level restart/full reset
4141
void fullReset() {
42+
PlayLayer::fullReset();
4243
m_fields->triggered = false;
4344
log::debug("gambler full reset");
44-
PlayLayer::fullReset();
4545
};
4646

4747
void resetLevel() {
48+
PlayLayer::resetLevel();
4849
m_fields->triggered = false;
4950
log::debug("gambler level reset");
50-
PlayLayer::resetLevel();
5151
};
5252

5353
void gamblerCheck(float) {
@@ -57,23 +57,30 @@ class $modify(GamblerPlayLayer, PlayLayer) {
5757
// detect the moment the player first reaches or crosses 95
5858
if (percentage == 95 && !f->triggered) {
5959
// roll a random number between 0 and 1
60-
int roll = randng::fast() % 2;
60+
int roll = randng::get(1);
6161

6262
log::info("Gambler roll: {}", roll);
6363
if (roll == 0) {
6464
log::info("Gambler lost the bet!");
6565

66+
sfx::play(sfx::file::pop);
67+
Notification::create("Unlucky!", NotificationIcon::Error)->show();
68+
6669
// reverse the player
6770
m_player1->reversePlayer(nullptr);
6871
m_player1->m_gravity = 0.01f; // reduce gravity to simulate a bounce
6972

7073
// force player to jump
71-
GJBaseGameLayer::get()->handleButton(true, 1, true);
74+
if (auto gjbgl = GJBaseGameLayer::get()) gjbgl->handleButton(true, 1, true);
7275

7376
f->triggered = true;
7477
f->tricked = true;
7578
} else {
7679
log::info("Gambler won the bet! instant win.");
80+
81+
sfx::play(sfx::file::good);
82+
Notification::create("You got lucky this time...", NotificationIcon::Success)->show();
83+
7784
levelComplete();
7885
f->triggered = true;
7986
};
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,13 @@ class $modify(SleepyPlayerObject, PlayerObject) {
3131
bool init(int player, int ship, GJBaseGameLayer* gameLayer, CCLayer* layer, bool playLayer) {
3232
if (!PlayerObject::init(player, ship, gameLayer, layer, playLayer)) return false;
3333

34-
auto f = m_fields.self();
35-
36-
if (playLayer) scheduleOnce(schedule_selector(SleepyPlayerObject::asleep), randng::get(30.f, 5.f) * chanceToDelayPct(f->chance));
34+
if (playLayer) scheduleOnce(schedule_selector(SleepyPlayerObject::asleep), randng::get(30.f, 5.f) * chanceToDelayPct(m_fields->chance));
3735

3836
return true;
3937
};
4038

4139
void startSleepTimer(float) {
42-
auto f = m_fields.self();
43-
scheduleOnce(schedule_selector(SleepyPlayerObject::wakeUpSchedule), randng::get(15.f, 3.f) * chanceToDelayPct(f->chance));
40+
scheduleOnce(schedule_selector(SleepyPlayerObject::wakeUpSchedule), randng::get(15.f, 3.f) * chanceToDelayPct(m_fields->chance));
4441
};
4542

4643
void wakeUpSchedule(float) {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ using namespace horrible::prelude;
1010
#define THIS_ID "pauses"
1111

1212
static auto const o = Option::create(THIS_ID)
13-
->setName("Random Pauses")
13+
->setName("Random Pause Chance")
1414
->setDescription("While playing a level, it will randomly pause itself.\n<cl>suggested by DragonixGD</c>")
15-
->setCategory(category::randoms)
15+
->setCategory(category::chances)
1616
->setSillyTier(SillyTier::Low)
1717
->autoRegister();
1818

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ using namespace horrible::prelude;
1010
#define THIS_ID "random_mirror"
1111

1212
static auto const o = Option::create(THIS_ID)
13-
->setName("Random Mirror Portal")
13+
->setName("Random Mirror Chance")
1414
->setDescription("Randomly activates a mirror portal while playing.\n<cl>suggested by TimeRed</c>")
15-
->setCategory(category::randoms)
15+
->setCategory(category::chances)
1616
->setSillyTier(SillyTier::Low)
1717
->autoRegister();
1818

0 commit comments

Comments
 (0)