From bb704a12ed90417b9ff6ec565c43e4704eb7a260 Mon Sep 17 00:00:00 2001 From: jugeeya Date: Mon, 19 Feb 2024 17:52:37 -0800 Subject: [PATCH] Small changes to fix notification ticks --- src/training/mod.rs | 7 ------- src/training/ui/display.rs | 13 +++---------- src/training/ui/notifications.rs | 5 ----- training_mod_consts/src/lib.rs | 2 +- 4 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/training/mod.rs b/src/training/mod.rs index a1bd752..3cd125f 100644 --- a/src/training/mod.rs +++ b/src/training/mod.rs @@ -786,13 +786,6 @@ unsafe fn handle_once_per_cpu_frame(_ctx: &mut InlineCtx) { input_record::handle_recording(); frame_counter::tick_ingame(); tech::hide_tech(); - // Tick notifications - let queue = &mut ui::notifications::QUEUE; - let notification = queue.first(); - if notification.is_some() { - let notification = queue.first_mut().unwrap(); - notification.tick(); - } } #[skyline::hook(offset = *OFFSET_FIM)] diff --git a/src/training/ui/display.rs b/src/training/ui/display.rs index 95b990e..fc9f132 100644 --- a/src/training/ui/display.rs +++ b/src/training/ui/display.rs @@ -1,7 +1,7 @@ use skyline::nn::ui2d::*; use smash::ui2d::{SmashPane, SmashTextBox}; -use crate::common::{menu::QUICK_MENU_ACTIVE, TRAINING_MENU_ADDR}; +use crate::common::menu::QUICK_MENU_ACTIVE; use crate::training::ui; macro_rules! display_parent_fmt { ($x:ident) => { @@ -22,8 +22,6 @@ macro_rules! display_txt_fmt { } pub unsafe fn draw(root_pane: &Pane) { - // Make sure the combo counter is being displayed before we draw - let cc_displayed = (*TRAINING_MENU_ADDR).combo_display_toggle != 0; let notification_idx = 0; let queue = &mut ui::notifications::QUEUE; @@ -32,20 +30,15 @@ pub unsafe fn draw(root_pane: &Pane) { root_pane .find_pane_by_name_recursive(display_parent_fmt!(notification_idx)) .unwrap() - .set_visible(notification.is_some() && !QUICK_MENU_ACTIVE && cc_displayed); + .set_visible(notification.is_some() && !QUICK_MENU_ACTIVE); if notification.is_none() { return; } let notification = notification.unwrap(); + notification.tick(); let color = notification.color; - if !cc_displayed { - // Set the notification to drawn so we don't draw it - notification.set_drawn(); - notification.force_complete(); - } - if !notification.has_drawn() { notification.set_drawn(); root_pane diff --git a/src/training/ui/notifications.rs b/src/training/ui/notifications.rs index c97ba7f..f137495 100644 --- a/src/training/ui/notifications.rs +++ b/src/training/ui/notifications.rs @@ -34,11 +34,6 @@ impl Notification { self.length -= 1; } - // Used to force the notification to be removed from queue - pub fn force_complete(&mut self) { - self.length = 0; - } - // Returns: has_completed pub fn check_completed(&mut self) -> bool { if self.length <= 1 { diff --git a/training_mod_consts/src/lib.rs b/training_mod_consts/src/lib.rs index cad47ff..2add2e3 100644 --- a/training_mod_consts/src/lib.rs +++ b/training_mod_consts/src/lib.rs @@ -671,7 +671,7 @@ impl_toggletrait! { OnOff, "Frame Advantage", "frame_advantage", - "Frame Advantage: Display the time difference between when the player is actionable and the CPU is actionable", + "Frame Advantage: Display the time difference between when the player is actionable and the CPU is actionable\nNote that the CPU must not be mashing any options.", true, 1, }