remove avatar (treat it as sprite)
This commit is contained in:
parent
4430ee74aa
commit
bf5b3a8d20
10
src/game.rs
10
src/game.rs
|
@ -78,7 +78,6 @@ pub struct Game {
|
|||
pub palettes: Vec<Palette>,
|
||||
pub rooms: Vec<Room>,
|
||||
pub tiles: Vec<Tile>,
|
||||
pub avatar: Sprite,
|
||||
pub sprites: Vec<Sprite>,
|
||||
pub items: Vec<Item>,
|
||||
pub dialogues: Vec<Dialogue>,
|
||||
|
@ -167,8 +166,6 @@ impl Game {
|
|||
rooms.push(Room::from(segment));
|
||||
} else if segment.starts_with("TIL ") {
|
||||
tiles.push(Tile::from(segment));
|
||||
} else if segment.starts_with("SPR A") {
|
||||
avatar = Some(Sprite::from(segment));
|
||||
} else if segment.starts_with("SPR ") {
|
||||
sprites.push(Sprite::from(segment));
|
||||
} else if segment.starts_with("ITM ") {
|
||||
|
@ -187,9 +184,7 @@ impl Game {
|
|||
}
|
||||
}
|
||||
|
||||
// todo return a custom error instead
|
||||
assert!(avatar.is_some());
|
||||
let avatar = avatar.unwrap();
|
||||
// todo check if SPR A (avatar) exists
|
||||
|
||||
Ok(
|
||||
Game {
|
||||
|
@ -203,7 +198,6 @@ impl Game {
|
|||
palettes,
|
||||
rooms,
|
||||
tiles,
|
||||
avatar,
|
||||
sprites,
|
||||
items,
|
||||
dialogues,
|
||||
|
@ -278,8 +272,6 @@ impl ToString for Game {
|
|||
}
|
||||
}
|
||||
|
||||
segments.push(self.avatar.to_string().replace("SPR a", "SPR A"));
|
||||
|
||||
for sprite in &self.sprites {
|
||||
if !is_string_numeric(sprite.id.clone()) {
|
||||
segments.push(sprite.to_string());
|
||||
|
|
|
@ -767,7 +767,8 @@ pub fn game_default() -> Game {
|
|||
walls: vec![],
|
||||
}],
|
||||
tiles: vec![self::tile_default()],
|
||||
avatar: Sprite {
|
||||
sprites: vec![
|
||||
Sprite {
|
||||
id: "A".to_string(),
|
||||
animation_frames: vec![Image {
|
||||
pixels: vec![
|
||||
|
@ -783,7 +784,7 @@ pub fn game_default() -> Game {
|
|||
dialogue_id: None,
|
||||
items: vec![]
|
||||
},
|
||||
sprites: vec![Sprite {
|
||||
Sprite {
|
||||
id: "a".to_string(),
|
||||
name: None,
|
||||
animation_frames: vec![Image {
|
||||
|
@ -798,7 +799,8 @@ pub fn game_default() -> Game {
|
|||
position: Some(Position { x: 8, y: 12 }),
|
||||
colour_id: None,
|
||||
items: vec![]
|
||||
}],
|
||||
},
|
||||
],
|
||||
items: vec![Item {
|
||||
id: "0".to_string(),
|
||||
animation_frames: vec![Image {
|
||||
|
|
Loading…
Reference in New Issue