From 931cdd3f4e5bfa6ae9942416993c9803c0a1e391 Mon Sep 17 00:00:00 2001 From: Christopher Monsanto Date: Wed, 2 Sep 2020 00:23:41 -0400 Subject: [PATCH] trim smogdex minisprites --- Tupfile.lua | 20 ++++++++++++++++++++ Tuprules.lua | 8 ++++++++ smogon.deploy.js | 4 ++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Tupfile.lua b/Tupfile.lua index ee4a7202..0fa6e12d 100644 --- a/Tupfile.lua +++ b/Tupfile.lua @@ -21,6 +21,26 @@ foreach_rule( "build/item-minisprites-padded/%b" ) +foreach_rule( + "newsrc/minisprites/pokemon/gen6/*.png", + { + display="trim g6 minisprite %f", + trimimg{}, + compresspng{config="MINISPRITE"} + }, + "build/gen6-minisprites-trimmed/%b" +) + +foreach_rule( + "newsrc/minisprites/items/*.png", + { + display="trim item minisprite %f", + trimimg{}, + compresspng{config="MINISPRITE"} + }, + "build/item-minisprites-trimmed/%b" +) + -- PS spritesheet rule( diff --git a/Tuprules.lua b/Tuprules.lua index ee703a89..3a2b2e32 100644 --- a/Tuprules.lua +++ b/Tuprules.lua @@ -16,6 +16,14 @@ function pad(opts) } end +function trimimg(opts) -- Can't just be trim because of the string function... + return rep{ + "convert ${input} -trim ${output}", + input = opts.input or "%f", + output = opts.output or "%o", + } +end + local DEFAULT_OPTIPNG = getconfig("DEFAULT_OPTIPNG") local DEFAULT_ADVPNG = getconfig("DEFAULT_ADVPNG") local DEFLOPT_PATH = getconfig("DEFLOPT_PATH") diff --git a/smogon.deploy.js b/smogon.deploy.js index c6d78039..5bfc7bbf 100644 --- a/smogon.deploy.js +++ b/smogon.deploy.js @@ -42,11 +42,11 @@ function itemspritecopy(f, {dir, ext}) { copy(f, {dir, ext, name}); } -for (const f of list("newsrc/minisprites/pokemon/gen6")) { +for (const f of list("build/gen6-minisprites-trimmed")) { spritecopy(f, {dir: "xyicons"}); } -for (const f of list("newsrc/minisprites/items")) { +for (const f of list("build/item-minisprites-trimmed")) { itemspritecopy(f, {dir: "xyitems"}); }