-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wad parsing + qmap fixes + refactoring
- Loading branch information
Showing
29 changed files
with
2,347 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/target | ||
Cargo.lock | ||
/dump | ||
|
||
/test-res/lg-file |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "quake-util" | ||
version = "0.2.0" | ||
version = "0.3.0" | ||
authors = ["Seth <[email protected]>"] | ||
edition = "2021" | ||
description = "A utility library for using Quake file formats" | ||
|
@@ -13,7 +13,8 @@ alloc_fills = ["hashbrown"] | |
std = [] | ||
|
||
[dependencies] | ||
hashbrown = { version = "^0.12", optional = true } | ||
hashbrown = { version = "^0.14", optional = true } | ||
|
||
[dev-dependencies] | ||
benchmarking = "^0.4" | ||
png = "^0.17" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#[cfg(feature = "std")] | ||
use quake_util::{lump, wad}; | ||
|
||
#[cfg(feature = "std")] | ||
use std::{env::args, fs::File, io::BufReader}; | ||
|
||
#[cfg(feature = "std")] | ||
fn main() { | ||
let mut arguments = args(); | ||
|
||
let arg1 = if let Some(arg1) = arguments.nth(1) { | ||
arg1 | ||
} else { | ||
panic!("No arguments"); | ||
}; | ||
|
||
let file = File::open(arg1).expect("Could not open file"); | ||
let mut cursor = BufReader::new(file); | ||
|
||
let (mut parser, warnings) = wad::Parser::new(&mut cursor).unwrap(); | ||
|
||
for warning in warnings { | ||
eprintln!("Warning: {warning}"); | ||
} | ||
|
||
for (name, entry) in parser.directory() { | ||
print!("Entry `{}`: ", name); | ||
|
||
match &parser | ||
.parse_inferred(&entry) | ||
.map_err(|e| format!("{}: {}", name, e)) | ||
.unwrap() | ||
{ | ||
lump::Lump::MipTexture(tex) => { | ||
println!("Texture"); | ||
for image in tex.mips() { | ||
println!( | ||
"\t{}x{}: {} bytes", | ||
image.width(), | ||
image.height(), | ||
image.pixels().len() | ||
); | ||
} | ||
} | ||
lump::Lump::Palette(_) => { | ||
println!("Palette"); | ||
println!("\t768 bytes"); | ||
} | ||
lump::Lump::StatusBar(img) => { | ||
println!("Status bar image"); | ||
println!( | ||
"\t{}x{}: {} bytes", | ||
img.width(), | ||
img.height(), | ||
img.pixels().len(), | ||
); | ||
} | ||
lump::Lump::Flat(bytes) => { | ||
println!("Flat"); | ||
println!("\t{} bytes", bytes.len()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
#[cfg(not(feature = "std"))] | ||
fn main() {} |
Oops, something went wrong.