launchCrispyDoom.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/bin/bash
  2. function 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,nolimit}/*/*.wad -type f -printf "%T@ %Tc %p\n" | sort -rn | awk '{print $9}' 2>/dev/null | grep -v 'tex' | grep -v 'fix' | grep -v 'res' | grep -v 'demo' | grep -v 'credits'
  23. #find ~/games/doom/wads/doom2/*/*/{*.wad,*.pk3} -printf "%T@ %Tc %p\n" | sort -rn | awk '{print $9}'
  24. echo ""
  25. exit
  26. fi
  27. while [ -n "$1" ]; do
  28. case "$1" in
  29. --iwad | -i)
  30. shift
  31. echo "iwad: $1"
  32. iwad=$1
  33. ;;
  34. --wad | -w)
  35. shift
  36. echo "wad: $1"
  37. wad=$1
  38. ;;
  39. *)
  40. show_usage
  41. ;;
  42. esac
  43. shift
  44. done
  45. if [ -z "$iwad" ]; then
  46. show_usage
  47. fi
  48. if [ -z "$wad" ]; then
  49. show_usage
  50. fi
  51. iwads=(doom doom2 tnt plutonia heretic hexen hexdd)
  52. if [[ " "${iwads[@]}" " != *" $iwad "* ]]; then
  53. echo "$iwad: not recognized. Valid environments are:"
  54. echo "${iwads[@]/%/,}"
  55. exit 1
  56. fi
  57. mods=
  58. base_dir="$HOME/games/doom"
  59. doom_mods="$base_dir/mods/vanilla/pk_doom_sfx/pk_doom_sfx_20120224.wad $base_dir/mods/vanilla/jovian_palette/JoyPal.wad"
  60. heretic_mods="$base_dir/mods/vanilla/dimm_pal/her-pal.wad"
  61. hexen_mods="$base_dir/mods/vanilla/dimm_pal/hex-pal.wad"
  62. doom_config="$base_dir"/config/crispy/config_nolimit.ini
  63. heretic_config="$base_dir"/config/crispy/config_nolimit_heretic.ini
  64. hexen_config="$base_dir"/config/crispy/config_nolimit_hexen.ini
  65. if [ -f ~/src/crispy-doom/src/crispy-doom ]; then
  66. engine_doom="~/src/crispy-doom/src/crispy-doom"
  67. engine_heretic="~/src/crispy-doom/src/crispy-heretic"
  68. engine_hexen="~/crispy-doom/src/crispy-hexen"
  69. else
  70. engine_doom="crispy-doom"
  71. engine_heretic="crispy-heretic"
  72. engine_hexen="crispy-hexen"
  73. fi
  74. case "$iwad" in
  75. *doom*) mods=$doom_mods; engine=$engine_doom; config=$doom_config ;;
  76. *tnt*) mods=$doom_mods; engine=$engine_doom; config=$doom_config ;;
  77. *plutonia*) mods=$doom_mods; engine=$engine_doom; config=$doom_config ;;
  78. *heretic*) mods=$heretic_mods, engine=$engine_heretic; config=$heretic_config ;;
  79. *hexen*) mods=$hexen_mods; engine=$engine_hexen; config=$hexen_config ;;
  80. *hexdd*) mods=$hexen_mods; engine=$engine_hexen; config=$hexen_config ;;
  81. esac
  82. $engine -fullscreen -config "$config" -iwad "$base_dir"/wads/iwads/"$iwad".wad -file "$wad" $mods -savedir "$base_dir"/savegames/"$iwad"/ -skill 3 -warp 01