fix: more catch fixes
This commit is contained in:
@@ -97,14 +97,14 @@ fn convert_object<'a>(
|
||||
let state = match h.kind {
|
||||
HitObjectKind::Circle => ObjectIterState::Fruit(Some(Fruit::new(count))),
|
||||
HitObjectKind::Slider(ref slider) => {
|
||||
let x = JuiceStream::clamp_to_playfield(h.pos.x);
|
||||
let x = h.pos.x;
|
||||
let stream = JuiceStream::new(x, h.start_time, slider, converted, count, bufs);
|
||||
|
||||
ObjectIterState::JuiceStream(stream)
|
||||
}
|
||||
HitObjectKind::Spinner(Spinner { duration })
|
||||
| HitObjectKind::Hold(HoldNote { duration }) => {
|
||||
ObjectIterState::BananaShower(BananaShower::new(h.start_time, duration))
|
||||
ObjectIterState::BananaShower(BananaShower::new(h.start_time, h.start_time + duration))
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -3,9 +3,11 @@ pub struct BananaShower {
|
||||
}
|
||||
|
||||
impl BananaShower {
|
||||
pub fn new(start_time: f64, duration: f64) -> Self {
|
||||
let mut spacing = duration;
|
||||
let end_time = start_time + duration;
|
||||
pub fn new(start_time: f64, end_time: f64) -> Self {
|
||||
// * Int truncation added to match osu!stable.
|
||||
let start_time = start_time as i32;
|
||||
let end_time = end_time as i32;
|
||||
let mut spacing = (end_time - start_time) as f32;
|
||||
|
||||
while spacing > 100.0 {
|
||||
spacing /= 2.0;
|
||||
@@ -14,15 +16,16 @@ impl BananaShower {
|
||||
let n_bananas = if spacing <= 0.0 {
|
||||
0
|
||||
} else {
|
||||
let mut time = start_time;
|
||||
let mut i = 0;
|
||||
let end_time = end_time as f32;
|
||||
let mut time = start_time as f32;
|
||||
let mut count = 0;
|
||||
|
||||
while time <= end_time {
|
||||
time += spacing;
|
||||
i += 1;
|
||||
count += 1;
|
||||
}
|
||||
|
||||
i
|
||||
count
|
||||
};
|
||||
|
||||
Self { n_bananas }
|
||||
|
||||
@@ -6,7 +6,7 @@ use rosu_map::section::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
catch::{attributes::ObjectCountBuilder, convert::CatchBeatmap, PLAYFIELD_WIDTH},
|
||||
catch::{attributes::ObjectCountBuilder, convert::CatchBeatmap},
|
||||
model::{
|
||||
control_point::{DifficultyPoint, TimingPoint},
|
||||
hit_object::Slider,
|
||||
@@ -122,7 +122,7 @@ impl<'a> JuiceStream<'a> {
|
||||
};
|
||||
|
||||
let nested = NestedJuiceStreamObject {
|
||||
pos: Self::clamp_to_playfield(x + path.position_at(e.path_progress).x),
|
||||
pos: x + path.position_at(e.path_progress).x,
|
||||
start_time: e.time,
|
||||
kind,
|
||||
};
|
||||
@@ -135,10 +135,6 @@ impl<'a> JuiceStream<'a> {
|
||||
nested_objects: bufs.nested_objects.drain(..),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clamp_to_playfield(value: f32) -> f32 {
|
||||
value.clamp(0.0, PLAYFIELD_WIDTH)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
Reference in New Issue
Block a user