spacetaxi/tools/stsim/gateLib.sh
2026-10-13 13:56:35 -05:00

26 lines
1 KiB
Bash

# Sourced by gate.sh and celGate.sh, which set $here first: the rides both
# gates replay, and the levels they replay them on.
# Every screen as letter:level file number -- A..X and the 25th, Y -- and
# how long a ride may run.
ticks=4000
pairs="A:01 B:02 C:03 D:04 E:05 F:06 G:07 H:08 I:09 J:10 K:11 L:12 M:13 N:14 O:15 P:16 Q:17 R:18 S:19 T:20 U:21 V:22 W:23 X:24 Y:25"
# The game's own level bake (program.mk). It is the same STL5 bytes for every
# target, so whichever target was built first will do; STSIM_LEVELS names
# another folder.
levels=${STSIM_LEVELS:-}
if [ -z "$levels" ]; then
for bake in "$here"/../../build/generated/*/levels; do
if [ -f "$bake/level25.dat" ]; then
levels=$(cd "$bake" && pwd)
break
fi
done
fi
if [ -z "$levels" ]; then
echo "$(basename "$0"): no level bake in build/generated/<port>/levels (scripts/importData.sh, then make)" >&2
exit 2
fi
make -C "$here" >/dev/null || { echo "$(basename "$0"): building stsim failed" >&2; exit 2; }