Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Jul 8, 2024
1 parent 7f6de20 commit 76d339b
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

- Fixed the UI Button disappearing if you have Transition Customizer enabled
- Lowered the Hitbox Trail limit to hopefully fix lag
- Slider Limit Bypass now works on the scale slider in the editor
- Added **Hide Pause Button**
- Added **Pause Countdown**

# 1.4.6

Expand Down
2 changes: 2 additions & 0 deletions src/Client/ClientSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ class ClientUtils

level->modules.push_back(new Module("Kill at %", "kill-after", "Kills the player after a set percentage"));
level->modules.push_back(new Module("Jump Hack", "jump-hack", "Allows you to jump infinitely"));

level->modules.push_back(new Module("Pause Countdown", "pause-countdown", "Shows a countdown for 3 seconds when you unpause a level"));
//level->modules.push_back(new Module("Frame Stepper", "frame-stepper", "Step the game through frames by tapping a button"));


Expand Down
54 changes: 54 additions & 0 deletions src/Hacks/Pause Countdown/CountdownLayer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "CountdownLayer.hpp"

bool CountdownLayer::init()
{
if (!CCLayer::init())
return false;

this->setKeypadEnabled(true);
this->schedule(schedule_selector(CountdownLayer::onDecrement), 1);

label = CCLabelBMFont::create(fmt::format("{}", count).c_str(), "goldFont.fnt");
label->setPosition(CCDirector::get()->getWinSize() / 2);

applyAnimation();

this->addChild(label);
return true;
}

void CountdownLayer::onDecrement(float)
{
count--;
label->setString(fmt::format("{}", count).c_str());
applyAnimation();

if (count == 0)
{
onCountReachedZero();
}
}

void CountdownLayer::onCountReachedZero()
{
PlayLayer::get()->resume();

this->removeFromParent();
}

void CountdownLayer::applyAnimation()
{
label->setScale(2.2f);
label->runAction(CCEaseElasticOut::create(CCScaleTo::create(0.5f, 1.5f)));

label->setOpacity(0);
label->runAction(CCEaseInOut::create(CCFadeTo::create(0.5f, 255), 2));
}

void CountdownLayer::keyBackClicked()
{
PlayLayer::get()->resume();
PlayLayer::get()->pauseGame(false);

this->removeFromParent();
}
20 changes: 20 additions & 0 deletions src/Hacks/Pause Countdown/CountdownLayer.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <Geode/Geode.hpp>
#include "../../Client/Client.h"

using namespace geode::prelude;

class CountdownLayer : public CCLayer
{
public:
CCLabelBMFont* label;
int count = 3;

void onDecrement(float);
void applyAnimation();

virtual bool init();
virtual void onCountReachedZero();
virtual void keyBackClicked();

CREATE_FUNC(CountdownLayer);
};
20 changes: 20 additions & 0 deletions src/Hacks/Pause Countdown/PauseCountdown.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <Geode/Geode.hpp>
#include <Geode/modify/PauseLayer.hpp>
#include "../../Client/Client.h"
#include "CountdownLayer.hpp"

using namespace geode::prelude;

class $modify (PauseLayer)
{
void onResume(cocos2d::CCObject* sender)
{
auto countdown = CountdownLayer::create();
CCScene::get()->addChild(countdown);

CCTouchDispatcher::get()->unregisterForcePrio(this);
this->removeFromParent();
}

QOLMOD_MOD_ALL_HOOKS("pause-countdown")
};
25 changes: 24 additions & 1 deletion src/Hacks/SliderLimit.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <Geode/Geode.hpp>
#include <Geode/modify/SliderTouchLogic.hpp>
#include <Geode/modify/SliderThumb.hpp>
#include <Geode/modify/GJScaleControl.hpp>
#include "../Client/Client.h"

Expand All @@ -27,4 +26,28 @@ class $modify (SliderTouchLogic)
modu->addHookRaw(hook);
});
}
};

class $modify (GJScaleControl)
{
virtual void ccTouchMoved(cocos2d::CCTouch* touch, cocos2d::CCEvent* event)
{
GJScaleControl::ccTouchMoved(touch, event);

if (m_sliderXY && m_sliderXY->m_touchLogic->m_activateThumb)
{
m_sliderXY->getThumb()->setPositionX(this->convertToNodeSpace(touch->getLocation()).x);
m_sliderXY->updateBar();

float value = scaleFloat(m_sliderXY->getThumb()->getValue(), m_lowerBound, m_upperBound);

updateLabelXY(value);
this->sliderChanged(m_sliderXY->getThumb());

if (EditorUI::get())
{
EditorUI::get()->scaleXYChanged(value, value, m_scaleLocked);
}
}
}
};
8 changes: 7 additions & 1 deletion src/Utils/Utils.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#include "Utils.hpp"

float roundUpToMultipleOf2(float num) {
float roundUpToMultipleOf2(float num)
{
float roundedNum = std::ceil(num / 2.0f) * 2.0f;
return roundedNum;
}

float scaleFloat(float v, float min, float max)
{
return (max - min) * v + min;
}
3 changes: 2 additions & 1 deletion src/Utils/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ static void onModify(auto& self) { \
}); \
}

float roundUpToMultipleOf2(float num);
float roundUpToMultipleOf2(float num);
float scaleFloat(float v, float min, float max);

0 comments on commit 76d339b

Please sign in to comment.