diff --git a/neothesia/src/scene/menu_scene/iced_menu/stats.rs b/neothesia/src/scene/menu_scene/iced_menu/stats.rs index b208a96..f2d156e 100644 --- a/neothesia/src/scene/menu_scene/iced_menu/stats.rs +++ b/neothesia/src/scene/menu_scene/iced_menu/stats.rs @@ -68,8 +68,20 @@ impl Page for StatsPage { // Populate data into tracks for (index, stats) in sorted_stats.iter().enumerate() { - let scores = stats.notes_hit + stats.correct_note_times * 10 - - (stats.notes_missed + stats.wrong_note_times + stats.notes_missed); // There are many ways to cook + let mut scores = stats.notes_hit + stats.correct_note_times * 10; // There are many ways to cook + + + // Apply penalties + if stats.notes_missed > 0 { + scores = scores.saturating_sub(stats.notes_missed); + } + if stats.wrong_notes > 0 { + scores = scores.saturating_sub(stats.wrong_notes); + } + + // Final bonus addition + scores += stats.correct_note_times; + let datetime: DateTime = stats.date.into(); let score = (index + 1) as u32; let trophy_image = if score <= 3 { score } else { 0 }; @@ -99,7 +111,7 @@ impl Page for StatsPage { .spacing(10) .align_items(Alignment::Start), ) - .height(ctx.window_state.logical_size.height as u16 - 400); + .height(ctx.window_state.logical_size.height as u16 - 250); let mut elements = Vec::new(); let scrollable_element: Element<'_, Event> = scrollable.into(); @@ -111,8 +123,8 @@ impl Page for StatsPage { .date("Date") .place("Place") .score("Score") - .notes_hits("Hits") - .notes_missed("Missed notes") + .notes_hits("Good Hits") + .notes_missed("Slow Hits") .wrong_notes("Wrong notes") .correct_notes_duration("Good Durations") .header(true); diff --git a/neothesia/src/scene/playing_scene/midi_player.rs b/neothesia/src/scene/playing_scene/midi_player.rs index 63f80f0..8a4a182 100644 --- a/neothesia/src/scene/playing_scene/midi_player.rs +++ b/neothesia/src/scene/playing_scene/midi_player.rs @@ -326,7 +326,7 @@ impl PlayAlong { .iter() .position(|item| item.note_id == note_id) { - if let None = self + /* if let None = self .user_pressed_recently .iter_mut() .find(|item| item.note_id == note_id) @@ -335,6 +335,8 @@ impl PlayAlong { self.user_stats.wrong_notes -= 1; } + */ + if timestamp .duration_since(self.required_notes[index].timestamp) .as_millis() @@ -520,15 +522,16 @@ impl PlayAlong { // Loop through user_stats.note_durations items, compare user_note_dur to file_note_dur let mut correct_note_times = 0; let mut wrong_note_times = 0; + // make it relaxed, Lower Bound: 83% of the file's note duration, Upper Bound: 112% of the file's note duration. for duration in &self.user_stats.note_durations { - // Compare user_note_dur to file_note_dur - let duration_difference = - (duration.user_note_dur as f64 - duration.file_note_dur as f64).abs(); - let percentage_difference = - duration_difference / duration.user_note_dur as f64 * 100.0; - - // Increment correctNoteTimes if it is close to 90%, otherwise increment wrongNoteTimes - if percentage_difference <= 10.0 { + // Calculate the lower and upper bounds for a "correct" duration + let lower_bound = duration.file_note_dur as f64 * 0.83; + let upper_bound = duration.file_note_dur as f64 * 1.12; + + // Increment correctNoteTimes if it is within the bounds, otherwise increment wrongNoteTimes + if (duration.user_note_dur as f64) >= lower_bound + && (duration.user_note_dur as f64) <= upper_bound + { correct_note_times += 1; } else { wrong_note_times += 1;