From 7e507cc3b710a03b5f36a614205795363e6f9d96 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 29 Sep 2010 14:48:44 +0200 Subject: [PATCH] also add a screenshot script --- misc/tools/xonotic-map-compiler-autobuild | 24 +++++++++++++++++--- misc/tools/xonotic-map-screenshot | 27 +++++++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) create mode 100755 misc/tools/xonotic-map-screenshot diff --git a/misc/tools/xonotic-map-compiler-autobuild b/misc/tools/xonotic-map-compiler-autobuild index b87465b9..5ed8665b 100755 --- a/misc/tools/xonotic-map-compiler-autobuild +++ b/misc/tools/xonotic-map-compiler-autobuild @@ -7,7 +7,7 @@ url=http://beta.xonotic.org/autobuild-bsp/ url_ssh=xonotic-beta:autobuild-bsp/ build_cachedir="$HOME/xonotic-map-compiler.cache/" screenshot_cachedir="$HOME/xonotic-map-screenshot.cache/" -override="-bsp_timeout 900 -vis_timeout 3600 -light_timeout 14400 -minimap_timeout 900 -scale_timeout 900" +build_override="-bsp_timeout 900 -vis_timeout 3600 -light_timeout 14400 -minimap_timeout 900 -scale_timeout 900" screenshot_override="9 300" allmaps() @@ -47,13 +47,24 @@ ss2spam() url=$2 branch=$3 hash=$4 + status=$5 branch=${branch##refs/heads/} branch=${branch##refs/remotes/} branch=${branch##origin/} hash=`echo "$hash" | cut -c 1-7` - echo "[$branch $hash] screenshots of $map are available on $url" + s_error= + + if [ "$status" -ne 0 ]; then + s_error="exited with status $status" + fi + + if [ -n "$s_error" ]; then + echo "[$branch $hash] 4screenshots of $map could not be made: $s_error" + else + echo "[$branch $hash] screenshots of $map are available on $url" + fi } log2spam() @@ -144,7 +155,7 @@ buildthemap() t0=`date +%s` ( cd maps - ../../../misc/tools/xonotic-map-compiler "$M" `grep ^- "$M.map.options" | cut -d '#' -f 1` $override > "$M.log" + ../../../misc/tools/xonotic-map-compiler "$M" `grep ^- "$M.map.options" | cut -d '#' -f 1` $build_override > "$M.log" ) t1=`date +%s` dt=$(($t1 - $t0)) @@ -176,7 +187,14 @@ screenshotthemap() fi rm -rf ~/.xonotic ( + ../../misc/tools/xonotic-map-screenshot "$M" $screenshot_override +scr_screenshot_name "$M" ) + if ! mv ~/.xonotic/data/screenshots "$M-$blobhash"; then + if [ -n "$IRCSPAM" ]; then + ss2spam "$M" "$url$M-$blobhash/" "$REFNAME" "$HASH" > "maps/$M.ircss" + fi + return 1 + fi if [ -n "$IRCSPAM" ]; then ss2spam "$M" "$url$M-$blobhash/" "$REFNAME" "$HASH" > "maps/$M.ircss" fi diff --git a/misc/tools/xonotic-map-screenshot b/misc/tools/xonotic-map-screenshot new file mode 100755 index 00000000..36f7e8ce --- /dev/null +++ b/misc/tools/xonotic-map-screenshot @@ -0,0 +1,27 @@ +#!/bin/sh + +map=$1; shift +count=$1; shift +watchdog=$1; shift + +# convert count to unary +count=`yes x | head -n "$count" | tr -cd x` + +./all run \ + +'vid_fullscreen 0' \ + +'exec effects-ultimate.cfg' \ + "$@" \ + +'r_motionblur 0' \ + +'r_damageblur 0' \ + +'r_letterbox -1' \ + +'r_drawviewmodel 0' \ + +'crosshair 0' \ + +'sv_cheats 1' \ + +'set catchme "catchme_"' \ + +"alias catchme_$count \"quit\"" \ + +'alias "autoscreenshot" "$catchme; set catchme \"${catchme}x\"; impulse 911; defer 1 \"screenshot; autoscreenshot\""' \ + +'alias cl_hook_gamestart_all "cmd join; defer 1 god; defer 2 noclip; defer 3 autoscreenshot"' \ + +"defer \"$watchdog\" quit" \ + +"map \"$map\"" \ + +'timelimit 0' \ + +'fraglimit 0' -- 2.39.2