Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Aug 29, 2024
1 parent db3efb0 commit 33c01d3
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 27 deletions.
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ bool Client::handleKeybinds(enumKeyCodes key, bool isDown, bool isRepeatedKey)

bool Client::useImGuiUI()
{
return Mod::get()->getSettingValue<bool>("use-imgui-ui", false);
return Mod::get()->getSettingValue<bool>("use-imgui-ui");
}

void Client::initImGui()
Expand Down
3 changes: 3 additions & 0 deletions src/Client/ClientSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 23 additions & 20 deletions src/Hacks/AllModesPlatformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,39 @@ class $modify (GJBaseGameLayer)
{
void collisionCheckObjects(PlayerObject* p0, gd::vector<GameObject*>* 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)
{
for (size_t i = 0; i < p1->size(); i++)
{
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<EffectGameObject*>(obj))
{
if(this->canBeActivatedByPlayer(p0, as<EffectGameObject*>(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<int>(obj->m_objectType));
#endif
obj->playShineEffect();
if(this->canBeActivatedByPlayer(p0, as<EffectGameObject*>(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<int>(obj->m_objectType));
#endif
obj->playShineEffect();
}
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/Hacks/HitboxTrail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -34,7 +38,7 @@ class $modify (GJBaseGameLayerExt, GJBaseGameLayer)
{
GJBaseGameLayer::update(dt);

if (hitboxTrail->enabled)
if (hitboxTrail->enabled && m_debugDrawNode->isVisible())
drawTrail();
}

Expand Down Expand Up @@ -83,7 +87,7 @@ class $modify (GJBaseGameLayerExt, GJBaseGameLayer)
}
}

if (points.size() > 500)
if (points.size() > 200)
{
points.erase(points.begin());
sizes.erase(sizes.begin());
Expand Down
6 changes: 5 additions & 1 deletion src/Hacks/ShowHitboxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ class $modify (PlayLayer)
Module* mod2 = nullptr;
};

static void onModify(auto& self) {
self.setHookPriority("PlayLayer::updateVisibility", -6969);
}

void updateVisibility(float p0)
{
PlayLayer::updateVisibility(p0);

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");
Expand Down
34 changes: 31 additions & 3 deletions src/Labels/BestRun.cpp
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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<InputModule*>(_accurateMod->options[0])->getIntValue();

if (!_accurateMod->enabled)
places = GameManager::sharedState()->getGameVariable("0126") ? 2 : 0;
}

if (places == 0)
return fmt::format("{}", as<int>(f));

return utils::numToString<float>(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<int>(m_fields->bestFrom), as<int>(m_fields->bestTo));
if (!Client::GetModuleEnabled("best-run-always-show-from") && (as<int>(fields->fromPercent) == 0))
return fmt::format("Best Run: {}%", getRoundedString(fields->bestTo));

return fmt::format("Best Run: {} - {}%", getRoundedString(fields->bestFrom), getRoundedString(fields->bestTo));
}
2 changes: 2 additions & 0 deletions src/Labels/BestRun.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ class $modify (BestPlayLayer, PlayLayer)
};

void resetLevel();

std::string getRoundedString(float f);
std::string getRunString();
};

0 comments on commit 33c01d3

Please sign in to comment.