Accedi
IT
games/satisfying-bounce / tools / warm-notes.sh · commit 8bdd6e4
#!/usr/bin/env bash# Rebuilds src/Audio/Warm.php: the voices each scene plays (a run of 30 s of every scene with three seeds), so that a game played live# makes them in the background while the scene starts instead of in the middle of a bounce.#   tools/warm-notes.sh            (from the project root: bin/jumphp runs the throw-away test tests/WarmGenTest.php)set -euo pipefailcd "$(dirname "$0")/.."echo 1 > tests/.warmgentrap 'rm -f tests/.warmgen' EXIT../../bin/jumphp test satisfying-bounce tests/WarmGenTest.php >/dev/nullpython3 - <<'P'import jsond = json.load(open('var/warm.json'))lines = []for cls, notes in d.items():    rows = ', '.join("['%s', %s, %s, %s]" % (w, repr(float(f)), repr(float(l)), repr(float(v))) for w, f, l, v in notes)    lines.append("        \\%s::class => [%s]," % (cls.replace('\\\\', '\\'), rows))src = open('src/Audio/Warm.php').read()a = src.index('    private const NOTES = [')b = src.index('];', a) + 2src = src[:a] + "    private const NOTES = [\n" + "\n".join(lines) + "\n    ];" + src[b:]open('src/Audio/Warm.php', 'w').write(src)P