From 11f335acc417de14f2d9d100d928975d7d671b76 Mon Sep 17 00:00:00 2001 From: dawnDus <96957561+dawndus@users.noreply.github.com> Date: Thu, 14 Apr 2022 22:15:25 -0400 Subject: [PATCH] Puu black fix and reword Vsync options --- src/builtin/locale/en.json | 16 ++++++++-------- src/builtin/locale/jp.json | 16 ++++++++-------- src/menu/settings_menu.rs | 21 +++++++++++++++++++-- src/npc/ai/maze.rs | 7 +++++-- 4 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/builtin/locale/en.json b/src/builtin/locale/en.json index ece3e01..3fe6d97 100644 --- a/src/builtin/locale/en.json +++ b/src/builtin/locale/en.json @@ -60,15 +60,15 @@ "vsync_mode": { "entry": "V-Sync:", "uncapped": "Uncapped", - "uncapped_desc": "No V-Sync, game runs at uncapped frame rate.", + "uncapped_desc": "V-Sync Off.", "vsync": "Enabled", - "vsync_desc": "Frame rate is synchronized to V-Sync interval.", - "vrr_1x": "Variable Refresh Rate - 1x game tick", - "vrr_1x_desc": "Synced to 1*TPS, uses (G-/Free)Sync if available.", - "vrr_2x": "Variable Refresh Rate - 2x game tick", - "vrr_2x_desc": "Synced to 2*TPS, uses (G-/Free)Sync if available.", - "vrr_3x": "Variable Refresh Rate - 3x game tick", - "vrr_3x_desc": "Synced to 3*TPS, uses (G-/Free)Sync if available." + "vsync_desc": "V-Sync On.", + "vrr_1x": "Variable Refresh Rate (1x)", + "vrr_1x_desc": "Uses (G-/Free)Sync if available.", + "vrr_2x": "Variable Refresh Rate (2x)", + "vrr_2x_desc": "Uses (G-/Free)Sync if available.", + "vrr_3x": "Variable Refresh Rate (3x)", + "vrr_3x_desc": "Uses (G-/Free)Sync if available." } }, diff --git a/src/builtin/locale/jp.json b/src/builtin/locale/jp.json index 9b5ae9e..da658bf 100644 --- a/src/builtin/locale/jp.json +++ b/src/builtin/locale/jp.json @@ -54,15 +54,15 @@ "vsync_mode": { "entry": "V-Sync:", "uncapped": "Uncapped", - "uncapped_desc": "No V-Sync, game runs at uncapped frame rate.", + "uncapped_desc": "V-Sync Off.", "vsync": "Enabled", - "vsync_desc": "Frame rate is synchronized to V-Sync interval.", - "vrr_1x": "Variable Refresh Rate - 1x game tick", - "vrr_1x_desc": "Synced to 1*TPS, uses (G-/Free)Sync if available.", - "vrr_2x": "Variable Refresh Rate - 2x game tick", - "vrr_2x_desc": "Synced to 2*TPS, uses (G-/Free)Sync if available.", - "vrr_3x": "Variable Refresh Rate - 3x game tick", - "vrr_3x_desc": "Synced to 3*TPS, uses (G-/Free)Sync if available." + "vsync_desc": "V-Sync On.", + "vrr_1x": "Variable Refresh Rate (1x)", + "vrr_1x_desc": "Uses (G-/Free)Sync if available.", + "vrr_2x": "Variable Refresh Rate (2x)", + "vrr_2x_desc": "Uses (G-/Free)Sync if available.", + "vrr_3x": "Variable Refresh Rate (3x)", + "vrr_3x_desc": "Uses (G-/Free)Sync if available." } }, "sound": "サウンド", diff --git a/src/menu/settings_menu.rs b/src/menu/settings_menu.rs index e5342f3..e7eb88e 100644 --- a/src/menu/settings_menu.rs +++ b/src/menu/settings_menu.rs @@ -283,7 +283,7 @@ impl SettingsMenu { _ => (), }, CurrentMenu::GraphicsMenu => match self.graphics.tick(controller, state) { - MenuSelectionResult::Selected(0, toggle) => { + MenuSelectionResult::Selected(0, toggle) | MenuSelectionResult::Right(0, toggle, _) => { if let MenuEntry::DescriptiveOptions(_, value, _, _) = toggle { let (new_mode, new_value) = match *value { 0 => (VSyncMode::VSync, 1), @@ -295,7 +295,24 @@ impl SettingsMenu { *value = new_value; state.settings.vsync_mode = new_mode; - graphics::set_vsync_mode(ctx, new_mode); + graphics::set_vsync_mode(ctx, new_mode)?; + + let _ = state.settings.save(ctx); + } + } + MenuSelectionResult::Left(0, toggle, _) => { + if let MenuEntry::DescriptiveOptions(_, value, _, _) = toggle { + let (new_mode, new_value) = match *value { + 0 => (VSyncMode::VRRTickSync3x, 4), + 1 => (VSyncMode::Uncapped, 0), + 2 => (VSyncMode::VSync, 1), + 3 => (VSyncMode::VRRTickSync1x, 2), + _ => (VSyncMode::VRRTickSync2x, 3), + }; + + *value = new_value; + state.settings.vsync_mode = new_mode; + graphics::set_vsync_mode(ctx, new_mode)?; let _ = state.settings.save(ctx); } diff --git a/src/npc/ai/maze.rs b/src/npc/ai/maze.rs index f227475..ec004a5 100644 --- a/src/npc/ai/maze.rs +++ b/src/npc/ai/maze.rs @@ -755,9 +755,7 @@ impl NPC { } else { self.anim_num = if self.direction != Direction::Left { 1 } else { 0 }; - self.anim_rect.top += self.action_counter3 / 8; self.y = ((self.action_counter3 as i32 / 8) * 0x200) + self.target_y; - self.anim_rect.left -= if (self.action_counter3 & 0x02) != 0 { 1 } else { 0 }; } if self.action_counter3 % 3 == 2 { let mut npc = NPC::create(161, &state.npc_table); @@ -787,6 +785,11 @@ impl NPC { self.anim_rect = state.constants.npc.n162_puu_black_dead[self.anim_num as usize]; + if self.action_num == 2 && self.action_counter3 <= 240 { + self.anim_rect.top += self.action_counter3 / 8; + self.anim_rect.left -= if (self.action_counter3 & 0x02) != 0 { 1 } else { 0 }; + } + Ok(()) }