clamp juicestream heads beforehand (/b/17295+Catch)

This commit is contained in:
MaxOhn
2024-02-17 14:11:41 +01:00
parent 2c50fbeb1b
commit 812a71fff6
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -99,10 +99,13 @@ fn convert_object<'a>(
attrs: &mut CatchDifficultyAttributesBuilder,
bufs: &'a mut JuiceStreamBufs,
) -> ObjectIter<'a> {
let mut x = h.pos.x;
let state = match h.kind {
HitObjectKind::Circle => ObjectIterState::Fruit(Some(Fruit::new(attrs))),
HitObjectKind::Slider(ref slider) => {
let stream = JuiceStream::new(h.pos.x, h.start_time, slider, converted, attrs, bufs);
x = JuiceStream::clamp_to_playfield(x);
let stream = JuiceStream::new(x, h.start_time, slider, converted, attrs, bufs);
ObjectIterState::JuiceStream(stream)
}
@@ -113,7 +116,7 @@ fn convert_object<'a>(
};
ObjectIter {
x: h.pos.x,
x,
start_time: h.start_time,
state,
}
+1 -1
View File
@@ -134,7 +134,7 @@ impl<'a> JuiceStream<'a> {
}
}
fn clamp_to_playfield(value: f32) -> f32 {
pub fn clamp_to_playfield(value: f32) -> f32 {
value.clamp(0.0, PLAYFIELD_WIDTH)
}
}