1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
use crate::{
    model::{
        beatmap::Beatmap,
        mode::{ConvertStatus, IGameMode},
    },
    Difficulty,
};

pub use self::{
    attributes::{CatchDifficultyAttributes, CatchPerformanceAttributes},
    convert::CatchBeatmap,
    difficulty::gradual::CatchGradualDifficulty,
    performance::{gradual::CatchGradualPerformance, CatchPerformance},
    score_state::CatchScoreState,
    strains::CatchStrains,
};

mod attributes;
mod catcher;
mod convert;
mod difficulty;
mod object;
mod performance;
mod score_state;
mod strains;

const PLAYFIELD_WIDTH: f32 = 512.0;

/// Marker type for [`GameMode::Catch`].
///
/// [`GameMode::Catch`]: rosu_map::section::general::GameMode::Catch
pub struct Catch;

impl IGameMode for Catch {
    type DifficultyAttributes = CatchDifficultyAttributes;
    type Strains = CatchStrains;
    type Performance<'map> = CatchPerformance<'map>;
    type GradualDifficulty = CatchGradualDifficulty;
    type GradualPerformance = CatchGradualPerformance;

    fn check_convert(map: &Beatmap) -> ConvertStatus {
        convert::check_convert(map)
    }

    fn try_convert(map: &mut Beatmap) -> ConvertStatus {
        convert::try_convert(map)
    }

    fn difficulty(
        difficulty: &Difficulty,
        converted: &CatchBeatmap<'_>,
    ) -> Self::DifficultyAttributes {
        difficulty::difficulty(difficulty, converted)
    }

    fn strains(difficulty: &Difficulty, converted: &CatchBeatmap<'_>) -> Self::Strains {
        strains::strains(difficulty, converted)
    }

    fn performance(map: CatchBeatmap<'_>) -> Self::Performance<'_> {
        CatchPerformance::new(map)
    }

    fn gradual_difficulty(
        difficulty: Difficulty,
        map: &CatchBeatmap<'_>,
    ) -> Self::GradualDifficulty {
        CatchGradualDifficulty::new(difficulty, map)
    }

    fn gradual_performance(
        difficulty: Difficulty,
        map: &CatchBeatmap<'_>,
    ) -> Self::GradualPerformance {
        CatchGradualPerformance::new(difficulty, map)
    }
}