bugfixing

This commit is contained in:
maxnut
2024-03-04 16:28:56 +01:00
parent 803c5d91b4
commit 489b7887f7
7 changed files with 46 additions and 46 deletions

View File

@@ -8,4 +8,5 @@ Open Source, feature-rich, gui-integrated Geometry Dash mod menu.
* Startpos Switcher
* Macro Bot
* Internal Recorder
* Layout Mode
* and much more!

View File

@@ -3,7 +3,7 @@
"gd": {
"win": "2.204"
},
"version": "v2.7.0",
"version": "v2.7.1",
"id": "maxnu.gd_mega_overlay",
"name": "GD Mega Overlay",
"developer": "maxnu & SpaghettDev",

View File

@@ -240,7 +240,7 @@ class $modify(PlayLayer)
int cameraSection = MBO(int, this, 10676);
int cameraSectionLast = MBO(int, this, 10680);
gd::vector<gd::vector<gd::vector<GameObject*>*>*> sections = MBO(std::vector<std::vector<std::vector<GameObject*>*>*>, this, 11336);
gd::vector<gd::vector<gd::vector<GameObject*>*>*> sections = MBO(gd::vector<gd::vector<gd::vector<GameObject*>*>*>, this, 11336);
for(int i = cameraSection; i < cameraSectionLast; i++)
{
@@ -256,7 +256,10 @@ class $modify(PlayLayer)
{
auto obj = sections.at(i)->at(j)->at(k);
for(auto &pair : Common::sectionLoopFunctions)
pair.first(obj);
{
if(Settings::get<bool>(pair.second, false))
pair.first(obj);
}
}
}
}

View File

@@ -33,9 +33,6 @@ namespace GUI
inline std::function<void()> lateInit;
inline bool(__thiscall* menuLayerInit)(int* self);
bool __fastcall menuLayerInitHook(int* self, void*);
ImVec2 getJsonPosition(const std::string&);
void setJsonPosition(const std::string&, ImVec2);

View File

@@ -3,6 +3,7 @@
#include "Settings.hpp"
#include <Geode/modify/PlayLayer.hpp>
#include <Geode/modify/GameObject.hpp>
#include "../Common.h"
@@ -11,7 +12,6 @@ class $modify(PlayLayer)
bool init(GJGameLevel* level, bool unk1, bool unk2)
{
bool res = PlayLayer::init(level, unk1, unk2);
HitboxMultiplier::rectForObject.clear();
HitboxMultiplier::memberRectForObject.clear();
return res;
}
@@ -59,47 +59,50 @@ void HitboxMultiplier::scaleHazard(GameObject* hazard)
MBO(cocos2d::CCRect, hazard, 728) = rect;
}
cocos2d::CCRect* HitboxMultiplier::GameObjectGetObjectRect(GameObject* obj)
class $modify(GameObject)
{
bool enabled = Settings::get<bool>("level/hitbox_multiplier", false);
cocos2d::CCRect m_objectRect;
if(!enabled)
return reinterpret_cast<cocos2d::CCRect*(__thiscall*)(GameObject*)>(base::get() + 0x13a570)(obj);
bool all = Settings::get<bool>("level/hitbox_multiplier/scale_all", false);
float x = 1, y = 1;
float scaleSlopes[2] = {Settings::get<float>("level/hitbox_multiplier/scale_slopes/x", 1.f), Settings::get<float>("level/hitbox_multiplier/scale_slopes/y", 1.f)};
float scalePlayer[2] = {Settings::get<float>("level/hitbox_multiplier/scale_player/x", 1.f), Settings::get<float>("level/hitbox_multiplier/scale_player/y", 1.f)};
if(obj == GameManager::get()->getGameLayer()->m_player1 || obj == GameManager::get()->getGameLayer()->m_player2)
CCRect const& getObjectRect()
{
x = scalePlayer[0];
y = scalePlayer[1];
}
else
{
switch(obj->m_objectType)
bool enabled = Settings::get<bool>("level/hitbox_multiplier", false);
if(!enabled)
return reinterpret_cast<cocos2d::CCRect const& (__thiscall*)(GameObject*)>(base::get() + 0x13a570)(this);
bool all = Settings::get<bool>("level/hitbox_multiplier/scale_all", false);
float x = 1, y = 1;
float scaleSlopes[2] = {Settings::get<float>("level/hitbox_multiplier/scale_slopes/x", 1.f), Settings::get<float>("level/hitbox_multiplier/scale_slopes/y", 1.f)};
float scalePlayer[2] = {Settings::get<float>("level/hitbox_multiplier/scale_player/x", 1.f), Settings::get<float>("level/hitbox_multiplier/scale_player/y", 1.f)};
if((PlayerObject*)this == GameManager::get()->getGameLayer()->m_player1 || (PlayerObject*)this == GameManager::get()->getGameLayer()->m_player2)
{
default:
return reinterpret_cast<cocos2d::CCRect*(__thiscall*)(GameObject*)>(base::get() + 0x13a570)(obj);
case GameObjectType::Slope:
x = scaleSlopes[0];
y = scaleSlopes[1];
break;
x = scalePlayer[0];
y = scalePlayer[1];
}
else
{
switch(this->m_objectType)
{
default:
return reinterpret_cast<cocos2d::CCRect const& (__thiscall*)(GameObject*)>(base::get() + 0x13a570)(this);
case GameObjectType::Slope:
x = scaleSlopes[0];
y = scaleSlopes[1];
break;
}
}
}
cocos2d::CCRect rect = *reinterpret_cast<cocos2d::CCRect*(__thiscall*)(GameObject*)>(base::get() + 0x13a570)(obj);
scaleRect(&rect, x, y);
rectForObject[obj] = rect;
return &rectForObject[obj];
}
cocos2d::CCRect rect = *reinterpret_cast<cocos2d::CCRect*(__thiscall*)(GameObject*)>(base::get() + 0x13a570)(this);
scaleRect(&rect, x, y);
m_fields->m_objectRect = rect;
return m_fields->m_objectRect;
}
};
$execute
{
Mod::get()->hook(reinterpret_cast<void *>(base::get() + 0x13a570), &HitboxMultiplier::GameObjectGetObjectRect, "GameObject::getObjectRect", tulip::hook::TulipConvention::Thiscall);
Common::sectionLoopFunctions.push_back({HitboxMultiplier::scaleHazard, "level/hitbox_multiplier"});
Common::sectionLoopFunctions.push_back({HitboxMultiplier::scaleHazard, "level/hitbox_multiplier"});
}

View File

@@ -6,11 +6,7 @@ using namespace geode::prelude;
namespace HitboxMultiplier
{
//TODO: replace this with a custom rect field in m_fields when geode fixes getobjectrect return type
std::unordered_map<GameObject*, cocos2d::CCRect> rectForObject;
std::unordered_map<GameObject*, cocos2d::CCRect> memberRectForObject;
cocos2d::CCRect* GameObjectGetObjectRect(GameObject* obj);
void scaleHazard(GameObject* hazard);
};

View File

@@ -145,7 +145,7 @@ void GJBaseGameLayerProcessCommands(GJBaseGameLayer* self)
$execute
{
Mod::get()->hook(reinterpret_cast<void *>(base::get() + 0x23f720), &LevelEditorLayerUpdateEditor, "LevelEditorLayer::UpdateEditor", tulip::hook::TulipConvention::Thiscall);
Mod::get()->hook(reinterpret_cast<void *>(base::get() + 0x23f720), &LevelEditorLayerUpdateEditor, "LevelEditorLayer::updateEditor", tulip::hook::TulipConvention::Thiscall);
Mod::get()->hook(reinterpret_cast<void *>(base::get() + 0x1BD240), &GJBaseGameLayerProcessCommands, "GJBaseGameLayer::processCommands", tulip::hook::TulipConvention::Thiscall);
}