Attempt to place things not controlled by package managers in ~/.local/games.

This commit is contained in:
Storm Dragon 2024-07-31 02:18:36 -04:00
parent afa4e36d16
commit 550b990195
2 changed files with 22 additions and 19 deletions

View File

@ -5,6 +5,8 @@ DIALOG_ITEM_HELP=""
export DIALOGOPTS='--no-lines --visit-items'
# Toby games path
gamePath=~/.local/games/doom
# Path where doom wads are stored
export doomPath="$(find /usr/share -type d -name "doom" 2> /dev/null | head -1)"
@ -17,13 +19,13 @@ export tobyVersion="7-0"
doomGames=(
# Toby demo map
"TobyAccMod_V${tobyVersion}.pk3 Toby-Demo-Level.wad ""$doomPath/Addons/TobyV${tobyVersion%%-*}_"* "Freedoom Toby Demo Map"
"TobyAccMod_V${tobyVersion}.pk3 Toby-Demo-Level.wad ""$gamePath/Addons/TobyV${tobyVersion%%-*}_"* "Freedoom Toby Demo Map"
# Unmodified Doom with accessibility.
"TobyAccMod_V${tobyVersion}.pk3 ""$doomPath/Addons/TobyV${tobyVersion%%-*}_"* "Freedoom"
"TobyAccMod_V${tobyVersion}.pk3 ""$gamePath/Addons/TobyV${tobyVersion%%-*}_"* "Freedoom"
# Toby accessibility mods
"TobyAccMod_V${tobyVersion}.pk3 TobyDoomLevels.wad ""$doomPath/Addons/TobyV${tobyVersion%%-*}_"* "Freedoom Toby Delux Map Pack"
"TobyAccMod_V${tobyVersion}.pk3 TobyDoomLevels.wad ""$gamePath/Addons/TobyV${tobyVersion%%-*}_"* "Freedoom Toby Delux Map Pack"
# OperationMDK
"TobyAccMod_V${tobyVersion}.pk3 OpMDK.wad ""$doomPath/Addons/TobyV${tobyVersion%%-*}_"* "Freedoom OperationMDK"
"TobyAccMod_V${tobyVersion}.pk3 OpMDK.wad ""$gamePath/Addons/TobyV${tobyVersion%%-*}_"* "Freedoom OperationMDK"
"custom_game" "Custom Game"
)
@ -94,9 +96,9 @@ gameOption="$(dialog --backtitle "Select your Doom!" \
--help-label "Exit" \
--menu "Please select one" 0 0 0 "${doomGames[@]}" --stdout)"
buttonCode=$?
if [[ -e "${doomPath}/DoomMetalVol7.wad" ]]; then
if [[ -e "${gamePath}/DoomMetalVol7.wad" ]]; then
gameOption+=" DoomMetalVol7.wad"
elif [[ -e "${doomPath}/DoomMetalVol6.wad" ]]; then
elif [[ -e "${gamePath}/DoomMetalVol6.wad" ]]; then
gameOption+=" DoomMetalVol6.wad"
fi
@ -104,7 +106,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${tobVersion%%-*}_"*
gameOption="${gamePath}/TobyAccMod_V${tobyVersion}.pk3 ${gamePath}/TobyDeathArena_V1-0.wad ""$gamePath/Addons/TobyV${tobVersion%%-*}_"*
ipAddress="$(dialog --backtitle "Deathmatch Options" \
--clear \
--no-tags \
@ -189,7 +191,7 @@ case ${buttonCode} in
)
fi
pushd "$doomPath"
exec stdbuf -oL ${gzdoom} ${gameOption} "$doomPath/Addons/TobyV${tobyVersion%%-*}_"* "${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} "$gamePath/Addons/TobyV${tobyVersion%%-*}_"* "${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
;;
2)
# Exit was pressed, so exit.
@ -241,7 +243,7 @@ case ${buttonCode} in
)
fi
pushd "${doomPath}"
exec stdbuf -oL ${gzdoom} ${gameOption} "$doomPath/Addons/TobyV${tobyVersion%%-*}_"* "${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} "$gamePath/Addons/TobyV${tobyVersion%%-*}_"* "${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)
if [[ "${gameOption%% *}" == "custom_game" ]]; then

View File

@ -677,6 +677,7 @@ case "${game}" in
;;
"Freedoom")
tobyVersion="7-0"
mkdir -p "${installPath}/doom"
doomPath="$(find /usr/share -type d -name "doom" 2> /dev/null)"
if [[ ${#doomPath} -lt 5 ]]; then
dialog --backtitle "Linux Game Manager" \
@ -695,7 +696,7 @@ case "${game}" in
fi
fi
doomPath="$(find /usr/share -type d -name "doom" 2> /dev/null | head -1)"
if ! [[ -e "${doomPath}/DoomMetalVol6.wad" ]] && ! [[ -e "${doomPath}/DoomMetalVol7.wad" ]]; then
if ! [[ -e "${installPath}/doom/DoomMetalVol6.wad" ]] && ! [[ -e "${installPath}/doom/DoomMetalVol7.wad" ]]; then
alert
dialog --backtitle "Linux Game manager" \
--extra-button \
@ -718,18 +719,18 @@ case "${game}" in
echo "The next step may require your password."
echo "It is necessary to move the extracted files into their proper place."
alert
[[ -e "${cache}/DoomMetalVol6.wad" ]] && sudo mv "${cache}/DoomMetalVol6.wad" "${doomPath}/"
[[ -e "${cache}/DoomMetalVol7.wad" ]] && sudo mv "${cache}/DoomMetalVol7.wad" "${doomPath}/"
sudo unzip -n -d "${doomPath}" "${cache}/TobyAccessibilityMod_Version${tobyVersion}.zip"
sudo unzip -n -d "${doomPath}" "${cache}/OpMDK_ForV7-0.zip"
sudo cp -v "${cache}/keyshare-universal.pk3" "${doomPath}"
sudo rm -fv "${doomPath}/"*.{bat,exe}
[[ -e "${cache}/DoomMetalVol6.wad" ]] && mv "${cache}/DoomMetalVol6.wad" "${installPath}/doom"
[[ -e "${cache}/DoomMetalVol7.wad" ]] && sudo mv "${cache}/DoomMetalVol7.wad" "${installPath}/doom"
unzip -n -d "${installPath}/doom" "${cache}/TobyAccessibilityMod_Version${tobyVersion}.zip"
unzip -n -d "${installPath}/doom" "${cache}/OpMDK_ForV7-0.zip"
sudo cp -v "${cache}/keyshare-universal.pk3" "${installPath}/doom"
rm -fv "${installPath}/"*.{bat,exe}
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom"
cp "${doomPath}/TobyConfig.ini" "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom/gzdoom.ini"
cp "${doomPath}/zcajun/bots.cfg" "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom/"
sed -i "s;^\[IWADSearch.Directories\]$;[IWADSearch.Directories]\nPath=${doomPath};" "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom/gzdoom.ini"
sed -i "s;^\[FileSearch.Directories\]$;[FileSearch.Directories]\nPath=${doomPath};" "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom/gzdoom.ini"
sed -i "s;^\[SoundfontSearch.Directories\]$;[SoundfontSearch.Directories]\nPath=${doomPath}/fm_banks\nPath=${doomPath}/soundfonts;" "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom/gzdoom.ini"
sed -i "s;^\[IWADSearch.Directories\]$;[IWADSearch.Directories]\nPath=${doomPath}\nPath=${installPath}/doom;" "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom/gzdoom.ini"
sed -i "s;^\[FileSearch.Directories\]$;[FileSearch.Directories]\nPath=${doomPath}\nPath=${installPath}/doom;" "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom/gzdoom.ini"
sed -i "s;^\[SoundfontSearch.Directories\]$;[SoundfontSearch.Directories]\nPath=${doomPath}/fm_banks\nPath=${doomPath}/soundfonts\nPath=${installPath}/doom/soundfonts;" "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom/gzdoom.ini"
# sed -i 's/Mouse1=+attack/CTRL=+attack/' "${XDG_CONFIG_HOME:-$HOME/.config}/gzdoom/gzdoom.ini"
launcherPath="$(readlink -f "$0")"
launcherPath="${launcherPath%/*}"