launchCrispyDoom.sh 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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,nolimit}/*/*.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. #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. echo "$iwads" | tr ' ' '\n' | while read -r item; do
  53. if [ "$item" = "$iwad" ]; then touch match; fi
  54. done
  55. if [ ! -f match ]; then echo "ERROR: $iwad is not a valid option, valid options are: $iwads"; exit 1; fi; rm match
  56. mods=
  57. base_dir="$HOME/games/doom"
  58. doom_mods="$base_dir/mods/vanilla/pk_doom_sfx/pk_doom_sfx_20120224.wad $base_dir/mods/vanilla/jovian_palette/JoyPal.wad"
  59. heretic_mods="$base_dir/mods/vanilla/dimm_pal/her-pal.wad"
  60. hexen_mods="$base_dir/mods/vanilla/dimm_pal/hex-pal.wad"
  61. doom_config="$base_dir"/config/crispy/config_nolimit.ini
  62. heretic_config="$base_dir"/config/crispy/config_nolimit_heretic.ini
  63. hexen_config="$base_dir"/config/crispy/config_nolimit_hexen.ini
  64. if [ -f ~/src/crispy-doom/src/crispy-doom ]; then
  65. engine_doom="~/src/crispy-doom/src/crispy-doom"
  66. engine_heretic="~/src/crispy-doom/src/crispy-heretic"
  67. engine_hexen="~/crispy-doom/src/crispy-hexen"
  68. else
  69. engine_doom="crispy-doom"
  70. engine_heretic="crispy-heretic"
  71. engine_hexen="crispy-hexen"
  72. fi
  73. case "$iwad" in
  74. *doom*) mods=$doom_mods; engine=$engine_doom; config=$doom_config ;;
  75. *tnt*) mods=$doom_mods; engine=$engine_doom; config=$doom_config ;;
  76. *plutonia*) mods=$doom_mods; engine=$engine_doom; config=$doom_config ;;
  77. *heretic*) mods=$heretic_mods, engine=$engine_heretic; config=$heretic_config ;;
  78. *hexen*) mods=$hexen_mods; engine=$engine_hexen; config=$hexen_config ;;
  79. *hexdd*) mods=$hexen_mods; engine=$engine_hexen; config=$hexen_config ;;
  80. esac
  81. $engine -fullscreen -config "$config" -iwad "$base_dir"/wads/iwads/"$iwad".wad -file "$wad" $mods -savedir "$base_dir"/savegames/"$iwad"/ -skill 3 -warp 01