From 2f9a4f7fe33a4fd47c2de902cb83451923a00993 Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Sun, 5 Apr 2020 20:46:55 +0100 Subject: [PATCH] more structs --- src/main.rs | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 981e00e..e085b40 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,6 +27,42 @@ struct Tile { animation_frames: Vec, } +#[derive(Eq, PartialEq)] +struct Position { + room: String, // id. is room id int or base36 string? + x: u8, + y: u8, +} + +#[derive(Eq, PartialEq)] +struct Dialogue { + id: String, + contents: String, +} + +#[derive(Eq, PartialEq)] +struct Sprite { + id: String, // lowercase base36 + name: Option, + animation_frames: Vec, + dialogue: Option, + position: Position, +} + +#[derive(Eq, PartialEq)] +struct Avatar { + animation_frames: Vec, + position: Position, +} + +#[derive(Eq, PartialEq)] +struct Item { + id: String, + animation_frames: Vec, + name: Option, + dialogue: Option, +} + #[derive(PartialEq)] struct Game { name: String, @@ -336,8 +372,14 @@ fn test_palette_from_string_no_name() { assert_eq!(output, expected); } +// fn get_avatar(game: Game) -> Sprite { +// // get the sprite with an id of A +// } + // fn game_from_string(game: String ) -> Game { -// +// // probably needs to split the game data into different segments starting from the end +// // e.g. VAR... then END... then DLG... +// // then split all these up into their individual items // } // // fn game_to_string(game: Game) -> String {