Skip to content

Commit

Permalink
📝 (readme): Updated the README file
Browse files Browse the repository at this point in the history
  • Loading branch information
theobori committed Jun 12, 2024
1 parent 3e0da5a commit 6162b0f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tinywad"
version = "0.1.2"
version = "0.1.3"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,18 @@
![build](https://github.com/theobori/tinywad/actions/workflows/build.yml/badge.svg)


A tiny lib to manage WAD file like DOOM1/2, HEXEN, etc..
A library to manage WAD for DOOM based game. It has been tested with the following IWAD:
- DOOM.WAD
- DOOM2.WAD
- HEXEN.WAD
- CHEX.WAD
- TNT.WAD
- PLUTONIA.WAD
- STRIFE0.WAD
- STRIFE1.WAD
- DOOMU.WAD
- DOOM2F.WAD
- HEXDD.WAD

It supports the following features:
- Load WAD buffer/file
Expand All @@ -30,7 +41,7 @@ use tinywad::wad::Wad;

fn main() -> Result<(), WadError> {
let mut doom_2 = Wad::new();
doom_2.load_from_file("wads/doom2.wad")?;
doom_2.load_from_file("doom2.wad")?;

let gate = doom_2.lump("GATE3").unwrap();

Expand Down Expand Up @@ -61,7 +72,7 @@ use tinywad::wad::Wad;

fn main() -> Result<(), WadError> {
let mut doom_2 = Wad::new();
doom_2.load_from_file("wads/doom2.wad")?;
doom_2.load_from_file("doom2.wad")?;

for pal in 0..MAX_PAL {
doom_2.set_palette(pal);
Expand Down
4 changes: 4 additions & 0 deletions src/lumps/flat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ impl Lump for Flat {
None => return Err(WadError::Parse(String::from("Invalid palette"))),
};

if FLAT_SIZE > buffer.len() {
return Err(WadError::Parse(String::from("Invalid FLAT length")));
}

for i in 0..FLAT_SIZE {
let byte = buffer[i];
let (r, g, b, _) = palette[byte as usize].into();
Expand Down

0 comments on commit 6162b0f

Please sign in to comment.