name room and give tiles appropriate names too
This commit is contained in:
parent
8c92b05b74
commit
f9b0f6b6db
|
@ -302,7 +302,7 @@ pub fn add_room() -> String {
|
||||||
let tile = Tile {
|
let tile = Tile {
|
||||||
// "0" will get overwritten to a new, safe tile ID
|
// "0" will get overwritten to a new, safe tile ID
|
||||||
id: "0".to_string(),
|
id: "0".to_string(),
|
||||||
name: tile_name(&state.room_name, &(row * column)),
|
name: tile_name(&state.room_name, &((row * SD) + column + 1)),
|
||||||
wall: None,
|
wall: None,
|
||||||
animation_frames: vec![Image { pixels }],
|
animation_frames: vec![Image { pixels }],
|
||||||
colour_id: None
|
colour_id: None
|
||||||
|
@ -324,7 +324,7 @@ pub fn add_room() -> String {
|
||||||
game.add_room(bitsy_parser::Room {
|
game.add_room(bitsy_parser::Room {
|
||||||
id: "0".to_string(),
|
id: "0".to_string(),
|
||||||
palette_id,
|
palette_id,
|
||||||
name: None,
|
name: state.room_name.clone(),
|
||||||
tiles: tile_ids,
|
tiles: tile_ids,
|
||||||
items: vec![],
|
items: vec![],
|
||||||
exits: vec![],
|
exits: vec![],
|
||||||
|
@ -357,7 +357,7 @@ pub fn output() -> String {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use crate::{add_room, load_image, load_default_game, output, get_preview};
|
use crate::{add_room, load_image, load_default_game, output, get_preview, set_room_name};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn image_to_base64() {
|
fn image_to_base64() {
|
||||||
|
@ -388,6 +388,7 @@ mod test {
|
||||||
fn example() {
|
fn example() {
|
||||||
load_default_game();
|
load_default_game();
|
||||||
load_image(include_str!("test-resources/test.png.base64").trim().to_string());
|
load_image(include_str!("test-resources/test.png.base64").trim().to_string());
|
||||||
|
set_room_name("test".to_string());
|
||||||
println!("add_room(): {}", add_room());
|
println!("add_room(): {}", add_room());
|
||||||
// todo what? why are extraneous pixels appearing in the output tiles?
|
// todo what? why are extraneous pixels appearing in the output tiles?
|
||||||
assert_eq!(output(), include_str!("test-resources/expected.bitsy"));
|
assert_eq!(output(), include_str!("test-resources/expected.bitsy"));
|
||||||
|
|
|
@ -47,6 +47,7 @@ a,a,1,1,2,2,3,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,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,0,0,0,0,0,0,0,0,0
|
||||||
|
NAME test
|
||||||
PAL 0
|
PAL 0
|
||||||
|
|
||||||
TIL a
|
TIL a
|
||||||
|
@ -69,6 +70,7 @@ TIL 1
|
||||||
00011000
|
00011000
|
||||||
00011000
|
00011000
|
||||||
00111100
|
00111100
|
||||||
|
NAME test 3
|
||||||
|
|
||||||
TIL 2
|
TIL 2
|
||||||
00111100
|
00111100
|
||||||
|
@ -79,6 +81,7 @@ TIL 2
|
||||||
00110000
|
00110000
|
||||||
01100000
|
01100000
|
||||||
01111110
|
01111110
|
||||||
|
NAME test 5
|
||||||
|
|
||||||
TIL 3
|
TIL 3
|
||||||
00111100
|
00111100
|
||||||
|
@ -89,6 +92,7 @@ TIL 3
|
||||||
01100110
|
01100110
|
||||||
01100110
|
01100110
|
||||||
00111100
|
00111100
|
||||||
|
NAME test 7
|
||||||
|
|
||||||
SPR A
|
SPR A
|
||||||
00011000
|
00011000
|
||||||
|
|
Loading…
Reference in New Issue