From b5bf2bc9f6ae98d3aef55805c6f6a33da1ba32ec Mon Sep 17 00:00:00 2001 From: Explodingbill Date: Tue, 19 Mar 2024 18:03:09 +1100 Subject: [PATCH] editor trail --- mod.json | 2 +- src/Hacks/HitboxTrail.cpp | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/mod.json b/mod.json index 2dc84f6..366f3af 100644 --- a/mod.json +++ b/mod.json @@ -1,6 +1,6 @@ { "geode": "2.0.0", - "version": "v1.2.6", + "version": "v1.2.7", "gd": { "win": "2.204", "mac": "2.200", diff --git a/src/Hacks/HitboxTrail.cpp b/src/Hacks/HitboxTrail.cpp index 494753f..f53c624 100644 --- a/src/Hacks/HitboxTrail.cpp +++ b/src/Hacks/HitboxTrail.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "../Client/Client.h" using namespace geode::prelude; @@ -8,7 +9,7 @@ std::vector points; std::vector sizes; Module* hitboxTrail = nullptr; -class $modify (GJBaseGameLayer) +class $modify (GJBaseGameLayerExt, GJBaseGameLayer) { CCPoint lastPos = CCPointZero; @@ -60,7 +61,13 @@ class $modify (GJBaseGameLayer) if (!m_fields->dn) m_fields->dn = getNode(); - if (m_player1 && m_fields->dn && hitboxTrail->enabled) + if (hitboxTrail->enabled) + drawTrail(); + } + + void drawTrail() + { + if (m_player1) { if (m_fields->lastPos != m_player1->getPosition()) { @@ -69,7 +76,10 @@ class $modify (GJBaseGameLayer) points.push_back(m_fields->lastPos); sizes.push_back(m_player1->getObjectRect().size); } + } + if (m_fields->dn) + { int i = 0; for (auto point : points) { @@ -95,4 +105,15 @@ class $modify (GJBaseGameLayer) sizes.erase(sizes.begin()); } } +}; + +class $modify (LevelEditorLayer) +{ + virtual TodoReturn updateVisibility(float p0) + { + LevelEditorLayer::updateVisibility(p0); + + if (hitboxTrail && hitboxTrail->enabled) + reinterpret_cast(this)->drawTrail(); + } }; \ No newline at end of file