# Choice of maps
mapList=(
    "${gamePath}/OpMDK.wad"
    "${gamePath}/TobyDoomLevels.wad"
    "${gamePath}/Toby-Demo-Level.wad"
)
                                                                                                                                                                          
declare -a mapMenu=('none' 'None')
for i in "${mapList[@]}" ; do
    if [[ -e "$i" ]]; then
        title="${i##*/}"
        title="${title%.*}"
        title="${title/OpMDK/Operation MDK}"
        title="${title/-/ }"
        mapMenu+=("$i" "$title")
    fi
done
map="$(dialog --backtitle "Select Map" \
    --clear \
    --no-tags \
    --cancel-label "Exit" \
    --ok-label "Next" \
    --menu "Please select one" 0 0 0 "${mapMenu[@]}" --stdout)"
[[ $? -ne 0 ]] && exit 0
if [[ "${map}" != "none" ]]; then
    gameOption=("$map" "${gameOption[@]}")
fi
if [[ "${map}" == ""${gamePath}/TobyDoomLevels.wad"" ]]; then
    gameOption=("$map" "${gameOption[@]}" "${gamePath}/Toby-Doom-Level-Music-Renamer.pk3")
fi