momento/make_filepaths.sh

31 lines
767 B
Bash
Raw Normal View History

#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-or-later
2021-04-08 15:34:16 +02:00
# Copyright (C) 2021 KikooDX
printf '/* SPDX-License-Identifier: GPL-3.0-or-later */\n'
printf '#pragma once\n'
printf '#include <stdint.h>\n\n'
printf 'static const uint16_t filepaths[][64] = {\n'
cd assets/levels
for PACK in *; do
PACK_NAME="$(basename $PACK)"
cd "$PACK"
for LEVEL in *; do
LEVEL_NAME="$(basename $LEVEL | cut -c2- |
2021-04-08 00:38:40 +02:00
awk -F '.' '{print $1}' |
tr '[:lower:]' '[:upper:]')"
[ -z "$LEVEL_NAMES" ] &&
LEVEL_NAMES="
\"$LEVEL_NAME\"" ||
LEVEL_NAMES="$LEVEL_NAMES,
\"$LEVEL_NAME\""
2021-04-08 00:38:40 +02:00
printf '\tu"\\\\\\\\fls0\\\\mtem\\\\%s\\\\' "$PACK_NAME"
printf '%s",\n' "$LEVEL"
done
cd ..
done
printf '};\n'
printf 'static const char level_names[][32] = { %s\n};\n' "$LEVEL_NAMES"