Skip to content

Commit c107598

Browse files
committed
sticky lol
1 parent 97f47fa commit c107598

12 files changed

Lines changed: 159 additions & 51 deletions

File tree

mod.json

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -216,23 +216,6 @@
216216
"big-arrow-step": 20
217217
}
218218
},
219-
"sleepy-chance": {
220-
"type": "int",
221-
"name": "Sleep Chance",
222-
"description": "<cj>Sleepy Player</c> - Chance of your player falling asleep.",
223-
"default": 75,
224-
"min": 0,
225-
"max": 100,
226-
"control": {
227-
"input": true,
228-
"slider": true,
229-
"slider-step": 1,
230-
"arrows": true,
231-
"arrow-step": 10,
232-
"big-arrows": true,
233-
"big-arrow-step": 20
234-
}
235-
},
236219
"spam-chance": {
237220
"type": "int",
238221
"name": "Spam Challenge Chance",
@@ -301,6 +284,40 @@
301284
"big-arrow-step": 20
302285
}
303286
},
287+
"sleepy-chance": {
288+
"type": "int",
289+
"name": "Sleep Chance",
290+
"description": "<cj>Sleepy Player</c> - Chance of your player falling asleep.",
291+
"default": 75,
292+
"min": 0,
293+
"max": 100,
294+
"control": {
295+
"input": true,
296+
"slider": true,
297+
"slider-step": 1,
298+
"arrows": true,
299+
"arrow-step": 10,
300+
"big-arrows": true,
301+
"big-arrow-step": 20
302+
}
303+
},
304+
"sticky-chance": {
305+
"type": "int",
306+
"name": "Sticky Chance",
307+
"description": "<cj>Sticky Grounds</c> - Chance of your player sticking to a surface.",
308+
"default": 20,
309+
"min": 0,
310+
"max": 100,
311+
"control": {
312+
"input": true,
313+
"slider": true,
314+
"slider-step": 1,
315+
"arrows": true,
316+
"arrow-step": 10,
317+
"big-arrows": true,
318+
"big-arrow-step": 20
319+
}
320+
},
304321
"upside_down-chance": {
305322
"type": "int",
306323
"name": "Upside-Down Scene Chance",

src/Utils.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ namespace horrible {
155155
"Your character will occasionally fall asleep while playing.\n<cy>Credit: this_guy_yt</c>",
156156
category::misc,
157157
SillyTier::Low},
158+
{"sticky",
159+
"Sticky Grounds",
160+
"When your character lands on an object, it may stay stuck on its surface until you jump again.\n<cy>Credit: Cheeseworks</c>",
161+
category::misc,
162+
SillyTier::Medium},
158163
{"pauses",
159164
"Random Pauses",
160165
"While playing a level, it will randomly pause itself.\n<cy>Credit: DragonixGD</c>",

src/classes/ui/src/MathQuiz.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,16 @@ bool MathQuiz::init() {
126126

127127
problemText = fmt::format("{} {} {}", m_impl->m_numFirst, operation, m_impl->m_numSecond);
128128

129-
auto equalsLabel = CCLabelBMFont::create("= ?", "goldFont.fnt");
129+
auto equalsLabel = CCLabelBMFont::create("= ?", "goldFont.fnt", getScaledContentWidth() - 1.25f);
130130
equalsLabel->setID("equals-label");
131-
equalsLabel->setWidth(getScaledContentWidth() - 1.25f);
132131
equalsLabel->setPosition({ winSize.width / 2.f, winSize.height - 100.f });
133132

134133
addChild(equalsLabel);
135134
};
136135

137136
// reuse winSize declared above
138-
auto problemLabel = CCLabelBMFont::create(problemText.data(), "bigFont.fnt");
137+
auto problemLabel = CCLabelBMFont::create(problemText.data(), "bigFont.fnt", getScaledContentWidth() - 1.25f);
139138
problemLabel->setID("problem-label");
140-
problemLabel->setWidth(getScaledContentWidth() - 1.25f);
141139
problemLabel->setPosition({ winSize.width / 2.f, winSize.height - 60.f });
142140
problemLabel->setScale(m_impl->m_operation == MathOperation::Geometry ? 0.5f : 0.925f);
143141

src/classes/ui/src/RandomAd.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ bool RandomAd::setup() {
1515
textLabel->setID("message");
1616
textLabel->ignoreAnchorPointForPosition(false);
1717
textLabel->setPosition({ m_mainLayer->getScaledContentWidth() / 2.f, m_mainLayer->getScaledContentHeight() - 37.5f });
18-
textLabel->setAlignment(CCTextAlignment::kCCTextAlignmentCenter);
1918
textLabel->setAnchorPoint({ 0.5, 0.5 });
2019

2120
m_mainLayer->addChild(textLabel);

src/classes/ui/src/SpamChallenge.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,15 @@ bool SpamChallenge::init() {
4040
auto const winSize = CCDirector::get()->getWinSize();
4141

4242
// reuse winSize declared above
43-
auto label = CCLabelBMFont::create("Quick! Spam or get sent back!", "bigFont.fnt");
43+
auto label = CCLabelBMFont::create("Quick! Spam or get sent back!", "bigFont.fnt", getScaledContentWidth() - 1.25f);
4444
label->setID("label");
45-
label->setWidth(getScaledContentWidth() - 1.25f);
4645
label->setPosition({ winSize.width / 2.f, winSize.height - 50.f });
4746
label->setScale(0.875f);
4847

4948
addChild(label, 1);
5049

51-
auto descLabel = CCLabelBMFont::create("Use your mouse button or tap the screen to increase the count.", "chatFont.fnt");
50+
auto descLabel = CCLabelBMFont::create("Use your mouse button or tap the screen to increase the count.", "chatFont.fnt", getScaledContentWidth() - 1.25f);
5251
descLabel->setID("description-label");
53-
descLabel->setWidth(getScaledContentWidth() - 1.25f);
5452
descLabel->setPosition({ winSize.width / 2.f, 25.f });
5553
descLabel->setAnchorPoint({ 0.5, 0 });
5654
descLabel->setColor({ 250, 250, 25 });

src/hooks/PlayLayer/Confetti.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class $modify(ConfettiPlayLayer, PlayLayer) {
4747
log::info("unleashing confetti!");
4848

4949
if (auto fmod = FMODAudioEngine::sharedEngine()) fmod->playEffectAsync("jumpscareAudio.mp3");
50-
shakeCamera(1.25f, 2.5f, 0.0125f);
50+
shakeCamera(1.25f, 2.5f, 0.00875F);
5151
for (int i = 0; i < randng::get(125, 75); i++) createConfetti();
5252
};
5353

src/hooks/PlayLayer/Earthquake.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class $modify(EarthquakePlayLayer, PlayLayer) {
2929
// shake the camera randomly based on intensity
3030
int rnd = randng::fast();
3131

32-
shakeCamera(randng::get(5.f, 1.f), randng::get(10.f, 1.f), 0.0125f);
32+
shakeCamera(randng::get(5.f, 1.f), randng::get(10.f, 1.f), 0.00875F);
3333
};
3434

3535
scheduleOnce(schedule_selector(EarthquakePlayLayer::nextQuake), 0.125f);

src/hooks/PlayLayer/Health.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class $modify(HealthPlayLayer, PlayLayer) {
8585
m_player1->playSpawnEffect();
8686
m_player2->playSpawnEffect();
8787

88-
shakeCamera(1.25f, 2.5f, 0.0125f);
88+
shakeCamera(1.25f, 2.5f, 0.00875F);
8989

9090
if (m_fields->m_healthLabel) {
9191
auto const hp = fmt::format("HP\n{}%", static_cast<int>(m_fields->m_health));

src/hooks/PlayLayer/Motivation.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,8 @@ class $modify(MotivationPlayLayer, PlayLayer) {
115115

116116
void showMessage(float) {
117117
if (m_fields->enabled && !m_hasCompletedLevel) {
118-
auto label = CCLabelBMFont::create(Fields::msgs[randng::get(Fields::msgs.size())].data(), "bigFont.fnt");
118+
auto label = CCLabelBMFont::create(Fields::msgs[randng::get(Fields::msgs.size())].data(), "bigFont.fnt", getScaledContentWidth() - 12.5f);
119119
label->setAnchorPoint({ 0.5, 0 });
120-
label->setAlignment(kCCTextAlignmentCenter);
121-
label->setWidth(getScaledContentWidth() - 12.5f);
122120
label->setPosition({ getScaledContentWidth() / 2.f, -label->getScaledContentHeight() });
123121

124122
auto action = CCSequence::create(

src/hooks/PlayerObject/Sleepy.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ using namespace horrible;
99

1010
class $modify(SleepyPlayerObject, PlayerObject) {
1111
struct Fields {
12-
bool enabled = options::get("sleepy");
13-
int chance = options::getChance("sleepy");
12+
bool enabled = options::get("m_sleepy");
13+
int chance = options::getChance("m_sleepy");
1414

15-
bool sleepy = false; // decelerating-to-zero stage
16-
bool waking = false; // 5s buffer stage (cannot be re-slept)
15+
bool m_sleepy = false; // decelerating-to-zero stage
16+
bool m_waking = false; // 5s buffer stage (cannot be re-slept)
1717

18-
float savedDefaultSpeed = 0.f; // original speed captured at sleep start
18+
float m_defSpeed = 0.f; // original speed captured at sleep start
1919
};
2020

2121
bool init(int player, int ship, GJBaseGameLayer * gameLayer, CCLayer * layer, bool playLayer) {
@@ -33,34 +33,34 @@ class $modify(SleepyPlayerObject, PlayerObject) {
3333
void wakeUpSchedule(float) {
3434
log::debug("Waking the player up");
3535

36-
m_fields->sleepy = false;
37-
m_fields->waking = true;
36+
m_fields->m_sleepy = false;
37+
m_fields->m_waking = true;
3838

39-
m_playerSpeed = m_fields->savedDefaultSpeed; // snap back to original speed
39+
m_playerSpeed = m_fields->m_defSpeed; // snap back to original speed
4040

4141
scheduleOnce(schedule_selector(SleepyPlayerObject::fullyWakeUpSchedule), 5.f);
4242
};
4343

4444
// schedule wrapper for fullyWakeUp
4545
void fullyWakeUpSchedule(float) {
46-
m_fields->waking = false;
46+
m_fields->m_waking = false;
4747
};
4848

4949
bool pushButton(PlayerButton p0) {
50-
// no jumping while sleepy
51-
if (m_fields->sleepy) return false;
50+
// no jumping while m_sleepy
51+
if (m_fields->m_sleepy) return false;
5252
return PlayerObject::pushButton(p0);
5353
};
5454

5555
void asleep(float) {
5656
if (m_fields->enabled) {
5757
// player sleepy if not already in any stage
5858
auto onGround = m_isOnGround || m_isOnGround2 || m_isOnGround3 || m_isOnGround4;
59-
if (!m_fields->sleepy && !m_fields->waking && onGround) {
60-
log::debug("Making the player sleepy");
59+
if (!m_fields->m_sleepy && !m_fields->m_waking && onGround) {
60+
log::debug("Making the player m_sleepy");
6161

62-
m_fields->savedDefaultSpeed = m_playerSpeed; // capture original speed
63-
m_fields->sleepy = true;
62+
m_fields->m_defSpeed = m_playerSpeed; // capture original speed
63+
m_fields->m_sleepy = true;
6464

6565
scheduleOnce(schedule_selector(SleepyPlayerObject::startSleepTimer), 0.25f);
6666

@@ -69,14 +69,14 @@ class $modify(SleepyPlayerObject, PlayerObject) {
6969
};
7070
} else {
7171
// wake up
72-
if (m_fields->sleepy || m_fields->waking) m_fields->waking = false;
72+
if (m_fields->m_sleepy || m_fields->m_waking) m_fields->m_waking = false;
7373
};
7474
};
7575

7676
void fallAsleep(float dt) {
7777
// decelerate to 0 speed
78-
if (m_fields->sleepy) {
79-
auto decelRate = m_fields->savedDefaultSpeed / 5.f; // decel to 0 in 5s
78+
if (m_fields->m_sleepy) {
79+
auto decelRate = m_fields->m_defSpeed / 5.f; // decel to 0 in 5s
8080
m_playerSpeed -= decelRate * dt;
8181

8282
if (m_playerSpeed <= 0.f) {

0 commit comments

Comments
 (0)