From 1280a40c6faccb62df80a6968d402ef72e3054e9 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 15 Apr 2024 20:33:58 -0400 Subject: [PATCH] Add a system for loading custom mods for TobyDoom. Place scripts in the TobyCustom directory. Included three examples using Project Brutality. --- .scripts/FreeDoom.sh | 57 +++++++++++++------ .../Project_Brutality_Operation_MDK.sh | 26 +++++++++ .../Project_Brutality_Toby_Deluxe.sh | 26 +++++++++ .../TobyCustom/Project_Brutality_Toby_Demo.sh | 26 +++++++++ 4 files changed, 119 insertions(+), 16 deletions(-) create mode 100755 .scripts/TobyCustom/Project_Brutality_Operation_MDK.sh create mode 100755 .scripts/TobyCustom/Project_Brutality_Toby_Deluxe.sh create mode 100755 .scripts/TobyCustom/Project_Brutality_Toby_Demo.sh diff --git a/.scripts/FreeDoom.sh b/.scripts/FreeDoom.sh index e57eb65..0cc07c7 100755 --- a/.scripts/FreeDoom.sh +++ b/.scripts/FreeDoom.sh @@ -6,33 +6,33 @@ export DIALOGOPTS='--no-lines --visit-items' # Path where doom wads are stored -doomPath="$(find /usr/share -type d -name "doom" 2> /dev/null | head -1)" +export doomPath="$(find /usr/share -type d -name "doom" 2> /dev/null | head -1)" # Path to gzdoom. -gzdoom="$(command -v gzdoom)" +export gzdoom="$(command -v gzdoom)" # Version of the accessibility mod -tobyVersion="7-0" -tobyShortVersion=7 +export tobyVersion="7-0" -doomGames=( +export doomGames=( # Toby demo map - "TobyAccMod_V${tobyVersion}.pk3 Toby-Demo-Level.wad ""$doomPath/Addons/TobyV${tobyShortVersion}_"* "Freedoom Toby Demo Map" + "TobyAccMod_V${tobyVersion}.pk3 Toby-Demo-Level.wad ""$doomPath/Addons/TobyV${tobyVersion%%-*}_"* "Freedoom Toby Demo Map" # Unmodified Doom with accessibility. - "TobyAccMod_V${tobyVersion}.pk3 ""$doomPath/Addons/TobyV${tobyShortVersion}_"* "Freedoom" + "TobyAccMod_V${tobyVersion}.pk3 ""$doomPath/Addons/TobyV${tobyVersion%%-*}_"* "Freedoom" # Toby accessibility mods - "TobyAccMod_V${tobyVersion}.pk3 TobyDoomLevels.wad ""$doomPath/Addons/TobyV${tobyShortVersion}_"* "Freedoom Toby Delux Map Pack" + "TobyAccMod_V${tobyVersion}.pk3 TobyDoomLevels.wad ""$doomPath/Addons/TobyV${tobyVersion%%-*}_"* "Freedoom Toby Delux Map Pack" # OperationMDK - "TobyAccMod_V${tobyVersion}.pk3 OpMDK.wad ""$doomPath/Addons/TobyV${tobyShortVersion}_"* "Freedoom OperationMDK" + "TobyAccMod_V${tobyVersion}.pk3 OpMDK.wad ""$doomPath/Addons/TobyV${tobyVersion%%-*}_"* "Freedoom OperationMDK" + "custom_game" "Custom Game" ) -antiGrepStrings=( +export antiGrepStrings=( '-E' '-v' '-e' '^Resolution:' ) -grepStrings=( +export grepStrings=( '-E' '-e' '^[A-Z][0-9a-z]+: .+' '-e' 'is now known as' @@ -56,13 +56,34 @@ grepStrings=( '-e' '^You have no keys in your pocket!$' ) -sedStrings=( +export sedStrings=( '-e' 's/"cl_run" = "true"/run/' '-e' 's/"cl_run" = "false"/walk/' '-e' 's:.*/:Game saved. (:' ) -gameOption="$(dialog --backtitle "Select your Doom!" \ +custom_game() { + mapfile -t customGames < <(find "${0%/*}/TobyCustom/" -type f -iname '*.sh') + declare -a customMenu + for i in "${customGames[@]}" ; do + customMenu+=("$i") + title="${i##*/}" + title="${title//_/ }" + title="${title%.*}" + customMenu+=("$title") + done + customGame="$(dialog --backtitle "Select your Custom Doom!" \ + --clear \ + --no-tags \ + --menu "Please select one" 0 0 0 "${customMenu[@]}" --stdout)" + buttonCode=$? + if [[ $buttonCode -eq 1 ]]; then + exit 0 + fi + source "${customGame}" +} + +export gameOption="$(dialog --backtitle "Select your Doom!" \ --clear \ --no-tags \ --ok-label "Single Player" \ @@ -81,7 +102,7 @@ case ${buttonCode} in 1) # Death match setup # Ignore the choice of map made above - gameOption="${doomPath}/TobyAccMod_V${tobyVersion}.pk3 ${doomPath}/TobyDeathArena_V1-0.wad ""$doomPath/Addons/TobyV${tobyShortVersion}_"* + gameOption="${doomPath}/TobyAccMod_V${tobyVersion}.pk3 ${doomPath}/TobyDeathArena_V1-0.wad ""$doomPath/Addons/TobyV${tobVersion%%-*}_"* ipAddress="$(dialog --backtitle "Deathmatch Options" \ --clear \ --no-tags \ @@ -221,8 +242,12 @@ case ${buttonCode} in exec stdbuf -oL ${gzdoom} ${gameOption} "${flags[@]}" | while IFS= read -r l ; do echo "$l" | { grep "${grepStrings[@]}" | grep "${antiGrepStrings[@]}" | sed "${sedStrings[@]}" | spd-say -e ${spd_module} ${spd_pitch} ${spd_rate} ${spd_voice} ${spd_volume} --; } ; echo "$l";done ;; 0) - pushd "${doomPath}" - exec stdbuf -oL ${gzdoom} ${gameOption} | while IFS= read -r l ; do echo "$l" | { grep "${grepStrings[@]}" | grep "${antiGrepStrings[@]}" | sed "${sedStrings[@]}" | spd-say -e ${spd_module} ${spd_pitch} ${spd_rate} ${spd_voice} ${spd_volume} -- > /dev/null 2>&1; }; echo "$l";done + if [[ "${gameOption%% *}" == "custom_game" ]]; then + custom_game + else + pushd "${doomPath}" + exec stdbuf -oL ${gzdoom} ${gameOption} | while IFS= read -r l ; do echo "$l" | { grep "${grepStrings[@]}" | grep "${antiGrepStrings[@]}" | sed "${sedStrings[@]}" | spd-say -e ${spd_module} ${spd_pitch} ${spd_rate} ${spd_voice} ${spd_volume} -- > /dev/null 2>&1; }; echo "$l";done + fi ;; esac diff --git a/.scripts/TobyCustom/Project_Brutality_Operation_MDK.sh b/.scripts/TobyCustom/Project_Brutality_Operation_MDK.sh new file mode 100755 index 0000000..0988f2c --- /dev/null +++ b/.scripts/TobyCustom/Project_Brutality_Operation_MDK.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# Add all the TobyDoom stuff we need, exclude things we do not. +mapfile -t addons < <(find "${doomPath}/Addons/" -type f -iname "TobyV${tobyVersion%%-*}_*" \ + -not -iname "TobyV${tobyVersion%%-*}_Decorations.pk3" \ +) + +# Set up the pk3 and wad files +gameOption=( + "$(find /usr/share/games/ -name 'Project_Brutality-master.pk3')" + "${doomPath}/TobyAccMod_V${tobyVersion}.pk3" + ${addons[@]} + "${doomPath}/OpMDK.wad" +) + +# Check for and include if present a wad. Some people may not have it. +if [[ -e "${doomPath}/DoomMetalVol6.wad" ]]; then + gameOption+=("${doomPath}/DoomMetalVol6.wad") +fi + +# Extend the search for new messages to be read. +grepStrings+=('-e' 'New PDA Entry:') + +# Launch the game and pipe things to be spoken through speech-dispatcher. +# This also leaves the console output intact for people who may want to read it. +exec stdbuf -oL ${gzdoom} ${gameOption[@]} | while IFS= read -r l ; do echo "$l" | { grep "${grepStrings[@]}" | grep "${antiGrepStrings[@]}" | sed "${sedStrings[@]}" | spd-say -e ${spd_module} ${spd_pitch} ${spd_rate} ${spd_voice} ${spd_volume} -- > /dev/null 2>&1; }; echo "$l";done diff --git a/.scripts/TobyCustom/Project_Brutality_Toby_Deluxe.sh b/.scripts/TobyCustom/Project_Brutality_Toby_Deluxe.sh new file mode 100755 index 0000000..203386f --- /dev/null +++ b/.scripts/TobyCustom/Project_Brutality_Toby_Deluxe.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# Add all the TobyDoom stuff we need, exclude things we do not. +mapfile -t addons < <(find "${doomPath}/Addons/" -type f -iname "TobyV${tobyVersion%%-*}_*" \ + -not -iname "TobyV${tobyVersion%%-*}_Decorations.pk3" \ +) + +# Set up the pk3 and wad files +gameOption=( + "$(find /usr/share/games/ -name 'Project_Brutality-master.pk3')" + "${doomPath}/TobyAccMod_V${tobyVersion}.pk3" + ${addons[@]} + "${doomPath}/TobyDoomLevels.wad" +) + +# Check for and include if present a wad. Some people may not have it. +if [[ -e "${doomPath}/DoomMetalVol6.wad" ]]; then + gameOption+=("${doomPath}/DoomMetalVol6.wad") +fi + +# Extend the search for new messages to be read. +grepStrings+=('-e' 'New PDA Entry:') + +# Launch the game and pipe things to be spoken through speech-dispatcher. +# This also leaves the console output intact for people who may want to read it. +exec stdbuf -oL ${gzdoom} ${gameOption[@]} | while IFS= read -r l ; do echo "$l" | { grep "${grepStrings[@]}" | grep "${antiGrepStrings[@]}" | sed "${sedStrings[@]}" | spd-say -e ${spd_module} ${spd_pitch} ${spd_rate} ${spd_voice} ${spd_volume} -- > /dev/null 2>&1; }; echo "$l";done diff --git a/.scripts/TobyCustom/Project_Brutality_Toby_Demo.sh b/.scripts/TobyCustom/Project_Brutality_Toby_Demo.sh new file mode 100755 index 0000000..d466ae2 --- /dev/null +++ b/.scripts/TobyCustom/Project_Brutality_Toby_Demo.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# Add all the TobyDoom stuff we need, exclude things we do not. +mapfile -t addons < <(find "${doomPath}/Addons/" -type f -iname "TobyV${tobyVersion%%-*}_*" \ + -not -iname "TobyV${tobyVersion%%-*}_Decorations.pk3" \ +) + +# Set up the pk3 and wad files +gameOption=( + "$(find /usr/share/games/ -name 'Project_Brutality-master.pk3')" + "${doomPath}/TobyAccMod_V${tobyVersion}.pk3" + ${addons[@]} + "${doomPath}/Toby-Demo-Level.wad" +) + +# Check for and include if present a wad. Some people may not have it. +if [[ -e "${doomPath}/DoomMetalVol6.wad" ]]; then + gameOption+=("${doomPath}/DoomMetalVol6.wad") +fi + +# Extend the search for new messages to be read. +grepStrings+=('-e' 'New PDA Entry:') + +# Launch the game and pipe things to be spoken through speech-dispatcher. +# This also leaves the console output intact for people who may want to read it. +exec stdbuf -oL ${gzdoom} ${gameOption[@]} | while IFS= read -r l ; do echo "$l" | { grep "${grepStrings[@]}" | grep "${antiGrepStrings[@]}" | sed "${sedStrings[@]}" | spd-say -e ${spd_module} ${spd_pitch} ${spd_rate} ${spd_voice} ${spd_volume} -- > /dev/null 2>&1; }; echo "$l";done