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
- parse:
- Cleanup
- parse & osu:
- Cleanup and tiny optimizations
# 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;
diff_attributes.n_circles = map.n_circles as usize;
diff_attributes.n_spinners = map.n_spinners as usize;
diff_attributes.stars = stars;
diff_attributes.speed_strain = speed_strain;
diff_attributes.aim_strain = aim_strain;
+14 -22
View File
@@ -43,16 +43,12 @@ impl OsuObject {
let stack_height = 0.0;
let obj = match &h.kind {
HitObjectKind::Circle => {
attributes.n_circles += 1;
Self {
time: h.start_time,
pos: h.pos,
stack_height,
kind: OsuObjectKind::Circle,
}
}
HitObjectKind::Circle => Self {
time: h.start_time,
pos: h.pos,
stack_height,
kind: OsuObjectKind::Circle,
},
HitObjectKind::Slider {
pixel_len,
repeats,
@@ -187,18 +183,14 @@ impl OsuObject {
},
}
}
HitObjectKind::Spinner { end_time } => {
attributes.n_spinners += 1;
Self {
time: h.start_time,
pos: h.pos,
stack_height,
kind: OsuObjectKind::Spinner {
end_time: *end_time,
},
}
}
HitObjectKind::Spinner { end_time } => Self {
time: h.start_time,
pos: h.pos,
stack_height,
kind: OsuObjectKind::Spinner {
end_time: *end_time,
},
},
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;
diff_attributes.n_circles = map.n_circles as usize;
diff_attributes.n_spinners = map.n_spinners as usize;
diff_attributes.stars = stars;
diff_attributes.speed_strain = speed_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
let obj = match &h.kind {
HitObjectKind::Circle => {
attributes.n_circles += 1;
Self {
time: h.start_time,
pos: h.pos,
end_pos: h.pos,
travel_dist: Some(0.0),
}
}
HitObjectKind::Circle => Self {
time: h.start_time,
pos: h.pos,
end_pos: h.pos,
travel_dist: Some(0.0),
},
HitObjectKind::Slider {
pixel_len,
repeats,
@@ -167,16 +163,12 @@ impl OsuObject {
travel_dist: Some(travel_dist),
}
}
HitObjectKind::Spinner { .. } => {
attributes.n_spinners += 1;
Self {
time: h.start_time,
pos: h.pos,
end_pos: h.pos,
travel_dist: None,
}
}
HitObjectKind::Spinner { .. } => Self {
time: h.start_time,
pos: h.pos,
end_pos: h.pos,
travel_dist: 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 n_circles = 0;
let mut n_spinners = 0;
let mut state = SliderState::new(&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 {
HitObjectKind::Circle => {
max_combo += 1;
n_circles += 1;
Some(Cow::Borrowed(h))
}
@@ -89,7 +86,6 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
}
HitObjectKind::Spinner { .. } => {
max_combo += 1;
n_spinners += 1;
Some(Cow::Borrowed(h))
}
@@ -172,8 +168,8 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
speed_strain,
aim_strain,
max_combo,
n_circles,
n_spinners,
n_circles: map.n_circles as usize,
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"))
)))]
{
let repeats = next_field!(split.nth(1), repeats).parse::<usize>()?;
let len: f32 = next_field!(split.next(), pixel len).parse()?;
let repeats = next_field!(split.nth(1), "repeats").parse::<usize>()?;
let len: f32 = next_field!(split.next(), "pixel len").parse()?;
HitObjectKind::Slider {
repeats,