launchChocolateDoom.sh 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 | heretic | hexen | hexdd] (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,heretic,hexen}/vanilla/*/*.wad -type f | 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 heretic hexen hexdd"
  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. heretic_mods="$base_dir/mods/vanilla/dimm_pal/her-pal.wad"
  59. hexen_mods="$base_dir/mods/vanilla/dimm_pal/hex-pal.wad"
  60. if [ -f ~/src/chocolate-doom/src/chocolate-doom ]; then
  61. engine_doom="~/src/chocolate-doom/src/chocolate-doom"
  62. engine_heretic="~/src/chocolate-doom/src/chocolate-heretic"
  63. engine_hexen="~/src/chocolate-doom/src/chocolate-hexen"
  64. else
  65. engine_doom="chocolate-doom"
  66. engine_heretic="chocolate-heretic"
  67. engine_hexen="chocolate-hexen"
  68. fi
  69. case "$iwad" in
  70. *doom*) mods=$doom_mods; engine=$engine_doom ;;
  71. *tnt*) mods=$doom_mods; engine=$engine_doom ;;
  72. *plutonia*) mods=$doom_mods; engine=$engine_doom ;;
  73. *heretic*) mods=$heretic_mods, engine=$engine_heretic ;;
  74. *hexen*) mods=$hexen_mods; engine=$engine_hexen ;;
  75. *hexdd*) mods=$hexen_mods; engine=$engine_hexen ;;
  76. esac
  77. $engine -fullscreen -config "$base_dir"/config/chocolate/config.ini -iwad "$base_dir"/wads/iwads/"$iwad".wad -file "$wad" $mods -savedir "$base_dir"/savegames/"$iwad"/ -skill 3 -warp 01