Rewrite of the menu system. Options for death match and co-op not net working, but coming soon. The default is single player, so for all intents and purposes it should work the same as always.
This commit is contained in:
parent
c4ed85ce08
commit
5e17fa9476
@ -1,17 +1,8 @@
|
||||
#!/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
|
||||
}
|
||||
# Dialog setup:
|
||||
DIALOG_ITEM_HELP=""
|
||||
export DIALOGOPTS='--no-lines --visit-items'
|
||||
|
||||
|
||||
# Path where doom wads are stored
|
||||
@ -33,18 +24,48 @@ doomGames=(
|
||||
"${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
|
||||
gameOption="$(dialog --backtitle "Select your Doom!" \
|
||||
--clear \
|
||||
--no-tags \
|
||||
--ok-label "Single Player" \
|
||||
--cancel-label "Death Match" \
|
||||
--extra-button \
|
||||
--extra-label "co-op" \
|
||||
--help-button \
|
||||
--help-label "Exit" \
|
||||
--menu "Please select one" 0 0 0 "${doomGames[@]}" --stdout)"
|
||||
buttonCode=$?
|
||||
|
||||
case ${buttonCode} in
|
||||
1)
|
||||
# Death match setup
|
||||
echo "Not yet implemented."
|
||||
exit 1
|
||||
;;
|
||||
2)
|
||||
# Exit was pressed, so exit.
|
||||
exit 0
|
||||
;;
|
||||
3)
|
||||
# Co-op setup
|
||||
echo "Not yet implemented."
|
||||
exit 1
|
||||
;;
|
||||
0)
|
||||
exec stdbuf -oL ${gameOption} | 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
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user