Skip to content

Commit d072128

Browse files
committed
sneaky button
1 parent 9461f92 commit d072128

5 files changed

Lines changed: 83 additions & 74 deletions

File tree

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ Want to add your own insane stuff to this mod? You can register your very own ho
5050
```cpp
5151
using namespace horrible;
5252

53-
inline static Option const opt = {
54-
"my-option"_spr,
53+
static constexpr auto id = "my-option"_spr;
54+
55+
static Option const opt = {
56+
id,
5557
"My Very Cool Option!",
5658
"This option is so very cool!",
5759
"Cool Options",
@@ -60,7 +62,7 @@ inline static Option const opt = {
6062
HORRIBLE_REGISTER_OPTION(opt);
6163

6264
class $modify(MyPlayLayer, PlayLayer) {
63-
HORRIBLE_DELEGATE_HOOKS(opt.id);
65+
HORRIBLE_DELEGATE_HOOKS(id);
6466

6567
// a vanilla hook
6668
void setupHasCompleted() {

about.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ Want to add your own insane stuff to this mod? You can <cy>register your very ow
4646
```cpp
4747
using namespace horrible;
4848

49-
inline static Option const opt = {
50-
"my-option"_spr,
49+
static constexpr auto id = "my-option"_spr;
50+
51+
static Option const opt = {
52+
id,
5153
"My Very Cool Option!",
5254
"This option is so very cool!",
5355
"Cool Options",
@@ -56,7 +58,7 @@ inline static Option const opt = {
5658
HORRIBLE_REGISTER_OPTION(opt);
5759

5860
class $modify(MyPlayLayer, PlayLayer) {
59-
HORRIBLE_DELEGATE_HOOKS(opt.id);
61+
HORRIBLE_DELEGATE_HOOKS(id);
6062

6163
// a vanilla hook
6264
void setupHasCompleted() {

src/hooks/Parry.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
1-
// #include <Utils.hpp>
1+
#include <Utils.hpp>
22

3-
// #include <Geode/Geode.hpp>
3+
#include <Geode/Geode.hpp>
44

55
// #include <Geode/modify/PlayLayer.hpp>
66
// #include <Geode/modify/PlayerObject.hpp>
77

8-
// // 8 hours and still not working properly :(
9-
// // imma take a nap
8+
// 8 hours and still not working properly :(
9+
// imma take a nap
1010

1111
// using namespace geode::prelude;
12-
// using namespace horrible::prelude;
12+
using namespace horrible::prelude;
1313

14-
// static constexpr auto id = "parry";
14+
inline static constexpr auto id = "parry";
15+
16+
inline static Option const o = {
17+
id,
18+
"Parry Obstacles",
19+
"Whenever your hitbox is inside of a hazard hitbox, you will instead destroy it if you time your input right.\n<cy>Credit: Wuffin</c>",
20+
category::misc,
21+
SillyTier::Low,
22+
true,
23+
{},
24+
};
25+
HORRIBLE_REGISTER_OPTION(o);
1526

1627
// static GameObject* s_pendingKiller1 = nullptr;
1728
// static GameObject* s_pendingKiller2 = nullptr;
@@ -29,16 +40,6 @@
2940

3041
// constexpr float kParryWindow = 0.5f; // seconds
3142

32-
// {
33-
// "parry",
34-
// "Parry Obstacles",
35-
// "Whenever your hitbox is inside of a hazard hitbox, you will instead destroy it if you time your input right.\n<cy>Credit: Wuffin</c>",
36-
// category::misc,
37-
// SillyTier::Low,
38-
// true,
39-
// {},
40-
// },
41-
4243
// class $modify(ParryPlayerObject, PlayerObject) {
4344
// struct Fields {
4445
// bool enabled = options::get(id);

src/menu/OptionMenu.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ class OptionMenu final : public Popup {
2626
OptionMenu();
2727
~OptionMenu();
2828

29-
void resetFilters(CCObject*);
30-
31-
void openModSettings(CCObject*);
32-
void openSeriesPage(CCObject*);
33-
void openSupporterPopup(CCObject*);
34-
3529
void onClose(CCObject* sender) override;
3630
void onExit() override;
3731
void cleanup() override;

src/menu/src/OptionMenu.cpp

Lines changed: 56 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,15 @@ bool OptionMenu::init() {
224224
m_mainLayer->addChild(filterMenu);
225225

226226
// add a mod settings at the bottom left
227+
// @geode-ignore(unknown-resource)
227228
auto settingsBtnSprite = CircleButtonSprite::createWithSpriteFrameName("geode.loader/settings.png");
228229
settingsBtnSprite->setScale(0.625f);
229230

230-
auto settingsBtn = CCMenuItemSpriteExtra::create(
231+
auto settingsBtn = CCMenuItemExt::createSpriteExtra(
231232
settingsBtnSprite,
232-
this,
233-
menu_selector(OptionMenu::openModSettings)
233+
[](auto) {
234+
openSettingsPopup(horribleMod);
235+
}
234236
);
235237
settingsBtn->setID("settings-btn");
236238

@@ -239,10 +241,21 @@ bool OptionMenu::init() {
239241
auto resetFiltersBtnSprite = CCSprite::createWithSpriteFrameName("GJ_replayBtn_001.png");
240242
resetFiltersBtnSprite->setScale(0.375f);
241243

242-
auto resetFiltersBtn = CCMenuItemSpriteExtra::create(
244+
auto resetFiltersBtn = CCMenuItemExt::createSpriteExtra(
243245
resetFiltersBtnSprite,
244-
this,
245-
menu_selector(OptionMenu::resetFilters)
246+
[this](auto) {
247+
createQuickPopup(
248+
"Reset Filters",
249+
"Would you like to <cr>reset all search filters</c>?",
250+
"Cancel", "OK",
251+
[this](bool, bool ok) {
252+
if (ok) {
253+
m_impl->selectedTier = SillyTier::None;
254+
CategoryEvent().send("", false);
255+
};
256+
}
257+
);
258+
}
246259
);
247260
resetFiltersBtn->setID("reset-filters-btn");
248261
resetFiltersBtn->setPositionX(m_mainLayer->getScaledContentWidth());
@@ -252,27 +265,57 @@ bool OptionMenu::init() {
252265
auto seriesBtnSprite = CCSprite::createWithSpriteFrameName("gj_ytIcon_001.png");
253266
seriesBtnSprite->setScale(0.75f);
254267

255-
auto seriesBtn = CCMenuItemSpriteExtra::create(
268+
auto seriesBtn = CCMenuItemExt::createSpriteExtra(
256269
seriesBtnSprite,
257-
this,
258-
menu_selector(OptionMenu::openSeriesPage)
270+
[](auto) {
271+
createQuickPopup(
272+
"Horrible Mods",
273+
"Watch the series '<cr>Horrible Mods</c>' on <cl>Avalanche</c>'s YouTube channel?",
274+
"Cancel", "OK",
275+
[](bool, bool ok) {
276+
if (ok) web::openLinkInBrowser("https://www.youtube.com/watch?v=Ssl49pNmW_0&list=PL0dsSu2pR5cERnq7gojZTKVRvUwWo2Ohu");
277+
}
278+
);
279+
}
259280
);
260281
seriesBtn->setID("horrible-mods-series-btn");
261282
seriesBtn->setPosition(mainLayerSize - 20.f);
262283

263284
m_buttonMenu->addChild(seriesBtn);
264285

286+
auto discordBtnSprite = CCSprite::createWithSpriteFrameName("gj_discordIcon_001.png");
287+
discordBtnSprite->setScale(0.75f);
288+
289+
auto discordBtn = CCMenuItemExt::createSpriteExtra(
290+
discordBtnSprite,
291+
[](auto) {
292+
createQuickPopup(
293+
"Discord",
294+
"Join the <cj>Cubic Studios</c> official Discord community server?",
295+
"Cancel", "OK",
296+
[](bool, bool ok) {
297+
if (ok) web::openLinkInBrowser("https://www.dsc.gg/cubic");
298+
}
299+
);
300+
}
301+
);
302+
discordBtn->setID("support-btn");
303+
discordBtn->setPosition({ mainLayerSize.width - 45.f, mainLayerSize.height - 20.f });
304+
305+
m_buttonMenu->addChild(discordBtn);
306+
265307
// @geode-ignore(unknown-resource)
266308
auto supporterBtnSprite = CCSprite::createWithSpriteFrameName("geode.loader/gift.png");
267309
supporterBtnSprite->setScale(0.75f);
268310

269-
auto supporterBtn = CCMenuItemSpriteExtra::create(
311+
auto supporterBtn = CCMenuItemExt::createSpriteExtra(
270312
supporterBtnSprite,
271-
this,
272-
menu_selector(OptionMenu::openSupporterPopup)
313+
[](auto) {
314+
openSupportPopup(horribleMod);
315+
}
273316
);
274317
supporterBtn->setID("support-btn");
275-
supporterBtn->setPosition({ mainLayerSize.width - 45.f, mainLayerSize.height - 20.f });
318+
supporterBtn->setPosition({ mainLayerSize.width - 70.f, mainLayerSize.height - 20.f });
276319

277320
m_buttonMenu->addChild(supporterBtn);
278321

@@ -305,39 +348,6 @@ bool OptionMenu::init() {
305348
return true;
306349
};
307350

308-
void OptionMenu::resetFilters(CCObject*) {
309-
createQuickPopup(
310-
"Reset Filters",
311-
"Would you like to <cr>reset all search filters</c>?",
312-
"Cancel", "OK",
313-
[this](bool, bool ok) {
314-
if (ok) {
315-
m_impl->selectedTier = SillyTier::None;
316-
CategoryEvent().send("", false);
317-
};
318-
}
319-
);
320-
};
321-
322-
void OptionMenu::openModSettings(CCObject*) {
323-
openSettingsPopup(horribleMod);
324-
};
325-
326-
void OptionMenu::openSeriesPage(CCObject*) {
327-
createQuickPopup(
328-
"Horrible Mods",
329-
"Watch the series '<cr>Horrible Mods</c>' on <cl>Avalanche</c>'s YouTube channel?",
330-
"Cancel", "OK",
331-
[this](bool, bool ok) {
332-
if (ok) web::openLinkInBrowser("https://www.youtube.com/watch?v=Ssl49pNmW_0&list=PL0dsSu2pR5cERnq7gojZTKVRvUwWo2Ohu");
333-
}
334-
);
335-
};
336-
337-
void OptionMenu::openSupporterPopup(CCObject*) {
338-
openSupportPopup(horribleMod);
339-
};
340-
341351
void OptionMenu::onClose(CCObject* sender) {
342352
s_inst = nullptr;
343353
Popup::onClose(sender);

0 commit comments

Comments
 (0)