]> git.rm.cloudns.org Git - xonotic/xonotic-maps.pk3dir.git/commitdiff
update the rules, more strict, see http://nopaste.linux-dev.org/?7646 or grep source...
authorRudolf Polzer <divverent@alientrap.org>
Wed, 28 Jul 2010 17:09:27 +0000 (19:09 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Wed, 28 Jul 2010 17:09:27 +0000 (19:09 +0200)
scripts/bigfan01.shader [deleted file]
scripts/model_bigfan01.shader [new file with mode: 0644]
scripts/shader-audit.sh

diff --git a/scripts/bigfan01.shader b/scripts/bigfan01.shader
deleted file mode 100644 (file)
index 001a496..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-models/mapobjects/fans/fanlight.tga
-{
- {
-       map models/fans/fanlight.tga
-       blendfunc add
-       tcmod rotate 40
- }
-}
-
-models/mapobjects/fans/fanshadow.tga
-{
- {
-       map models/fans/fanshadow.tga
-       blendfunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
-       tcmod rotate 40
- }
-}
diff --git a/scripts/model_bigfan01.shader b/scripts/model_bigfan01.shader
new file mode 100644 (file)
index 0000000..001a496
--- /dev/null
@@ -0,0 +1,17 @@
+models/mapobjects/fans/fanlight.tga
+{
+ {
+       map models/fans/fanlight.tga
+       blendfunc add
+       tcmod rotate 40
+ }
+}
+
+models/mapobjects/fans/fanshadow.tga
+{
+ {
+       map models/fans/fanshadow.tga
+       blendfunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+       tcmod rotate 40
+ }
+}
index af3d03e59b76b8f5e907977fac1131f4eeeedeb6..f7c0b95a4af02708cb12bac8a827726395c0f3b1 100644 (file)
@@ -56,6 +56,7 @@ use_texture()
        fi
 
        case "$3" in
+               ## RULE: skyboxes must lie in env/
                sky)
                        case "$2" in
                                env/*)
@@ -65,6 +66,7 @@ use_texture()
                                        ;;
                        esac
                        ;;
+               ## RULE: non-skyboxes must not lie in env/
                *)
                        case "$2" in
                                env/*)
@@ -78,10 +80,10 @@ use_texture()
 
        # verify shader -> texture name
        case "$1" in
+               ## RULE: textures/FOOx/BAR-BAZ must use textures/FOO/*/*, recommended textures/FOO/BAR/BAZ
                textures/*x/*-*)
                        pre=${1%%x/*}x
                        suf=${1#*x/}
-                       # rule: in suffix part, change each - to /
                        suf="`echo "$suf" | sed 's,-,/,g'`"
                        case "$2" in
                                "$pre"/*/*)
@@ -91,6 +93,7 @@ use_texture()
                                        ;;
                        esac
                        ;;
+               ## RULE: textures/FOOx/BAR must use textures/FOO/*/*, recommended textures/FOO/base/BAR
                textures/*x/*)
                        pre=${1%%x/*}x
                        suf=${1#*x/}
@@ -102,6 +105,7 @@ use_texture()
                                        ;;
                        esac
                        ;;
+               ## RULE: textures/map_FOO[_/]* must use textures/map_FOO[_/]*
                textures/map_*/*)
                        pre=${1%%/map_*}
                        suf=${1#*/map_}
@@ -114,6 +118,7 @@ use_texture()
                                        ;;
                        esac
                        ;;
+               ## RULE: textures/common/FOO must use textures/common/FOO or textures/common/*/*
                textures/common/*)
                        case "$2" in
                                "$1")
@@ -125,10 +130,11 @@ use_texture()
                                        ;;
                        esac
                        ;;
+               ## RULE: textures/FOO/* must use textures/FOO/*, for FOO in decals, liquids_water, liquids_slime, liquids_lava, warpzone
                textures/decals/*|textures/liquids_water/*|textures/liquids_slime/*|textures/liquids_lava/*|textures/warpzone/*)
-                       prefix=${1%%_*}
+                       pre=${1%/*}
                        case "$2" in
-                               "$prefix"_*|"$prefix")
+                               "$pre"/*)
                                        # I _suppose_ this is fine, as tZork committed this pack
                                        ;;
                                *)
@@ -136,6 +142,7 @@ use_texture()
                                        ;;
                        esac
                        ;;
+               ## RULE: textures/skies/FOO or textures/skies/FOO_BAR must use textures/skies/FOO respective textures/skies/FOO_BAR as preview image, and env/FOO[_/]* as skybox
                textures/skies/*)
                        sky=${1#textures/skies/}
                        sky=${sky%%_*}
@@ -151,6 +158,7 @@ use_texture()
                                        ;;
                        esac
                        ;;
+               ## RULE: models/* must use models/*
                models/*)
                        case "$2" in
                                models/*)
@@ -220,17 +228,25 @@ parse_shader()
 parse_shaderfile()
 {
        case "$1" in
+               ## RULE: map_FOO.shader may define tetxures/map_FOO_* and textures/map_FOO/*
                map_*)
                        allowed_prefixes="textures/map_`echo "$1" | cut -d _ -f 2`_ textures/map_`echo "$1" | cut -d - -f 2`/"
                        forbidden_prefixes=
                        ;;
+               ## RULE: skies_FOO.shader may define tetxures/skies/FOO and textures/skies/FOO_*
                skies_*)
                        allowed_prefixes="textures/skies/`echo "$1" | cut -d _ -f 2`: textures/skies/`echo "$1" | cut -d _ -f 2`_"
                        forbidden_prefixes=
                        ;;
+               ## RULE: model_*.shader may define models/*
+               model_*)
+                       allowed_prefixes="models/"
+                       forbidden_prefixes=
+                       ;;
+               ## RULE: any other FOO.shader may define textures/FOO/*
                *)
-                       allowed_prefixes=
-                       forbidden_prefixes="textures/skies/ textures/map_"
+                       allowed_prefixes="textures/$1/"
+                       forbidden_prefixes="textures/skies/ textures/map_ models/"
                        ;;
        esac
        while read L; do