-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
167 lines (144 loc) · 4.28 KB
/
Makefile
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
MAKEFLAGS += --silent
.PHONY: all
all: dist
# Directories where images will be placed
dirs = \
build/textures/bmodels \
build/textures/models \
build/textures/wad
# The SVGs to generate images from
svgs = \
bmodels/simple_b_batt0_0.svg \
bmodels/simple_b_batt1_0.svg \
bmodels/simple_b_bh10_0.svg \
bmodels/simple_b_bh25_0.svg \
bmodels/simple_b_bh100_0.svg \
bmodels/simple_b_nail0_0.svg \
bmodels/simple_b_nail1_0.svg \
bmodels/simple_b_rock0_0.svg \
bmodels/simple_b_rock1_0.svg \
bmodels/simple_b_shell0_0.svg \
bmodels/simple_b_shell1_0.svg \
models/simple_armor_0.svg \
models/simple_armor_1.svg \
models/simple_armor_2.svg \
models/simple_g_light_0.svg \
models/simple_g_nail_0.svg \
models/simple_g_nail2_0.svg \
models/simple_g_rock_0.svg \
models/simple_g_rock2_0.svg \
models/simple_g_shot_0.svg \
models/simple_g_shot_1.svg \
models/simple_invisibl_0.svg \
models/simple_invulner_0.svg \
models/simple_quaddama_0.svg \
# The inventory weapon icons
inventory_weapons = \
shotgun \
sshotgun \
nailgun \
snailgun \
rlaunch \
srlaunch \
lightng \
# The inventory weapon icon prefixes
# ezQuake requires several variants per weapon for the weapon acquisition
# animation, so we need to generate all of them
inventory_weapon_variants = \
inv2 \
inva1 \
inva2 \
inva3 \
inva4 \
inva5 \
# The ImageMagick options to use for converting weapon icons to inventory icons
inventory_weapon_options = \
-background transparent \
-gravity center \
-resize 256x256 \
-extent 384x256 \
# The ImageMagick options to use for converting non-weapon icons
inventory_icon_options = \
-resize 256x256 \
# Render SVGs to PNG images and convert them to TGA
# Also perform some conversions using ImageMagick for inventory images
# ezQuake will only override the default simple items from nQuake if they
# are in TGA format
.PHONY: build
build: clean
mkdir -p $(dirs)
for vector in $(svgs); do \
raster_png="build/textures/$${vector%.*}.png"; \
raster_tga="build/textures/$${vector%.*}.tga"; \
inkscape "src/textures/$$vector" --export-file "$$raster_png"; \
convert "$$raster_png" "$$raster_tga"; \
rm "$$raster_png"; \
done
# Weapon HUD icons
convert \
"build/textures/models/simple_g_shot_1.tga" \
$(inventory_weapon_options) \
"build/textures/wad/inv_shotgun.tga"
convert \
"build/textures/models/simple_g_shot_0.tga" \
$(inventory_weapon_options) \
"build/textures/wad/inv_sshotgun.tga"
convert \
"build/textures/models/simple_g_nail_0.tga" \
$(inventory_weapon_options) \
"build/textures/wad/inv_nailgun.tga"
convert \
"build/textures/models/simple_g_nail2_0.tga" \
$(inventory_weapon_options) \
"build/textures/wad/inv_snailgun.tga"
convert \
"build/textures/models/simple_g_rock_0.tga" \
$(inventory_weapon_options) \
"build/textures/wad/inv_rlaunch.tga"
convert \
"build/textures/models/simple_g_rock2_0.tga" \
$(inventory_weapon_options) \
"build/textures/wad/inv_srlaunch.tga"
convert \
"build/textures/models/simple_g_light_0.tga" \
$(inventory_weapon_options) \
-gravity west \
-extent 768x256 \
"build/textures/wad/inv_lightng.tga"
for weapon in $(inventory_weapons); do \
for variant in $(inventory_weapon_variants); do \
cp "build/textures/wad/inv_$${weapon}.tga" "build/textures/wad/$${variant}_$${weapon}.tga"; \
done; \
done
# Armor HUD icons
for armor_type in 0 1 2; do \
convert \
"build/textures/models/simple_armor_$${armor_type}.tga" \
$(inventory_icon_options) \
"build/textures/wad/sb_armor$$((armor_type+1)).tga"; \
done
# Powerup HUD icons
convert \
"build/textures/models/simple_invisibl_0.tga" \
$(inventory_icon_options) \
"build/textures/wad/sb_invis.tga"
convert \
"build/textures/models/simple_invulner_0.tga" \
$(inventory_icon_options) \
"build/textures/wad/sb_invuln.tga"
convert \
"build/textures/models/simple_quaddama_0.tga" \
$(inventory_icon_options) \
"build/textures/wad/sb_quad.tga"
# Generate a PK3 archive for distribution
# (includes the README and a copy of the license for reference)
.PHONY: dist
dist: build
mkdir -p "out/"
cp "README.md" "LICENSE.md" "build/"
cd "build" && zip -r9 "../out/quakeworld-simple-items.pk3" "textures/" "README.md" "LICENSE.md"
rm "build/README.md" "build/LICENSE.md"
# Clean up build artifacts
.PHONY: clean
clean:
rm -rf "build/" "out/"