From 433d27100a4c5a3c282f7b552b2f7cf60f2446ee Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sun, 4 Sep 2011 22:51:31 +0200 Subject: [PATCH] add a REALLY FUN FUN FUN texture randomizer script --- misc/tools/bsptool-shaderfun.sh | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 misc/tools/bsptool-shaderfun.sh 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" +"$@" -- 2.39.2