wolfrpg_map_parser/page/
options.rs1#[cfg(feature = "serde")]
2use serde::{Serialize, Deserialize};
3
4#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5#[derive(PartialEq, Clone)]
6pub struct Options {
7 idle_animation: bool,
8 move_animation: bool,
9 fixed_direction: bool,
10 slip_through: bool,
11 above_hero: bool,
12 square_hitbox: bool,
13 half_step_up: bool,
14}
15
16impl Options {
17 pub fn new(options: u8) -> Self {
18 Self {
19 idle_animation: options & 0b00000001 != 0,
20 move_animation: options & 0b00000010 != 0,
21 fixed_direction: options & 0b00000100 != 0,
22 slip_through: options & 0b00001000 != 0,
23 above_hero: options & 0b00010000 != 0,
24 square_hitbox: options & 0b00100000 != 0,
25 half_step_up: options & 0b01000000 != 0,
26 }
27 }
28
29 pub fn idle_animation(&self) -> bool {
30 self.idle_animation
31 }
32
33 pub fn idle_animation_mut(&mut self) -> &mut bool {
34 &mut self.idle_animation
35 }
36
37 pub fn move_animation(&self) -> bool {
38 self.move_animation
39 }
40
41 pub fn move_animation_mut(&mut self) -> &mut bool {
42 &mut self.move_animation
43 }
44
45 pub fn fixed_direction(&self) -> bool {
46 self.fixed_direction
47 }
48
49 pub fn fixed_direction_mut(&mut self) -> &mut bool {
50 &mut self.fixed_direction
51 }
52
53 pub fn slip_through(&self) -> bool {
54 self.slip_through
55 }
56
57 pub fn slip_through_mut(&mut self) -> &mut bool {
58 &mut self.slip_through
59 }
60
61 pub fn above_hero(&self) -> bool {
62 self.above_hero
63 }
64
65 pub fn above_hero_mut(&mut self) -> &mut bool {
66 &mut self.above_hero
67 }
68
69 pub fn square_hitbox(&self) -> bool {
70 self.square_hitbox
71 }
72
73 pub fn square_hitbox_mut(&mut self) -> &mut bool {
74 &mut self.square_hitbox
75 }
76
77 pub fn half_step_up(&self) -> bool {
78 self.half_step_up
79 }
80
81 pub fn half_step_up_mut(&mut self) -> &mut bool {
82 &mut self.half_step_up
83 }
84}