diff --git a/src/mock.rs b/src/mock.rs index 89bf0e9..bdb4c07 100644 --- a/src/mock.rs +++ b/src/mock.rs @@ -114,7 +114,7 @@ pub fn avatar() -> Sprite { pub fn tile_default() -> Tile { Tile { id: "a".to_string(), - name: None, + name: Some("block".to_string()), wall: None, animation_frames: vec![Image { pixels: vec![ @@ -155,7 +155,7 @@ pub fn sprite() -> Sprite { 0, 1, 1, 0, 1, 1, 1, 1, ], }], - dialogue_id: Some("SPR_0".to_string()), + dialogue_id: Some("0".to_string()), room_id: Some("4".to_string()), position: Some(Position { x: 9, y: 7 }), colour_id: None, @@ -163,19 +163,49 @@ pub fn sprite() -> Sprite { } } -#[inline] +pub mod item { + use crate::item::Item; + use crate::image::Image; + + pub fn key() -> Item { + Item { + id: "1".to_string(), + animation_frames: vec![ + Image { pixels: vec![ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 1, 1, 0, 0, + 0, 0, 1, 0, 0, 1, 0, 0, + 0, 0, 1, 1, 1, 1, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 0, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 0, 0, 0 + ]} + ], + name: Some("key".to_string()), + dialogue_id: Some("2".to_string()), + colour_id: None + } + } +} + pub fn item() -> Item { Item { id: "6".to_string(), animation_frames: vec![Image { pixels: vec![ - 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, ], }], name: Some("door".to_string()), - dialogue_id: Some("ITM_2".to_string()), + dialogue_id: Some("2".to_string()), colour_id: None, } } @@ -488,7 +518,7 @@ pub fn room() -> Room { pub fn game_default() -> Game { Game { name: "Write your game's title here".to_string(), - version: Some(Version { major: 6, minor: 5 }), + version: Some(Version { major: 7, minor: 1 }), room_format: Some(RoomFormat::CommaSeparated), room_type: RoomType::Room, font: Font::AsciiSmall, @@ -496,7 +526,7 @@ pub fn game_default() -> Game { text_direction: TextDirection::LeftToRight, palettes: vec![Palette { id: "0".to_string(), - name: None, + name: Some("blueprint".to_string()), colours: vec![ Colour { red: 0, @@ -518,7 +548,7 @@ pub fn game_default() -> Game { rooms: vec![Room { id: "0".to_string(), palette_id: Some("0".to_string()), - name: None, + name: Some("example room".to_string()), tiles: vec![ "0".to_string(), "0".to_string(), @@ -802,7 +832,7 @@ pub fn game_default() -> Game { }, Sprite { id: "a".to_string(), - name: None, + name: Some("cat".to_string()), animation_frames: vec![Image { pixels: vec![ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, @@ -810,37 +840,45 @@ pub fn game_default() -> Game { 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, ], }], - dialogue_id: Some("SPR_0".to_string()), + dialogue_id: Some("0".to_string()), room_id: Some("0".to_string()), position: Some(Position { x: 8, y: 12 }), colour_id: None, items: vec![] }, ], - items: vec![Item { - id: "0".to_string(), - animation_frames: vec![Image { - pixels: vec![ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ], - }], - name: Some("tea".to_string()), - dialogue_id: Some("ITM_0".to_string()), - colour_id: None, - }], + items: vec![ + Item { + id: "0".to_string(), + animation_frames: vec![Image { + pixels: vec![ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }], + name: Some("tea".to_string()), + dialogue_id: Some("1".to_string()), + colour_id: None, + }, + item::key() + ], dialogues: vec![ Dialogue { - id: "SPR_0".to_string(), + id: "0".to_string(), contents: "I'm a cat".to_string(), - name: None + name: Some("cat dialog".to_string()), }, Dialogue { - id: "ITM_0".to_string(), + id: "1".to_string(), contents: "You found a nice warm cup of tea".to_string(), - name: None + name: Some("tea dialog".to_string()), }, + Dialogue { + id: "2".to_string(), + contents: "A key! {wvy}What does it open?{wvy}".to_string(), + name: Some("key dialog".to_string()) + } ], endings: vec![], variables: vec![Variable { diff --git a/src/test-resources/default.bitsy b/src/test-resources/default.bitsy index decb8b4..4c6f470 100644 --- a/src/test-resources/default.bitsy +++ b/src/test-resources/default.bitsy @@ -1,10 +1,11 @@ Write your game's title here -# BITSY VERSION 6.5 +# BITSY VERSION 7.1 ! ROOM_FORMAT 1 PAL 0 +NAME blueprint 0,82,204 128,159,255 255,255,255 @@ -26,6 +27,7 @@ ROOM 0 0,a,0,0,0,0,0,0,0,0,0,0,0,0,a,0 0,a,a,a,a,a,a,a,a,a,a,a,a,a,a,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +NAME example room PAL 0 TIL a @@ -37,6 +39,7 @@ TIL a 10000001 10000001 11111111 +NAME block SPR A 00011000 @@ -58,7 +61,8 @@ SPR a 01111100 00111100 00100100 -DLG SPR_0 +NAME cat +DLG 0 POS 0 8,12 ITM 0 @@ -71,13 +75,31 @@ ITM 0 00011000 00000000 NAME tea -DLG ITM_0 +DLG 1 -DLG SPR_0 +ITM 1 +00000000 +00111100 +00100100 +00111100 +00010000 +00011000 +00010000 +00011000 +NAME key +DLG 2 + +DLG 0 I'm a cat +NAME cat dialog -DLG ITM_0 +DLG 1 You found a nice warm cup of tea +NAME tea dialog + +DLG 2 +A key! {wvy}What does it open?{wvy} +NAME key dialog VAR a 42