dpic, todpic – Doom picture decoder and encoder


dpic [ -f ] [ -p palette ] [ pic ]

todpic [ -fw ] [ -b bgcol ] [ -p palette ] [ image ]


Dpic reads a doom picture formatted image (default standard input), converts it to a Plan 9 image(6) and writes it to standard out. Todpic does the opposite transformation.

A color palette is needed for the process; its location is set to /mnt/wad/playpal by default. This may be overridden with the -p command line option. Both programs also accept an -f flag to indicate processing a doom 64x64 flat picture.

When encoding a doom picture, x and y offsets are set to the input’s top left corner coordinates. The -w flag sets the offsets so as to center the picture when drawn by the doom engine, which is useful for wall patches. The -b option sets the RGB24 color to signal transparent pixels, 0x00FFFF by default.


Create a patch WAD (see wadfs(4)) replacing a sky texture. First, create a 256x128 image, mirror it, and convert it for use with tweak(1).


% png -9t tuttleglenda.png \\
	| resample -x 128 -y 128 \\
	| crop -r 0 0 256 128 \\
	| rotate -l \\
	| iconv -c m8 > tuttlesky

Next, use tweak(1) to tile the 128x128 picture. Then, mount an IWAD containing the base color palette, convert to a doom picture, create a patch WAD, then launch doom using it.


% games/wadfs /sys/games/lib/doom/doom2.wad
createfile SW18_7: file already exists
% games/wadfs -m /mnt/new
% games/todpic tuttlesky > /mnt/new/rsky1
% cp /mnt/new/WAD tuttle.wad
% games/doom -file tuttle.wad

Create a crude catclock weapon sprite.


% games/wadfs /sys/games/lib/doom/doom2.wad
createfile SW18_7: file already exists
% mkdir /mnt/new/s
adding end marker S_END
% cp /mnt/wad/s/* /mnt/new/s/
% crop -r 0 0 114 120 -t -120 -60 catclock.bit \\
	| games/todpic -b 0xffffff > /mnt/new/s/punga0
% games/doom -file /mnt/new/WAD




games(1), tweak(1), wadfs(4)


Dpic and todpic first appeared in 9front (July, 2018).