+ if [ -n "$AUDIT_ALPHACHANNELS" ] && [ -n "$maintexture" ] && ! $textureblending; then
+ getstats "../$maintexture.tga" || getstats "../$maintexture.png" || getstats "../$maintexture.jpg"
+ case "$mainblendfunc" in
+ *src_alpha*|*blend*)
+ # texture must have alpha
+ if [ x"$mainalphagen" = x"none" -a $min -eq 255 ]; then
+ err "$parsing_shader uses alpha-less texture $maintexture with blendfunc $mainblendfunc and alphagen $mainalphagen"
+ fi
+ ;;
+ add|"gl_one gl_one")
+ # texture must not have alpha (engine bug)
+ if [ x"$mainalphagen" != x"none" -o $min -lt 255 ]; then
+ err "$parsing_shader uses alpha-using texture $maintexture with blendfunc $mainblendfunc and alphagen $mainalphagen"
+ fi
+ ;;
+ *)
+ case "$mainalphafunc" in
+ g*)
+ # texture must have alpha
+ if [ x"$mainalphagen" = x"none" -a $min -eq 255 ]; then
+ err "$parsing_shader uses alpha-less texture $maintexture with alphafunc $mainalphafunc and alphagen $mainalphagen"
+ fi
+ ;;
+ *)
+ # texture should not have alpha (no bug if not)
+ case "$mainalphagen" in
+ none)
+ if [ $min -lt 255 ]; then
+ warn "$parsing_shader uses alpha-using texture $maintexture with blendfunc $mainblendfunc and alphafunc $mainalphafunc and alphagen $mainalphagen"
+ fi
+ ;;
+ *)
+ # alphagen is set, but blendfunc has no use for it
+ err "$parsing_shader uses alpha-using texture $maintexture with blendfunc $mainblendfunc and alphafunc $mainalphafunc and alphagen $mainalphagen"
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ fi