diff --git a/changelog.md b/changelog.md index add4832..472ed27 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +# 1.4.7 + +- Fixed the UI Button disappearing if you have Transition Customizer enabled +- Added **Hide Pause Button** + # 1.4.6 - Fixed Touch Issues (now uses geode::Popup<>) diff --git a/mod.json b/mod.json index 601fed6..b922c42 100644 --- a/mod.json +++ b/mod.json @@ -1,6 +1,6 @@ { "geode": "3.2.0", - "version": "v1.4.6", + "version": "v1.4.7", "gd": { "win": "2.206", "android": "2.206" diff --git a/src/Client/ClientSetup.h b/src/Client/ClientSetup.h index e1f2e74..3059c8b 100644 --- a/src/Client/ClientSetup.h +++ b/src/Client/ClientSetup.h @@ -283,6 +283,8 @@ class ClientUtils cosmetic->modules.push_back(new Module("No Orb Pulse", "no-orb-pulse", "Disables orb's from pulsing, Doesn't work on main levels made before 2.2")); cosmetic->modules.push_back(new Module("Main Menu Gameplay", "main-menu-gameplay", "Allows you to control the icons on the main menu.\nI honestly have no idea what category to put it in so its cosmetic now :3")); + cosmetic->modules.push_back(new Module("Hide Pause Button", "hide-pause-button", "Hides the pause button in game, requires reopening level to apply")); + //cosmetic->modules.push_back(new Module("No Camera Movement", "no-camera", "Disables camera movements that are made with triggers")); //cosmetic->modules.push_back(new Module("No Player Rotation", "no-plr-rot", "Disables Player Rotation :3\nIt looks ugly imo but you do you")); diff --git a/src/Client/Module.cpp b/src/Client/Module.cpp index bcf9426..dc301a0 100644 --- a/src/Client/Module.cpp +++ b/src/Client/Module.cpp @@ -2,6 +2,51 @@ #include "../Layers/ModuleOptionsLayer.h" #include "Dropdown.h" +#include "../UI/PCDrawUtils.hpp" + +bool Module::touchBegan(CCPoint point, CCTouch* touch) +{ + if (CCRectMake(0, 0, Client::tileSize.x, Client::tileSize.y).containsPoint(point)) + { + log::info("id: {}", id); + mouseHeldDown = true; + + return true; + } + + return false; +} + +bool Module::touchMoved(CCPoint point, CCTouch* touch) +{ + return false; +} + +bool Module::touchEndedOrCancelled(CCPoint point, CCTouch* touch, bool cancelled) +{ + if (mouseHeldDown) + { + enabled = !enabled; + save(); + onChange(); + + if (enabled) + enableHooks(); + else + disableHooks(); + + mouseHeldDown = false; + } + + return false; +} + + +void Module::drawModule(CCPoint pointTopLeft) +{ + PCDrawUtils::drawRect(pointTopLeft, Client::tileSize, ccc4(0, 0, 255, 255)); +} + void Module::onOptionsAndroid(CCObject* sender) { diff --git a/src/Client/Module.h b/src/Client/Module.h index e985162..5331af6 100644 --- a/src/Client/Module.h +++ b/src/Client/Module.h @@ -5,21 +5,6 @@ #include -#define public_cast(value, member) [](auto* v) { \ - class FriendClass__; \ - using T = std::remove_pointer::type; \ - class FriendeeClass__: public T { \ - protected: \ - friend FriendClass__; \ - }; \ - class FriendClass__ { \ - public: \ - auto& get(FriendeeClass__* v) { return v->member; } \ - } c; \ - return c.get(reinterpret_cast(v)); \ -}(value) - - using namespace geode::prelude; class ModuleChangeDelegate @@ -61,6 +46,8 @@ class Module bool def; float value = 1.0f; + bool mouseHeldDown = false; + ModuleChangeDelegate* delegate = nullptr; void addHookRaw(Result hook); @@ -101,6 +88,16 @@ class Module this->load(); } + /// @brief + /// @param point the position of the touch relative to where the module should be drawn + /// @param touch touch + /// @return should stop input passing to gd + bool touchBegan(CCPoint point, CCTouch* touch); + bool touchMoved(CCPoint point, CCTouch* touch); + bool touchEndedOrCancelled(CCPoint point, CCTouch* touch, bool cancelled); + + void drawModule(CCPoint pointTopLeft); + virtual bool Draw(ImVec2 tileSize) { ImVec2 pos = ImGui::GetCursorPos(); diff --git a/src/Client/Window.cpp b/src/Client/Window.cpp index 63cc165..ab8792f 100644 --- a/src/Client/Window.cpp +++ b/src/Client/Window.cpp @@ -8,13 +8,15 @@ void Window::drawWindow() auto pos = windowPos + offsetForTime(Client::instance->animStatus); - PCDrawUtils::drawRect(pos, Client::tileSize, ccc4(255, 0, 0, 100)); + PCDrawUtils::drawRect(pos, Client::tileSize, ccc4(255, 0, 0, 255)); int i = 0; for (auto module : modules) { - PCDrawUtils::drawRect(pos + ccp(0, Client::tileSize.y * (i + 1)), Client::tileSize, ccc4(0, 255 - (5 * i), 0, 100)); + auto point = pos + ccp(0, Client::tileSize.y * (i + 1)); + + module->drawModule(point); i++; } @@ -35,6 +37,7 @@ bool Window::touchBegan(CCPoint point, CCTouch* touch) { auto pos = windowPos + offsetForTime(Client::instance->animStatus); auto rect = CCRectMake(pos.x, pos.y, Client::tileSize.x, Client::tileSize.y); + auto wndRect = CCRectMake(pos.x, pos.y, Client::tileSize.x, Client::tileSize.y * (modules.size() + 1)); if (rect.containsPoint(PCDrawUtils::getMousePosition())) { @@ -43,12 +46,27 @@ bool Window::touchBegan(CCPoint point, CCTouch* touch) return true; } + else + { + int i = 0; + + for (auto mod : modules) + { + if (mod->touchBegan((pos - point) + ccp(0, Client::tileSize.y * i), touch)) + return true; + + i++; + } + } return false; } bool Window::touchMoved(CCPoint point, CCTouch* touch) { + auto pos = windowPos + offsetForTime(Client::instance->animStatus); + auto wndRect = CCRectMake(pos.x, pos.y, Client::tileSize.x, Client::tileSize.y * (modules.size() + 1)); + if (dragging) { windowPos = PCDrawUtils::getMousePosition() + offset; @@ -58,6 +76,19 @@ bool Window::touchMoved(CCPoint point, CCTouch* touch) return true; } + if (true) + { + int i = 0; + + for (auto mod : modules) + { + if (mod->touchMoved((pos - point) + ccp(0, Client::tileSize.y * i), touch)) + return true; + + i++; + } + } + return false; } diff --git a/src/Hacks/HidePauseButton.cpp b/src/Hacks/HidePauseButton.cpp new file mode 100644 index 0000000..f895835 --- /dev/null +++ b/src/Hacks/HidePauseButton.cpp @@ -0,0 +1,23 @@ +#include +#include +#include "../Client/Client.h" + +using namespace geode::prelude; + +class $modify (UILayer) +{ + bool init(GJBaseGameLayer* p0) + { + if (!UILayer::init(p0)) + return false; + + if (auto menu = getChildOfType(this, 0); auto btn = getChildOfType(menu, 0)) + { + btn->getNormalImage()->setVisible(false); + } + + return true; + } + + QOLMOD_MOD_HOOK("hide-pause-button", "UILayer::init") +}; \ No newline at end of file diff --git a/src/Hacks/TransitionTimeCustomiser.cpp b/src/Hacks/TransitionTimeCustomiser.cpp index 964b022..8a94766 100644 --- a/src/Hacks/TransitionTimeCustomiser.cpp +++ b/src/Hacks/TransitionTimeCustomiser.cpp @@ -13,6 +13,8 @@ using namespace geode::prelude; CCScene* getSceneForSel(int i, float f, CCScene* s) { + AppDelegate::get()->willSwitchToScene(s); + switch (i) { default: diff --git a/src/UI/PCGuiNode.cpp b/src/UI/PCGuiNode.cpp index 3452900..886aec8 100644 --- a/src/UI/PCGuiNode.cpp +++ b/src/UI/PCGuiNode.cpp @@ -1,4 +1,4 @@ -#//include "PCGuiNode.hpp" +//#include "PCGuiNode.hpp" // //PCGuiNode* PCGuiNode::create() //{ @@ -156,12 +156,12 @@ // return CCTouchDispatcher::touches(touches, event, type); // } //}; -// -///* -//CCTOUCHBEGAN = 0, -//CCTOUCHMOVED = 1, -//CCTOUCHENDED = 2, -//CCTOUCHCANCELLED = 3, -// -//ccTouchMax = 4, -//*/ \ No newline at end of file + +/* +CCTOUCHBEGAN = 0, +CCTOUCHMOVED = 1, +CCTOUCHENDED = 2, +CCTOUCHCANCELLED = 3, + +ccTouchMax = 4, +*/ \ No newline at end of file diff --git a/src/Utils/Utils.hpp b/src/Utils/Utils.hpp index 862c890..4346d0f 100644 --- a/src/Utils/Utils.hpp +++ b/src/Utils/Utils.hpp @@ -15,4 +15,13 @@ return c.get(reinterpret_cast(v)); \ }(value) +#define QOLMOD_MOD_HOOK(_modid, _hookname) \ +static void onModify(auto& self) { \ + auto hook = self.getHook(_hookname); \ + Loader::get()->queueInMainThread([hook] { \ + auto modu = Client::GetModule(_modid); \ + modu->addHookRaw(hook); \ + }); \ +} + float roundUpToMultipleOf2(float num); \ No newline at end of file