1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2025-11-30 08:08:18 +00:00

Trigger CPS and CSS when going to title

This commit is contained in:
dawnDus 2022-04-24 11:55:37 -04:00
parent e4ec69b6dc
commit f672ff6f24
No known key found for this signature in database
GPG key ID: 972AABDE81848F21
3 changed files with 10 additions and 7 deletions

View file

@ -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()));
}

View file

@ -814,7 +814,6 @@ impl Player {
self.skin.set_state(PlayerAnimationState::Jumping);
self.anim_num = 3;
}
self.anim_num = 1;
self.anim_counter = 0;
}

View file

@ -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);