From: Rudolf Polzer Date: Thu, 22 Jul 2010 13:35:45 +0000 (+0200) Subject: detect skyparms X-Git-Tag: xonotic-v0.1.0preview~141^2~8^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=915cb278306e79adfcb7907b739b18c83af960f7;p=xonotic%2Fxonotic-maps.pk3dir.git detect skyparms --- diff --git a/scripts/shader-audit.sh b/scripts/shader-audit.sh index dd371ac0..95ae9ae1 100644 --- a/scripts/shader-audit.sh +++ b/scripts/shader-audit.sh @@ -14,7 +14,7 @@ forbidden_prefixes= textures_used= # $1 = shader # $2 = texture -# $3 = self | map | animmap | editorimage +# $3 = shader | map | animmap | editorimage | sky use_texture() { # does texture exist? @@ -24,7 +24,7 @@ use_texture() [ -f "../$2.png" ]; then : else - if [ "$3" = "self" ]; then + if [ "$3" = "shader" ]; then return else echo "(EE) shader $1 uses non-existing texture $2" @@ -55,7 +55,28 @@ use_texture() echo "(EE) shader $1 is not allowed in this shader file (allowed: $allowed_prefixes, forbidden: $forbidden_prefixes)" fi - # TODO verify shader -> texture name + case "$3" in + sky) + case "$2" in + env/*) + ;; + *) + echo "(EE) texture $2 of shader $1 is out of place, $3 textures must be in env/" + ;; + esac + ;; + *) + case "$2" in + env/*) + echo "(EE) texture $2 of shader $1 is out of place, $3 textures must not be in env/" + ;; + *) + ;; + esac + ;; + esac + + # verify shader -> texture name case "$1" in textures/*x/*-*) pre=${1%%x/*}x @@ -173,12 +194,15 @@ parse_shaderstage() parse_shader() { - use_texture "$parsing_shader" "$parsing_shader" self + use_texture "$parsing_shader" "$parsing_shader" shader while read L A1; do case "$L" in qer_editorimage\ *) use_texture "$parsing_shader" "$A1" editorimage ;; + skyparms\ *) + use_texture "$parsing_shader" "$A1" sky + ;; '{') parse_shaderstage ;;