Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,40 @@
"big-arrow-step": 20
}
},
"tidal_wave-chance": {
"type": "int",
"name": "Tidal Wave Chance",
"description": "<cc>'Tidal Wave' Jumpscare!</c> - Chance of your level switching to the level named 'Tidal Wave'.",
"default": 15,
"min": 0,
"max": 100,
"control": {
"input": true,
"slider": true,
"slider-step": 1,
"arrows": true,
"arrow-step": 10,
"big-arrows": true,
"big-arrow-step": 20
}
},
"troll_level-chance": {
"type": "int",
"name": "Troll Level Chance",
"description": "<cc>You're Getting Trolled</c> - Chance of your level switching to Congregation.",
"default": 20,
"min": 0,
"max": 100,
"control": {
"input": true,
"slider": true,
"slider-step": 1,
"arrows": true,
"arrow-step": 10,
"big-arrows": true,
"big-arrow-step": 20
}
},
"whack_a_face-chance": {
"type": "int",
"name": "Whack-A-Face Chance",
Expand Down Expand Up @@ -335,6 +369,23 @@
"big-arrow-step": 20
}
},
"captcha-chance": {
"type": "int",
"name": "Captcha Chance",
"description": "<cc>Verify Your Captchas...</c> - Chance of the captcha appearing in a level.",
"default": 20,
"min": 0,
"max": 100,
"control": {
"input": true,
"slider": true,
"slider-step": 1,
"arrows": true,
"arrow-step": 10,
"big-arrows": true,
"big-arrow-step": 20
}
},
"mock-chance": {
"type": "int",
"name": "Mock Chance",
Expand Down
4 changes: 4 additions & 0 deletions src/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <util/Random.hpp>
#include <util/Themes.hpp>

#include <util/ui/Captcha.hpp>
#include <util/ui/MathQuiz.hpp>
#include <util/ui/RandomAd.hpp>
#include <util/ui/SpamChallenge.hpp>
Expand All @@ -25,6 +26,8 @@

#include <Geode/ui/Button.hpp>

#include <Geode/utils/cocos.hpp>

#include <Geode/binding/FMODAudioEngine.hpp>

#define HIGHEST_Z cocos2d::CCScene::get()->getHighestChildZ() + 1
Expand Down Expand Up @@ -93,6 +96,7 @@ namespace horrible {
namespace category {
inline constexpr auto playerlife = "Player Life";
inline constexpr auto jumpscares = "Jumpscares";
inline constexpr auto mechanics = "Mechanics";
inline constexpr auto randoms = "Randoms";
inline constexpr auto chances = "Chances";
inline constexpr auto obstructive = "Obstructive";
Expand Down
39 changes: 0 additions & 39 deletions src/hooks/DoubleJump.cpp

This file was deleted.

64 changes: 64 additions & 0 deletions src/hooks/Flicks.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include <Utils.h>

#include <Geode/Geode.hpp>

#include <Geode/modify/PlayLayer.hpp>

using namespace geode::prelude;
using namespace horrible::prelude;

#define THIS_ID "flick"

static auto const o = Option::create(THIS_ID)
->setName("Flicks")
->setDescription("Every time you respawn in a level, whether it be from the beginning or a checkpoint, one of your options get toggled on or off.\n<co>Careful! It might break some things...</c>\n<cl>suggested by scr33n_p4r45173</c>")
->setCategory(category::misc)
->setSillyTier(SillyTier::High)
->setCheating(true)
->autoRegister();

class $modify(FlicksPlayLayer, PlayLayer) {
HORRIBLE_DELEGATE_HOOKS(THIS_ID);

struct Fields final {
std::vector<std::weak_ptr<Option>> options = OptionManager::get()->getOptions();

bool firstTime = true;
};

void resetLevel() {
PlayLayer::resetLevel();

auto f = m_fields.self();

if (f->firstTime) {
f->firstTime = false;
return;
};

if (f->options.empty()) return;

auto opt = f->options[rng::get(f->options.size() - 1)];
if (auto o = opt.lock()) {
if (o->getID() == THIS_ID || !platformCompat(o->getSupportedPlatforms())) return Notification::create("Whoops! Missed an option!", NotificationIcon::Warning, 0.25f)->show();

queueInMainThread([opt]() {
if (auto o = opt.lock()) {
o->isEnabled() ? o->disable() : o->enable();
log::warn("Flicked option {} {} due to flicks", o->getID(), o->isEnabled() ? "ON" : "OFF");

sfx::play(sfx::file::bad);
Notification::create(fmt::format("Flicked {} ({}) {}", o->getName(), o->getCategory(), o->isEnabled() ? "ON" : "OFF").c_str(), NotificationIcon::Warning, 0.5f)->show();
};
});
};
};

bool platformCompat(std::span<const Platform> plats) {
for (auto const& p : plats) {
if (p & GEODE_PLATFORM_TARGET) return true;
};

return false;
};
};
19 changes: 17 additions & 2 deletions src/hooks/jumpscares/ForceLevels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ using namespace horrible::prelude;

#define THIS_ID_GRIEF "grief"
#define THIS_ID_CONGREG "congregation"
#define THIS_ID_TIDAL "tidal_wave"

static auto const oGrief = Option::create(THIS_ID_GRIEF)
->setName("Get Back on Grief")
->setDescription("A chance of forcing you to play Grief when you die in a level.\n<cl>suggested by Sweep</c>")
->setCategory(category::jumpscares)
->setSillyTier(SillyTier::High)
->setOnline(true)
->setCheating(true)
->autoRegister();

static auto const oCongreg = Option::create(THIS_ID_CONGREG)
Expand All @@ -29,16 +29,24 @@ static auto const oCongreg = Option::create(THIS_ID_CONGREG)
->setCategory(category::jumpscares)
->setSillyTier(SillyTier::High)
->setOnline(true)
->setCheating(true)
->autoRegister();

static auto const oTidal = Option::create(THIS_ID_TIDAL)
->setName("'Tidal Wave' Jumpscare!")
->setDescription("A chance of forcing you to play the level 'Tidal Wave' when you die in a level. The level called 'Tidal Wave'. That one.\n<cl>suggested by liliam25</c>")
->setCategory(category::jumpscares)
->setSillyTier(SillyTier::Medium)
->setOnline(true)
->autoRegister();

static StringMap<bool> g_jsMap;
static std::vector<std::weak_ptr<Hook>> g_jsHookVector;

namespace js_internal {
static constexpr auto getLevelInfo(std::string_view id) noexcept {
if (id == THIS_ID_GRIEF) return jumpscares::level::grief;
if (id == THIS_ID_CONGREG) return jumpscares::level::congregation;
if (id == THIS_ID_TIDAL) return jumpscares::level::tidal;

return jumpscares::level::grief;
};
Expand Down Expand Up @@ -68,6 +76,7 @@ namespace js_internal {
$on_mod(Loaded) {
js_internal::toggleOption(THIS_ID_GRIEF, options::isEnabled(THIS_ID_GRIEF));
js_internal::toggleOption(THIS_ID_CONGREG, options::isEnabled(THIS_ID_CONGREG));
js_internal::toggleOption(THIS_ID_TIDAL, options::isEnabled(THIS_ID_TIDAL));

listenForHorribleOptionChanges(
THIS_ID_GRIEF,
Expand All @@ -80,6 +89,12 @@ namespace js_internal {
[](HorribleOptionSave data) {
js_internal::toggleOption(THIS_ID_CONGREG, data.enabled);
});

listenForHorribleOptionChanges(
THIS_ID_TIDAL,
[](HorribleOptionSave data) {
js_internal::toggleOption(THIS_ID_TIDAL, data.enabled);
});
};

static void tryJumpscare(bool useReplay) {
Expand Down
75 changes: 75 additions & 0 deletions src/hooks/jumpscares/TrollLevel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#include <Utils.h>

#include <Geode/Geode.hpp>

#include <Geode/modify/PlayLayer.hpp>

using namespace geode::prelude;
using namespace horrible::prelude;

#define THIS_ID "troll_level"

static auto const o = Option::create(THIS_ID)
->setName("You're Getting Trolled")
->setDescription("A chance when loading a level, to instead load a funny troll level.\n<cl>created by Cheeseworks</c>")
->setCategory(category::jumpscares)
->setSillyTier(SillyTier::High)
->setOnline(true)
->autoRegister();

namespace js_internal {
static constexpr auto id = 57436521;

static void saveTrollLevel() {
jumpscares::coro::getLevel(id, [](Result<GJGameLevel*> result) {
if (result.isOk()) {
auto level = std::move(result).unwrap();

if (auto mdm = MusicDownloadManager::sharedState()) {
mdm->addMusicDownloadDelegate(jumpscares::JumpscareLevelManager::get());
mdm->downloadSong(level->m_songID);
};

if (auto glm = GameLevelManager::sharedState()) glm->saveLevel(level);
if (auto jm = jumpscares::JumpscareLevelManager::get()) jm->saveLevel(level);
} else if (result.isErr()) {
log::error("Failed to get level {}: {}", id, result.unwrapErr());
};
});
};

static void switchToTrollLevel(GJGameLevel* level, bool dontCreateObjects, bool useReplay) {
log::warn("Switching to {} level ({})", level->m_levelName, level->m_levelID.value());

auto scene = PlayLayer::scene(level, useReplay, dontCreateObjects);
CCDirector::sharedDirector()->replaceScene(scene);
};
};

$on_mod(Loaded) {
if (options::isEnabled(THIS_ID)) js_internal::saveTrollLevel();

listenForHorribleOptionChanges(
THIS_ID,
[](HorribleOptionSave data) {
if (data.enabled) js_internal::saveTrollLevel();
});
};

class $modify(TrollLevelPlayLayer, PlayLayer) {
HORRIBLE_DELEGATE_HOOKS(THIS_ID);

struct Fields final {
uint8_t chance = options::getChance(THIS_ID);
};

bool init(GJGameLevel* level, bool useReplay, bool dontCreateObjects) {
if (auto jm = jumpscares::JumpscareLevelManager::get()) {
if (rng::fast() <= m_fields->chance) {
if (auto lvl = jm->getLevel(js_internal::id)) return PlayLayer::init(lvl, useReplay, dontCreateObjects);
};
};

return PlayLayer::init(level, useReplay, dontCreateObjects);
};
};
Loading
Loading