Add a system for loading custom mods for TobyDoom. Place scripts in the TobyCustom directory. Included three examples using Project Brutality.

This commit is contained in:
Storm Dragon 2024-04-15 20:33:58 -04:00
parent f00785ba20
commit 1280a40c6f
4 changed files with 119 additions and 16 deletions

View File

@ -6,33 +6,33 @@ export DIALOGOPTS='--no-lines --visit-items'
# Path where doom wads are stored # 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. # Path to gzdoom.
gzdoom="$(command -v gzdoom)" export gzdoom="$(command -v gzdoom)"
# Version of the accessibility mod # Version of the accessibility mod
tobyVersion="7-0" export tobyVersion="7-0"
tobyShortVersion=7
doomGames=( export doomGames=(
# Toby demo map # 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. # 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 # 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 # 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' '-v'
'-e' '^Resolution:' '-e' '^Resolution:'
) )
grepStrings=( export grepStrings=(
'-E' '-E'
'-e' '^[A-Z][0-9a-z]+: .+' '-e' '^[A-Z][0-9a-z]+: .+'
'-e' 'is now known as' '-e' 'is now known as'
@ -56,13 +56,34 @@ grepStrings=(
'-e' '^You have no keys in your pocket!$' '-e' '^You have no keys in your pocket!$'
) )
sedStrings=( export sedStrings=(
'-e' 's/"cl_run" = "true"/run/' '-e' 's/"cl_run" = "true"/run/'
'-e' 's/"cl_run" = "false"/walk/' '-e' 's/"cl_run" = "false"/walk/'
'-e' 's:.*/:Game saved. (:' '-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 \ --clear \
--no-tags \ --no-tags \
--ok-label "Single Player" \ --ok-label "Single Player" \
@ -81,7 +102,7 @@ case ${buttonCode} in
1) 1)
# Death match setup # Death match setup
# Ignore the choice of map made above # 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" \ ipAddress="$(dialog --backtitle "Deathmatch Options" \
--clear \ --clear \
--no-tags \ --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 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) 0)
pushd "${doomPath}" if [[ "${gameOption%% *}" == "custom_game" ]]; then
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 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 esac

View File

@ -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

View File

@ -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

View File

@ -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