-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild
executable file
·100 lines (81 loc) · 1.83 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env bash
#
# Settings
SHOCK2=${SHOCK2:=ss2}
THIEF1=${THIEF1:=t1}
THIEF2=${THIEF2:=t2}
SHOCK2_GAMESYS=${SHOCK2_GAMESYS:=shockscp.gam}
THIEF1_GAMESYS=${THIEF1_GAMESYS:=dark.gam}
THIEF2_GAMESYS=${THIEF2_GAMESYS:=dark.gam}
# Implementation
set -e
function main {
local cmds=()
while [[ $1 ]]; do
if [[ $1 == -- ]]; then
shift; break
elif [[ $1 == -* ]]; then
break
else
cmds+=("$1")
shift
fi
done
for cmd in "${cmds[@]}"; do
echo "build/$cmd"
build/$cmd "$@"
done
}
function build/clean {
git clean -fx maps/
}
function build/ss2 {
mkmaps ss2 "$@"
}
function build/ss2_ponterbee {
mkmaps ss2_ponterbee --strings game/ss2_ponterbee/strings/english "$@"
}
function build/ss2_nightwalker {
mkmaps ss2_nightwalker --strings game/ss2_nightwalker/strings/english "$@"
}
function build/ss2_polaris {
mkmaps ss2_polaris --strings game/ss2_polaris/strings/english "$@"
}
function build/t1 {
mkmaps t1 "$@"
}
function build/t2 {
mkmaps t2 "$@"
}
function build/all {
main ss2{,_ponterbee,_nightwalker,_polaris} t1 t2 zip -- "$@"
}
function build/deploy {
rsync -aPhv --delete-after maps/ funkyhorror:www/toxicfrog/maps/
}
function build/zip {
cd maps
for game in *; do
[[ -e $game/map.html ]] || continue
echo -n "${game}-maps.zip: "
rm -rf "zips/${game}-maps.zip"
zip -9qr "zips/${game}-maps.zip" "${game}"
echo "done."
done
cd ..
}
function mkmaps {
local game="$1"; shift
# FIXME: generalize strings, if they are useful for anything in T1/T2 -- book
# and scroll titles, maybe?
mkdir -p maps/$game
./mishtml \
--gamedir game/$game \
--propformat ${game%_*} \
--gameinfo gameinfo/${game%_*}-objects.lua,gameinfo/${game}-maps.lua \
--strings game/ss2/strings \
--html-out maps/$game \
"$@"
}
[[ $1 ]] || set -- all
main "$@"