From 37f82daca1474dbe6527b00b7f87a56d23e13641 Mon Sep 17 00:00:00 2001 From: ashley Date: Sun, 17 Sep 2023 23:28:18 -0400 Subject: [PATCH] connect nametable exporter --- src/reskit/cli/evaluator.rs | 6 +++++- src/reskit/level/system.rs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/reskit/cli/evaluator.rs b/src/reskit/cli/evaluator.rs index 7fbcf31..bc63424 100644 --- a/src/reskit/cli/evaluator.rs +++ b/src/reskit/cli/evaluator.rs @@ -1,6 +1,6 @@ use std::{error::Error, fs::File, io::Write, path::Path}; use clap::Parser; -use crate::reskit::{tileset, soundtrack::{formats::dmf::DmfModule, engines::echo::engine::{EchoFormat, EchoArtifact}}, utility::{print_good, print_error, print_info}, level::{converter::get_tiled_tilemap, system::{get_tiles, get_code}}}; +use crate::reskit::{tileset, soundtrack::{formats::dmf::DmfModule, engines::echo::engine::{EchoFormat, EchoArtifact}}, utility::{print_good, print_error, print_info}, level::{converter::get_tiled_tilemap, system::{get_tiles, get_code, get_tilemap}}}; use super::settings::{Args, Tools, TileOutputFormat, TileOrder}; pub fn run_command() -> Result<(), Box> { @@ -79,6 +79,10 @@ pub fn run_command() -> Result<(), Box> { palettes_bin.write_all( &palettes )?; print_good( "exported palettes.pal" ); + let mut nametables_bin = File::create( format!( "{}nametables.map", output_directory ) )?; + nametables_bin.write_all( &get_tilemap( &tiled_file )? )?; + print_good( "exported nametables.map" ); + let mut code_asm = File::create( format!( "{}level.asm", output_directory ) )?; code_asm.write_all( &get_code( &tiled_file, "testlevel", "levels/" )?.as_bytes() )?; print_good( "exported level.asm" ); diff --git a/src/reskit/level/system.rs b/src/reskit/level/system.rs index 9c02a76..66061fd 100644 --- a/src/reskit/level/system.rs +++ b/src/reskit/level/system.rs @@ -182,10 +182,14 @@ pub fn get_code( tilemap: &TiledTilemap, level_name: &str, path_prefix: &str ) - {level_label}Palettes: incbin '{path_prefix}{level_name}/palettes.pal' +{level_label}Nametables: + incbin '{path_prefix}{level_name}/nametables.map' + {level_label}: dc.w {width}, {height}, {num_tiles} dc.l {level_label}Tiles - dc.l {level_label}Palettes"# ); + dc.l {level_label}Palettes + dc.l {level_label}Nametables"# ); Ok( file ) } \ No newline at end of file