@@ -39,26 +39,26 @@ void Hooks::init() {
3939}
4040
4141void __fastcall Hooks::CCScheduler_update_H (CCScheduler* self, int , float dt) {
42- auto rs = ReplaySystem::get_instance ();
43- if (rs-> is_playing () || rs-> is_recording () && gd::GameManager::sharedState ()->getPlayLayer ()) {
44- auto fps = rs-> get_replay ().get_fps ();
42+ auto & rs = ReplaySystem::get_instance ();
43+ if (rs. is_playing () || rs. is_recording () && gd::GameManager::sharedState ()->getPlayLayer ()) {
44+ auto fps = rs. get_replay ().get_fps ();
4545 auto speedhack = self->getTimeScale ();
4646 dt = 1 .f / fps / speedhack;
4747 }
4848 CCScheduler_update (self, dt);
4949}
5050
5151void __fastcall Hooks::CCKeyboardDispatcher_dispatchKeyboardMSG_H (CCKeyboardDispatcher* self, int , int key, bool down) {
52- auto rs = ReplaySystem::get_instance ();
52+ auto & rs = ReplaySystem::get_instance ();
5353 if (down) {
5454 auto play_layer = gd::GameManager::sharedState ()->getPlayLayer ();
55- if (rs-> is_recording () && play_layer) {
55+ if (rs. is_recording () && play_layer) {
5656 if (key == ' C' ) {
57- rs-> set_frame_advance (false );
58- PlayLayer::update_H (play_layer, 0 , 1 .f / rs-> get_default_fps ());
59- rs-> set_frame_advance (true );
57+ rs. set_frame_advance (false );
58+ PlayLayer::update_H (play_layer, 0 , 1 .f / rs. get_default_fps ());
59+ rs. set_frame_advance (true );
6060 } else if (key == ' F' ) {
61- rs-> set_frame_advance (false );
61+ rs. set_frame_advance (false );
6262 } else if (key == ' R' ) {
6363 PlayLayer::resetLevel_H (play_layer, 0 );
6464 }
@@ -73,19 +73,19 @@ bool __fastcall Hooks::PlayLayer::init_H(gd::PlayLayer* self, int, void* level)
7373}
7474
7575void __fastcall Hooks::PlayLayer::update_H (gd::PlayLayer* self, int , float dt) {
76- auto rs = ReplaySystem::get_instance ();
77- if (rs-> get_frame_advance ()) return ;
78- if (rs-> is_playing ())
79- rs-> handle_playing ();
76+ auto & rs = ReplaySystem::get_instance ();
77+ if (rs. get_frame_advance ()) return ;
78+ if (rs. is_playing ())
79+ rs. handle_playing ();
8080 update (self, dt);
8181}
8282
8383
8484bool _player_button_handler (bool hold, bool button) {
8585 if (gd::GameManager::sharedState ()->getPlayLayer ()) {
86- auto rs = ReplaySystem::get_instance ();
87- if (rs-> is_playing ()) return true ;
88- rs-> record_action (hold, button);
86+ auto & rs = ReplaySystem::get_instance ();
87+ if (rs. is_playing ()) return true ;
88+ rs. record_action (hold, button);
8989 }
9090 return false ;
9191}
@@ -102,18 +102,18 @@ int __fastcall Hooks::PlayLayer::releaseButton_H(gd::PlayLayer* self, int, int i
102102
103103int __fastcall Hooks::PlayLayer::resetLevel_H (gd::PlayLayer* self, int ) {
104104 auto ret = resetLevel (self);
105- ReplaySystem::get_instance ()-> on_reset ();
105+ ReplaySystem::get_instance (). on_reset ();
106106 return ret;
107107}
108108
109109
110110void __fastcall Hooks::PlayLayer::pauseGame_H (gd::PlayLayer* self, int , bool idk) {
111111 auto addr = cast<void *>(gd::base + 0x20D43C );
112- auto rs = ReplaySystem::get_instance ();
113- if (rs-> is_recording ())
114- rs-> record_action (false , true , false );
112+ auto & rs = ReplaySystem::get_instance ();
113+ if (rs. is_recording ())
114+ rs. record_action (false , true , false );
115115
116- bool should_patch = rs-> is_playing ();
116+ bool should_patch = rs. is_playing ();
117117 if (should_patch)
118118 patch (addr, {0x83 , 0xC4 , 0x04 , 0x90 , 0x90 });
119119
@@ -125,26 +125,26 @@ void __fastcall Hooks::PlayLayer::pauseGame_H(gd::PlayLayer* self, int, bool idk
125125
126126
127127int __fastcall Hooks::PlayLayer::createCheckpoint_H (gd::PlayLayer* self, int ) {
128- auto rs = ReplaySystem::get_instance ();
129- if (rs-> is_recording ()) rs-> get_practice_fixes ().add_checkpoint ();
128+ auto & rs = ReplaySystem::get_instance ();
129+ if (rs. is_recording ()) rs. get_practice_fixes ().add_checkpoint ();
130130 return createCheckpoint (self);
131131}
132132
133133void * __fastcall Hooks::PlayLayer::removeLastCheckpoint_H (gd::PlayLayer* self, int ) {
134- ReplaySystem::get_instance ()-> get_practice_fixes ().remove_checkpoint ();
134+ ReplaySystem::get_instance (). get_practice_fixes ().remove_checkpoint ();
135135 return removeLastCheckpoint (self);
136136}
137137
138138
139139void * __fastcall Hooks::PlayLayer::levelComplete_H (gd::PlayLayer* self, int ) {
140- ReplaySystem::get_instance ()-> reset_state ();
140+ ReplaySystem::get_instance (). reset_state ();
141141 return levelComplete (self);
142142}
143143
144144void _on_exit_level () {
145- auto rs = ReplaySystem::get_instance ();
146- rs-> get_practice_fixes ().clear_checkpoints ();
147- rs-> reset_state ();
145+ auto & rs = ReplaySystem::get_instance ();
146+ rs. get_practice_fixes ().clear_checkpoints ();
147+ rs. reset_state ();
148148}
149149
150150void * __fastcall Hooks::PlayLayer::onQuit_H (gd::PlayLayer* self, int ) {
@@ -182,18 +182,18 @@ bool __fastcall Hooks::PauseLayer_init_H(gd::PauseLayer* self, int) {
182182
183183void __fastcall Hooks::PlayerObject_ringJump_H (gd::PlayerObject* self, int , gd::GameObject* ring) {
184184 PlayerObject_ringJump (self, ring);
185- auto rs = ReplaySystem::get_instance ();
185+ 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->m_hasBeenActivated ) {
188- rs-> get_practice_fixes ().add_activated_object (ring);
187+ if (play_layer && play_layer->is_practice_mode && rs. is_recording () && ring->m_hasBeenActivated ) {
188+ rs. get_practice_fixes ().add_activated_object (ring);
189189 }
190190}
191191
192192void __fastcall Hooks::GameObject_activateObject_H (gd::GameObject* self, int , gd::PlayerObject* player) {
193193 GameObject_activateObject (self, player);
194- auto rs = ReplaySystem::get_instance ();
194+ 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->m_hasBeenActivated ) {
197- rs-> get_practice_fixes ().add_activated_object (self);
196+ if (play_layer && play_layer->is_practice_mode && rs. is_recording () && self->m_hasBeenActivated ) {
197+ rs. get_practice_fixes ().add_activated_object (self);
198198 }
199199}
0 commit comments