Skip to content

Commit

Permalink
wip: fix assets path for convert_to_png
Browse files Browse the repository at this point in the history
  • Loading branch information
berkus committed Mar 31, 2024
1 parent 56b20ba commit 032b336
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/bin/convert_to_png.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ fn main() {

// /// Load palette once and then apply to a bunch of pixmap data
fn convert_all_pixmaps() -> Result<()> {
let palette =
&PixelMap::load_many(String::from("DecodedData/DATA/REG/PALETTES/DRRENDER.PAL"))?[0];
visit_files(Path::new("DecodedData"), &mut |dir_entry| {
let palette = &PixelMap::load_many(String::from(
"assets/DecodedData/DATA/REG/PALETTES/DRRENDER.PAL",
))?[0];
visit_files(Path::new("assets/DecodedData"), &mut |dir_entry| {
if let Ok(file_type) = dir_entry.file_type() {
let fname = String::from(dir_entry.path().to_str().unwrap());
if file_type.is_file() && fname.ends_with(".PIX") {
Expand All @@ -31,8 +32,9 @@ fn convert_all_pixmaps() -> Result<()> {
}

fn convert_game_pixmap(fname: String) -> Result<()> {
let palette =
&PixelMap::load_many(String::from("DecodedData/DATA/REG/PALETTES/DRRENDER.PAL"))?[0];
let palette = &PixelMap::load_many(String::from(
"assets/DecodedData/DATA/REG/PALETTES/DRRENDER.PAL",
))?[0];
convert_pixmap(fname, palette)
}

Expand Down Expand Up @@ -61,7 +63,8 @@ fn convert_pixmap(fname: String, palette: &PixelMap) -> Result<()> {
/// Uses different palette for race-selection part
#[allow(unused)]
fn convert_menu_pixmap(fname: String) -> Result<()> {
let palette =
&PixelMap::load_many(String::from("DecodedData/DATA/REG/PALETTES/DRACEFLC.PAL"))?[0];
let palette = &PixelMap::load_many(String::from(
"assets/DecodedData/DATA/REG/PALETTES/DRACEFLC.PAL",
))?[0];
convert_pixmap(fname, palette)
}

0 comments on commit 032b336

Please sign in to comment.