From ccfe92933e44e0e648107db0581b9db8241f0d69 Mon Sep 17 00:00:00 2001 From: Mattia Basaglia Date: Fri, 6 Feb 2015 13:46:14 +0100 Subject: [PATCH] Include minigame busy sprite to the build script --- gfx/minigames/build.sh | 65 ++++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/gfx/minigames/build.sh b/gfx/minigames/build.sh index 5e47774..883a767 100755 --- a/gfx/minigames/build.sh +++ b/gfx/minigames/build.sh @@ -53,38 +53,49 @@ function scale_image() fi } +# handle_file src_file out_dir +function handle_file() +{ + local src_file="$1" + local out_dir="$2" + local out_file="$out_dir/$src_file" + $MKDIR "$out_dir/$(dirname "$src_file")" + + local file_extension="$(echo "$src_file" | sed -r "s/^(.*)\.([^.]+)$/\2/")" + local base_file="$(echo "$out_file" | sed -r "s/^(.*)\.([^.]+)$/\1/")" + + if echo -n "$file_extension" | grep -Eq "^(png|svg|tga|xcf)$" && + [ "$file_extension" != "$FORMAT" ] + then + out_file="$base_file.$FORMAT" + if [ "$src_file" -nt "$out_file" ] + then + echo -e "Converting \x1b[1m$src_file\x1b[0m" + convert_image "$src_file" "$base_file" + scale_image "$base_file" + continue + fi + elif [ "$src_file" -nt "$out_file" ] + then + echo -e "Copying \x1b[1m$src_file\x1b[0m" + cp -T "$src_file" "$out_file" + continue + fi + + echo -e "Skipping \x1b[1m$src_file\x1b[0m" +} + # Create the files for packaging function generate() { for src_file in $(git ls-files '*/*') do - local out_dir="$OUT_DIR/gfx/hud/default/minigames/" - local out_file="$out_dir/$src_file" - $MKDIR "$out_dir/$(dirname "$src_file")" - - local file_extension="$(echo "$src_file" | sed -r "s/^(.*)\.([^.]+)$/\2/")" - local base_file="$(echo "$out_file" | sed -r "s/^(.*)\.([^.]+)$/\1/")" - - if echo -n "$file_extension" | grep -Eq "^(png|svg|tga|xcf)$" && - [ "$file_extension" != "$FORMAT" ] - then - out_file="$base_file.$FORMAT" - if [ "$src_file" -nt "$out_file" ] - then - echo -e "Converting \x1b[1m$src_file\x1b[0m" - convert_image "$src_file" "$base_file" - scale_image "$base_file" - continue - fi - elif [ "$src_file" -nt "$out_file" ] - then - echo -e "Copying \x1b[1m$src_file\x1b[0m" - cp -T "$src_file" "$out_file" - continue - fi - - echo -e "Skipping \x1b[1m$src_file\x1b[0m" - + handle_file "$src_file" "$OUT_DIR/gfx/hud/default/minigames/" + done + + for src_file in $(git ls-files '../../models/sprites/minigame*') + do + handle_file "$src_file" "$OUT_DIR/models/sprites/" done } -- 2.39.2