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