]> icculus.org git repositories - divverent/nexuiz.git/blob - data/maps/compile.sh
add a nice patch from esteel to fix the rapid weapon switching "NexMG"
[divverent/nexuiz.git] / data / maps / compile.sh
1 #!/bin/sh
2
3 : ignore <<'EOF'
4
5 Nexuiz map recompilation script
6
7 NOTE: to use this script, you need a shell script called q3map2 in your $PATH.
8       Mine looks like this:
9
10         #!/bin/sh
11         exec ~/bin/q3map2.x86 -threads 2 "$@"
12
13       Note that you can NOT call q3map2.x86 directly from $PATH, as it segfaults
14       then!
15
16 Usage:
17 sh compile.sh tznex01
18
19 EOF
20
21 settings_default="-samplesize 8::-deluxe -patchshadows -samples 3"
22 settings_farewell="-samplesize 8 -patchmeta::-deluxe -patchshadows -samples 3"
23 scale_bloodprison=1.2
24 scale_aggressor=1.25
25
26 set -ex
27
28 map2()
29 {
30         dir=`pwd`
31         # note: you are in data/maps. Removintg these two components...
32         dir=${dir%/*/*}
33
34         q3map2 -fs_basepath "$dir" -fs_game data -v "$@"
35 }
36
37 for MAP in "$@"; do
38         [ -f "$MAP.map" ]
39
40         # get settings for this map
41         eval s=\$settings_$MAP
42         [ -n "$s" ] || s=$settings_default
43         eval scale=\$scale_$MAP
44
45         # recompile it
46         if [ -n "$scale" ]; then
47                 if ! grep "_keeplights" "$MAP.map" >/dev/null; then
48                         echo "$MAP does not have _keeplights in worldspawn!"
49                         exit 1
50                 fi
51         fi
52         map2 -bsp -meta `echo "$s" | cut -d : -f 1` "$MAP.map" | tee    "$MAP.log"
53         if [ -n "$scale" ]; then
54                 map2 -scale "$scale" "$MAP.bsp"
55                 mv "${MAP}_s.bsp" "$MAP.bsp"
56         fi
57         map2 -vis       `echo "$s" | cut -d : -f 2` "$MAP.map" | tee -a "$MAP.log"
58         map2 -light     `echo "$s" | cut -d : -f 3` "$MAP.map" | tee -a "$MAP.log"
59         rm   -f                                     "$MAP.srf"
60 done