summaryrefslogtreecommitdiff
path: root/sys/man/1/dpic
blob: 29bdc3842a2f2797fade99174f0216526c86cbe9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
.TH DPIC 1
.SH NAME
dpic, todpic \- Doom picture decoder and encoder
.SH SYNOPSIS
.B dpic
[
.B -f
] [
.B -p
.I palette
] [
.I pic
]
.PP
.B todpic
[
.B -fw
] [
.B -b
.I bgcol
] [
.B -p
.I palette
] [
.I image
]
.SH DESCRIPTION
.I Dpic
reads a doom picture formatted image (default standard input),
converts it to a Plan 9
.IR image (6)
and writes it to standard out.
.I Todpic
does the opposite transformation.
.PP
A color palette is needed for the process;
its location is set to
.B /mnt/wad/playpal
by default.
This may be overridden with the
.B -p
command line option.
Both programs also accept an
.B -f
flag to indicate processing a doom 64x64 flat picture.
.PP
When encoding a doom picture,
x and y offsets are set to the input's top left corner coordinates.
The
.B -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 -b
option sets the RGB24 color to signal transparent pixels,
.L 0x00FFFF
by default.
.SH EXAMPLES
Create a patch
.I WAD
(see
.IR wadfs (4))
replacing a sky texture.
First, create a 256x128 image, mirror it, and convert it for use with
.IR tweak (1).
.IP
.EX
% png -9t tuttleglenda.png \\
	| resample -x 128 -y 128 \\
	| crop -r 0 0 256 128 \\
	| rotate -l \\
	| iconv -c m8 > tuttlesky
.EE
.PP
Next, use
.IR tweak (1)
to tile the 128x128 picture.
Then, mount an
.I IWAD
containing the base color palette, convert to a doom picture,
create a patch
.IR WAD ,
then launch doom using it.
.IP
.EX
% 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
.EE
.PP
Create a crude catclock weapon sprite.
.IP
.EX
% 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
.EE
.SH SOURCE
.B /sys/src/games/dpic.c
.br
.B /sys/src/games/todpic.c
.SH "SEE ALSO"
.IR games (1),
.IR tweak (1),
.IR wadfs (4)
.SH HISTORY
.I Dpic
and
.I todpic
first appeared in 9front (July, 2018).