feat: support MR for catch
This commit is contained in:
@@ -5,6 +5,7 @@ use crate::{
|
|||||||
beatmap::{Beatmap, Converted},
|
beatmap::{Beatmap, Converted},
|
||||||
hit_object::{HitObject, HitObjectKind, HoldNote, Spinner},
|
hit_object::{HitObject, HitObjectKind, HoldNote, Spinner},
|
||||||
mode::ConvertStatus,
|
mode::ConvertStatus,
|
||||||
|
mods::Reflection,
|
||||||
},
|
},
|
||||||
util::{float_ext::FloatExt, random::Random},
|
util::{float_ext::FloatExt, random::Random},
|
||||||
};
|
};
|
||||||
@@ -50,6 +51,7 @@ pub fn try_convert(map: &mut Beatmap) -> ConvertStatus {
|
|||||||
pub fn convert_objects(
|
pub fn convert_objects(
|
||||||
converted: &CatchBeatmap<'_>,
|
converted: &CatchBeatmap<'_>,
|
||||||
count: &mut ObjectCountBuilder,
|
count: &mut ObjectCountBuilder,
|
||||||
|
reflection: Reflection,
|
||||||
hr_offsets: bool,
|
hr_offsets: bool,
|
||||||
cs: f32,
|
cs: f32,
|
||||||
) -> Vec<PalpableObject> {
|
) -> Vec<PalpableObject> {
|
||||||
@@ -82,6 +84,13 @@ pub fn convert_objects(
|
|||||||
palpable_objects.extend(new_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));
|
palpable_objects.sort_by(|a, b| a.start_time.total_cmp(&b.start_time));
|
||||||
initialize_hyper_dash(cs, &mut palpable_objects);
|
initialize_hyper_dash(cs, &mut palpable_objects);
|
||||||
|
|
||||||
|
|||||||
@@ -72,9 +72,16 @@ impl CatchGradualDifficulty {
|
|||||||
CatchDifficultySetup::new(&difficulty, converted);
|
CatchDifficultySetup::new(&difficulty, converted);
|
||||||
|
|
||||||
let hr_offsets = difficulty.get_hardrock_offsets();
|
let hr_offsets = difficulty.get_hardrock_offsets();
|
||||||
|
let reflection = difficulty.get_mods().reflection();
|
||||||
let mut count = ObjectCountBuilder::new_gradual();
|
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(
|
let diff_objects = DifficultyValues::create_difficulty_objects(
|
||||||
&map_attrs,
|
&map_attrs,
|
||||||
|
|||||||
@@ -69,10 +69,16 @@ impl DifficultyValues {
|
|||||||
} = CatchDifficultySetup::new(difficulty, converted);
|
} = CatchDifficultySetup::new(difficulty, converted);
|
||||||
|
|
||||||
let hr_offsets = difficulty.get_hardrock_offsets();
|
let hr_offsets = difficulty.get_hardrock_offsets();
|
||||||
|
let reflection = difficulty.get_mods().reflection();
|
||||||
let mut count = ObjectCountBuilder::new_regular(take);
|
let mut count = ObjectCountBuilder::new_regular(take);
|
||||||
|
|
||||||
let palpable_objects =
|
let palpable_objects = convert_objects(
|
||||||
convert_objects(converted, &mut count, hr_offsets, map_attrs.cs as f32);
|
converted,
|
||||||
|
&mut count,
|
||||||
|
reflection,
|
||||||
|
hr_offsets,
|
||||||
|
map_attrs.cs as f32,
|
||||||
|
);
|
||||||
|
|
||||||
let diff_objects = Self::create_difficulty_objects(
|
let diff_objects = Self::create_difficulty_objects(
|
||||||
&map_attrs,
|
&map_attrs,
|
||||||
|
|||||||
+8
-7
@@ -124,15 +124,16 @@ impl GameMods {
|
|||||||
|
|
||||||
mods.iter()
|
mods.iter()
|
||||||
.find_map(|m| match m {
|
.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,
|
_ => None,
|
||||||
})
|
})
|
||||||
.map_or(Reflection::None, |mr| match mr.reflection.as_deref() {
|
.unwrap_or(Reflection::None)
|
||||||
None => Reflection::Horizontal,
|
|
||||||
Some("1") => Reflection::Vertical,
|
|
||||||
Some("2") => Reflection::Both,
|
|
||||||
Some(_) => Reflection::None,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
GameModsInner::Intermode(ref mods) => {
|
GameModsInner::Intermode(ref mods) => {
|
||||||
if mods.contains(GameModIntermode::HardRock) {
|
if mods.contains(GameModIntermode::HardRock) {
|
||||||
|
|||||||
Reference in New Issue
Block a user