-
Notifications
You must be signed in to change notification settings - Fork 28
/
Tupfile.lua
243 lines (206 loc) · 5.57 KB
/
Tupfile.lua
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
-- Generate uniform size minisprites
foreach_rule(
"src/minisprites/pokemon/gen6/*.png",
{
display="pad g6 minisprite %f",
pad{w=40, h=30},
compresspng{config="MINISPRITE"}
},
"build/gen6-minisprites-padded/%b"
)
foreach_rule(
"src/minisprites/items/*.png",
{
display="pad item minisprite %f",
pad{w=24, h=24},
compresspng{config="MINISPRITE"}
},
"build/item-minisprites-padded/%b"
)
foreach_rule(
"src/minisprites/pokemon/gen6/*.png",
{
display="trim g6 minisprite %f",
trimimg{},
compresspng{config="MINISPRITE"}
},
"build/gen6-minisprites-trimmed/%b"
)
foreach_rule(
"src/minisprites/items/*.png",
{
display="trim item minisprite %f",
trimimg{},
compresspng{config="MINISPRITE"}
},
"build/item-minisprites-trimmed/%b"
)
-- Gen 9
foreach_rule(
"src/gen9species/*.png",
{
display="96x96 %f",
-- TODO, add customizable compression for gif
-- ... or investigate using webp instead of both png/gif here
"magick convert %f -trim +repage -resize 90x90 %o",
"gifsicle -O3 -b %o"
},
"build/gen9-modelslike/%B.gif"
)
-- Gen 5 CAPs...
foreach_rule(
"src/sprites/gen5/*.png",
{
-- TODO, add customizable compression for gif
-- ... or investigate using webp instead of both png/gif here
"magick convert %f %o",
"gifsicle -O3 -b %o"
},
"build/gen5-gif/%B.gif"
)
-- PS spritesheet
rule(
"ps-pokemon.sheet.mjs",
{
display="ps pokemon sheet",
"node tools/sheet %f %o",
compresspng{config="SPRITESHEET"}
},
"build/ps/pokemonicons-sheet.png"
)
-- TODO: reenable when trainers are moved
-- rule{
-- display="ps trainers sheet",
-- {"ps-trainers.sheet.mjs"},
-- {
-- "node tools/sheet %f %o",
-- compresspng{config="SPRITESHEET"}
-- },
-- {"build/ps/trainers-sheet.png"}
-- }
rule(
"ps-items.sheet.mjs",
{
display="ps items sheet",
"node tools/sheet %f %o",
compresspng{config="SPRITESHEET"}
},
"build/ps/itemicons-sheet.png"
)
-- PS pokeball icons
local balls = {
"src/_uncategorized/noncanonical/ui/battle/Ball-Normal.png",
"src/_uncategorized/noncanonical/ui/battle/Ball-Sick.png",
"src/_uncategorized/noncanonical/ui/battle/Ball-Null.png",
}
rule(
balls,
{
display="pokemonicons-pokeball-sheet",
"magick convert -background transparent -gravity center -extent 40x30 %f +append %o",
compresspng{config="SPRITESHEET"}
},
"build/ps/pokemonicons-pokeball-sheet.png"
)
-- Smogdex minisprites (webp)
foreach_rule(
spriteglob({"src/minisprites/pokemon/gen6/*", "src/minisprites/items/*"}, {a = false}),
{
display="webp minisprite %f",
"cwebp -z 9 %f -o %o"
},
"build/smogon/minisprites/%B.webp"
)
-- Smogdex spritesheet
rule(
spriteglob({"src/minisprites/pokemon/gen6/*", "src/minisprites/items/*"}, {a = false}),
{
display="smogdex sheet",
"node tools/smogdexspritesheet --image build/smogon/spritesheet.png --stylesheet build/smogon/spritesheet.css -- %f",
"cwebp -z 9 build/smogon/spritesheet.png -o build/smogon/spritesheet.webp",
"rm build/smogon/spritesheet.png"
},
{"build/smogon/spritesheet.webp", "build/smogon/spritesheet.css"}
)
-- Smogdex social images
local input = spriteglob({"src/models/*"}, {b = false, s = false})
-- Copied from the CAP bit, dedup, should probably make a routine for it
local dexSet = {}
for file in iter(input) do
dexSet[tup.base(file)] = true
end
for file in iter(spriteglob({"src/gen9species/*"}, {b = false, s = false})) do
local base = tup.base(file)
if dexSet[base] then
goto continue
end
input += file
dexSet[base] = true
::continue::
end
foreach_rule(
input,
{
display="fbsprite %f",
"magick convert \"%f[0]\" -trim -resize 150x150 -background white -gravity center -extent 198x198 -bordercolor black -border 1 %o",
compresspng{config="MODELS"}
},
"build/smogon/fbsprites/xy/%B.png"
)
foreach_rule(
input,
{
display="twittersprite %f",
"magick convert \"%f[0]\" -trim -resize 115x115 -background white -gravity center -extent 120x120 %o",
compresspng{config="MODELS"}
},
"build/smogon/twittersprites/xy/%B.png"
)
-- Trainers
-- TODO: reenable when trainers are moved
-- foreach_rule{
-- display="pad trainer %f",
-- {"src/canonical/trainers/*"},
-- {
-- pad{w=80, h=80},
-- compresspng{config="TRAINERS"}
-- },
-- {"build/padded-trainers/canonical/%b"}
-- }
-- Padded Dex
local dexOutput = foreach_rule(
"src/dex/*",
{
display="pad dex %f",
pad{w=120, h=120},
compresspng{config="DEX"}
},
"build/padded-dex/%b"
)
-- Build missing CAP dex
local dexSet = {}
for file in iter(dexOutput) do
dexSet[tup.base(file)] = true
end
local dexMissing = {}
for file in iter(spriteglob(
{"src/sprites/gen5/*.gif", "src/models/*.gif"},
{b = false, s = false})) do
local base = tup.base(file)
if dexSet[base] then
goto continue
end
dexMissing += file
dexSet[base] = true
::continue::
end
foreach_rule(
dexMissing,
{
display="missing dex %B",
"magick convert \"%f[0]\" -trim %o",
"magick mogrify -background transparent -gravity center -resize \"120x120>\" -extent 120x120 %o",
compresspng{config="DEX"}
},
"build/padded-dex/%B.png"
)