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
}