Add collision map to export
parent
e6e1500fd4
commit
bd6136903d
|
@ -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, get_tilemap}}};
|
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, get_collision_map}}};
|
||||||
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>> {
|
||||||
|
@ -83,6 +83,10 @@ pub fn run_command() -> Result<(), Box<dyn Error>> {
|
||||||
nametables_bin.write_all( &get_tilemap( &tiled_file )? )?;
|
nametables_bin.write_all( &get_tilemap( &tiled_file )? )?;
|
||||||
print_good( "exported nametables.map" );
|
print_good( "exported nametables.map" );
|
||||||
|
|
||||||
|
let mut nametables_bin = File::create( format!( "{}collision.lvc", output_directory ) )?;
|
||||||
|
nametables_bin.write_all( &get_collision_map( &tiled_file )? )?;
|
||||||
|
print_good( "exported collision.lvc" );
|
||||||
|
|
||||||
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" );
|
||||||
|
|
|
@ -243,11 +243,15 @@ pub fn get_code( tilemap: &TiledTilemap, level_name: &str, path_prefix: &str ) -
|
||||||
{level_label}Nametables:
|
{level_label}Nametables:
|
||||||
incbin '{path_prefix}{level_name}/nametables.map'
|
incbin '{path_prefix}{level_name}/nametables.map'
|
||||||
|
|
||||||
|
{level_label}Collision:
|
||||||
|
incbin '{path_prefix}{level_name}/collision.lvc'
|
||||||
|
|
||||||
{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"# );
|
dc.l {level_label}Nametables
|
||||||
|
dc.l {level_label}Collision"# );
|
||||||
|
|
||||||
Ok( file )
|
Ok( file )
|
||||||
}
|
}
|
Loading…
Reference in New Issue