diff --git a/changelog.md b/changelog.md index 6f22cbb..e77bfec 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,12 @@ +# 1.6.2 + +- Fixed infamous all modes platformer crash +- Fixed Hitbox Trail saving the trail when show hitboxes is disabled +- Fixed Show Hitboxes not working if prism menu is enabled +- Lowered Max Hitbox Trail count to 200 instead of 500 for performance reasons +- Added **Decimals to Best Run** +- Added **Hide From % from 0 to Best Run** + # 1.6.1 - Fixed game loading slowly if speedhack was turned to really low (<0.01) diff --git a/src/Client/Client.cpp b/src/Client/Client.cpp index 5fec915..2586372 100644 --- a/src/Client/Client.cpp +++ b/src/Client/Client.cpp @@ -56,7 +56,7 @@ bool Client::handleKeybinds(enumKeyCodes key, bool isDown, bool isRepeatedKey) bool Client::useImGuiUI() { - return Mod::get()->getSettingValue("use-imgui-ui", false); + return Mod::get()->getSettingValue("use-imgui-ui"); } void Client::initImGui() diff --git a/src/Client/ClientSetup.h b/src/Client/ClientSetup.h index 0326ad7..72f1b91 100644 --- a/src/Client/ClientSetup.h +++ b/src/Client/ClientSetup.h @@ -426,6 +426,9 @@ class ClientUtils Client::GetModule("status-clock")->options.push_back(new Module("24 Hour Time", "status-clock-24h-time", "Uses 24 hour time instead of 12 hour time")); + Client::GetModule("best-run")->options.push_back(new Module("Always Show From", "best-run-always-show-from", "Always shows the from percent even if it's from 0%")); + Client::GetModule("best-run")->options.push_back(new Module("Show Decimal Places", "best-run-decimals", "Shows decimal places in the run", true)); + #ifdef STATUS_TEXTS StatusNode::postSetup(replay); #endif diff --git a/src/Hacks/AllModesPlatformer.cpp b/src/Hacks/AllModesPlatformer.cpp index 9dabf8d..6d98294 100644 --- a/src/Hacks/AllModesPlatformer.cpp +++ b/src/Hacks/AllModesPlatformer.cpp @@ -11,10 +11,10 @@ class $modify (GJBaseGameLayer) { void collisionCheckObjects(PlayerObject* p0, gd::vector* p1, int p2, float p3) { -GJBaseGameLayer::collisionCheckObjects(p0, p1, p2, p3); + GJBaseGameLayer::collisionCheckObjects(p0, p1, p2, p3); -if (!m_isPlatformer) - return; + if (!m_isPlatformer) + return; if (p0 && p1) { @@ -22,25 +22,28 @@ if (!m_isPlatformer) { if (auto obj = p1->at(i)) { -if (obj->m_objectType == GameObjectType::WavePortal || obj->m_objectType == GameObjectType::SwingPortal) - { - if (p0->getObjectRect().intersectsRect(obj->getObjectRect())) + if (typeinfo_cast(obj)) { - if(this->canBeActivatedByPlayer(p0, as(obj))) + if (obj->m_objectType == GameObjectType::WavePortal || obj->m_objectType == GameObjectType::SwingPortal) + { + if (p0->getObjectRect().intersectsRect(obj->getObjectRect())) { - this->playerWillSwitchMode(p0, obj); - #ifdef GEODE_IS_WINDOWS - p0->switchedToMode(obj->m_objectType); - - if (obj->m_objectType == GameObjectType::SwingPortal) - p0->toggleSwingMode(true, false); - else - p0->toggleDartMode(true, false); - - #else - this->switchToFlyMode(p0, obj, false, as(obj->m_objectType)); - #endif - obj->playShineEffect(); + if(this->canBeActivatedByPlayer(p0, as(obj))) + { + this->playerWillSwitchMode(p0, obj); + #ifdef GEODE_IS_WINDOWS + p0->switchedToMode(obj->m_objectType); + + if (obj->m_objectType == GameObjectType::SwingPortal) + p0->toggleSwingMode(true, false); + else + p0->toggleDartMode(true, false); + + #else + this->switchToFlyMode(p0, obj, false, as(obj->m_objectType)); + #endif + obj->playShineEffect(); + } } } } diff --git a/src/Hacks/HitboxTrail.cpp b/src/Hacks/HitboxTrail.cpp index c41e257..a139ebd 100644 --- a/src/Hacks/HitboxTrail.cpp +++ b/src/Hacks/HitboxTrail.cpp @@ -26,6 +26,10 @@ class $modify (GJBaseGameLayerExt, GJBaseGameLayer) lastPos2 = CCPointZero; hitboxTrail = Client::GetModule("show-hitboxes")->options[6]; + hitboxTrail->onToggle = [](bool enabled){ + points.clear(); + sizes.clear(); + }; return true; } @@ -34,7 +38,7 @@ class $modify (GJBaseGameLayerExt, GJBaseGameLayer) { GJBaseGameLayer::update(dt); - if (hitboxTrail->enabled) + if (hitboxTrail->enabled && m_debugDrawNode->isVisible()) drawTrail(); } @@ -83,7 +87,7 @@ class $modify (GJBaseGameLayerExt, GJBaseGameLayer) } } - if (points.size() > 500) + if (points.size() > 200) { points.erase(points.begin()); sizes.erase(sizes.begin()); diff --git a/src/Hacks/ShowHitboxes.cpp b/src/Hacks/ShowHitboxes.cpp index 15aa0fb..627bade 100644 --- a/src/Hacks/ShowHitboxes.cpp +++ b/src/Hacks/ShowHitboxes.cpp @@ -12,6 +12,10 @@ class $modify (PlayLayer) Module* mod2 = nullptr; }; + static void onModify(auto& self) { + self.setHookPriority("PlayLayer::updateVisibility", -6969); + } + void updateVisibility(float p0) { PlayLayer::updateVisibility(p0); @@ -19,7 +23,7 @@ class $modify (PlayLayer) if (!m_debugDrawNode) return; - bool shouldVis = GameManager::sharedState()->getGameVariable("0166") && m_isPracticeMode; + bool shouldVis = m_debugDrawNode->isVisible(); if (!m_fields->mod) m_fields->mod = Client::GetModule("show-hitboxes"); diff --git a/src/Labels/BestRun.cpp b/src/Labels/BestRun.cpp index baa6715..10fea03 100644 --- a/src/Labels/BestRun.cpp +++ b/src/Labels/BestRun.cpp @@ -1,8 +1,10 @@ #include "BestRun.hpp" +Module* _accurateMod; + void BestPlayLayer::resetLevel() { - if (m_fields->ignoreBest) + if (m_fields->ignoreBest || (m_startPosObject && getCurrentPercent() == 0)) return PlayLayer::resetLevel(); m_fields->toPercent = getCurrentPercent(); @@ -20,10 +22,36 @@ void BestPlayLayer::resetLevel() m_fields->fromPercent = getCurrentPercent(); } +std::string BestPlayLayer::getRoundedString(float f) +{ + int places = 0; + + if (!_accurateMod) + _accurateMod = Client::GetModule("accurate-percentage"); + + if (Client::GetModuleEnabled("best-run-decimals") && _accurateMod) + { + places = as(_accurateMod->options[0])->getIntValue(); + + if (!_accurateMod->enabled) + places = GameManager::sharedState()->getGameVariable("0126") ? 2 : 0; + } + + if (places == 0) + return fmt::format("{}", as(f)); + + return utils::numToString(f, places); +} + std::string BestPlayLayer::getRunString() { - if (m_fields->bestLength == 0) + auto fields = m_fields.self(); + + if (fields->bestLength == 0) return "Best Run: None"; - return fmt::format("Best Run: {} - {}%", as(m_fields->bestFrom), as(m_fields->bestTo)); + if (!Client::GetModuleEnabled("best-run-always-show-from") && (as(fields->fromPercent) == 0)) + return fmt::format("Best Run: {}%", getRoundedString(fields->bestTo)); + + return fmt::format("Best Run: {} - {}%", getRoundedString(fields->bestFrom), getRoundedString(fields->bestTo)); } \ No newline at end of file diff --git a/src/Labels/BestRun.hpp b/src/Labels/BestRun.hpp index 9eacef2..f88f0b7 100644 --- a/src/Labels/BestRun.hpp +++ b/src/Labels/BestRun.hpp @@ -21,5 +21,7 @@ class $modify (BestPlayLayer, PlayLayer) }; void resetLevel(); + + std::string getRoundedString(float f); std::string getRunString(); }; \ No newline at end of file