make-example-wad.sh

changeset 10
f2eb2cd815e4
equal deleted inserted replaced
9:7e8ccf76a84d 10:f2eb2cd815e4
1 #!/bin/bash
2
3 acsdata=$(tempfile)
4 libname=$(basename $acsdata |head -c8)
5
6 echo -n "wad name: "
7 read name_of_wad
8
9 if [ -z "$name_of_wad" ]
10 then
11 name_of_wad=$acsdata
12 fi
13
14 if [ $(echo -n $name_of_wad |tail -c4) = ".pk3" ]
15 then
16 name_of_wad="${name_of_wad}.pk3"
17 fi
18
19 echo "using $name_of_wad as example WAD name"
20
21 zipname="${HOME}/Desktop/$name_of_wad"
22
23 if [ -f "$zipname" ]
24 then
25 echo "$zipname already exists" >/dev/null
26 rm -v $acsdata
27 exit 1
28 fi
29
30 vim $acsdata
31
32 if [ "$(wc -c $acsdata)" = "0" ]
33 then
34 echo "abort: no acs given" >/dev/null
35 fi
36
37 tmpdir=$(tempfile)
38 rm -f $tmpdir
39 mkdir $tmpdir
40 pushd $tmpdir
41 mkdir acs acs_src
42 echo "#include \"zcommon.acs\"" >>acs_src/scripts.acs
43 echo "#library \"$libname\"" >>acs_src/scripts.acs
44 cat ${acsdata} >>acs_src/scripts.acs
45
46 built=0
47 while [ ! -f acs/${libname}.o ]
48 do
49 acc -I ${HOME}/doom/acs acs_src/scripts.acs acs/${libname}.o
50
51 if [ ! -f acs/${libname}.o ]
52 then
53 echo -n "failed to build, please re-check your source: "
54 read answer
55 vim acs_src/scripts.acs
56 fi
57 done
58
59 echo "${libname}" >loadacs.txt
60 zip -r9 ${zipname} *
61 popd
62
63 rm -rv $tmpdir
64 rm -v $acsdata
65

mercurial