launchPrboomPlus.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/sh
  2. show_usage (){
  3. printf "Usage: $0 [options [parameters]]\n"
  4. printf "\n"
  5. printf "Mandatory options:\n"
  6. printf " -i|--iwad [doom | doom2 | tnt | plutonia] (Mandatory)\n"
  7. printf "\n"
  8. printf "Options:\n"
  9. printf " -w|--wads (wad or space separated wad list)\n"
  10. printf "\n"
  11. printf " -l|--list, list available wad files\n"
  12. printf " -h|--help, Print help\n"
  13. exit
  14. }
  15. if [ -z "$1" ]; then
  16. show_usage
  17. fi
  18. if { [ "$1" = --help ] || [ "$1" = -h ];}; then
  19. show_usage
  20. fi
  21. if { [ "$1" = --list ] || [ "$1" = -l ];}; then
  22. find "$HOME"/games/doom/wads/{doom,doom2,tnt,plutonia}/{vanilla,nolimit,boom}/*/*.wad -type f -printf "%T@ %Tc %p\n" | sort -rn | awk '{print $9}' >/dev/null 2>&1 | grep -v 'tex' | grep -v 'fix' | grep -v 'res' | grep -v 'demo' | grep -v 'credits'
  23. echo ""
  24. exit
  25. fi
  26. while [ -n "$1" ]; do
  27. case "$1" in
  28. --iwad | -i)
  29. shift
  30. echo "iwad: $1"
  31. iwad=$1
  32. ;;
  33. --wad | -w)
  34. shift
  35. echo "wad: $1"
  36. wad=$1
  37. ;;
  38. *)
  39. show_usage
  40. ;;
  41. esac
  42. shift
  43. done
  44. if [ -z "$iwad" ]; then
  45. show_usage
  46. fi
  47. if [ -z "$wad" ]; then
  48. show_usage
  49. fi
  50. iwads="doom doom2 tnt plutonia"
  51. echo "$iwads" | tr ' ' '\n' | while read -r item; do
  52. if [ "$item" = "$iwad" ]; then touch match; fi
  53. done
  54. if [ ! -f match ]; then echo "ERROR: $iwad is not a valid option, valid options are: $iwads"; exit 1; fi; rm match
  55. mods=
  56. base_dir="$HOME/games/doom"
  57. doom_mods="$base_dir/mods/vanilla/pk_doom_sfx/pk_doom_sfx_20120224.wad $base_dir/mods/vanilla/jovian_palette/JoyPal.wad"
  58. doom_config="$base_dir"/config/prboom-plus/prboom-plus_vanilla.cfg
  59. case "$iwad" in
  60. *doom*) mods=$doom_mods; config=$doom_config ;;
  61. *tnt*) mods=$doom_mods; config=$doom_config ;;
  62. *plutonia*) mods=$doom_mods; config=$doom_config ;;
  63. esac
  64. #if [ -f ~/src/prboom-plus/prboom2/prboom-plus ]; then
  65. # cd ~/src/prboom-plus/prboom2/ && ./prboom-plus -config "$config" -vidmode gl -complevel 17 -width 1920 -height 1080 -fullscreen -aspect 16:9 -iwad "$base_dir"/wads/iwads/"$iwad".wad -file "$wad" "$mods" -save "$base_dir"/savegames/"$iwad"/ -skill 3 -warp 01 && cd -
  66. #else
  67. prboom-plus -config "$config" -vidmode gl -complevel 17 -width 1920 -height 1080 -fullscreen -aspect 16:9 -iwad "$base_dir"/wads/iwads/"$iwad".wad -file "$wad" $mods -save "$base_dir"/savegames/"$iwad"/ -skill 3 -warp 01
  68. #fi