From bd6136903d6621fd7538a2965b111f9bb0b89055 Mon Sep 17 00:00:00 2001 From: ashley Date: Tue, 19 Sep 2023 22:18:46 -0400 Subject: [PATCH] Add collision map to export --- 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 bc63424..b81570a 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, 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}; pub fn run_command() -> Result<(), Box> { @@ -83,6 +83,10 @@ pub fn run_command() -> Result<(), Box> { nametables_bin.write_all( &get_tilemap( &tiled_file )? )?; 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 ) )?; 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 fa89041..494bd10 100644 --- a/src/reskit/level/system.rs +++ b/src/reskit/level/system.rs @@ -243,11 +243,15 @@ pub fn get_code( tilemap: &TiledTilemap, level_name: &str, path_prefix: &str ) - {level_label}Nametables: incbin '{path_prefix}{level_name}/nametables.map' +{level_label}Collision: + incbin '{path_prefix}{level_name}/collision.lvc' + {level_label}: dc.w {width}, {height}, {num_tiles} dc.l {level_label}Tiles dc.l {level_label}Palettes - dc.l {level_label}Nametables"# ); + dc.l {level_label}Nametables + dc.l {level_label}Collision"# ); Ok( file ) } \ No newline at end of file