osu: dont count hitobjects again

This commit is contained in:
MaxOhn
2021-04-17 14:28:04 +02:00
parent ed33eda909
commit 3f81f18c75
7 changed files with 36 additions and 52 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
## Upcoming ## Upcoming
- parse: - parse & osu:
- Cleanup - Cleanup and tiny optimizations
# v0.2.0 # v0.2.0
+2
View File
@@ -180,6 +180,8 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
let stars = aim_strain + speed_strain + (aim_strain - speed_strain).abs() / 2.0; let stars = aim_strain + speed_strain + (aim_strain - speed_strain).abs() / 2.0;
diff_attributes.n_circles = map.n_circles as usize;
diff_attributes.n_spinners = map.n_spinners as usize;
diff_attributes.stars = stars; diff_attributes.stars = stars;
diff_attributes.speed_strain = speed_strain; diff_attributes.speed_strain = speed_strain;
diff_attributes.aim_strain = aim_strain; diff_attributes.aim_strain = aim_strain;
+14 -22
View File
@@ -43,16 +43,12 @@ impl OsuObject {
let stack_height = 0.0; let stack_height = 0.0;
let obj = match &h.kind { let obj = match &h.kind {
HitObjectKind::Circle => { HitObjectKind::Circle => Self {
attributes.n_circles += 1; time: h.start_time,
pos: h.pos,
Self { stack_height,
time: h.start_time, kind: OsuObjectKind::Circle,
pos: h.pos, },
stack_height,
kind: OsuObjectKind::Circle,
}
}
HitObjectKind::Slider { HitObjectKind::Slider {
pixel_len, pixel_len,
repeats, repeats,
@@ -187,18 +183,14 @@ impl OsuObject {
}, },
} }
} }
HitObjectKind::Spinner { end_time } => { HitObjectKind::Spinner { end_time } => Self {
attributes.n_spinners += 1; time: h.start_time,
pos: h.pos,
Self { stack_height,
time: h.start_time, kind: OsuObjectKind::Spinner {
pos: h.pos, end_time: *end_time,
stack_height, },
kind: OsuObjectKind::Spinner { },
end_time: *end_time,
},
}
}
HitObjectKind::Hold { .. } => return None, HitObjectKind::Hold { .. } => return None,
}; };
+2
View File
@@ -144,6 +144,8 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
let stars = aim_strain + speed_strain + (aim_strain - speed_strain).abs() / 2.0; let stars = aim_strain + speed_strain + (aim_strain - speed_strain).abs() / 2.0;
diff_attributes.n_circles = map.n_circles as usize;
diff_attributes.n_spinners = map.n_spinners as usize;
diff_attributes.stars = stars; diff_attributes.stars = stars;
diff_attributes.speed_strain = speed_strain; diff_attributes.speed_strain = speed_strain;
diff_attributes.aim_strain = aim_strain; diff_attributes.aim_strain = aim_strain;
+12 -20
View File
@@ -30,16 +30,12 @@ impl OsuObject {
attributes.max_combo += 1; // hitcircle, slider head, or spinner attributes.max_combo += 1; // hitcircle, slider head, or spinner
let obj = match &h.kind { let obj = match &h.kind {
HitObjectKind::Circle => { HitObjectKind::Circle => Self {
attributes.n_circles += 1; time: h.start_time,
pos: h.pos,
Self { end_pos: h.pos,
time: h.start_time, travel_dist: Some(0.0),
pos: h.pos, },
end_pos: h.pos,
travel_dist: Some(0.0),
}
}
HitObjectKind::Slider { HitObjectKind::Slider {
pixel_len, pixel_len,
repeats, repeats,
@@ -167,16 +163,12 @@ impl OsuObject {
travel_dist: Some(travel_dist), travel_dist: Some(travel_dist),
} }
} }
HitObjectKind::Spinner { .. } => { HitObjectKind::Spinner { .. } => Self {
attributes.n_spinners += 1; time: h.start_time,
pos: h.pos,
Self { end_pos: h.pos,
time: h.start_time, travel_dist: None,
pos: h.pos, },
end_pos: h.pos,
travel_dist: None,
}
}
HitObjectKind::Hold { .. } => return None, HitObjectKind::Hold { .. } => return None,
}; };
@@ -60,8 +60,6 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
} }
let mut max_combo = 0; let mut max_combo = 0;
let mut n_circles = 0;
let mut n_spinners = 0;
let mut state = SliderState::new(&map); let mut state = SliderState::new(&map);
let mut hit_objects = map let mut hit_objects = map
@@ -71,7 +69,6 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
.filter_map(|h| match &h.kind { .filter_map(|h| match &h.kind {
HitObjectKind::Circle => { HitObjectKind::Circle => {
max_combo += 1; max_combo += 1;
n_circles += 1;
Some(Cow::Borrowed(h)) Some(Cow::Borrowed(h))
} }
@@ -89,7 +86,6 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
} }
HitObjectKind::Spinner { .. } => { HitObjectKind::Spinner { .. } => {
max_combo += 1; max_combo += 1;
n_spinners += 1;
Some(Cow::Borrowed(h)) Some(Cow::Borrowed(h))
} }
@@ -172,8 +168,8 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
speed_strain, speed_strain,
aim_strain, aim_strain,
max_combo, max_combo,
n_circles, n_circles: map.n_circles as usize,
n_spinners, n_spinners: map.n_spinners as usize,
}) })
} }
+2 -2
View File
@@ -506,8 +506,8 @@ macro_rules! parse_hitobjects_body {
all(feature = "osu", not(feature = "no_sliders_no_leniency")) all(feature = "osu", not(feature = "no_sliders_no_leniency"))
)))] )))]
{ {
let repeats = next_field!(split.nth(1), repeats).parse::<usize>()?; let repeats = next_field!(split.nth(1), "repeats").parse::<usize>()?;
let len: f32 = next_field!(split.next(), pixel len).parse()?; let len: f32 = next_field!(split.next(), "pixel len").parse()?;
HitObjectKind::Slider { HitObjectKind::Slider {
repeats, repeats,