Work on freedoom launcher to support deathmatch, some parts are currently hard coded.

This commit is contained in:
Michael Taboada 2024-01-21 10:12:55 -08:00
parent 73d3ad2c2b
commit e62533b2ce

View File

@ -61,10 +61,73 @@ fi
case ${buttonCode} in
1)
# Death match setup
dialog --backtitle "Death Match" \
# Ignore the choice of map made above
gameOption="${doomPath}/TobyAccMod_V${tobyVersion}.pk3 ${doomPath}/TobyDeathArena_V1-0.wad"
ipAddress="$(dialog --backtitle "Deathmatch Options" \
--clear \
--msgbox "Coming soon!" -1 -1 --stdout
exit 1
--no-tags \
--ok-label "Join" \
--cancel-label "Exit" \
--extra-button \
--extra-label "Host" \
--inputbox "Enter ip or URL, required for join." -1 -1 --stdout)"
buttonCode=$?
[[ $buttonCode -eq 1 ]] && 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
exit 1
fi
flags=('-join' "${ipAddress}")
else
# List of maps included:
maps=(
"1" "Com Station (2-4 players)"
"2" "Warehouse (2-4 players)"
"3" "Sector 3 (2-4 players)"
"4" "Dungeon of Doom (2-4 players)"
"5" "Ocean Fortress (2-4 players)"
"6" "Water Treatment Facility (2-4 players)"
"7" "Phobos Base Site 4 (2-4 players)"
"8" "Hangar Bay 18 (2-4 players)")
# Array of how many players a given map supports in dialog rangebox syntax
declare -a mapPlayers=(
[1]="2 4"
[2]="2 4"
[3]="2 4"
[4]="2 4"
[5]="2 4"
[6]="2 4"
[7]="2 4"
[8]="2 4")
# Dialog statement to choose map goes here
map="1"
# Get ip address
yourIpAddress="$(curl -4s https://icanhazip.com)"
players="$(dialog --backtitle "Host Deathmatch Game" \
--clear \
--ok-label "Next" \
--cancel-label "Exit" \
--rangebox "Select number of players. Remember to give them your IP address: ${yourIpAddress}" -1 -1 ${mapPlayers[$map]} --stdout)"
[[ $? -eq 1 ]] && exit 0
skillLevel="$(dialog --backtitle "Host Deathmatch Game" \
--clear \
--ok-label "Start" \
--cancel-label "Exit" \
--rangebox "Select difficulty. 1 easiest, 5 hardest." -1 -1 1 5 3 --stdout)"
[[ $? -eq 1 ]] && exit 0
flags=(
'-host' "${players}"
'-skill' "${skillLevel}"
'-deathmatch'
'+set' 'sv_cheats' '1'
'+fraglimit' '20' # Change this to be user selectable
'+dmflags' '16384' '+dmflags' '4' '+dmflags' '128' '+dmflags' '4096'
'-extratic' '-dup' '3'
'-warp' "$map"
)
fi
exec stdbuf -oL ${gzdoom} ${gameOption} "${flags[@]}" | stdbuf -oL grep "${grepStrings[@]}" | stdbuf -oL sed "${sedStrings[@]}" | spd-say -e
;;
2)
# Exit was pressed, so exit.