1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-27 20:34:03 +00:00

Small changes to fix notification ticks

This commit is contained in:
jugeeya 2024-02-19 17:52:37 -08:00
parent 66aa745e53
commit bb704a12ed
4 changed files with 4 additions and 23 deletions

View file

@ -786,13 +786,6 @@ unsafe fn handle_once_per_cpu_frame(_ctx: &mut InlineCtx) {
input_record::handle_recording(); input_record::handle_recording();
frame_counter::tick_ingame(); frame_counter::tick_ingame();
tech::hide_tech(); 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)] #[skyline::hook(offset = *OFFSET_FIM)]

View file

@ -1,7 +1,7 @@
use skyline::nn::ui2d::*; use skyline::nn::ui2d::*;
use smash::ui2d::{SmashPane, SmashTextBox}; 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; use crate::training::ui;
macro_rules! display_parent_fmt { macro_rules! display_parent_fmt {
($x:ident) => { ($x:ident) => {
@ -22,8 +22,6 @@ macro_rules! display_txt_fmt {
} }
pub unsafe fn draw(root_pane: &Pane) { 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 notification_idx = 0;
let queue = &mut ui::notifications::QUEUE; let queue = &mut ui::notifications::QUEUE;
@ -32,20 +30,15 @@ pub unsafe fn draw(root_pane: &Pane) {
root_pane root_pane
.find_pane_by_name_recursive(display_parent_fmt!(notification_idx)) .find_pane_by_name_recursive(display_parent_fmt!(notification_idx))
.unwrap() .unwrap()
.set_visible(notification.is_some() && !QUICK_MENU_ACTIVE && cc_displayed); .set_visible(notification.is_some() && !QUICK_MENU_ACTIVE);
if notification.is_none() { if notification.is_none() {
return; return;
} }
let notification = notification.unwrap(); let notification = notification.unwrap();
notification.tick();
let color = notification.color; 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() { if !notification.has_drawn() {
notification.set_drawn(); notification.set_drawn();
root_pane root_pane

View file

@ -34,11 +34,6 @@ impl Notification {
self.length -= 1; 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 // Returns: has_completed
pub fn check_completed(&mut self) -> bool { pub fn check_completed(&mut self) -> bool {
if self.length <= 1 { if self.length <= 1 {

View file

@ -671,7 +671,7 @@ impl_toggletrait! {
OnOff, OnOff,
"Frame Advantage", "Frame Advantage",
"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, true,
1, 1,
} }