fixes for osu_fast feature

This commit is contained in:
MaxOhn
2021-11-09 04:13:13 +01:00
parent cb4a3d76d9
commit 1ba6cfc44c
9 changed files with 263 additions and 95 deletions
+2 -1
View File
@@ -59,7 +59,8 @@ pub enum HitObjectKind {
#[cfg(not(feature = "sliders"))]
Slider {
pixel_len: f32,
repeats: usize,
span_count: usize,
last_control_point: Pos2,
},
Spinner {
end_time: f32,
+23 -3
View File
@@ -533,10 +533,30 @@ macro_rules! parse_hitobjects_body {
#[cfg(not(feature = "sliders"))]
{
let repeats = split.nth(1).next_field("repeats")?.parse()?;
let pixel_len = split.next().next_field("pixel len")?.parse()?;
let last_control_point = split
.next()
.next_field("control points")?
.split('|')
.next_back();
HitObjectKind::Slider { repeats, pixel_len }
match last_control_point.map(|v| v.split(':').map(str::parse)) {
Some(mut coords) => {
let last_control_point = match (coords.next(), coords.next()) {
(Some(Ok(x)), Some(Ok(y))) => Pos2 { x, y },
_ => return Err(ParseError::InvalidCurvePoints),
};
let span_count = split.next().next_field("repeats")?.parse()?;
let pixel_len = split.next().next_field("pixel len")?.parse()?;
HitObjectKind::Slider {
span_count,
pixel_len,
last_control_point,
}
}
None => HitObjectKind::Circle,
}
}
} else if kind & Self::SPINNER_FLAG > 0 {
$self.n_spinners += 1;