11#include " replay_system.hpp"
22#include " hooks.hpp"
3-
43ReplaySystem* ReplaySystem::instance;
54
65void 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
6261void 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