Skip to content

Commit

Permalink
editor trail
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSillyDoggo committed Mar 19, 2024
1 parent 12f3b65 commit b5bf2bc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"geode": "2.0.0",
"version": "v1.2.6",
"version": "v1.2.7",
"gd": {
"win": "2.204",
"mac": "2.200",
Expand Down
25 changes: 23 additions & 2 deletions src/Hacks/HitboxTrail.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <Geode/Geode.hpp>
#include <Geode/modify/GJBaseGameLayer.hpp>
#include <Geode/modify/LevelEditorLayer.hpp>
#include "../Client/Client.h"

using namespace geode::prelude;
Expand All @@ -8,7 +9,7 @@ std::vector<CCPoint> points;
std::vector<CCPoint> sizes;
Module* hitboxTrail = nullptr;

class $modify (GJBaseGameLayer)
class $modify (GJBaseGameLayerExt, GJBaseGameLayer)
{
CCPoint lastPos = CCPointZero;

Expand Down Expand Up @@ -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())
{
Expand All @@ -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)
{
Expand All @@ -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<GJBaseGameLayerExt*>(this)->drawTrail();
}
};

0 comments on commit b5bf2bc

Please sign in to comment.