feat: support horizontal flipping

This commit is contained in:
MaxOhn
2024-11-11 12:07:40 +01:00
parent 9edad8a3d5
commit 757b57bfa0
5 changed files with 99 additions and 9 deletions
+45 -1
View File
@@ -179,7 +179,7 @@ impl_has_mod! {
}
impl GameMods {
pub fn no_slider_head_acc(&self, lazer: bool) -> bool {
pub(crate) fn no_slider_head_acc(&self, lazer: bool) -> bool {
match self.inner {
GameModsInner::Lazer(ref mods) => mods
.iter()
@@ -196,6 +196,42 @@ impl GameMods {
GameModsInner::Legacy(_) => !lazer,
}
}
pub(crate) fn reflection(&self) -> Reflection {
match self.inner {
GameModsInner::Lazer(ref mods) => {
if mods.contains_intermode(GameModIntermode::HardRock) {
return Reflection::Vertical;
}
mods.iter()
.find_map(|m| match m {
GameMod::MirrorOsu(mirror) => Some(mirror),
_ => None,
})
.map_or(Reflection::None, |mr| match mr.reflection.as_deref() {
Some("Horizontal") | None => Reflection::Horizontal,
Some("Vertical") => Reflection::Vertical,
Some("Both") => Reflection::Both,
Some(_) => Reflection::None,
})
}
GameModsInner::Intermode(ref mods) => {
if mods.contains(GameModIntermode::HardRock) {
Reflection::Vertical
} else {
Reflection::None
}
}
GameModsInner::Legacy(mods) => {
if mods.contains(GameModsLegacy::HardRock) {
Reflection::Vertical
} else {
Reflection::None
}
}
}
}
}
impl Default for GameMods {
@@ -244,3 +280,11 @@ impl From<u32> for GameMods {
GameModsLegacy::from_bits(bits).into()
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Reflection {
None,
Vertical,
Horizontal,
Both,
}