connect nametable exporter
parent
62a762515d
commit
37f82daca1
|
@ -1,6 +1,6 @@
|
||||||
use std::{error::Error, fs::File, io::Write, path::Path};
|
use std::{error::Error, fs::File, io::Write, path::Path};
|
||||||
use clap::Parser;
|
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};
|
use super::settings::{Args, Tools, TileOutputFormat, TileOrder};
|
||||||
|
|
||||||
pub fn run_command() -> Result<(), Box<dyn Error>> {
|
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 )?;
|
palettes_bin.write_all( &palettes )?;
|
||||||
print_good( "exported palettes.pal" );
|
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 ) )?;
|
let mut code_asm = File::create( format!( "{}level.asm", output_directory ) )?;
|
||||||
code_asm.write_all( &get_code( &tiled_file, "testlevel", "levels/" )?.as_bytes() )?;
|
code_asm.write_all( &get_code( &tiled_file, "testlevel", "levels/" )?.as_bytes() )?;
|
||||||
print_good( "exported level.asm" );
|
print_good( "exported level.asm" );
|
||||||
|
|
|
@ -182,10 +182,14 @@ pub fn get_code( tilemap: &TiledTilemap, level_name: &str, path_prefix: &str ) -
|
||||||
{level_label}Palettes:
|
{level_label}Palettes:
|
||||||
incbin '{path_prefix}{level_name}/palettes.pal'
|
incbin '{path_prefix}{level_name}/palettes.pal'
|
||||||
|
|
||||||
|
{level_label}Nametables:
|
||||||
|
incbin '{path_prefix}{level_name}/nametables.map'
|
||||||
|
|
||||||
{level_label}:
|
{level_label}:
|
||||||
dc.w {width}, {height}, {num_tiles}
|
dc.w {width}, {height}, {num_tiles}
|
||||||
dc.l {level_label}Tiles
|
dc.l {level_label}Tiles
|
||||||
dc.l {level_label}Palettes"# );
|
dc.l {level_label}Palettes
|
||||||
|
dc.l {level_label}Nametables"# );
|
||||||
|
|
||||||
Ok( file )
|
Ok( file )
|
||||||
}
|
}
|
Loading…
Reference in New Issue