Skip to content

Commit e0335e1

Browse files
committed
double jump lol
1 parent f0a7893 commit e0335e1

4 files changed

Lines changed: 39 additions & 10 deletions

File tree

mod.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646
"name": "Safe Mode",
4747
"description": "Prevent any progression made in the level. <cr>Highly recommended that this is kept enabled!</cr>",
4848
"default": true
49+
},
50+
"mods": {
51+
"type": "title",
52+
"name": "Mods",
53+
"description": "Customize the horrible mods."
4954
}
5055
}
5156
}

src/modified/GJBaseGameLayer.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ class $modify(HorribleGJBaseGameLayer, GJBaseGameLayer) {
5151
if (m_isPracticeMode && !m_fields->m_currentQuiz) {
5252
// pause the game
5353
auto gm = GameManager::sharedState();
54-
if (auto playLayer = PlayLayer::get()) {
55-
playLayer->pauseGame(true);
56-
57-
}
54+
if (auto playLayer = PlayLayer::get()) playLayer->pauseGame(true);
55+
5856
if (auto quiz = MathQuiz::create()) {
5957
#ifdef GEODE_IS_WINDOWS
6058
CCEGLView::sharedOpenGLView()->showCursor(true);
@@ -69,19 +67,22 @@ class $modify(HorribleGJBaseGameLayer, GJBaseGameLayer) {
6967

7068
// do something like if answer is right, just do PlayLayer::resumeGame()
7169
// then do something like if answer is wrong, do PlayLayer::resetLevelFromStart()
72-
// if the user do a keyBack, the absolutely do PlayLayer::resetLevelFromStart() :trol:
70+
// if the user do a keyBack, then absolutely do PlayLayer::resetLevelFromStart() :trol:
7371
};
7472

7573
if (horribleMod->getSavedValue<bool>("ads", false)) {
7674
m_fields->m_adCooldown += p0;
75+
7776
static float nextAdTime = 0.f;
7877
auto gm = GameManager::sharedState();
78+
7979
if (nextAdTime == 0.f || m_fields->m_adCooldown >= nextAdTime) {
8080
// Randomize next ad time between 20 and 40 seconds
8181
nextAdTime = 20.f + static_cast<float>(rand() % 21); // 20 to 40 inclusive
8282
m_fields->m_adCooldown = 0.f;
8383

8484
log::warn("ad time!");
85+
8586
#ifdef GEODE_IS_WINDOWS
8687
// Show cursor when ad appears
8788
CCEGLView::sharedOpenGLView()->showCursor(true);
@@ -99,14 +100,13 @@ class $modify(HorribleGJBaseGameLayer, GJBaseGameLayer) {
99100
} else {
100101
m_fields->m_currentAd = nullptr;
101102
};
102-
}
103+
};
104+
103105
#ifdef GEODE_IS_WINDOWS
104106
// Hide cursor if ad popup is closed
105-
if (!m_fields->m_currentAd && !CCScene::get()->getChildByID("ad"_spr)) {
106-
CCEGLView::sharedOpenGLView()->showCursor(false);
107-
}
107+
if (!m_fields->m_currentAd && !CCScene::get()->getChildByID("ad"_spr)) CCEGLView::sharedOpenGLView()->showCursor(false);
108108
#endif
109-
}
109+
};
110110

111111
GJBaseGameLayer::update(p0);
112112
};

src/modified/PlayerObject.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ using namespace geode::prelude;
1111
static RandomSeeder _randomSeeder;
1212

1313
class $modify(HorriblePlayerObject, PlayerObject) {
14+
struct Fields {
15+
int m_jumps = 0;
16+
};
17+
1418
void updateJump(float p0) {
1519
auto horribleMod = getMod();
1620
auto rnd = rand() % 101;
@@ -76,4 +80,19 @@ class $modify(HorriblePlayerObject, PlayerObject) {
7680

7781
PlayerObject::update(p0);
7882
};
83+
84+
bool pushButton(PlayerButton p0) {
85+
auto horribleMod = getMod();
86+
87+
if (horribleMod->getSavedValue<bool>("double-jump", false)) {
88+
if (p0 == PlayerButton::Jump) {
89+
if (m_isOnGround) m_fields->m_jumps = 0;
90+
if (!m_isOnGround) m_fields->m_jumps++;
91+
};
92+
93+
m_isOnGround = m_fields->m_jumps < 2;
94+
};
95+
96+
return PlayerObject::pushButton(p0);
97+
};
7998
};

src/popups/HorribleMenuPopup.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ std::vector<std::tuple<std::string, std::string, std::string, SillyTier, bool>>
9595
"Whenever your hitbox is inside of an obstacle hitbox, if you time your click right, you don't die.\n<cy>Credit: Wuffin</c>",
9696
SillyTier::Low,
9797
false},
98+
{"double-jump",
99+
"Double-Jump",
100+
"Allow your character to double-jump in a level.\n<cy>Credit: Cheeseworks</c>",
101+
SillyTier::Low,
102+
false}
98103
};
99104
};
100105

0 commit comments

Comments
 (0)