connect nametable exporter

stinkhead7ds
Ashley N. 2023-09-17 23:28:18 -04:00
parent 62a762515d
commit 37f82daca1
2 changed files with 10 additions and 2 deletions

View File

@ -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<dyn Error>> {
@ -79,6 +79,10 @@ pub fn run_command() -> Result<(), Box<dyn Error>> {
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" );

View File

@ -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 )
}