mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-11-24 14:42:52 +00:00
make strafing toggleable (closes #220)
This commit is contained in:
parent
02e1763e1d
commit
5f24ee52b0
|
@ -130,7 +130,8 @@
|
|||
"hold": "Hold to Skip",
|
||||
"fastforward": "Fast-Forward"
|
||||
},
|
||||
"discord_rpc": "Discord Rich Presence:"
|
||||
"discord_rpc": "Discord Rich Presence:",
|
||||
"allow_strafe": "Allow strafe:"
|
||||
},
|
||||
"links": "Links...",
|
||||
"advanced": "Advanced...",
|
||||
|
|
|
@ -130,7 +130,8 @@
|
|||
"hold": "を押し続け",
|
||||
"fastforward": "はやおくり"
|
||||
},
|
||||
"discord_rpc": "Discord Rich Presence:"
|
||||
"discord_rpc": "Discord Rich Presence:",
|
||||
"allow_strafe": "ストレイフを許可する:"
|
||||
},
|
||||
"links": "リンク",
|
||||
"advanced": "詳細設定",
|
||||
|
|
|
@ -237,7 +237,7 @@ impl Player {
|
|||
self.booster_switch = BoosterSwitch::None;
|
||||
}
|
||||
|
||||
if state.control_flags.control_enabled() {
|
||||
if state.control_flags.control_enabled() && state.settings.allow_strafe {
|
||||
if self.controller.trigger_strafe() {
|
||||
if self.controller.move_up() {
|
||||
self.strafe_up = true;
|
||||
|
@ -273,7 +273,7 @@ impl Player {
|
|||
&& !self.controller.map()
|
||||
&& !self.controller.inventory()
|
||||
&& !self.controller.strafe();
|
||||
// Leaving the skip button unchecked as a "feature" :)
|
||||
// Leaving the skip button unchecked as a "feature" :)
|
||||
|
||||
if self.controller.trigger_down()
|
||||
&& only_down
|
||||
|
@ -291,7 +291,7 @@ impl Player {
|
|||
self.vel_x += physics.dash_ground;
|
||||
}
|
||||
|
||||
if !self.controller.strafe() {
|
||||
if !self.controller.strafe() || !state.settings.allow_strafe {
|
||||
if self.controller.move_left() {
|
||||
self.direction = Direction::Left;
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ impl Player {
|
|||
self.vel_x += physics.dash_air;
|
||||
}
|
||||
|
||||
if !self.controller.strafe() {
|
||||
if !self.controller.strafe() || !state.settings.allow_strafe {
|
||||
if self.controller.look_left() {
|
||||
self.direction = Direction::Left;
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ impl Player {
|
|||
|
||||
let mut booster_dir = self.direction;
|
||||
|
||||
if self.controller.strafe() {
|
||||
if self.controller.strafe() && state.settings.allow_strafe {
|
||||
if self.controller.move_left() {
|
||||
self.booster_switch = BoosterSwitch::Left;
|
||||
} else if self.controller.move_right() {
|
||||
|
@ -805,13 +805,11 @@ impl Player {
|
|||
self.anim_num = 0;
|
||||
self.anim_counter = 0;
|
||||
}
|
||||
} else if self.up
|
||||
{
|
||||
} else if self.up {
|
||||
self.skin.set_state(PlayerAnimationState::FallingLookingUp);
|
||||
self.anim_num = 6;
|
||||
self.anim_counter = 0;
|
||||
} else if self.down
|
||||
{
|
||||
} else if self.down {
|
||||
self.skin.set_state(PlayerAnimationState::FallingLookingDown);
|
||||
self.anim_num = 10;
|
||||
self.anim_counter = 0;
|
||||
|
|
|
@ -85,6 +85,8 @@ pub struct Settings {
|
|||
pub cutscene_skip_mode: CutsceneSkipMode,
|
||||
#[serde(default = "default_true")]
|
||||
pub discord_rpc: bool,
|
||||
#[serde(default = "default_true")]
|
||||
pub allow_strafe: bool,
|
||||
}
|
||||
|
||||
fn default_true() -> bool {
|
||||
|
@ -93,7 +95,7 @@ fn default_true() -> bool {
|
|||
|
||||
#[inline(always)]
|
||||
fn current_version() -> u32 {
|
||||
23
|
||||
24
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
@ -341,6 +343,11 @@ impl Settings {
|
|||
self.display_touch_controls = true;
|
||||
}
|
||||
|
||||
if self.version == 23 {
|
||||
self.version = 24;
|
||||
self.allow_strafe = true;
|
||||
}
|
||||
|
||||
if self.version != initial_version {
|
||||
log::info!("Upgraded configuration file from version {} to {}.", initial_version, self.version);
|
||||
}
|
||||
|
@ -448,6 +455,7 @@ impl Default for Settings {
|
|||
more_rust: false,
|
||||
cutscene_skip_mode: CutsceneSkipMode::Hold,
|
||||
discord_rpc: true,
|
||||
allow_strafe: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,6 +114,7 @@ impl Default for LanguageMenuEntry {
|
|||
enum BehaviorMenuEntry {
|
||||
GameTiming,
|
||||
PauseOnFocusLoss,
|
||||
AllowStrafe,
|
||||
CutsceneSkipMode,
|
||||
#[cfg(feature = "discord-rpc")]
|
||||
DiscordRPC,
|
||||
|
@ -559,6 +560,14 @@ impl SettingsMenu {
|
|||
),
|
||||
);
|
||||
|
||||
self.behavior.push_entry(
|
||||
BehaviorMenuEntry::AllowStrafe,
|
||||
MenuEntry::Toggle(
|
||||
state.loc.t("menus.options_menu.behavior_menu.allow_strafe").to_owned(),
|
||||
state.settings.allow_strafe,
|
||||
),
|
||||
);
|
||||
|
||||
self.behavior.push_entry(
|
||||
BehaviorMenuEntry::CutsceneSkipMode,
|
||||
MenuEntry::Options(
|
||||
|
@ -969,6 +978,14 @@ impl SettingsMenu {
|
|||
*value = state.settings.pause_on_focus_loss;
|
||||
}
|
||||
}
|
||||
MenuSelectionResult::Selected(BehaviorMenuEntry::AllowStrafe, toggle) => {
|
||||
if let MenuEntry::Toggle(_, value) = toggle {
|
||||
state.settings.allow_strafe = !state.settings.allow_strafe;
|
||||
let _ = state.settings.save(ctx);
|
||||
|
||||
*value = state.settings.allow_strafe;
|
||||
}
|
||||
}
|
||||
MenuSelectionResult::Selected(BehaviorMenuEntry::CutsceneSkipMode, toggle) => {
|
||||
if let MenuEntry::Options(_, value, _) = toggle {
|
||||
match state.settings.cutscene_skip_mode {
|
||||
|
@ -1031,7 +1048,7 @@ impl SettingsMenu {
|
|||
fs_container.open_game_directory()?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(not(any(target_os = "android", target_os = "horizon")))]
|
||||
MenuSelectionResult::Selected(AdvancedMenuEntry::MakePortable, _) => {
|
||||
self.current = CurrentMenu::PortableMenu;
|
||||
|
|
Loading…
Reference in a new issue