store bpm_mult in diff points (/b/1033882+Taiko)
This commit is contained in:
@@ -6,8 +6,8 @@ use crate::{
|
||||
object::ManiaObject,
|
||||
},
|
||||
model::{
|
||||
beatmap::{get_precision_adjusted_beat_len_taiko_mania, Beatmap},
|
||||
control_point::{EffectPoint, TimingPoint},
|
||||
beatmap::Beatmap,
|
||||
control_point::{DifficultyPoint, EffectPoint, TimingPoint},
|
||||
hit_object::HitObject,
|
||||
},
|
||||
util::{float_ext::FloatExt, random::Random},
|
||||
@@ -40,10 +40,16 @@ impl<'h> DistanceObjectPatternGenerator<'h> {
|
||||
curve: &BorrowedCurve<'_>,
|
||||
node_sounds: &'h [HitSoundType],
|
||||
) -> Self {
|
||||
let beat_len = orig
|
||||
let timing_beat_len = orig
|
||||
.timing_point_at(hit_object.start_time)
|
||||
.map_or(TimingPoint::DEFAULT_BEAT_LEN, |point| point.beat_len);
|
||||
|
||||
let bpm_multiplier = orig
|
||||
.difficulty_point_at(hit_object.start_time)
|
||||
.map_or(DifficultyPoint::DEFAULT_BPM_MULTIPLIER, |point| {
|
||||
point.bpm_multiplier
|
||||
});
|
||||
|
||||
let kiai = orig
|
||||
.effect_point_at(hit_object.start_time)
|
||||
.map_or(EffectPoint::DEFAULT_KIAI, |point| point.kiai);
|
||||
@@ -54,8 +60,7 @@ impl<'h> DistanceObjectPatternGenerator<'h> {
|
||||
PatternType::LOW_PROBABILITY
|
||||
};
|
||||
|
||||
let beat_len =
|
||||
get_precision_adjusted_beat_len_taiko_mania(orig, beat_len, hit_object.start_time);
|
||||
let beat_len = timing_beat_len * bpm_multiplier;
|
||||
|
||||
let span_count = (repeats + 1) as i32;
|
||||
let start_time = hit_object.start_time.round_even() as i32;
|
||||
|
||||
@@ -5,7 +5,7 @@ use rosu_map::{
|
||||
LATEST_FORMAT_VERSION,
|
||||
};
|
||||
|
||||
use crate::{Performance, Difficulty};
|
||||
use crate::{Difficulty, Performance};
|
||||
|
||||
pub use self::{
|
||||
attributes::{BeatmapAttributes, BeatmapAttributesBuilder, HitWindows},
|
||||
@@ -183,29 +183,3 @@ impl Default for Beatmap {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! define_beat_len_fn {
|
||||
( $fn_name:ident, $clamp:literal) => {
|
||||
#[allow(unused)]
|
||||
pub(crate) fn $fn_name(map: &Beatmap, beat_len: f64, time: f64) -> f64 {
|
||||
let slider_velocity = map
|
||||
.difficulty_point_at(time)
|
||||
.map_or(DifficultyPoint::DEFAULT_SLIDER_VELOCITY, |point| {
|
||||
point.slider_velocity
|
||||
});
|
||||
|
||||
let slider_velocity_as_beat_len = -100.0 / slider_velocity;
|
||||
|
||||
let bpm_mult = if slider_velocity_as_beat_len < 0.0 {
|
||||
f64::from(((-slider_velocity_as_beat_len) as f32).clamp(10.0, $clamp)) / 100.0
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
|
||||
beat_len * bpm_mult
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
define_beat_len_fn!(get_precision_adjusted_beat_len_taiko_mania, 10_000.0);
|
||||
define_beat_len_fn!(get_precision_adjusted_beat_len_osu_catch, 1000.0);
|
||||
|
||||
@@ -1,4 +1,46 @@
|
||||
pub use rosu_map::section::timing_points::DifficultyPoint;
|
||||
/// Difficulty-related info about this control point.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct DifficultyPoint {
|
||||
pub time: f64,
|
||||
pub slider_velocity: f64,
|
||||
pub bpm_multiplier: f64,
|
||||
pub generate_ticks: bool,
|
||||
}
|
||||
|
||||
impl DifficultyPoint {
|
||||
pub const DEFAULT_SLIDER_VELOCITY: f64 = 1.0;
|
||||
pub const DEFAULT_BPM_MULTIPLIER: f64 = 1.0;
|
||||
pub const DEFAULT_GENERATE_TICKS: bool = true;
|
||||
|
||||
pub fn new(time: f64, beat_len: f64, speed_multiplier: f64) -> Self {
|
||||
Self {
|
||||
time,
|
||||
slider_velocity: speed_multiplier.clamp(0.1, 10.0),
|
||||
bpm_multiplier: if beat_len < 0.0 {
|
||||
f64::from((-beat_len) as f32).clamp(10.0, 10_000.0) / 100.0
|
||||
} else {
|
||||
1.0
|
||||
},
|
||||
generate_ticks: !beat_len.is_nan(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_redundant(&self, existing: &Self) -> bool {
|
||||
self.generate_ticks == existing.generate_ticks
|
||||
&& (self.slider_velocity - existing.slider_velocity).abs() < f64::EPSILON
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for DifficultyPoint {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
time: 0.0,
|
||||
slider_velocity: Self::DEFAULT_SLIDER_VELOCITY,
|
||||
bpm_multiplier: Self::DEFAULT_BPM_MULTIPLIER,
|
||||
generate_ticks: Self::DEFAULT_GENERATE_TICKS,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn difficulty_point_at(points: &[DifficultyPoint], time: f64) -> Option<&DifficultyPoint> {
|
||||
points
|
||||
|
||||
+13
-7
@@ -7,8 +7,8 @@ use rosu_map::{
|
||||
|
||||
use crate::{
|
||||
model::{
|
||||
beatmap::{get_precision_adjusted_beat_len_taiko_mania, Beatmap, Converted},
|
||||
control_point::TimingPoint,
|
||||
beatmap::{Beatmap, Converted},
|
||||
control_point::{DifficultyPoint, TimingPoint},
|
||||
hit_object::{HitObject, HitObjectKind, HoldNote, Slider, Spinner},
|
||||
mode::ConvertStatus,
|
||||
},
|
||||
@@ -36,6 +36,8 @@ pub fn try_convert(map: &mut Cow<'_, Beatmap>) -> ConvertStatus {
|
||||
}
|
||||
|
||||
fn convert(map: &mut Beatmap) {
|
||||
map.slider_multiplier *= f64::from(LEGACY_TAIKO_VELOCITY_MULTIPLIER);
|
||||
|
||||
let mut new_objects = Vec::new();
|
||||
let mut new_sounds = Vec::new();
|
||||
|
||||
@@ -131,12 +133,16 @@ fn should_convert_slider_to_taiko_hits(map: &Beatmap, params: &mut SliderParams<
|
||||
.timing_point_at(*start_time)
|
||||
.map_or(TimingPoint::DEFAULT_BEAT_LEN, |point| point.beat_len);
|
||||
|
||||
let mut beat_len =
|
||||
get_precision_adjusted_beat_len_taiko_mania(map, timing_beat_len, *start_time);
|
||||
let bpm_multiplier = map
|
||||
.difficulty_point_at(*start_time)
|
||||
.map_or(DifficultyPoint::DEFAULT_BPM_MULTIPLIER, |point| {
|
||||
point.bpm_multiplier
|
||||
});
|
||||
|
||||
let slider_scoring_point_dist = f64::from(OSU_BASE_SCORING_DIST)
|
||||
* (map.slider_multiplier * f64::from(LEGACY_TAIKO_VELOCITY_MULTIPLIER))
|
||||
/ map.slider_tick_rate;
|
||||
let mut beat_len = timing_beat_len * bpm_multiplier;
|
||||
|
||||
let slider_scoring_point_dist =
|
||||
f64::from(OSU_BASE_SCORING_DIST) * map.slider_multiplier / map.slider_tick_rate;
|
||||
|
||||
// * The velocity and duration of the taiko hit object - calculated as the velocity of a drum roll.
|
||||
let taiko_vel = slider_scoring_point_dist * map.slider_tick_rate;
|
||||
|
||||
Reference in New Issue
Block a user