Skip to content

Commit 8bd4e9f

Browse files
added disabled options for other plat
1 parent b16c80a commit 8bd4e9f

3 files changed

Lines changed: 83 additions & 39 deletions

File tree

src/popups/HorribleMenuPopup.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ std::vector<std::tuple<std::string, std::string, std::string, SillyTier, bool>>
3535
{
3636
"mock",
3737
"Mock your 90%+ Fail",
38-
"Shows a screenshot of your 90%-99% fail everywhere.\n<cy>Credit: Wuffin</c>\n\n<cr>Note: This will not work on macOS and iOS</c>",
38+
"Shows a screenshot of your 90%-99% fail everywhere.\n<cy>Credit: Wuffin</c>\n<cr>Note: This will not work on macOS and iOS</c>",
3939
SillyTier::Medium,
4040
false
4141
},
@@ -115,7 +115,14 @@ std::vector<std::tuple<std::string, std::string, std::string, SillyTier, bool>>
115115
"Whenever your hitbox is inside of an obstacle hitbox, if you time your click right, you don't die.\n<cy>Credit: Wuffin</c>",
116116
SillyTier::Low,
117117
false
118-
}
118+
},
119+
{
120+
"health",
121+
"Player Health",
122+
"Add a health bar and decreases everytime you taken damage. When your health reaches zero, you die.\n<cy>Credit: Cheeseworks</c>",
123+
SillyTier::Low,
124+
false
125+
},
119126
};
120127
};
121128

src/popups/toggle/ModOption.cpp

Lines changed: 73 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
using namespace geode::prelude;
99

10-
bool ModOption::init(CCSize const& size, std::string id, std::string name, std::string description, SillyTier silly, bool restart) {
10+
bool ModOption::init(CCSize const &size, std::string id, std::string name, std::string description, SillyTier silly, bool restart)
11+
{
1112
m_modID = id;
1213
m_modName = name;
1314
m_modDescription = description;
@@ -16,17 +17,18 @@ bool ModOption::init(CCSize const& size, std::string id, std::string name, std::
1617

1718
m_restartRequired = restart;
1819

19-
if (!CCMenu::init()) return false;
20+
if (!CCMenu::init())
21+
return false;
2022

2123
setID(m_modID);
22-
setContentSize({ size.width, size.height });
23-
setAnchorPoint({ 0.5, 1 });
24+
setContentSize({size.width, size.height});
25+
setAnchorPoint({0.5, 1});
2426

2527
auto bg = CCScale9Sprite::create("square02_001.png");
2628
bg->setID("background");
2729
bg->setScale(0.5);
28-
bg->setAnchorPoint({ 0, 0 });
29-
bg->setContentSize({ getScaledContentWidth() * 2.f, getScaledContentHeight() * 2.f });
30+
bg->setAnchorPoint({0, 0});
31+
bg->setContentSize({getScaledContentWidth() * 2.f, getScaledContentHeight() * 2.f});
3032
bg->setOpacity(40);
3133

3234
addChild(bg, -1);
@@ -47,15 +49,15 @@ bool ModOption::init(CCSize const& size, std::string id, std::string name, std::
4749
togglerOff,
4850
togglerOn,
4951
this,
50-
menu_selector(ModOption::onToggle)
51-
);
52+
menu_selector(ModOption::onToggle));
5253
m_toggler->setID("toggle");
53-
m_toggler->setAnchorPoint({ 0.5f, 0.5f });
54-
m_toggler->setPosition({ x + 12.f, yCenter });
54+
m_toggler->setAnchorPoint({0.5f, 0.5f});
55+
m_toggler->setPosition({x + 12.f, yCenter});
5556
m_toggler->setScale(0.875f);
5657

5758
// Set toggler state based on saved mod option value
58-
if (m_mod) m_toggler->toggle(m_mod->getSavedValue<bool>(m_modID));
59+
if (m_mod)
60+
m_toggler->toggle(m_mod->getSavedValue<bool>(m_modID));
5961

6062
addChild(m_toggler);
6163

@@ -66,30 +68,30 @@ bool ModOption::init(CCSize const& size, std::string id, std::string name, std::
6668
m_modName.c_str(),
6769
"bigFont.fnt",
6870
getContentSize().width - 80.f,
69-
kCCTextAlignmentLeft
70-
);
71+
kCCTextAlignmentLeft);
7172
nameLabel->setID("name");
7273
nameLabel->setLineBreakWithoutSpace(true);
73-
nameLabel->setAnchorPoint({ 0.f, 0.5f });
74-
nameLabel->setPosition({ x, yCenter });
74+
nameLabel->setAnchorPoint({0.f, 0.5f});
75+
nameLabel->setPosition({x, yCenter});
7576
nameLabel->setScale(0.4f);
7677

7778
// Set color based on m_modTier
78-
switch (m_modTier) {
79+
switch (m_modTier)
80+
{
7981
case SillyTier::Low: // green
80-
nameLabel->setColor({ 100, 255, 100 });
82+
nameLabel->setColor({100, 255, 100});
8183
break;
8284

8385
case SillyTier::Medium: // yellow
84-
nameLabel->setColor({ 255, 255, 100 });
86+
nameLabel->setColor({255, 255, 100});
8587
break;
8688

8789
case SillyTier::High: // red
88-
nameLabel->setColor({ 255, 100, 100 });
90+
nameLabel->setColor({255, 100, 100});
8991
break;
9092

9193
default: // white
92-
nameLabel->setColor({ 255, 255, 255 });
94+
nameLabel->setColor({255, 255, 255});
9395
break;
9496
};
9597

@@ -106,63 +108,98 @@ bool ModOption::init(CCSize const& size, std::string id, std::string name, std::
106108
this,
107109
menu_selector(ModOption::onDescription));
108110
descBtn->setID("info");
109-
descBtn->setAnchorPoint({ 0.5f, 0.5f });
110-
descBtn->setPosition({ getContentSize().width - padding - 10.f, yCenter });
111+
descBtn->setAnchorPoint({0.5f, 0.5f});
112+
descBtn->setPosition({getContentSize().width - padding - 10.f, yCenter});
111113

112114
addChild(descBtn);
113115

116+
// disable if macos
117+
#ifdef GEODE_IS_MACOS
118+
if (m_modID == "mock")
119+
{ // add an modID to disabled for macOS
120+
m_toggler->setEnabled(false);
121+
togglerOff->setColor({166, 166, 166});
122+
togglerOn->setColor({166, 166, 166});
123+
bg->setColor({166, 166, 166});
124+
nameLabel->setColor({166, 166, 166});
125+
}
126+
#endif
127+
128+
// disable if ios
129+
#ifdef GEODE_IS_IOS
130+
if (m_modID == "mock")
131+
{ // add an modID to disabled for iOS
132+
m_toggler->setEnabled(false);
133+
togglerOff->setColor({166, 166, 166});
134+
togglerOn->setColor({166, 166, 166});
135+
bg->setColor({166, 166, 166});
136+
nameLabel->setColor({166, 166, 166});
137+
}
138+
#endif
139+
114140
return true;
115141
};
116142

117-
void ModOption::saveTogglerState() {
118-
if (m_toggler && m_mod) {
143+
void ModOption::saveTogglerState()
144+
{
145+
if (m_toggler && m_mod)
146+
{
119147
m_mod->setSavedValue(m_modID, m_toggler->isToggled());
120148
}
121149
};
122150

123-
void ModOption::onToggle(CCObject*) {
151+
void ModOption::onToggle(CCObject *)
152+
{
124153
if (m_toggler)
125154
m_mod->setSavedValue(m_modID, m_toggler->isToggled());
126155
if (m_restartRequired)
127156
Notification::create("Restart required!", NotificationIcon::Warning, 2.5f)->show();
128157

129158
// If grief option is toggled on, call LevelManager::checkAndDownloadGriefLevel
130-
if (m_modID == "grief" && m_toggler->isToggled()) {
159+
if (m_modID == "grief" && m_toggler->isToggled())
160+
{
131161
LevelManager::DownloadGriefLevel();
132162
}
133163

134164
log::info("Option {} now set to {}", m_modName, m_mod->getSavedValue<bool>(m_modID) ? "disabled" : "enabled"); // wtf is it other way around lmao
135165
};
136166

137-
void ModOption::onDescription(CCObject*) {
167+
void ModOption::onDescription(CCObject *)
168+
{
138169
if (auto popup = FLAlertLayer::create(
139-
m_modName.c_str(),
140-
m_modDescription.c_str(),
141-
"OK"))
170+
m_modName.c_str(),
171+
m_modDescription.c_str(),
172+
"OK"))
142173
popup->show();
143174
};
144175

145-
void ModOption::onExit() {
176+
void ModOption::onExit()
177+
{
146178
saveTogglerState();
147179
CCMenu::onExit();
148180
}
149181

150-
std::string ModOption::getModID() {
182+
std::string ModOption::getModID()
183+
{
151184
return m_modID;
152185
};
153186

154-
std::string ModOption::getModName() {
187+
std::string ModOption::getModName()
188+
{
155189
return m_modName;
156190
};
157191

158-
std::string ModOption::getModDescription() {
192+
std::string ModOption::getModDescription()
193+
{
159194
return m_modDescription;
160195
};
161196

162-
ModOption* ModOption::create(CCSize const& size, std::string id, std::string name, std::string description, SillyTier silly, bool restart) {
197+
ModOption *ModOption::create(CCSize const &size, std::string id, std::string name, std::string description, SillyTier silly, bool restart)
198+
{
163199
auto ret = new ModOption();
164200

165-
if (ret && ret->init(size, id, name, description, silly, restart)) {
201+
if (ret && ret->init(size, id, name, description, silly, restart))
202+
{
166203
ret->autorelease();
167204
return ret;
168205
};

todo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- get freeze working
1+
- get health bar working
22
- get math-quiz working
33
- get ads working
44
- get parry working

0 commit comments

Comments
 (0)