From f672ff6f245a51e786fd109da84186080ffa67f6 Mon Sep 17 00:00:00 2001 From: dawnDus <96957561+dawndus@users.noreply.github.com> Date: Sun, 24 Apr 2022 11:55:37 -0400 Subject: [PATCH] Trigger CPS and CSS when going to title --- src/menu/pause_menu.rs | 9 +++------ src/player/mod.rs | 1 - src/shared_game_state.rs | 7 +++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/menu/pause_menu.rs b/src/menu/pause_menu.rs index ceb1527..7f7f376 100644 --- a/src/menu/pause_menu.rs +++ b/src/menu/pause_menu.rs @@ -101,9 +101,7 @@ impl PauseMenu { // Shortcut for quick restart if ctx.keyboard_context.is_key_pressed(ScanCode::F2) { - state.sound_manager.stop_sfx(40); - state.sound_manager.stop_sfx(41); - state.sound_manager.stop_sfx(58); + state.stop_noise(); state.sound_manager.play_song(0, &state.constants, &state.settings, ctx)?; state.load_or_start_game(ctx)?; } @@ -118,9 +116,7 @@ impl PauseMenu { } } MenuSelectionResult::Selected(1, _) => { - state.sound_manager.stop_sfx(40); - state.sound_manager.stop_sfx(41); - state.sound_manager.stop_sfx(58); + state.stop_noise(); state.sound_manager.play_song(0, &state.constants, &state.settings, ctx)?; state.load_or_start_game(ctx)?; } @@ -151,6 +147,7 @@ impl PauseMenu { CurrentMenu::ConfirmMenu => match self.confirm_menu.tick(&mut self.controller, state) { MenuSelectionResult::Selected(1, _) => match self.pause_menu.selected { 3 => { + state.stop_noise(); state.textscript_vm.flags.set_cutscene_skip(false); state.next_scene = Some(Box::new(TitleScene::new())); } diff --git a/src/player/mod.rs b/src/player/mod.rs index 902cbd2..2b7da9b 100644 --- a/src/player/mod.rs +++ b/src/player/mod.rs @@ -814,7 +814,6 @@ impl Player { self.skin.set_state(PlayerAnimationState::Jumping); self.anim_num = 3; } - self.anim_num = 1; self.anim_counter = 0; } diff --git a/src/shared_game_state.rs b/src/shared_game_state.rs index 3249d19..67eb01b 100644 --- a/src/shared_game_state.rs +++ b/src/shared_game_state.rs @@ -643,6 +643,13 @@ impl SharedGameState { self.shutdown = true; } + // Stops SFX 40/41/58 (CPS and CSS) + pub fn stop_noise(&mut self) { + self.sound_manager.stop_sfx(40); + self.sound_manager.stop_sfx(41); + self.sound_manager.stop_sfx(58); + } + pub fn set_flag(&mut self, id: usize, value: bool) { if id < self.game_flags.len() { self.game_flags.set(id, value);