Skip to content

Commit 1f20f76

Browse files
committed
update gd.h
1 parent 6ef1ead commit 1f20f76

4 files changed

Lines changed: 15 additions & 16 deletions

File tree

src/hooks.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ void __fastcall Hooks::PlayerObject_ringJump_H(gd::PlayerObject* self, int, gd::
184184
PlayerObject_ringJump(self, ring);
185185
auto rs = ReplaySystem::get_instance();
186186
auto play_layer = gd::GameManager::sharedState()->getPlayLayer();
187-
if (play_layer && play_layer->is_practice_mode && rs->is_recording() && ring->hasBeenActivated) {
187+
if (play_layer && play_layer->is_practice_mode && rs->is_recording() && ring->m_hasBeenActivated) {
188188
rs->get_practice_fixes().add_activated_object(ring);
189189
}
190190
}
@@ -193,7 +193,7 @@ void __fastcall Hooks::GameObject_activateObject_H(gd::GameObject* self, int, gd
193193
GameObject_activateObject(self, player);
194194
auto rs = ReplaySystem::get_instance();
195195
auto play_layer = gd::GameManager::sharedState()->getPlayLayer();
196-
if (play_layer && play_layer->is_practice_mode && rs->is_recording() && self->hasBeenActivated) {
196+
if (play_layer && play_layer->is_practice_mode && rs->is_recording() && self->m_hasBeenActivated) {
197197
rs->get_practice_fixes().add_activated_object(self);
198198
}
199199
}

src/practice_fixes.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class PracticeFixes {
3131
void add_checkpoint() {
3232
auto play_layer = gd::GameManager::sharedState()->getPlayLayer();
3333
checkpoints.push({
34-
CheckpointData::from_player(play_layer->player1),
35-
CheckpointData::from_player(play_layer->player2),
34+
CheckpointData::from_player(play_layer->m_player1),
35+
CheckpointData::from_player(play_layer->m_player2),
3636
activated_objects.size()
3737
});
3838
}
@@ -52,8 +52,8 @@ class PracticeFixes {
5252
if (!checkpoints.empty()) {
5353
auto play_layer = gd::GameManager::sharedState()->getPlayLayer();
5454
auto checkpoint = checkpoints.top();
55-
checkpoint.player1.apply(play_layer->player1);
56-
checkpoint.player2.apply(play_layer->player2);
55+
checkpoint.player1.apply(play_layer->m_player1);
56+
checkpoint.player2.apply(play_layer->m_player2);
5757
}
5858
}
5959

src/replay_system.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#include "replay_system.hpp"
22
#include "hooks.hpp"
3-
43
ReplaySystem* ReplaySystem::instance;
54

65
void ReplaySystem::record_action(bool hold, bool player1, bool flip) {
76
if (is_recording()) {
87
auto gm = gd::GameManager::sharedState();
98
auto play_layer = gm->getPlayLayer();
10-
auto is_two_player = play_layer->levelSettings->m_twoPlayerMode;
9+
auto is_two_player = play_layer->m_levelSettings->m_twoPlayerMode;
1110
player1 ^= flip && gm->getGameVariable("0010");
12-
get_replay().add_action({ play_layer->player1->position.x, hold, is_two_player && !player1 });
11+
get_replay().add_action({ play_layer->m_player1->position.x, hold, is_two_player && !player1 });
1312
}
1413
}
1514

@@ -27,7 +26,7 @@ void ReplaySystem::on_reset() {
2726
Hooks::PlayLayer::releaseButton(play_layer, 0, true);
2827
action_index = 0;
2928
} else if (is_recording()) {
30-
replay.remove_actions_after(play_layer->player1->position.x);
29+
replay.remove_actions_after(play_layer->m_player1->position.x);
3130
auto& activated_objects = practice_fixes.activated_objects;
3231
if (practice_fixes.checkpoints.empty()) {
3332
activated_objects.clear();
@@ -37,31 +36,31 @@ void ReplaySystem::on_reset() {
3736
activated_objects.end()
3837
);
3938
for (const auto object : activated_objects) {
40-
object->hasBeenActivated = true;
39+
object->m_hasBeenActivated = true;
4140
}
4241
}
4342
const auto& actions = replay.get_actions();
44-
bool holding = play_layer->player1->isActuallyHolding;
43+
bool holding = play_layer->m_player1->isActuallyHolding;
4544
if ((holding && actions.empty()) || (!actions.empty() && actions.back().hold != holding)) {
4645
record_action(holding, true, false);
4746
if (holding) {
4847
Hooks::PlayLayer::releaseButton(play_layer, 0, true);
4948
Hooks::PlayLayer::pushButton(play_layer, 0, true);
50-
play_layer->player1->canBufferOrb = true;
49+
play_layer->m_player1->canBufferOrb = true;
5150
}
5251
} else if (!actions.empty() && actions.back().hold && holding && !practice_fixes.checkpoints.empty() && practice_fixes.checkpoints.top().player1.buffer_orb) {
5352
Hooks::PlayLayer::releaseButton(play_layer, 0, true);
5453
Hooks::PlayLayer::pushButton(play_layer, 0, true);
5554
}
56-
if (play_layer->levelSettings->m_twoPlayerMode)
55+
if (play_layer->m_levelSettings->m_twoPlayerMode)
5756
record_action(false, false, false);
5857
practice_fixes.apply_checkpoint();
5958
}
6059
}
6160

6261
void ReplaySystem::handle_playing() {
6362
if (is_playing()) {
64-
auto x = gd::GameManager::sharedState()->getPlayLayer()->player1->position.x;
63+
auto x = gd::GameManager::sharedState()->getPlayLayer()->m_player1->position.x;
6564
auto& actions = replay.get_actions();
6665
Action action;
6766
while (action_index < actions.size() && x >= (action = actions[action_index]).x) {

0 commit comments

Comments
 (0)