add a REALLY FUN FUN FUN texture randomizer script

This commit is contained in:
Rudolf Polzer 2011-09-04 22:51:31 +02:00
parent 59ecb5b7d8
commit 433d27100a

37
misc/tools/bsptool-shaderfun.sh Executable file
View File

@ -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"
"$@"