1use rosu_map::section::general::GameMode;
2
3use crate::{
4 Difficulty,
5 any::CalculateError,
6 model::{
7 beatmap::Beatmap,
8 mode::{ConvertError, IGameMode},
9 },
10};
11
12pub use self::{
13 attributes::{CatchDifficultyAttributes, CatchPerformanceAttributes},
14 difficulty::gradual::CatchGradualDifficulty,
15 performance::{CatchPerformance, gradual::CatchGradualPerformance},
16 score_state::{CatchHitResults, CatchScoreState},
17 strains::CatchStrains,
18};
19
20mod attributes;
21mod catcher;
22mod convert;
23mod difficulty;
24mod object;
25mod performance;
26mod score_state;
27mod strains;
28
29const PLAYFIELD_WIDTH: f32 = 512.0;
30
31pub struct Catch;
35
36impl Catch {
37 pub fn convert(map: &mut Beatmap) {
38 debug_assert!(!map.is_convert && map.mode == GameMode::Osu);
39 convert::convert(map);
40 }
41}
42
43impl IGameMode for Catch {
44 type DifficultyAttributes = CatchDifficultyAttributes;
45 type Strains = CatchStrains;
46 type Performance<'map> = CatchPerformance<'map>;
47 type HitResults = CatchHitResults;
48 type GradualDifficulty = CatchGradualDifficulty;
49 type GradualPerformance = CatchGradualPerformance;
50
51 fn difficulty(
52 difficulty: &Difficulty,
53 map: &Beatmap,
54 ) -> Result<Self::DifficultyAttributes, ConvertError> {
55 difficulty::difficulty(difficulty, map)
56 }
57
58 fn checked_difficulty(
59 difficulty: &Difficulty,
60 map: &Beatmap,
61 ) -> Result<Self::DifficultyAttributes, CalculateError> {
62 difficulty::checked_difficulty(difficulty, map)
63 }
64
65 fn strains(difficulty: &Difficulty, map: &Beatmap) -> Result<Self::Strains, ConvertError> {
66 strains::strains(difficulty, map)
67 }
68
69 fn performance(map: &Beatmap) -> Self::Performance<'_> {
70 CatchPerformance::new(map)
71 }
72
73 fn gradual_difficulty(
74 difficulty: Difficulty,
75 map: &Beatmap,
76 ) -> Result<Self::GradualDifficulty, ConvertError> {
77 CatchGradualDifficulty::new(difficulty, map)
78 }
79
80 fn gradual_performance(
81 difficulty: Difficulty,
82 map: &Beatmap,
83 ) -> Result<Self::GradualPerformance, ConvertError> {
84 CatchGradualPerformance::new(difficulty, map)
85 }
86}