diff --git a/changelog.md b/changelog.md index 43fa068..47ec230 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,8 @@ # 1.7.0 - Made Icon Effects change colour of objects that use player colour in the level +- Frame Stepper no longer saves ticks if you are dead +- Frame Stepper buttons now repeat presses when being held down - Rewrote **Show Layout** to be better, allowing it to be ported to Windows and macOS - Added **Chest Unlock Bypass** diff --git a/src/Hacks/Frame Stepper/FrameStepper.cpp b/src/Hacks/Frame Stepper/FrameStepper.cpp index 360f0d5..1badb33 100644 --- a/src/Hacks/Frame Stepper/FrameStepper.cpp +++ b/src/Hacks/Frame Stepper/FrameStepper.cpp @@ -7,6 +7,9 @@ void SteppedBaseGameLayer::storeState() if (!typeinfo_cast(this)) return; + if (m_player1 && m_player1->m_isDead) + return; + auto fields = m_fields.self(); if (fields->states.size() + 1 > MAX_STORED_STATES) @@ -91,13 +94,13 @@ bool SteppedUILayer::init(GJBaseGameLayer* bgl) menu->setPosition(ccp(135 / 2, 40 / 2) + ccp(25, 25)); - m_fields->pause = CCMenuItemSpriteExtra::create(CCSprite::createWithSpriteFrameName("GJ_pauseBtn_001.png"), this, menu_selector(SteppedUILayer::onTogglePaused)); + m_fields->pause = RepeatableMenuItemSpriteExtra::create(CCSprite::createWithSpriteFrameName("GJ_pauseBtn_001.png"), this, menu_selector(SteppedUILayer::onTogglePaused)); m_fields->pause->getNormalImage()->setScale(0.8f); - m_fields->prev = CCMenuItemSpriteExtra::create(CCSprite::createWithSpriteFrameName("GJ_arrow_02_001.png"), this, menu_selector(SteppedUILayer::onPreviousFrame)); + m_fields->prev = RepeatableMenuItemSpriteExtra::create(CCSprite::createWithSpriteFrameName("GJ_arrow_02_001.png"), this, menu_selector(SteppedUILayer::onPreviousFrame)); m_fields->prev->getNormalImage()->setScale(0.8f); - auto next = CCMenuItemSpriteExtra::create(CCSprite::createWithSpriteFrameName("GJ_arrow_02_001.png"), this, menu_selector(SteppedUILayer::onStepFrame)); + auto next = RepeatableMenuItemSpriteExtra::create(CCSprite::createWithSpriteFrameName("GJ_arrow_02_001.png"), this, menu_selector(SteppedUILayer::onStepFrame)); next->getNormalImage()->setScale(0.8f); as(next->getNormalImage())->setFlipX(true); diff --git a/src/Hacks/Frame Stepper/FrameStepper.hpp b/src/Hacks/Frame Stepper/FrameStepper.hpp index b44400a..0e428c3 100644 --- a/src/Hacks/Frame Stepper/FrameStepper.hpp +++ b/src/Hacks/Frame Stepper/FrameStepper.hpp @@ -6,6 +6,7 @@ #include #include "../../Layers/EditPositionLayer.hpp" #include "../../Client/Client.h" +#include "../../UI/RepeatableMenuItemSpriteExtra.hpp" using namespace geode::prelude; @@ -35,9 +36,9 @@ class $modify (SteppedUILayer, UILayer) { struct Fields { - CCMenuItemSpriteExtra* next; - CCMenuItemSpriteExtra* prev; - CCMenuItemSpriteExtra* pause; + RepeatableMenuItemSpriteExtra* next; + RepeatableMenuItemSpriteExtra* prev; + RepeatableMenuItemSpriteExtra* pause; CCMenu* menu; }; diff --git a/src/Hacks/Show Layout/Layout.hpp b/src/Hacks/Show Layout/Layout.hpp index cc4bbb0..1ed1424 100644 --- a/src/Hacks/Show Layout/Layout.hpp +++ b/src/Hacks/Show Layout/Layout.hpp @@ -66,7 +66,9 @@ class $modify (LayoutBaseGameLayer, GJBaseGameLayer) static void onModify(auto& self) { showLayoutHooks.push_back(self.getHook("GJBaseGameLayer::updateColor").unwrapOr(nullptr)); - showLayoutHooks.push_back(self.getHook("GJBaseGameLayer::updateColor").unwrapOr(nullptr)); + showLayoutHooks.push_back(self.getHook("GJBaseGameLayer::createBackground").unwrapOr(nullptr)); + showLayoutHooks.push_back(self.getHook("GJBaseGameLayer::createGroundLayer").unwrapOr(nullptr)); + showLayoutHooks.push_back(self.getHook("GJBaseGameLayer::createMiddleground").unwrapOr(nullptr)); for (auto hook : showLayoutHooks) hook->setAutoEnable(false); @@ -76,12 +78,5 @@ class $modify (LayoutBaseGameLayer, GJBaseGameLayer) void createGroundLayer(int p0, int p1); void createMiddleground(int p0); - void updateDualGround(PlayerObject* p0, int p1, bool p2, float p3) - { - log::info("p0: {}, p1: {}, p2: {}, p3: {}", p0, p1, p2, p3); - - GJBaseGameLayer::updateDualGround(p0, p1, p2, p3); - } - virtual void updateColor(cocos2d::ccColor3B& color, float fadeTime, int colorID, bool blending, float opacity, cocos2d::ccHSVValue& copyHSV, int colorIDToCopy, bool copyOpacity, EffectGameObject* callerObject, int unk1, int unk2); }; \ No newline at end of file diff --git a/src/UI/RepeatableMenuItemSpriteExtra.cpp b/src/UI/RepeatableMenuItemSpriteExtra.cpp new file mode 100644 index 0000000..3b38efa --- /dev/null +++ b/src/UI/RepeatableMenuItemSpriteExtra.cpp @@ -0,0 +1,61 @@ +#include "RepeatableMenuItemSpriteExtra.hpp" + +void RepeatableMenuItemSpriteExtra::update(float dt) +{ + if (!m_bEnabled) + { + m_bSelected = false; + } + + if (!m_bSelected) + { + t = 0; + v = 0; + d = 0; + return; + } + + t += dt; + + if (t > startDelay) + { + v += dt; + + if (v > repeatTime - d) + { + v -= repeatTime - d; + + d += repTimeInc; + + if (d > repeatTime - maxSpeed) + d = repeatTime - maxSpeed; + + activate(); + + auto sequence = CCSequence::create(CCEaseBackOut::create(CCScaleBy::create(0.07f, 1.2f)), CCDelayTime::create(0.02f), CCScaleBy::create(0.1f, 1.0f / 1.2f), nullptr); + + this->runAction(sequence); + } + } +} + +RepeatableMenuItemSpriteExtra* RepeatableMenuItemSpriteExtra::create(cocos2d::CCNode* sprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback) +{ + auto pRet = new RepeatableMenuItemSpriteExtra(); + + if (pRet && pRet->init(sprite, disabledSprite, target, callback)) + { + pRet->scheduleUpdate(); + + pRet->autorelease(); + return pRet; + } + + CC_SAFE_DELETE(pRet); + return nullptr; +} + +RepeatableMenuItemSpriteExtra* RepeatableMenuItemSpriteExtra::create(cocos2d::CCNode* sprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback) +{ + return create(sprite, nullptr, target, callback); +} \ No newline at end of file diff --git a/src/UI/RepeatableMenuItemSpriteExtra.hpp b/src/UI/RepeatableMenuItemSpriteExtra.hpp new file mode 100644 index 0000000..82dd5f5 --- /dev/null +++ b/src/UI/RepeatableMenuItemSpriteExtra.hpp @@ -0,0 +1,22 @@ +#pragma once + +#include + +using namespace geode::prelude; + +class RepeatableMenuItemSpriteExtra : public CCMenuItemSpriteExtra +{ + public: + float maxSpeed = 0.03f; + float repTimeInc = 0.003f; + float repeatTime = 0.15f; + float startDelay = 0.4f; + float t = 0; + float v = 0; + float d = 0; + + virtual void update(float dt); + + static RepeatableMenuItemSpriteExtra* create(cocos2d::CCNode* sprite, cocos2d::CCNode* disabledSprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback); + static RepeatableMenuItemSpriteExtra* create(cocos2d::CCNode* sprite, cocos2d::CCObject* target, cocos2d::SEL_MenuHandler callback); +}; \ No newline at end of file