diff --git a/.scripts/TobyCustom/Brutal_Death_Match.sh b/.scripts/TobyCustom/Custom_Death_Match.sh similarity index 84% rename from .scripts/TobyCustom/Brutal_Death_Match.sh rename to .scripts/TobyCustom/Custom_Death_Match.sh index 58dadb0..fe61d9b 100755 --- a/.scripts/TobyCustom/Brutal_Death_Match.sh +++ b/.scripts/TobyCustom/Custom_Death_Match.sh @@ -4,11 +4,21 @@ gameOption=( "${gamePath}/TobyAccMod_V${tobyVersion}.pk3" "$gamePath/Addons/MENU/TobyV${tobyVersion%%-*}_"* - "$(find /usr/share/games/ -name 'Project_Brutality-master.pk3')" - "$(find ~/.local/games/doom -name 'Project_Brutality-master.pk3')" - "${gamePath}/TobyDeathArena_V1-0.wad" ) +# Get a list of pk3s to use for the custom death match. +mapfile -t pk3List < <(find "${gamePath}" -maxdepth 1 -mindepth 1 -size +100M -iname '*.pk3') +if [[ -e "${gamePath}/aoddoom1.wad" ]]; then + pk3List+=("${gamePath}/aoddoom1.wad") +fi + +declare -a pk3Menu +for i in "${pk3List[@]}" ; do + title="${i##*/}" + title="${title%.*}" + pk3Menu+=("${i}" "${title}") +done + # Death match setup ipAddress="$(dialog --backtitle "Deathmatch Options" \ --clear \ @@ -20,6 +30,13 @@ ipAddress="$(dialog --backtitle "Deathmatch Options" \ --inputbox "Enter ip or URL, required for join." -1 -1 --stdout)" buttonCode=$? [[ $buttonCode -eq 1 ]] && exit 0 +pk3="$(dialog --backtitle "Select Customization" \ + --clear \ + --no-tags \ + --cancel-label "Exit" \ + --ok-label "Next" \ + --menu "Please select one" 0 0 0 "${pk3Menu[@]}" --stdout)" +[[ $? -ne 0 ]] && exit 0 if [[ $buttonCode -eq 0 ]]; then if [[ "${#ipAddress}" -lt 3 ]]; then dialog --backtitle "Deathmatch" --clear --msgbox "No ip address or URL given." -1 -1 --stdout @@ -94,6 +111,10 @@ else ) fi +gameOption+=("${pk3}" + "${gamePath}/TobyDeathArena_V1-0.wad" +) + # Check for and include if present a wad. Some people may not have it. if [[ -e "${gamePath}/DoomMetalVol7.wad" ]]; then gameOption+=" DoomMetalVol7.wad"