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