feat: support MR for catch

This commit is contained in:
MaxOhn
2024-11-13 02:09:19 +01:00
parent baeaeb77de
commit f37b917f76
4 changed files with 34 additions and 11 deletions
+9
View File
@@ -5,6 +5,7 @@ use crate::{
beatmap::{Beatmap, Converted},
hit_object::{HitObject, HitObjectKind, HoldNote, Spinner},
mode::ConvertStatus,
mods::Reflection,
},
util::{float_ext::FloatExt, random::Random},
};
@@ -50,6 +51,7 @@ pub fn try_convert(map: &mut Beatmap) -> ConvertStatus {
pub fn convert_objects(
converted: &CatchBeatmap<'_>,
count: &mut ObjectCountBuilder,
reflection: Reflection,
hr_offsets: bool,
cs: f32,
) -> Vec<PalpableObject> {
@@ -82,6 +84,13 @@ pub fn convert_objects(
palpable_objects.extend(new_objects);
}
if let Reflection::Horizontal = reflection {
for h in palpable_objects.iter_mut() {
h.x = PLAYFIELD_WIDTH - h.x;
h.x_offset = -h.x_offset;
}
}
palpable_objects.sort_by(|a, b| a.start_time.total_cmp(&b.start_time));
initialize_hyper_dash(cs, &mut palpable_objects);
+9 -2
View File
@@ -72,9 +72,16 @@ impl CatchGradualDifficulty {
CatchDifficultySetup::new(&difficulty, converted);
let hr_offsets = difficulty.get_hardrock_offsets();
let reflection = difficulty.get_mods().reflection();
let mut count = ObjectCountBuilder::new_gradual();
let palpable_objects =
convert_objects(converted, &mut count, hr_offsets, map_attrs.cs as f32);
let palpable_objects = convert_objects(
converted,
&mut count,
reflection,
hr_offsets,
map_attrs.cs as f32,
);
let diff_objects = DifficultyValues::create_difficulty_objects(
&map_attrs,
+8 -2
View File
@@ -69,10 +69,16 @@ impl DifficultyValues {
} = CatchDifficultySetup::new(difficulty, converted);
let hr_offsets = difficulty.get_hardrock_offsets();
let reflection = difficulty.get_mods().reflection();
let mut count = ObjectCountBuilder::new_regular(take);
let palpable_objects =
convert_objects(converted, &mut count, hr_offsets, map_attrs.cs as f32);
let palpable_objects = convert_objects(
converted,
&mut count,
reflection,
hr_offsets,
map_attrs.cs as f32,
);
let diff_objects = Self::create_difficulty_objects(
&map_attrs,
+8 -7
View File
@@ -124,15 +124,16 @@ impl GameMods {
mods.iter()
.find_map(|m| match m {
GameMod::MirrorOsu(mirror) => Some(mirror),
GameMod::MirrorOsu(mr) => match mr.reflection.as_deref() {
None => Some(Reflection::Horizontal),
Some("1") => Some(Reflection::Vertical),
Some("2") => Some(Reflection::Both),
Some(_) => Some(Reflection::None),
},
GameMod::MirrorCatch(_) => Some(Reflection::Horizontal),
_ => None,
})
.map_or(Reflection::None, |mr| match mr.reflection.as_deref() {
None => Reflection::Horizontal,
Some("1") => Reflection::Vertical,
Some("2") => Reflection::Both,
Some(_) => Reflection::None,
})
.unwrap_or(Reflection::None)
}
GameModsInner::Intermode(ref mods) => {
if mods.contains(GameModIntermode::HardRock) {