wolfrpg_map_parser/command/effect_command/scroll_screen/
scroll_speed.rs

1#[cfg(feature = "serde")]
2use serde::{Serialize, Deserialize};
3
4#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5#[derive(PartialEq, Clone)]
6pub enum ScrollSpeed {
7    OneEight    = 0x00,
8    OneFourth   = 0x01,
9    OneHalf     = 0x02,
10    One         = 0x03,
11    Two         = 0x04,
12    Four        = 0x05,
13    Eight       = 0x06,
14    Sixteen     = 0x07,
15    Instant     = 0x08,
16    ThirtyTwo   = 0x09,
17    SixtyFour   = 0x0a,
18    Unknown
19}
20
21impl ScrollSpeed {
22    pub const fn new(speed: u8) -> Self {
23        match speed {
24            0x00 => ScrollSpeed::OneEight,
25            0x01 => ScrollSpeed::OneFourth,
26            0x02 => ScrollSpeed::OneHalf,
27            0x03 => ScrollSpeed::One,
28            0x04 => ScrollSpeed::Two,
29            0x05 => ScrollSpeed::Four,
30            0x06 => ScrollSpeed::Eight,
31            0x07 => ScrollSpeed::Sixteen,
32            0x08 => ScrollSpeed::Instant,
33            0x09 => ScrollSpeed::ThirtyTwo,
34            0x0a => ScrollSpeed::SixtyFour,
35            _ => ScrollSpeed::Unknown
36        }
37    }
38}