From: Rudolf Polzer Date: Sun, 4 Sep 2011 20:51:31 +0000 (+0200) Subject: add a REALLY FUN FUN FUN texture randomizer script X-Git-Tag: xonotic-v0.5.0^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=433d27100a4c5a3c282f7b552b2f7cf60f2446ee;p=xonotic%2Fxonotic.git add a REALLY FUN FUN FUN texture randomizer script --- diff --git a/misc/tools/bsptool-shaderfun.sh b/misc/tools/bsptool-shaderfun.sh new file mode 100755 index 00000000..b6b656d5 --- /dev/null +++ b/misc/tools/bsptool-shaderfun.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +# input: a .shader file +# parameters: in and out .bsp file + +BSPTOOL="${0%/*}"/bsptool.pl +LF=" +" + +in=$1 +out=$2 + +shaders=`"$BSPTOOL" "$in" -S` + +newshaders=`cat | grep '^[^ {}]'` + +set -- + +list= +for shader in $shaders; do + if [ -z "$list" ]; then + echo >&2 "Filling list..." + list=`echo "$newshaders" | sort -R`$LF + fi + case "$shader" in + noshader|NULL|textures/common/*) + ;; + *) + item=${list%%$LF*} + list=${list#*$LF} + set -- "$@" "-S$shader=$item" + ;; + esac +done + +set -- "$BSPTOOL" "$in" "$@" -o"$out" +"$@"