From: Mario Date: Sat, 21 Nov 2015 08:18:30 +0000 (+1000) Subject: Merge branch 'Melanosuchus/minigames' X-Git-Tag: xonotic-v0.8.2~15 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fmediasource.git;a=commitdiff_plain;h=0da1824a3b5784511fe88b02e5a6717dd3c9e265;hp=234b4dbd19110e72355af1780882c98864473f52 Merge branch 'Melanosuchus/minigames' --- diff --git a/gfx/minigames/build.sh b/gfx/minigames/build.sh new file mode 100755 index 0000000..e368d3e --- /dev/null +++ b/gfx/minigames/build.sh @@ -0,0 +1,130 @@ +#!/bin/bash + +CONVERT=convert +SED="sed -r" +MKDIR="mkdir -p" + +OUT_DIR=../../../data/xonotic-data.pk3dir/ +JPEG_QUALITY=75 +TEXTURE_SIZE=2048 +FORMAT=tga + +# Converts images into $FORMAT +# Synopsis: convert_image input.png output +# Genreates output.jpg and output_alpha.jpg +function convert_image() +{ + local covert_flags="-layers flatten" + if [ "$FORMAT" = "jpg" ] + then + covert_flags="$covert_flags -quality $JPEG_QUALITY" + fi + convert -background none "$1" $covert_flags "$2.$FORMAT" + if [ "$FORMAT" = "jpg" ] + then + convert -background none "$1" $covert_flags -alpha Extract "$2_alpha.jpg" + fi +} + +# Ensure that the output jpg are of the appropriate size +# Synopsis: scale_image output +# Where "output" is the same as $2 in convert_image +function scale_image() +{ + let max_w=$TEXTURE_SIZE + + if echo -n "$1" | grep -q ".*/piece.*" + then + let max_w/=4 + fi + + if [ "$max_w" -gt 0 ] + then + let img_w=$(identify -format %w "$1.$FORMAT") + if [ "$img_w" -gt "$max_w" ] + then + local scale=$(echo "scale=10; $max_w/$img_w*100" | bc) + convert "$1.$FORMAT" -resize "$scale%" "$1.$FORMAT" + if [ "$FORMAT" = "jpg" ] + then + convert "$1_alpha.jpg" -resize "$scale%" "$1_alpha.jpg" + fi + fi + 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 + 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 +} + +SYSTEM_NAME=$(uname) +if [ "$SYSTEM_NAME" = Darwin -o "$SYSTEM_NAME" = FreeBSD ] +then + SED="sed -E" +fi + + +$MKDIR "$OUT_DIR" + + +while [ "$1" ] +do + case $1 in + help|-h|--help) + echo TODO + exit + ;; + clean) + echo -e "Removing old files" + [ -n "$OUT_DIR" -a -e "$OUT_DIR" ] && rm -rf "$OUT_DIR" + ;; + *) + echo 1>&2 "Unknown option: $1" + ;; + esac + shift +done + +generate diff --git a/gfx/minigames/c4/board.svg b/gfx/minigames/c4/board.svg new file mode 100644 index 0000000..92c7ad1 --- /dev/null +++ b/gfx/minigames/c4/board.svg @@ -0,0 +1,2007 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gfx/minigames/c4/board_over.svg b/gfx/minigames/c4/board_over.svg new file mode 100644 index 0000000..09a172e --- /dev/null +++ b/gfx/minigames/c4/board_over.svg @@ -0,0 +1,1486 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gfx/minigames/c4/board_under.svg b/gfx/minigames/c4/board_under.svg new file mode 100644 index 0000000..d7182f0 --- /dev/null +++ b/gfx/minigames/c4/board_under.svg @@ -0,0 +1,910 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gfx/minigames/nmm/board.svg b/gfx/minigames/nmm/board.svg new file mode 100644 index 0000000..46b0170 --- /dev/null +++ b/gfx/minigames/nmm/board.svg @@ -0,0 +1,1379 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gfx/minigames/nmm/icon.svg b/gfx/minigames/nmm/icon.svg new file mode 100644 index 0000000..e1fe59e --- /dev/null +++ b/gfx/minigames/nmm/icon.svg @@ -0,0 +1,250 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gfx/minigames/nmm/icon_notif.svg b/gfx/minigames/nmm/icon_notif.svg new file mode 100644 index 0000000..ea4a9ce --- /dev/null +++ b/gfx/minigames/nmm/icon_notif.svg @@ -0,0 +1,221 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gfx/minigames/nmm/piece1.xcf b/gfx/minigames/nmm/piece1.xcf new file mode 100644 index 0000000..f56a7f4 Binary files /dev/null and b/gfx/minigames/nmm/piece1.xcf differ diff --git a/gfx/minigames/nmm/piece2.xcf b/gfx/minigames/nmm/piece2.xcf new file mode 100644 index 0000000..848eaa8 Binary files /dev/null and b/gfx/minigames/nmm/piece2.xcf differ diff --git a/gfx/minigames/nmm/tile_active.svg b/gfx/minigames/nmm/tile_active.svg new file mode 100644 index 0000000..f24f976 --- /dev/null +++ b/gfx/minigames/nmm/tile_active.svg @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/gfx/minigames/nmm/tile_available.svg b/gfx/minigames/nmm/tile_available.svg new file mode 100644 index 0000000..8208667 --- /dev/null +++ b/gfx/minigames/nmm/tile_available.svg @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/gfx/minigames/nmm/tile_selected.svg b/gfx/minigames/nmm/tile_selected.svg new file mode 100644 index 0000000..af0bc62 --- /dev/null +++ b/gfx/minigames/nmm/tile_selected.svg @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/gfx/minigames/pong/ball-glow.svg b/gfx/minigames/pong/ball-glow.svg new file mode 100644 index 0000000..9ae912a --- /dev/null +++ b/gfx/minigames/pong/ball-glow.svg @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/gfx/minigames/pong/ball.svg b/gfx/minigames/pong/ball.svg new file mode 100644 index 0000000..789c2f1 --- /dev/null +++ b/gfx/minigames/pong/ball.svg @@ -0,0 +1,536 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gfx/minigames/pong/board.svg b/gfx/minigames/pong/board.svg new file mode 100644 index 0000000..2b85ed6 --- /dev/null +++ b/gfx/minigames/pong/board.svg @@ -0,0 +1,501 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gfx/minigames/pong/icon.svg b/gfx/minigames/pong/icon.svg new file mode 100644 index 0000000..7cbc7de --- /dev/null +++ b/gfx/minigames/pong/icon.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/gfx/minigames/pong/icon_notif.svg b/gfx/minigames/pong/icon_notif.svg new file mode 100644 index 0000000..49ec2a5 --- /dev/null +++ b/gfx/minigames/pong/icon_notif.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/gfx/minigames/pong/paddle-glow.svg b/gfx/minigames/pong/paddle-glow.svg new file mode 100644 index 0000000..b26c3dc --- /dev/null +++ b/gfx/minigames/pong/paddle-glow.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/gfx/minigames/pong/paddle.svg b/gfx/minigames/pong/paddle.svg new file mode 100644 index 0000000..0828648 --- /dev/null +++ b/gfx/minigames/pong/paddle.svg @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/gfx/minigames/ttt/board.svg b/gfx/minigames/ttt/board.svg new file mode 100644 index 0000000..3ddb560 --- /dev/null +++ b/gfx/minigames/ttt/board.svg @@ -0,0 +1,844 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gfx/minigames/ttt/icon.svg b/gfx/minigames/ttt/icon.svg new file mode 100644 index 0000000..b049e95 --- /dev/null +++ b/gfx/minigames/ttt/icon.svg @@ -0,0 +1,136 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/gfx/minigames/ttt/icon_notif.svg b/gfx/minigames/ttt/icon_notif.svg new file mode 100644 index 0000000..68552e2 --- /dev/null +++ b/gfx/minigames/ttt/icon_notif.svg @@ -0,0 +1,132 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/gfx/minigames/ttt/piece1.xcf b/gfx/minigames/ttt/piece1.xcf new file mode 100644 index 0000000..83ec8aa Binary files /dev/null and b/gfx/minigames/ttt/piece1.xcf differ diff --git a/gfx/minigames/ttt/piece2.xcf b/gfx/minigames/ttt/piece2.xcf new file mode 100644 index 0000000..45a6c87 Binary files /dev/null and b/gfx/minigames/ttt/piece2.xcf differ diff --git a/gfx/minigames/ttt/winglow.svg b/gfx/minigames/ttt/winglow.svg new file mode 100644 index 0000000..936890a --- /dev/null +++ b/gfx/minigames/ttt/winglow.svg @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/models/sprites/minigame_busy.xcf b/models/sprites/minigame_busy.xcf new file mode 100644 index 0000000..23011af Binary files /dev/null and b/models/sprites/minigame_busy.xcf differ