added convert support (#12)

* added taiko conversion

* finished converts

* made clippy happy

* optimized allocations for patterns

* taiko convert fixes

* added mode methods for osu calculators

* from CRLF back to LF

* updated changelog

* updated readme

* undo normal hitsound change

* added edge_sounds to changelog
This commit is contained in:
Max
2022-07-04 14:17:15 +02:00
committed by GitHub
parent c2e96ce95b
commit 7ed1ac5226
38 changed files with 2636 additions and 284 deletions
+1
View File
@@ -49,6 +49,7 @@ impl FruitOrJuice {
pixel_len,
repeats,
control_points,
..
} => {
// HR business
params.last_pos = Some(h.pos.x + control_points[control_points.len() - 1].pos.x);
+23 -2
View File
@@ -16,7 +16,9 @@ use movement::Movement;
pub use pp::*;
use slider_state::SliderState;
use crate::{catch::fruit_or_juice::FruitParams, curve::CurveBuffers, Beatmap, Mods, Strains};
use crate::{
catch::fruit_or_juice::FruitParams, curve::CurveBuffers, Beatmap, Mods, OsuStars, Strains,
};
const SECTION_LENGTH: f64 = 750.0;
const STAR_SCALING_FACTOR: f64 = 0.153;
@@ -128,7 +130,6 @@ fn calculate_movement(params: CatchStars<'_>) -> (Movement, CatchDifficultyAttri
} = params;
let take = passed_objects.unwrap_or(usize::MAX);
let map_attributes = map.attributes().mods(mods);
let clock_rate = clock_rate.unwrap_or(map_attributes.clock_rate);
@@ -274,7 +275,27 @@ impl CatchPerformanceAttributes {
}
impl From<CatchPerformanceAttributes> for CatchDifficultyAttributes {
#[inline]
fn from(attributes: CatchPerformanceAttributes) -> Self {
attributes.difficulty
}
}
impl<'map> From<OsuStars<'map>> for CatchStars<'map> {
#[inline]
fn from(osu: OsuStars<'map>) -> Self {
let OsuStars {
map,
mods,
passed_objects,
clock_rate,
} = osu;
Self {
map,
mods,
passed_objects,
clock_rate,
}
}
}
+38 -1
View File
@@ -1,5 +1,5 @@
use super::{CatchDifficultyAttributes, CatchPerformanceAttributes, CatchScoreState, CatchStars};
use crate::{Beatmap, DifficultyAttributes, Mods, PerformanceAttributes};
use crate::{Beatmap, DifficultyAttributes, Mods, OsuPP, PerformanceAttributes};
/// Performance calculator on osu!catch maps.
///
@@ -431,6 +431,43 @@ impl CatchPPInner {
}
}
impl<'map> From<OsuPP<'map>> for CatchPP<'map> {
fn from(osu: OsuPP<'map>) -> Self {
let OsuPP {
map,
mods,
acc,
combo,
n300,
n100,
n50,
n_misses,
passed_objects,
clock_rate,
..
} = osu;
let res = Self {
map,
attributes: None,
mods,
combo,
n_fruits: n300,
n_droplets: n100,
n_tiny_droplets: n50,
n_tiny_droplet_misses: None,
n_misses,
passed_objects,
clock_rate,
};
match acc {
Some(acc) => res.accuracy(acc),
None => res,
}
}
}
/// Abstract type to provide flexibility when passing difficulty attributes to a performance calculation.
pub trait CatchAttributeProvider {
/// Provide the actual difficulty attributes.
+5
View File
@@ -56,24 +56,29 @@ mod test {
TimingPoint {
time: 1.0,
beat_len: 10.0,
kiai: false,
},
TimingPoint {
time: 3.0,
beat_len: 20.0,
kiai: false,
},
TimingPoint {
time: 4.0,
beat_len: 30.0,
kiai: false,
},
],
difficulty_points: vec![
DifficultyPoint {
time: 2.0,
speed_multiplier: 15.0,
kiai: false,
},
DifficultyPoint {
time: 5.0,
speed_multiplier: 45.0,
kiai: false,
},
],
..Default::default()