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