hlac fix: proper size for textures, smaller scope, reposition of 1st person view
[divverent/nexuiz.git] / data / check-sounds.sh
1 #!/bin/sh
2
3 allsounds=`find sound -name .svn -prune -o \( -name \*.ogg -o -name \*.wav \) -print`
4 for S in $allsounds; do
5         SND=${S#sound/}
6         SND=${SND%.*}
7         if [ -f "sound/$SND.ogg" ] && [ -f "sound/$SND.wav" ]; then
8                 echo "$SND exists twice"
9         fi
10         case "$SND" in
11                 player/*/*)
12                         # verified by .sounds file check
13                         ;;
14                 ambient/*)
15                         # maps can use them always
16                         ;;
17                 weather/*)
18                         # maps can use them always
19                         ;;
20                 cdtracks/*)
21                         # maps can use them always
22                         ;;
23                 misc/footstep*)
24                         ;;
25                 misc/metalfootstep*)
26                         ;;
27                 misc/hitground*)
28                         ;;
29                 misc/metalhitground*)
30                         ;;
31                 misc/talk*) # engine
32                         ;;
33                 *)
34                         if ! grep -Er '"'$SND'\.(ogg|wav)"' qcsrc/server >/dev/null; then
35                                 echo "$S ($SND) is unused by the code"
36                         fi
37                         ;;
38         esac
39 done
40
41 LF="
42 "
43 allsounds="$LF`find sound/player -mindepth 2 -name .svn -prune -o \( -name \*.ogg -o -name \*.wav \) -print`$LF"
44 remainingsounds=$allsounds
45 psoundfile()
46 {
47         snd=$1
48         pat="$LF$snd$LF"
49         case "$allsounds" in
50                 *$pat*)
51                         case "$remainingsounds" in
52                                 *$pat*)
53                                         remainingsounds=${remainingsounds%%$pat*}$LF${remainingsounds#*$pat}
54                                         ;;
55                         esac
56                         return 0
57                         ;;
58                 *)
59                         return 1
60                         ;;
61         esac
62 }
63 psoundtry()
64 {
65         s=$1
66         psoundfile "$s.ogg" || psoundfile "$s.wav"
67 }
68 psound()
69 {
70         s=$1
71         if psoundtry "$s"; then
72                 :
73         else
74                 echo "$S references nonexisting sound $s"
75         fi
76 }
77
78 for S in models/player/*.sounds sound/player/default.sounds; do
79         if [ "$S" = "sound/player/default.sounds" ] || [ -f "${S#.sounds}" ]; then
80                 while read -r TITLE SOUND COUNT; do
81                         case "$TITLE" in
82                                 //*)
83                                         good=false
84                                         case "$COUNT" in
85                                                 0)
86                                                         if psoundtry "$SOUND"; then
87                                                                 good=false
88                                                         fi
89                                                         ;;
90                                                 *)
91                                                         for i in `seq 1 $COUNT`; do
92                                                                 if psoundtry "$SOUND$i"; then
93                                                                         good=true
94                                                                 fi
95                                                         done
96                                                         ;;
97                                         esac
98                                         if $good; then
99                                                 echo "$S references existing sound $SOUND but commented out"
100                                         fi
101                                         ;;
102                                 *[!a-z0-9]*)
103                                         echo "Unknown identifier $TITLE in $S"
104                                         ;;
105                                 *)
106                                         case "$COUNT" in
107                                                 0)
108                                                         psound "$SOUND"
109                                                         ;;
110                                                 *)
111                                                         for i in `seq 1 $COUNT`; do
112                                                                 psound "$SOUND$i"
113                                                         done
114                                                         ;;
115                                         esac
116                                         ;;
117                         esac
118                 done < "$S"
119         else
120                 echo "$S exists for nonexisting player model"
121         fi
122 done
123 for S in $remainingsounds; do
124         echo "$S is not used by any player model"
125 done
126
127 # tag check
128 for S in models/player/*.sounds; do echo -n `head -n 1 "$S"`"  "; md5sum "$S"; done | sort