]> git.rm.cloudns.org Git - xonotic/mediasource.git/commitdiff
Include minigame busy sprite to the build script
authorMattia Basaglia <mattia.basaglia@gmail.com>
Fri, 6 Feb 2015 12:46:14 +0000 (13:46 +0100)
committerMattia Basaglia <mattia.basaglia@gmail.com>
Fri, 6 Feb 2015 12:46:14 +0000 (13:46 +0100)
gfx/minigames/build.sh

index 5e47774e51dba38cd99ba87bb52c95c5a50e295d..883a767a9812bc4ba9d95e9774ab785a6d41fa72 100755 (executable)
@@ -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
 }