Skip to content
This repository was archived by the owner on Jun 18, 2024. It is now read-only.

Commit 3b8677c

Browse files
committed
a whole bunch of practice fixes and bug fixes
1 parent 9a58b9e commit 3b8677c

File tree

10 files changed

+69
-44
lines changed

10 files changed

+69
-44
lines changed

cmake/gdr.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include(FetchContent)
33
FetchContent_Declare(
44
gdr
55
GIT_REPOSITORY https://github.com/maxnut/GDReplayFormat.git
6-
GIT_TAG 0b803b44a3769a9c450c113ef1aa028f2c960127
6+
GIT_TAG af2eafe478968835dde3e9e9837db27a72632d7c
77
GIT_PROGRESS TRUE
88
)
99
message("Fetching gdr")

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"gd": {
44
"win": "2.204"
55
},
6-
"version": "v2.5.1",
6+
"version": "v2.5.2",
77
"id": "maxnu.gd_mega_overlay",
88
"name": "GD Mega Overlay",
99
"developer": "maxnu & SpaghettDev",

res/default_windows.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"y": 40.0
77
},
88
"Creator": {
9-
"h": 200.0,
9+
"h": 120.0,
1010
"w": 200.0,
1111
"x": 1340.0,
1212
"y": 40.0
@@ -15,7 +15,7 @@
1515
"h": 120.0,
1616
"w": 200.0,
1717
"x": 1600.0,
18-
"y": 340.0
18+
"y": 400.0
1919
},
2020
"General": {
2121
"h": 270.0,
@@ -30,13 +30,13 @@
3030
"y": 40.0
3131
},
3232
"Labels": {
33-
"h": 310.0,
33+
"h": 370.0,
3434
"w": 200.0,
3535
"x": 1340.0,
36-
"y": 280.0
36+
"y": 200.0
3737
},
3838
"Level": {
39-
"h": 380.0,
39+
"h": 410.0,
4040
"w": 200.0,
4141
"x": 560.0,
4242
"y": 40.0
@@ -45,13 +45,13 @@
4545
"h": 330.0,
4646
"w": 200.0,
4747
"x": 60.0,
48-
"y": 340.0
48+
"y": 360.0
4949
},
5050
"Menu Settings": {
5151
"h": 350.0,
5252
"w": 200.0,
53-
"x": 1600.0,
54-
"y": 500.0
53+
"x": 800.0,
54+
"y": 400.0
5555
},
5656
"Player": {
5757
"h": 320.0,
@@ -66,7 +66,7 @@
6666
"y": 380.0
6767
},
6868
"Shortcuts": {
69-
"h": 270.0,
69+
"h": 350.0,
7070
"w": 200.0,
7171
"x": 1600.0,
7272
"y": 40.0

src/Common.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,7 @@ void Common::updateCheating()
187187
return;
188188
}
189189

190-
float tps = 240.f;
191-
192-
if (Settings::get<bool>("general/tps/enabled"))
193-
tps = Settings::get<float>("general/tps/value", 240.f);
194-
else
195-
tps = 240.f;
196-
197-
if(Macrobot::playerMode == Macrobot::PLAYBACK)
198-
tps = Macrobot::macro.framerate;
199-
200-
if(tps < 1.f)
201-
tps = 1.f;
190+
float tps = getTPS();
202191

203192
PlayLayer* pl = GameManager::get()->getPlayLayer();
204193

src/Hacks/Labels.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ class $modify(PlayLayer)
170170
this
171171
);
172172

173+
setupLabel(
174+
"Attempts",
175+
[&](cocos2d::CCLabelBMFont* pointer) {
176+
pointer->setString(fmt::format("{} Attempts", this->m_level->m_attempts.value()).c_str());
177+
},
178+
this
179+
);
180+
173181
//keep this at the bottom :)
174182
setupLabel(
175183
"Macro Info",
@@ -482,5 +490,7 @@ void Labels::renderWindow()
482490

483491
settingsForLabel("Best Run", [] { });
484492

493+
settingsForLabel("Attempts", [] { });
494+
485495
settingsForLabel("Macro Info", [] { });
486496
}

src/Hacks/ShowHitboxes.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ void ShowHitboxes::forceDraw(GJBaseGameLayer* self, bool editor)
5555

5656
getDrawNode()->setVisible(show || editor);
5757

58-
GameManager::get()->setGameVariable("0045", show);
58+
bool onDeath = Settings::get<bool>("level/show_hitbox/on_death", false);
59+
60+
GameManager::get()->setGameVariable("0045", show && !onDeath);
5961

6062
if(!show)
6163
return;
62-
63-
bool onDeath = Settings::get<bool>("level/show_hitbox/on_death", false);
64+
6465
if(onDeath)
65-
getDrawNode()->setVisible(dead);
66+
getDrawNode()->setVisible(dead || editor);
6667

6768
if(onDeath && !dead)
6869
return;

src/Macrobot/Clickpacks.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "../Settings.hpp"
77
#include <portable-file-dialogs.h>
88
#include <filesystem>
9+
#include <algorithm>
10+
#include <cctype>
911

1012
#include <Geode/Geode.hpp>
1113
#include <Geode/binding/FMODAudioEngine.hpp>
@@ -32,12 +34,17 @@ std::optional<Clickpack> Clickpack::fromPath(const fs::path& pathString)
3234
return;
3335

3436
for (const auto& entry : fs::directory_iterator(folder))
35-
if (entry.is_regular_file() && (entry.path().extension() == ".wav"))
37+
{
38+
std::string ext = entry.path().extension().string();
39+
std::transform(ext.begin(), ext.end(), ext.begin(),
40+
[](unsigned char c) { return std::tolower(c); });
41+
if (entry.is_regular_file() && ext == ".wav")
3642
{
3743
FMOD::Sound* s = nullptr;
3844
FMODAudioEngine::sharedEngine()->m_system->createSound(string::wideToUtf8(entry.path().wstring()).c_str(), FMOD_LOOP_OFF, 0, &s);
3945
vector.push_back(s);
4046
}
47+
}
4148
};
4249

4350
addFromPath(pack.clicks, clickPath);

src/Macrobot/Macrobot.cpp

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@ class $modify(PlayLayer)
5454
if (checkpoints.contains(checkpoint) && playerMode != DISABLED && GameManager::get()->getPlayLayer())
5555
{
5656
CheckpointData checkpointData = checkpoints[checkpoint];
57-
const auto check = [&](const Action &action) -> bool { return action.frame >= checkpointData.frame; };
57+
const auto check = [&](const Action &action) -> bool { return action.frame > checkpointData.frame; };
5858
macro.inputs.erase(std::remove_if (macro.inputs.begin(), macro.inputs.end(), check), macro.inputs.end());
5959
PlayLayer::loadFromCheckpoint(checkpoint);
6060

6161
gameTime = checkpointData.time;
6262
checkpointData.p1.apply(this->m_player1, true);
63-
checkpointData.p2.apply(this->m_player2, true);
63+
if(MBO(bool, this, 878))
64+
checkpointData.p2.apply(this->m_player2, true);
6465
}
6566
else
6667
PlayLayer::loadFromCheckpoint(checkpoint);
@@ -109,12 +110,13 @@ class $modify(PlayLayer)
109110
this->m_player1->pushButton(PlayerButton::Left);
110111
}
111112

113+
//TODO only do this when necessary
112114
bool isDual = MBO(bool, this, 878);
113115

114116
gameTime += (1.0 / (double)Common::getTPS()) + 0.00000001;
115-
this->handleButton(false, 1, true);
117+
Macrobot::recordAction(PlayerButton::Jump, gameTime, false, true);
116118
if(isDual)
117-
this->handleButton(false, 1, false);
119+
Macrobot::recordAction(PlayerButton::Jump, gameTime, false, false);
118120
gameTime -= (1.0 / (double)Common::getTPS()) + 0.00000001;
119121
}
120122
else
@@ -317,7 +319,7 @@ void Macrobot::PlayerCheckpoint::fromPlayer(PlayerObject *player, bool fullCaptu
317319
return;
318320

319321
cocos2d::CCPoint position = player->m_position;
320-
this->yVel = MBO(double, player, 1936);
322+
this->yVel = player->m_yVelocity;
321323
this->rotation = player->getRotation();
322324
this->xVel = player->m_platformerXVelocity;
323325
this->xPos = position.x;
@@ -326,6 +328,8 @@ void Macrobot::PlayerCheckpoint::fromPlayer(PlayerObject *player, bool fullCaptu
326328
this->nodeYPos = player->getPositionY();
327329
this->rotationRate = player->m_rotationSpeed;
328330
this->lastSnappedTo = player->m_objectSnappedTo;
331+
this->isOnSlope = player->m_isOnSlope;
332+
this->wasOnSlope = player->m_wasOnSlope;
329333

330334
if (fullCapture)
331335
{
@@ -354,15 +358,15 @@ void Macrobot::PlayerCheckpoint::apply(PlayerObject* player, bool fullRestore)
354358
{
355359
// 🗣️ 🔥 🗣️ 🔥 🗣️ 🔥 🗣️ 🔥 🗣️ 🔥 🗣️ 🔥
356360
// no but seriously this has no right of working so well
357-
for (int i = 1410; i < 1600; i++)
361+
for (int i = 1410; i < 1700; i++)
358362
{
359363
if (this->randomProperties[i] < 10000 && this->randomProperties[i] > -10000)
360364
{
361365
*reinterpret_cast<float *>(reinterpret_cast<uintptr_t>(player) + 160 + i) = this->randomProperties[i];
362366
}
363367
}
364368

365-
for (int i = 1800; i < 2265; i++)
369+
for (int i = 1794; i < 2265; i++)
366370
{
367371
if (this->randomProperties[i] < 10000 && this->randomProperties[i] > -10000)
368372
{
@@ -383,7 +387,7 @@ void Macrobot::PlayerCheckpoint::apply(PlayerObject* player, bool fullRestore)
383387

384388
player->m_objectSnappedTo = this->lastSnappedTo;
385389

386-
MBO(double, player, 1936) = this->yVel; //remove this when geode fixes the offset
390+
player->m_yVelocity = this->yVel;//remove this when geode fixes the offset
387391
player->setRotation(this->rotation);
388392

389393
player->setPositionX(this->nodeXPos);
@@ -395,6 +399,14 @@ void Macrobot::PlayerCheckpoint::apply(PlayerObject* player, bool fullRestore)
395399
player->m_platformerXVelocity = this->xVel;
396400

397401
player->m_rotationSpeed = this->rotationRate;
402+
403+
player->m_isOnSlope = this->isOnSlope;
404+
player->m_wasOnSlope = this->wasOnSlope;
405+
406+
//TODO: spamming checkpoints on slopes changes slope start time
407+
408+
/* double slopeTime = MBO(double, self->m_player1, 2144);
409+
double slopeStartTime = MBO(double, self->m_player1, 1240);*/
398410
}
399411

400412
void Macrobot::save(const std::string& file)
@@ -486,6 +498,11 @@ void Macrobot::drawWindow()
486498
PhysicsBypass::calculateTickrate();
487499
if (GameManager::get()->getPlayLayer())
488500
GameManager::get()->getPlayLayer()->resetLevelFromStart();
501+
502+
macro.framerate = 240.f;
503+
504+
if (Settings::get<bool>("general/tps/enabled"))
505+
macro.framerate = Settings::get<float>("general/tps/value", 240.f);
489506
}
490507
if (ImGui::RadioButton("Play", (int*)&Macrobot::playerMode, (int)PLAYBACK))
491508
{

src/Macrobot/Macrobot.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ namespace Macrobot
3131
float rotationRate;
3232
GameObject* lastSnappedTo = nullptr;
3333

34+
bool isOnSlope;
35+
bool wasOnSlope;
36+
3437
std::vector<float> randomProperties;
3538

3639
void apply(PlayerObject* player, bool fullRestore);

src/main.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ void initGUI()
7070
if (GUI::checkbox("Framerate", "general/fps/enabled"))
7171
Common::calculateFramerate();
7272

73+
if(Macrobot::playerMode == Macrobot::RECORDING || Macrobot::playerMode == Macrobot::PLAYBACK)
74+
ImGui::BeginDisabled();
75+
7376
float tps = Settings::get<float>("general/tps/value", 240.f);
7477
if (GUI::inputFloat("##TPSValue", &tps))
7578
Mod::get()->setSavedValue<float>("general/tps/value", tps);
@@ -85,6 +88,9 @@ void initGUI()
8588
if (GUI::checkbox("Physics Bypass", "general/tps/enabled"))
8689
PhysicsBypass::calculateTickrate();
8790

91+
if(Macrobot::playerMode == Macrobot::RECORDING || Macrobot::playerMode == Macrobot::PLAYBACK)
92+
ImGui::EndDisabled();
93+
8894
float speedhack = Settings::get<float>("general/speedhack/value", 1.f);
8995
if (GUI::inputFloat("##SpeedhackValue", &speedhack))
9096
{
@@ -348,14 +354,6 @@ void initGUI()
348354
recorder.position = {800, 280};
349355
recorder.size.y = 450;
350356
GUI::addWindow(recorder);
351-
352-
GUI::Window credits("Credits", [] {
353-
GUI::textURL("SpaghettDev", "https://github.com/SpaghettDev");
354-
GUI::textURL("TpdEA", "https://github.com/TpdeaX");
355-
});
356-
credits.position = {1550, 480};
357-
credits.size.y = 120;
358-
GUI::addWindow(credits);
359357
}
360358

361359
void render()

0 commit comments

Comments
 (0)