wolfrpg_map_parser/command/party_graphics_command/
options.rs

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
#[cfg(feature = "serde")]
use serde::Serialize;
use crate::command::party_graphics_command::operation::Operation;
use crate::command::party_graphics_command::special_operation::SpecialOperation;

#[cfg_attr(feature = "serde", derive(Serialize))]
pub struct Options {
    operation: Operation,
    special_operation: SpecialOperation,
    graphics_is_variable: bool
}

impl Options {
    pub fn new(options: u32) -> Self {
        Self {
            operation: Operation::new((options & 0x0f) as u8),
            special_operation: SpecialOperation::new(((options >> 4) & 0x0f) as u8),
            graphics_is_variable: (options >> 8) & 0b00000001 != 0
        }
    }

    pub fn operation(&self) -> &Operation {
        &self.operation
    }

    pub fn operation_mut(&mut self) -> &mut Operation {
        &mut self.operation
    }

    pub fn special_operation(&self) -> &SpecialOperation {
        &self.special_operation
    }

    pub fn special_operation_mut(&mut self) -> &mut SpecialOperation {
        &mut self.special_operation
    }

    pub fn graphics_is_variable(&self) -> bool {
        self.graphics_is_variable
    }

    pub fn graphics_is_variable_mut(&mut self) -> &mut bool {
        &mut self.graphics_is_variable
    }
}