Started work on a FreeDoom menu system in preparation for lots of new maps and options.

This commit is contained in:
Storm Dragon 2023-11-05 21:51:14 -05:00
parent ddc7fdcf3c
commit 2843b47192

48
.scripts/FreeDoom.sh Executable file
View File

@ -0,0 +1,48 @@
#!/usr/bin/env bash
menulist() {
# Args: tag item.
# returns: selected tag
dialog --backtitle "Select your Doom!" \
--clear \
--no-tags \
--menu "Please select one" 0 0 0 "${@}" --stdout
if [[ $? -ne 1 ]]; then
exit 0
fi
}
# Path where doom wads are stored
doomPath="$(find /usr/share -type d -name "doom" 2> /dev/null | head -1)"
# Path to gzdoom.
gzdoom="$(command -v gzdoom)"
# Version of the accessibility mod
tobyVersion="6-1"
doomGames=(
# Unmodified Doom with accessibility.
"${gzdoom} ${doomPath}/TobyAccMod_V${tobyVersion}.pk3" "FreeDoom"
# Toby accessibility mods
"${gzdoom} ${doomPath}/TobyAccMod_V${tobyVersion}.pk3 ${doomPath}/TobyDoomLevels.wad" "Freedoom Toby Mod"
# OperationMDK
"${gzdoom} ${doomPath}/TobyAccMod_V${tobyVersion}.pk3 ${doomPath}/OpMDK.wad" "Freedoom OperationMDK"
)
exec stdbuf -oL $(menulist "${doomGames[@]}") | stdbuf -oL grep -E \
-e '^[0-9]+\. ' \
-e '^"cl_run"' \
-e '^Game saved. ' \
-e '^A secret is revealed!$' \
-e '^MAP[0-9]*' \
-e '^Player was ' \
-e '^Please select a game wad \(or 0 to exit\):' \
-e '^You have no keys in your pocket!$' | stdbuf -oL sed \
-e 's/"cl_run" = "true"/run/' \
-e 's/"cl_run" = "false"/walk/' \
-e 's/MAP0\([1-9]\)/Map \1/' \
-e 's:.*/:Game saved. (:' | spd-say -e
exit 0