1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2024-11-21 21:22:44 +00:00

Added cutscene auto skip option (#249)

This commit is contained in:
Sobakin 2024-01-09 14:17:08 +03:00 committed by GitHub
parent c56bd2e8ae
commit e1fb118910
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 14 deletions

View file

@ -128,7 +128,8 @@
"cutscene_skip_method": {
"entry": "Cutscene Skip:",
"hold": "Hold to Skip",
"fastforward": "Fast-Forward"
"fastforward": "Fast-Forward",
"auto": "Auto"
},
"discord_rpc": "Discord Rich Presence:",
"allow_strafe": "Allow strafe:"

View file

@ -120,6 +120,7 @@ pub enum PlayerCount {
pub enum CutsceneSkipMode {
Hold,
FastForward,
Auto,
}
impl GameDifficulty {

View file

@ -572,10 +572,11 @@ impl SettingsMenu {
BehaviorMenuEntry::CutsceneSkipMode,
MenuEntry::Options(
state.loc.t("menus.options_menu.behavior_menu.cutscene_skip_method.entry").to_owned(),
if state.settings.cutscene_skip_mode == CutsceneSkipMode::Hold { 0 } else { 1 },
state.settings.cutscene_skip_mode as usize,
vec![
state.loc.t("menus.options_menu.behavior_menu.cutscene_skip_method.hold").to_owned(),
state.loc.t("menus.options_menu.behavior_menu.cutscene_skip_method.fastforward").to_owned(),
state.loc.t("menus.options_menu.behavior_menu.cutscene_skip_method.auto").to_owned(),
],
),
);
@ -986,18 +987,30 @@ impl SettingsMenu {
*value = state.settings.allow_strafe;
}
}
MenuSelectionResult::Selected(BehaviorMenuEntry::CutsceneSkipMode, toggle) => {
MenuSelectionResult::Selected(BehaviorMenuEntry::CutsceneSkipMode, toggle)
| MenuSelectionResult::Right(BehaviorMenuEntry::CutsceneSkipMode, toggle, _) => {
if let MenuEntry::Options(_, value, _) = toggle {
match state.settings.cutscene_skip_mode {
CutsceneSkipMode::Hold => {
state.settings.cutscene_skip_mode = CutsceneSkipMode::FastForward;
*value = 1;
}
CutsceneSkipMode::FastForward => {
state.settings.cutscene_skip_mode = CutsceneSkipMode::Hold;
*value = 0;
let (new_mode, new_value) = match state.settings.cutscene_skip_mode {
CutsceneSkipMode::Hold => (CutsceneSkipMode::FastForward, 1),
CutsceneSkipMode::FastForward => (CutsceneSkipMode::Auto, 2),
CutsceneSkipMode::Auto => (CutsceneSkipMode::Hold, 0),
};
state.settings.cutscene_skip_mode = new_mode;
*value = new_value;
let _ = state.settings.save(ctx);
}
}
MenuSelectionResult::Left(BehaviorMenuEntry::CutsceneSkipMode, toggle, _) => {
if let MenuEntry::Options(_, value, _) = toggle {
let (new_mode, new_value) = match state.settings.cutscene_skip_mode {
CutsceneSkipMode::Hold => (CutsceneSkipMode::Auto, 2),
CutsceneSkipMode::FastForward => (CutsceneSkipMode::Hold, 0),
CutsceneSkipMode::Auto => (CutsceneSkipMode::FastForward, 1),
};
state.settings.cutscene_skip_mode = new_mode;
*value = new_value;
let _ = state.settings.save(ctx);
}
}

View file

@ -1841,6 +1841,9 @@ impl Scene for GameScene {
state.textscript_vm.flags.set_cutscene_skip(false);
}
}
CutsceneSkipMode::Auto => {
state.textscript_vm.flags.set_cutscene_skip(true);
}
_ => (),
}
}
@ -2183,7 +2186,7 @@ impl Scene for GameScene {
self.falling_island.draw(state, ctx, &self.frame)?;
self.text_boxes.draw(state, ctx, &self.frame)?;
if self.skip_counter > 1 || state.tutorial_counter > 0 {
if (self.skip_counter > 1 || state.tutorial_counter > 0) && (state.settings.cutscene_skip_mode != CutsceneSkipMode::Auto) {
let key = {
if state.settings.touch_controls {
">>".to_owned()