more structs

This commit is contained in:
Max Bradbury 2020-04-05 20:46:55 +01:00
parent 7866cb9f6a
commit 2f9a4f7fe3
1 changed files with 43 additions and 1 deletions

View File

@ -27,6 +27,42 @@ struct Tile {
animation_frames: Vec<Image>,
}
#[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<String>,
animation_frames: Vec<Image>,
dialogue: Option<Dialogue>,
position: Position,
}
#[derive(Eq, PartialEq)]
struct Avatar {
animation_frames: Vec<Image>,
position: Position,
}
#[derive(Eq, PartialEq)]
struct Item {
id: String,
animation_frames: Vec<Image>,
name: Option<String>,
dialogue: Option<Dialogue>,
}
#[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 {