From a99622cf9250d40e4cf16ff81e34ea7af2d8b50a Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Sun, 5 Apr 2020 18:58:04 +0100 Subject: [PATCH] initial --- .gitignore | 2 + Cargo.toml | 9 + README.md | 36 ++ src/main.rs | 348 +++++++++++ test/example.bitsy | 1492 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 1887 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.toml create mode 100644 README.md create mode 100644 src/main.rs create mode 100755 test/example.bitsy diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4fffb2f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..095b256 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "bitsy_parser" +version = "0.1.0" +authors = ["Max Bradbury "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/README.md b/README.md new file mode 100644 index 0000000..0263eb1 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# bitsy_parser + +a library for parsing Bitsy game data. + +## done + +### functions + +* colour from +* colour to +* palette from +* palette to +* image from +* image to + +## todo + +### functions +* tile from +* tile to +* sprite from +* sprite to +* item from +* item to +* room from +* room to +* dialogue from +* dialogue to +* variable from +* variable to +* ending from +* ending to +* game from +* game to + +### \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..32178e9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,348 @@ +use std::fmt; + +#[derive(Eq, PartialEq)] +struct Colour { + red: u8, + green: u8, + blue: u8, +} + +#[derive(Eq, PartialEq)] +struct Palette { + id: String, // base36 string (why??) + name: Option, + colours: Vec, +} + +#[derive(Eq, PartialEq)] +struct Image { + pixels: Vec, // 64 for SD, 256 for HD +} + +#[derive(Eq, PartialEq)] +struct Tile { + id: String, // base36 string + name: Option, + wall: bool, + animation_frames: Vec, +} + +#[derive(PartialEq)] +struct Game { + name: String, + version: f64, + room_format: bool, + 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(); + // the above seems to add an extra "" at the start and end of the vec, so strip them below + let pixels: Vec = pixels[1..(pixels.len() - 1)].iter().map(|&char| {char == "1"}).collect(); + + Image { pixels } +} + +fn image_to_string(image: Image) -> String { + let mut string = String::new(); + + for line in image.pixels.chunks(8) { + for pixel in line { + string.push(if *pixel {'1'} else {'0'}); + } + string.push('\n'); + } + + string.pop(); // remove trailing newline + + string +} + +#[test] +fn test_image_from_string() { + let output = image_from_string( + "11111111\n11001111\n10111111\n11111111\n11111111\n11111111\n11111111\n11111111".to_string() + ); + + let expected = Image { + pixels: vec![ + true,true,true,true,true,true,true,true, + true,true,false,false,true,true,true,true, + true,false,true,true,true,true,true,true, + true,true,true,true,true,true,true,true, + true,true,true,true,true,true,true,true, + true,true,true,true,true,true,true,true, + true,true,true,true,true,true,true,true, + true,true,true,true,true,true,true,true, + ] + }; + + assert_eq!(output, expected) +} + +#[test] +fn test_image_to_string() { + let output = image_to_string(Image { + pixels: vec![ + true,false,true,false,true,false,true,false, + false,true,false,true,false,true,false,true, + true,false,true,false,true,false,true,false, + false,true,false,true,false,true,false,true, + true,false,true,false,true,false,true,false, + false,true,false,true,false,true,false,true, + true,false,true,false,true,false,true,false, + false,true,false,true,false,true,false,true, + ] + }); + + let expected = "10101010\n01010101\n10101010\n01010101\n10101010\n01010101\n10101010\n01010101".to_string(); + + assert_eq!(output, expected); +} + +fn tile_from_string(string: String) -> Tile { + let mut lines: Vec<&str> = string.split("\n").collect(); + + let id = lines[0].replace("TIL ", ""); + + let last_line = lines.pop().unwrap(); + let wall = match last_line == "WAL true" { + true => true, + false => { + lines.push(last_line); + false + } + }; + + let last_line = lines.pop().unwrap(); + let name = match last_line.starts_with("NAME") { + true => Some(last_line.replace("NAME ", "").to_string()), + false => { + lines.push(last_line); + None + } + }; + + let animation_frames = lines[1..].join(""); + let animation_frames: Vec<&str> = animation_frames.split("\n>\n").collect(); + let animation_frames: Vec = animation_frames.iter().map(|&frame| { + image_from_string(frame.to_string()) + }).collect(); + + Tile {id, name, wall, animation_frames} +} + +#[test] +fn test_tile_from_string() { + let output = tile_from_string("TIL z\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\nNAME concrete 1\nWAL true".to_string()); + + let expected = Tile { + id: "z".to_string(), + name: Some("concrete 1".to_string()), + wall: true, + animation_frames: vec![ + Image { + pixels: vec![true; 64] + } + ], + }; + + assert_eq!(output, expected); +} + +fn tile_to_string(tile: Tile) -> String { + let mut animation_frames = String::new(); + + for (i, frame) in tile.animation_frames.into_iter().enumerate() { + animation_frames.push_str(&image_to_string(frame)); + + if i < animation_frames.len() - 1 { + animation_frames.push_str(&"\n>\n".to_string()); + } + } + + format!( + "TIL {}\n{}{}{}", + tile.id, + animation_frames, + if tile.name.is_some() {format!("\nNAME {}", tile.name.unwrap())} else {"".to_string()}, + if tile.wall {"\nWAL true"} else {""} + ) +} + +// #[test] +// fn test_tile_to_string() { +// let output = tile_to_string(Tile { +// id: "7a".to_string(), +// name: Some("chequers".to_string()), +// wall: false, +// animation_frames: vec![ +// Image { pixels: vec![ +// true,false,true,false,true,false,true,false, +// false,true,false,true,false,true,false,true, +// true,false,true,false,true,false,true,false, +// false,true,false,true,false,true,false,true, +// true,false,true,false,true,false,true,false, +// false,true,false,true,false,true,false,true, +// true,false,true,false,true,false,true,false, +// false,true,false,true,false,true,false,true, +// ]}, +// Image { pixels: vec![ +// false,true,false,true,false,true,false,true, +// true,false,true,false,true,false,true,false, +// false,true,false,true,false,true,false,true, +// true,false,true,false,true,false,true,false, +// false,true,false,true,false,true,false,true, +// true,false,true,false,true,false,true,false, +// false,true,false,true,false,true,false,true, +// true,false,true,false,true,false,true,false, +// ]}, +// ] +// }); +// +// let expected = "TIL 7a\n10101010\n01010101\n10101010\n01010101\n10101010\n01010101\n10101010\n01010101\n>\n01010101\n10101010\n01010101\n10101010\n01010101\n10101010\n01010101\n10101010\nNAME chequers".to_string(); +// +// assert_eq!(output, expected); +// } + +// todo support Bitsy HD? +// todo impl (Game::from_string etc.) + +fn colour_from_string(colour: String) -> Colour { + let values: Vec<&str> = colour.split(',').collect(); + + let red: u8 = values[0].parse().unwrap_or(0); + let green: u8 = values[1].parse().unwrap_or(0); + let blue: u8 = values[2].parse().unwrap_or(0); + + Colour { red, green, blue } +} + +fn colour_to_string(colour: Colour) -> String { + format!("{},{},{}", colour.red, colour.green, colour.blue) +} + +#[test] +fn test_colour_from_string() { + assert_eq!( + colour_from_string("0,255,0".to_string()), + Colour { red: 0, green: 255, blue: 0 } + ); +} + +#[test] +fn test_colour_to_string() { + assert_eq!( + colour_to_string(Colour { red: 22, green: 33, blue: 44 }), + "22,33,44".to_string() + ); +} + +fn palette_from_string(palette: String) -> Palette { + let lines: Vec<&str> = palette.split('\n').collect(); + + let id = lines[0].replace("PAL ", ""); + + let name = match lines[1].starts_with("NAME") { + true => Some(lines[1].replace("NAME ", "").to_string()), + false => None, + }; + + let colour_start_index = if name.is_some() {2} else {1}; + + let colours = lines[colour_start_index..].iter().map(|&line| { + colour_from_string(line.to_string()) + }).collect(); + + Palette { id, name, colours } +} + +#[test] +fn test_palette_from_string() { + let output = palette_from_string( + "PAL 1\nNAME lamplight\n45,45,59\n66,60,39\n140,94,1".to_string() + ); + + let expected = Palette { + id: "1".to_string(), + name: Some("lamplight".to_string()), + colours: vec![ + Colour {red: 45, green: 45, blue: 59}, + Colour {red: 66, green: 60, blue: 39}, + Colour {red: 140, green: 94, blue: 1 }, + ], + }; + + assert_eq!(output, expected); +} + +#[test] +fn test_palette_from_string_no_name() { + let output = palette_from_string( + "PAL 9\n45,45,59\n66,60,39\n140,94,1".to_string() + ); + + let expected = Palette { + id: "9".to_string(), + name: None, + colours: vec![ + Colour {red: 45, green: 45, blue: 59}, + Colour {red: 66, green: 60, blue: 39}, + Colour {red: 140, green: 94, blue: 1 }, + ], + }; + + assert_eq!(output, expected); +} + +// fn game_from_string(game: String ) -> Game { +// +// } +// +// fn game_to_string(game: Game) -> String { +// +// } + +fn main() { + println!("why am I here?") +} diff --git a/test/example.bitsy b/test/example.bitsy new file mode 100755 index 0000000..43e8615 --- /dev/null +++ b/test/example.bitsy @@ -0,0 +1,1492 @@ +sun machine + +# BITSY VERSION 4.8 + +! ROOM_FORMAT 1 + +PAL 0 +NAME dark +33,33,43 +39,45,48 +64,51,62 + +PAL 1 +NAME lamplight +45,45,59 +66,60,39 +140,94,1 + +PAL 2 +NAME dawn +65,64,84 +97,112,122 +128,102,125 + +PAL 3 +NAME machine +45,45,59 +105,103,82 +176,138,48 + +PAL 4 +NAME machine 2 +76,70,86 +117,115,92 +201,158,55 + +PAL 5 +NAME machine 3 +100,93,107 +143,140,112 +219,179,88 + +PAL 6 +NAME machine 4 +125,118,125 +168,165,132 +245,200,98 + +PAL 7 +NAME machine 5 +156,153,149 +204,200,160 +255,226,131 + +PAL 8 +NAME machine 6 +219,219,198 +240,235,188 +255,249,195 + +PAL 9 +NAME machine 7 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,z,z,z,z,z,z,z,12,z,z,10,12,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +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,0,0,0,0,0 +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +NAME cellar 6 +ITM d 11,5 +ITM e 8,3 +ITM 5 1,0 +ITM 6 2,1 +ITM 6 3,2 +EXT 3,3 3 10,6 +PAL 8 + +ROOM a +0,0,0,0,0,0,0,0,1l,0,0,0,0,0,0,0 +y,x,0,0,1j,0,0,1j,1l,0,1j,0,0,1j,0,0 +y,y,x,k,k,1c,1x,1y,1m,0,0,0,0,0,0,0 +y,y,y,x,k,s,s,s,k,k,k,k,k,1g,1f,k +k,z,z,z,1i,1u,1u,1u,1v,11,19,1b,1a,1e,10,k +k,z,z,11,12,z,z,z,z,10,17,z,18,1e,12,k +k,z,z,z,z,z,z,z,z,1k,14,15,16,1h,z,k +k,z,z,z,z,z,z,10,1d,1v,1r,1s,1r,1q,1z,k +k,z,z,12,10,z,z,z,1i,1n,1o,1o,1o,1p,z,k +k,z,z,z,z,z,z,z,z,z,z,z,10,z,z,k +k,z,z,z,z,z,11,z,z,z,z,z,z,z,z,k +k,z,z,z,z,z,z,z,z,z,12,z,z,10,12,k +k,k,k,k,k,k,k,k,k,k,k,k,k,k,k,k +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,0,0,0,0,0 +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +NAME cellar 7 +ITM d 11,5 +ITM e 8,3 +ITM 5 1,0 +ITM 6 2,1 +ITM 6 3,2 +EXT 3,3 3 10,6 +END undefined 8,7 +PAL 9 + +TIL 10 +11111111 +11001111 +10111111 +11111111 +11111111 +11111111 +11111111 +11111111 +NAME concrete 2 + +TIL 11 +11111111 +11111111 +11111111 +11111111 +11111111 +10101111 +11011111 +11011111 + +TIL 12 +11111111 +11111111 +11111111 +11111101 +11111110 +11111111 +11111111 +11111111 +NAME concrete 3 + +TIL 13 +00000000 +01111110 +01111110 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL 14 +01000000 +01010000 +01010000 +01000000 +01100000 +10011000 +11100111 +11111000 +WAL true + +TIL 15 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +11111111 +00000000 +WAL true + +TIL 16 +00000010 +00000010 +00000010 +00000010 +00000110 +00011001 +11100111 +00011111 +WAL true + +TIL 17 +01010000 +01010000 +01010000 +01010000 +01010000 +01010000 +01010000 +01010000 +WAL true + +TIL 18 +00000010 +00000010 +00000010 +00000010 +00000010 +00000010 +00000010 +00000010 +WAL true + +TIL 19 +11111000 +11100111 +11011000 +10100011 +10100100 +01001000 +01010000 +01010000 +WAL true + +TIL 20 +00010000 +00100000 +01100000 +01000000 +01000000 +11000000 +10000000 +10000000 +> +00001000 +00110000 +00100000 +00100000 +01000000 +01000000 +11000000 +10000000 + +TIL 21 +00000001 +00000001 +00000011 +00000010 +00000010 +00000110 +00000100 +00001100 +> +00000001 +00000001 +00000001 +00000011 +00000010 +00000010 +00000110 +00001100 + +TIL 22 +00000000 +00000000 +00100000 +00100000 +01101000 +01001001 +01001010 +11010010 + +TIL 23 +00100110 +00010110 +01011100 +11001101 +10110101 +11110111 +11111111 +11111111 + +TIL a +11111000 +11111111 +01101111 +01011111 +01111110 +11111001 +11111111 +00000000 +WAL true + +TIL b +01111111 +11111111 +11111110 +11011110 +00111110 +11111111 +00011111 +00000000 +WAL true + +TIL c +11111111 +11111011 +11110111 +11101111 +11111111 +11111111 +10111111 +01111111 +WAL true + +TIL d +00000000 +11111111 +10000000 +10000000 +00000000 +00000000 +00000000 +00000000 + +TIL e +00000000 +11111111 +00000001 +00000001 +00000000 +00000000 +00000000 +00000000 + +TIL f +10111011 +10111011 +11011101 +11011101 +10111011 +10111011 +11111111 +10011001 + +TIL g +10111101 +10111101 +10111101 +10111101 +10111101 +10111101 +10110001 +10000001 + +TIL h +11111111 +10000001 +10111101 +10111101 +10111101 +10111101 +10111101 +10110101 + +TIL i +01000000 +00000000 +00000000 +00000100 +00100000 +00000000 +00000000 +00000010 +NAME carpet + +TIL j +00000000 +00011000 +00111100 +01111110 +00011000 +00111100 +00111100 +00011000 +WAL true + +TIL k +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +NAME wall +WAL true + +TIL l +11010000 +11110000 +11100000 +11100000 +10100000 +10100000 +11110111 +11110000 + +TIL m +10000101 +10000111 +10000011 +10000011 +10000011 +10000011 +11110011 +00000101 + +TIL n +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +11111111 +10101010 + +TIL o +00000000 +01111110 +01110010 +01111110 +01111110 +01111110 +01111110 +00000000 +NAME kitchen cabinet left +WAL true + +TIL p +00000000 +11111100 +10011100 +11111100 +11111100 +11111100 +11111100 +00000000 +NAME kitchen cabinet right +WAL true + +TIL q +00110000 +01010000 +01000000 +01111111 +10000001 +10000001 +10100001 +01111111 +> +00110000 +01000000 +01000000 +01111111 +10000001 +10000001 +10100001 +01111111 +NAME sink + +TIL r +00000000 +00000000 +00000000 +11111110 +00000001 +11111111 +00000001 +11111110 +NAME draining board + +TIL s +00000000 +00000000 +00000000 +11111011 +11111111 +10111110 +11111111 +11101111 +NAME countertop + +TIL t +11001100 +11001100 +00110011 +00110011 +11001100 +11001100 +00110011 +00110011 +NAME kitchen tiles + +TIL u +11001100 +10001000 +00110011 +00100010 +11001100 +10001000 +00110011 +00100010 + +TIL v +11001100 +11001000 +11110011 +11100010 +11001100 +11001000 +11110011 +11100010 +NAME table leg left + +TIL w +11001111 +10001011 +00110011 +00100011 +11001111 +10001011 +00110011 +00100011 +NAME kitchen table leg right + +TIL x +11000000 +10000000 +11110000 +01100000 +00111100 +00011000 +00001111 +00000110 +NAME stairs +WAL true + +TIL y +00000011 +00000001 +00000001 +00000001 +00000001 +00000001 +00000001 +00000001 +WAL true + +TIL z +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +11111111 +NAME concrete 1 + +TIL 1a +00011111 +11100111 +00011011 +00000101 +00000101 +00000010 +00000010 +00000010 +WAL true + +TIL 1b +00000000 +11111111 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +WAL true + +TIL 1c +11111111 +11000111 +10101111 +11101000 +11101101 +11101101 +11101101 +11111111 +NAME hammers + +TIL 1d +11111111 +11111011 +11110111 +11101111 +11011111 +10011111 +00111111 +11111111 +NAME screwdriver + +TIL 1e +01100010 +01111000 +01110100 +00011010 +01100100 +01111000 +01110100 +00011010 +WAL true + +TIL 1f +00000000 +01110111 +01110111 +11101110 +10101010 +01010101 +10001000 +00000000 +WAL true + +TIL 1g +00000000 +00000111 +00011111 +00101010 +00110100 +01110010 +01111000 +00010100 +WAL true + +TIL 1h +01100100 +01111000 +01111100 +10011010 +11100100 +11111000 +11111100 +11111010 +WAL true + +TIL 1i +11101111 +11011000 +10101101 +11111111 +11111111 +10011111 +01001111 +10011111 + +TIL 1j +11111111 +11111111 +11111111 +00000000 +00000000 +00000000 +00000000 +00000000 +NAME cellar light + +TIL 1k +11111111 +11111111 +11111110 +11111001 +11100111 +10011111 +01111111 +01111111 +WAL true + +TIL 1l +00010000 +00010000 +00010000 +00010000 +00010000 +00010000 +00010000 +00010000 + +TIL 1m +00010000 +00010000 +00010000 +00010000 +00010000 +00010000 +00011000 +00111100 + +TIL 1n +01111111 +10111111 +11001111 +11110000 +11111111 +11111111 +11111111 +11111111 + +TIL 1o +10000000 +11111111 +11111111 +00000000 +11111111 +11111111 +11111111 +11111111 +WAL false + +TIL 1p +11110100 +11101001 +11010011 +00001111 +11111111 +11111111 +11111111 +11111111 + +TIL 1q +11110100 +11111010 +11110100 +11111010 +11111100 +11111010 +11110100 +11111010 +WAL true + +TIL 1r +11111111 +11111111 +10000000 +10111110 +10101010 +10111110 +10101010 +10111110 +WAL true + +TIL 1s +11111111 +11111111 +10000000 +10111110 +10100110 +10100100 +10111110 +10101010 +WAL true + +TIL 1t +00000000 +11111111 +11111111 +11111111 +11111111 +00000000 +00000000 +00000000 + +TIL 1u +00000000 +00101010 +01111111 +00101010 +01111111 +00101010 +00000000 +01111111 +WAL true + +TIL 1v +00111111 +00111111 +00111011 +00111111 +00111101 +00111111 +00111111 +00111111 + +TIL 1w +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +TIL 1x +11111111 +10101010 +10101010 +10101011 +10101110 +10101110 +10111000 +11111111 +NAME spanners + +TIL 1y +11111111 +10000111 +11000111 +11111011 +00011111 +11010101 +01010101 +11111111 +NAME drill + +TIL 1z +11111000 +11110111 +00001111 +11010000 +00100111 +11001011 +00011100 +11111111 +NAME wires + +SPR A +00000000 +00111100 +01111110 +11101110 +10011001 +11111111 +11111111 +01111110 +> +00000000 +00000000 +00111100 +01111110 +11101110 +10011001 +11111111 +01110110 +POS 0 2,5 + +SPR a +00000000 +01111000 +01001000 +00111100 +00111100 +01011110 +01011110 +01101111 +NAME hatch +DLG SPR_0 +POS 4 9,7 + +SPR b +11111111 +11111111 +10000000 +10111110 +10100110 +10100100 +10111110 +10101010 +NAME display +DLG SPR_1 +POS 4 11,7 + +SPR c +00000000 +01111000 +01001000 +00111100 +00111100 +01011110 +01011110 +01101111 +NAME hatch 2 +DLG SPR_2 +POS 5 9,7 + +SPR d +00000000 +01111000 +01001000 +00111100 +00111100 +01011110 +01011110 +01101111 +NAME hatch 3 +DLG SPR_3 +POS 6 9,7 + +SPR e +00000000 +01111000 +01001000 +00111100 +00111100 +01011110 +01011110 +01101111 +NAME hatch 4 +DLG SPR_4 +POS 7 9,7 + +SPR f +00000000 +01111000 +01001000 +00111100 +00111100 +01011110 +01011110 +01101111 +NAME hatch 5 +DLG SPR_5 +POS 8 9,7 + +SPR g +00000000 +01111000 +01001000 +00111100 +00111100 +01011110 +01011110 +01101111 +NAME hatch 6 +DLG SPR_6 +POS 9 9,7 + +ITM 0 +01000000 +00000000 +00000000 +00000100 +00100000 +00000000 +00000000 +00000010 +NAME curtains +DLG ITM_0 + +ITM 1 +00000000 +00011000 +00111100 +01111110 +00011000 +00111100 +00111100 +00011000 +NAME lamp + +ITM 2 +01000000 +00000000 +00000000 +00000100 +00100000 +00000000 +00000000 +00000010 +NAME light lamp +DLG ITM_1 + +ITM 3 +00010001 +00000100 +01000010 +00001000 +00000001 +00001010 +01000000 +00000101 +NAME lamplight left + +ITM 4 +00101000 +10000000 +00100000 +10001010 +00100000 +01010000 +10000000 +01001000 +NAME lamplight right + +ITM 5 +00000000 +00000000 +00000000 +00010000 +00000010 +01000000 +00001000 +00100100 +NAME lamplight top + +ITM 6 +01000000 +00000000 +00000000 +00000100 +00100000 +00000000 +00000000 +00000010 +NAME door +DLG ITM_2 + +ITM 7 +00000000 +00000000 +00100000 +00010000 +00000000 +01111100 +01111010 +00110100 +> +00000000 +00000000 +00010000 +00100000 +00000000 +01111100 +01111010 +00110100 +DLG ITM_3 + +ITM 8 +00000000 +00000100 +00010000 +00100000 +00000000 +01111110 +01111110 +00111100 +> +00000000 +00001000 +00100000 +00010000 +00000000 +01111110 +01111110 +00111100 +NAME porridge +DLG ITM_4 + +ITM a +01111110 +01111110 +01000010 +01101010 +01010010 +01101010 +01000010 +00111100 +> +01111110 +01111110 +01000010 +01010010 +01101010 +01010010 +01000010 +00111100 +NAME sun jar +DLG ITM_6 + +ITM c +11111111 +11111111 +11111111 +11111111 +11111100 +10010001 +11000100 +10011111 +DLG ITM_5 + +ITM d +00001000 +00100000 +10101100 +00010000 +01101000 +00001010 +00000000 +00010000 +> +00100000 +10010010 +00111010 +01111100 +10111001 +00010000 +00001100 +01000000 + +ITM e +00011000 +00011000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 + +ITM f +00001000 +00110010 +01100100 +01101101 +00101011 +01110110 +01111001 +00110110 +> +00000000 +00001000 +00110010 +00110100 +01101101 +01111011 +01111110 +00111100 + +DLG ITM_0 +I draw the curtains. somehow the lamp seemed brighter than this. + +DLG ITM_1 +""" +another long sleep but I feel just as tired as last night. +I turn on the lamp and the light hurts my eyes. +""" + +DLG ITM_2 +I can't remember the last time I saw the sun. + +DLG ITM_3 +the coffee doesn't wake me up. now I'm just tired and jittery. + +DLG ITM_4 +I eat the porridge and begin to feel nauseated. + +DLG ITM_5 +""" +tired or not, it's time to get to work. +all winter I've worked on this machine but it's so close now... I can feel it. +""" + +DLG ITM_6 +""" +{sequence + - Last summer, every time the sun came out I would run outside with a jar. I'd catch the rays, seal them tight. + Put the jar on the shelf with the others. {jars = jars + 1} + - I miss those summer days and I know it's not the same, but every day I come down to the cellar and peer into the jars and I swear I could almost see junebugs in the air, + smell the smoke of distant barbeques, + and hear the faint jingle of the ice cream van. {jars = jars + 1} + - Every summer I worry that this one will be the last. + I have to make this count. {jars = jars + 1} + - I started work on the sun machine around autumn. I still had some energy then and there was still some sunlight to get it started. +Now I can only manage a small amount of work each day, if I'm lucky. {jars = jars + 1} + - But I think I'm finally finished. Or at least close enough to try. {jars = jars + 1} +} +""" + +DLG SPR_0 +""" +{ + - checked == 1 ? + { + - jars >= 5 ? + here goes nothing. + (exit "cellar 2,8,7") + - else ? + OK. time to gather the jars of sunlight. + } + - else ? + better check the readout first. +} +""" + +DLG SPR_1 +""" +looks pretty good... I think. + +one final adjustment. here we go. {checked = 1} +""" + +DLG SPR_2 +the feeling of sand between my toes. (exit "cellar 3,8,7") + +DLG SPR_3 +walking out of the corner shop and pressing a cold can of drink to my forehead. (exit "cellar 4,8,7") + +DLG SPR_4 +loud music from the cars passing by. (exit "cellar 5,8,7") + +DLG SPR_5 +""" +the mild evening air, +heavy with perfume from the blossoming trees. (exit "cellar 6,8,7") +""" + +DLG SPR_6 +loving easily and knowing I'm loved for sure. (exit "cellar 7,8,7") + +END 0 + + +END undefined +all this and still the promise of even better days to come. + +END undefined + + +VAR a +42 +