fix: refactor get_precision_adjusted_beat_len
This commit is contained in:
@@ -11,6 +11,7 @@ use crate::{
|
||||
control_point::{DifficultyPoint, TimingPoint},
|
||||
hit_object::Slider,
|
||||
},
|
||||
util::get_precision_adjusted_beat_len,
|
||||
};
|
||||
|
||||
pub struct JuiceStream<'a> {
|
||||
@@ -159,15 +160,3 @@ pub struct JuiceStreamBufs {
|
||||
pub curve: CurveBuffers,
|
||||
pub ticks: Vec<SliderEvent>,
|
||||
}
|
||||
|
||||
fn get_precision_adjusted_beat_len(slider_velocity_multiplier: f64, beat_len: f64) -> f64 {
|
||||
let slider_velocity_as_beat_len = -100.0 / slider_velocity_multiplier;
|
||||
|
||||
let bpm_multiplier = if slider_velocity_as_beat_len < 0.0 {
|
||||
f64::from(((-slider_velocity_as_beat_len) as f32).clamp(10.0, 10_000.0)) / 100.0
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
|
||||
beat_len * bpm_multiplier
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use crate::{
|
||||
control_point::{DifficultyPoint, EffectPoint, TimingPoint},
|
||||
hit_object::HitObject,
|
||||
},
|
||||
util::random::Random,
|
||||
util::{get_precision_adjusted_beat_len, random::Random},
|
||||
};
|
||||
|
||||
use super::PatternGenerator;
|
||||
@@ -46,10 +46,10 @@ impl<'h> PathObjectPatternGenerator<'h> {
|
||||
.timing_point_at(hit_object.start_time)
|
||||
.map_or(TimingPoint::DEFAULT_BEAT_LEN, |point| point.beat_len);
|
||||
|
||||
let bpm_multiplier = orig
|
||||
let slider_velocity = orig
|
||||
.difficulty_point_at(hit_object.start_time)
|
||||
.map_or(DifficultyPoint::DEFAULT_BPM_MULTIPLIER, |point| {
|
||||
point.bpm_multiplier
|
||||
.map_or(DifficultyPoint::DEFAULT_SLIDER_VELOCITY, |point| {
|
||||
point.slider_velocity
|
||||
});
|
||||
|
||||
let kiai = orig
|
||||
@@ -62,7 +62,7 @@ impl<'h> PathObjectPatternGenerator<'h> {
|
||||
PatternType::LOW_PROBABILITY
|
||||
};
|
||||
|
||||
let beat_len = timing_beat_len * bpm_multiplier;
|
||||
let beat_len = get_precision_adjusted_beat_len(slider_velocity, timing_beat_len);
|
||||
|
||||
let span_count = (repeats + 1) as i32;
|
||||
let start_time = hit_object.start_time.round_ties_even() as i32;
|
||||
|
||||
+1
-13
@@ -13,7 +13,7 @@ use crate::{
|
||||
control_point::{DifficultyPoint, TimingPoint},
|
||||
hit_object::{HitObject, HitObjectKind, HoldNote, Slider, Spinner},
|
||||
},
|
||||
util::sort,
|
||||
util::{get_precision_adjusted_beat_len, sort},
|
||||
};
|
||||
|
||||
use super::{convert::OsuBeatmap, PLAYFIELD_BASE_SIZE};
|
||||
@@ -340,15 +340,3 @@ pub enum NestedSliderObjectKind {
|
||||
Tail,
|
||||
Tick,
|
||||
}
|
||||
|
||||
fn get_precision_adjusted_beat_len(slider_velocity_multiplier: f64, beat_len: f64) -> f64 {
|
||||
let slider_velocity_as_beat_len = -100.0 / slider_velocity_multiplier;
|
||||
|
||||
let bpm_multiplier = if slider_velocity_as_beat_len < 0.0 {
|
||||
f64::from(((-slider_velocity_as_beat_len) as f32).clamp(10.0, 10_000.0)) / 100.0
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
|
||||
beat_len * bpm_multiplier
|
||||
}
|
||||
|
||||
+1
-13
@@ -9,7 +9,7 @@ use crate::{
|
||||
hit_object::{HitObject, HitObjectKind, HoldNote, Slider, Spinner},
|
||||
mode::ConvertStatus,
|
||||
},
|
||||
util::{float_ext::FloatExt, sort::TandemSorter},
|
||||
util::{float_ext::FloatExt, get_precision_adjusted_beat_len, sort::TandemSorter},
|
||||
};
|
||||
|
||||
use super::Taiko;
|
||||
@@ -143,18 +143,6 @@ fn should_convert_slider_to_taiko_hits(map: &Beatmap, params: &mut SliderParams<
|
||||
point.slider_velocity
|
||||
});
|
||||
|
||||
fn get_precision_adjusted_beat_len(slider_velocity_multiplier: f64, beat_len: f64) -> f64 {
|
||||
let slider_velocity_as_beat_len = -100.0 / slider_velocity_multiplier;
|
||||
|
||||
let bpm_multiplier = if slider_velocity_as_beat_len < 0.0 {
|
||||
f64::from(((-slider_velocity_as_beat_len) as f32).clamp(10.0, 10_000.0)) / 100.0
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
|
||||
beat_len * bpm_multiplier
|
||||
}
|
||||
|
||||
let mut beat_len = get_precision_adjusted_beat_len(slider_velocity, timing_beat_len);
|
||||
|
||||
let slider_scoring_point_dist = f64::from(OSU_BASE_SCORING_DIST)
|
||||
|
||||
@@ -7,3 +7,15 @@ pub mod sort;
|
||||
pub mod special_functions;
|
||||
pub mod strains_vec;
|
||||
pub mod sync;
|
||||
|
||||
pub fn get_precision_adjusted_beat_len(slider_velocity_multiplier: f64, beat_len: f64) -> f64 {
|
||||
let slider_velocity_as_beat_len = -100.0 / slider_velocity_multiplier;
|
||||
|
||||
let bpm_multiplier = if slider_velocity_as_beat_len < 0.0 {
|
||||
f64::from(((-slider_velocity_as_beat_len) as f32).clamp(10.0, 10_000.0)) / 100.0
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
|
||||
beat_len * bpm_multiplier
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user