Wolfenstein 3D Extractor is a command-line utility for extracting assets from the data files of the PC game Wolfenstein 3D. The program is written more as a proof-of-concept than an "everyman's tool"; this means you will need to call it from the command line and supply exactly which assets you want. The output is printed to the standard output, so you will want to redirect it or pipe it into another program.
A makefile is included with the project, to build navigate to the source folder and type on of the following into your terminal:
make make release
The release target will apply compiler optimisations, while the default target does not, it is intended for debugging where we don't want the compiler to alter our code.
The makefile was written for the clang compiler, if you want to use a different
compiler you have to re-assign the CC
variable:
make release CC=gcc
To clean up the build directory use the clean target:
make clean
You can also run the clang static analyser, both of the spellings below are valid:
make analyze make analyse
There are no dependencies, other than a C99-compliant compiler with support for variable-sized arrays. You can refer to the makefile for more details if you wish, it is a very simple makefile.
Execute the program from the same directory where your data files are. Pass it the folliwing argumenst:
Option | Arguments | Description |
---|---|---|
-ext |
abc | Set the file extension to use the string "abc" |
-dbg |
n | Set the debug level of messages (default 0, i.e. none) |
-la |
Extract level atlas | |
-lh |
e l | Extract header of level l from episode e |
-lm |
e l m | Extract map m of level l from episode e |
-po |
Extract pic offsets | |
-pt |
Extract the picture table | |
-pic |
m | Extract the picture with the specified magic number |
-tex |
m | Extract the texture with the specified magic number |
-spr |
m | Extract the sprite with the specified magic number |
-snd |
m f | Extract the sound effect with the specified magic number and format ("pc" or "adlib") |
-mus |
m | Extract the music track with the specified magic number |
Arguments are processed in the order they are given, so it is possible for example to change the file extension midway during execution. Example: .. code:
./wolf3dextrac -ext WL6 -lh 5 2 -ext WL1 -lh 1 2
Extracts first the header of episode 5, level 2 from the registered version, then episode 1, level 2 from the shareware version. Beware that all data is written to the standard output, so the files will be appened to each other. If you want seperate output files you should call the program multiple times.
To write the output to an actual file you should redirect the standard output or pipe it into another program. Here is an example of how to get a PNG from a texture: .. code:
./wolf3dextract -tex 3 | ./vga2ppm | convert /dev/stdin texture_3.png
First the texture is extracted, then it is piped into the converter to get a PPM file. Instead of outputting the file it is further piped into ImageMagick and a PNG is generated.
The VGA images generated by the extractor are virtually useless to any other program, so they need to be converted to something standardised. My choice was binary PPM since that is a very simple format. From there on it can be read or edited using 3rd party programs.
Using the converter is simple: the input is the standard input, the output is the standard output. The order of pixels depends on the type of image, so a composition mode needs to be specified as an argument:
linear | Unchanged, useless but interesting results |
woven | Woven in a weird way, for bitmap pictures |
transposed | Rows and columns switched, like a transposed matrix, for textures |
flipped | Flipped upside-down, for sprites |
Currently the program can only extract maps, more types will be added as the formats are understood. Also, currently the output contains the padding from platform-specific data structure alignment; this will have to be filtered out.
The MIT License (MIT)
Copyright (c) 2014-2015 "HiPhish"
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.