launchGzdoom.sh 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #!/bin/sh
  2. # fail if any commands fails
  3. #set -e
  4. # debug log
  5. #set -x
  6. show_usage (){
  7. printf "Usage: $0 [options [parameters]]\n"
  8. printf "\n"
  9. printf "Mandatory options:\n"
  10. printf " -i|--iwad [doom | doom2 | tnt | plutonia | heretic | hexen | hexdd | square ] (Mandatory)\n"
  11. printf "\n"
  12. printf "Options:\n"
  13. printf " -w|--wads (wad or space separated wad list)\n"
  14. printf " -b|--brutal (add brutal mod)\n"
  15. printf "\n"
  16. printf " -l|--list, list available wad files\n"
  17. printf " -h|--help, Print help\n"
  18. exit
  19. }
  20. if [ -z "$1" ]; then
  21. show_usage
  22. fi
  23. if { [ "$1" = --help ] || [ "$1" = -h ];}; then
  24. show_usage
  25. fi
  26. if { [ "$1" = --list ] || [ "$1" = -l ];}; then
  27. find "$HOME"/games/doom/wads/{doom,doom2,tnt,plutonia,heretic,hexen,square}/{vanilla,nolimit,boom,zdoom}/*/{*.wad,*.pk3} -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'
  28. echo ""
  29. exit
  30. fi
  31. while [ -n "$1" ]; do
  32. case "$1" in
  33. --iwad | -i)
  34. shift
  35. echo "iwad: $1"
  36. iwad=$1
  37. ;;
  38. --wad | -w)
  39. shift
  40. echo "wad: $1"
  41. wad=$1
  42. ;;
  43. --brutal)
  44. shift
  45. mod_brutal=1
  46. ;;
  47. --beautiful)
  48. shift
  49. mod_beautiful=1
  50. ;;
  51. *)
  52. show_usage
  53. ;;
  54. esac
  55. shift
  56. done
  57. if [ -z "$iwad" ]; then
  58. show_usage
  59. fi
  60. if [ -z "$wad" ]; then
  61. show_usage
  62. fi
  63. iwads="doom doom2 tnt plutonia heretic hexen hexdd square jazz"
  64. echo "$iwads" | tr ' ' '\n' | while read -r item; do
  65. if [ "$item" = "$iwad" ]; then touch match; fi
  66. done
  67. if [ ! -f match ]; then echo "ERROR: $iwad is not a valid option, valid options are: $iwads"; exit 1; fi; rm match
  68. mods=
  69. base_dir="$HOME"/games/doom
  70. doom_mods="$base_dir/mods/vanilla/pk_doom_sfx/pk_doom_sfx_20120224.wad $base_dir/mods/vanilla/jovian_palette/JoyPal.wad $base_dir/mods/zdoom/vanilla_essence/vanilla_essence_4_3.pk3"
  71. heretic_mods="$base_dir/mods/vanilla/dimm_pal/her-pal.wad $base_dir/mods/zdoom/vanilla_essence/vanilla_essence_4_3.pk3"
  72. hexen_mods="$base_dir/mods/vanilla/dimm_pal/hex-pal.wad $base_dir/mods/zdoom/vanilla_essence/vanilla_essence_4_3.pk3"
  73. if [ $mod_brutal = 1 ]; then
  74. doom_mods="$doom_mods $base_dir/mods/zdoom/brutal/brutal_doom/brutalv21.11.3.pk3"
  75. heretic_mods="$heretic_mods $base_dir/mods/zdoom/brutal/brutal_heretic/Heretic-Shadow_Collection/1_BRUTAL_HERETIC/BrutalHereticRPG_V5.0.pk3"
  76. hexen_mods="$hexen_mods $base_dir/mods/zdoom/brutal/brutal_hexen/Hexen/1_BRUTAL_HEXEN/BrutalHexenRPG_V4.7.pk3"
  77. fi
  78. if [ $mod_beautiful = 1 ]; then
  79. doom_mods="$doom_mods $base_dir/mods/zdoom/beautiful_doom/beautiful_doom_716.pk3"
  80. heretic_mods="$base_dir/mods/vanilla/dimm_pal/her-pal.wad $base_dir/mods/zdoom/vanilla_essence/vanilla_essence_4_3.pk3"
  81. hexen_mods="$base_dir/mods/vanilla/dimm_pal/hex-pal.wad $base_dir/mods/zdoom/vanilla_essence/vanilla_essence_4_3.pk3"
  82. fi
  83. doom_config="$base_dir"/config/zdoom/config_zdoom.ini
  84. heretic_config="$base_dir"/config/zdoom/config_zdoom.ini
  85. hexen_config="$base_dir"/config/zdoom/config_zdoom.ini
  86. square_config="$base_dir"/config/zdoom/config_square.ini
  87. jazz_config="$base_dir"/config/zdoom/config_jazz.ini
  88. case "$iwad" in
  89. *doom*) mods=$doom_mods; config=$doom_config ;;
  90. *tnt*) mods=$doom_mods; config=$doom_config ;;
  91. *plutonia*) mods=$doom_mods; config=$doom_config ;;
  92. *heretic*) mods=$heretic_mods; config=$heretic_config ;;
  93. *hexen*) mods=$hexen_mods; config=$hexen_config ;;
  94. *hexdd*) mods=$hexen_mods; config=$hexen_config ;;
  95. *square*) mods=""; config=$square_config ;;
  96. *jazz*) mods=""; config=$jazz_config ;;
  97. esac
  98. if [ -f ~/src/gzdoom/build/gzdoom ]; then
  99. cd ~/src/gzdoom/build/ && ./gzdoom -config "$config" -width 1920 -height 1080 -fullscreen -iwad "$base_dir"/wads/iwads/"$iwad".wad -file "$wad" $mods -savedir "$base_dir"/savegames/"$iwad"/ -skill 3 -warp 01 && cd -
  100. else
  101. gzdoom -config "$config" -width 1920 -height 1080 -fullscreen -iwad "$base_dir"/wads/iwads/"$iwad".wad -file "$wad" $mods -savedir "$base_dir"/savegames/"$iwad"/ -skill 3 -warp 01
  102. fi