diff --git a/src/main.rs b/src/main.rs index c1f0ab9..46354f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,26 +4,26 @@ use std::collections::HashMap; const IMAGE_DIMENSION_SD: usize = 8; const IMAGE_DIMENSION_HD: usize = 16; -#[derive(Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] struct Colour { red: u8, green: u8, blue: u8, } -#[derive(Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] struct Palette { id: String, // base36 string (why??) name: Option, colours: Vec, } -#[derive(Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] struct Image { pixels: Vec, // 64 for SD, 256 for HD } -#[derive(Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] struct Tile { id: String, // base36 string name: Option, @@ -38,13 +38,13 @@ struct Position { y: u8, } -#[derive(Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] struct Dialogue { id: String, contents: String, } -#[derive(Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] struct Sprite { id: String, // lowercase base36 name: Option, @@ -54,13 +54,13 @@ struct Sprite { } /// avatar is a "sprite" in the game data but with a specific ID -#[derive(Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] struct Avatar { animation_frames: Vec, position: Position, } -#[derive(Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] struct Item { id: String, animation_frames: Vec, @@ -68,7 +68,7 @@ struct Item { dialogue: Option, } -#[derive(Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] struct Exit { /// destination room: String, /// id @@ -76,12 +76,12 @@ struct Exit { } // same as a dialogue basically -#[derive(Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] struct Ending { contents: String, } -#[derive(Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] struct Room { id: String, palette: String, /// id @@ -100,45 +100,6 @@ struct Game { palettes: Vec, } -impl fmt::Debug for Colour { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Colour") - .field("red", &self.red) - .field("green", &self.green) - .field("blue", &self.blue) - .finish() - } -} - -impl fmt::Debug for Palette { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Palette") - .field("id", &self.id) - .field("name", &self.name) - .field("colours", &self.colours) - .finish() - } -} - -impl fmt::Debug for Image { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Image") - .field("pixels", &self.pixels) - .finish() - } -} - -impl fmt::Debug for Tile { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Tile") - .field("id", &self.id) - .field("name", &self.name) - .field("wall", &self.wall) - .field("animation_frames", &self.animation_frames) - .finish() - } -} - fn image_from_string(string: String) -> Image { let string = string.replace("\n", ""); let pixels: Vec<&str> = string.split("").collect();