doom_random_map.sh 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  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 " -g|--game [doom|doom2|tnt|plutonia|heretic|hexen]\n"
  11. printf " -e|--engine [chocolate|crispy|prboom|dsda|gzdoom]\n"
  12. printf " -l|--map_limit [none|vanilla|nolimit|boom|zdoom]\n"
  13. printf "\n"
  14. printf "Options:\n"
  15. printf " -d|--game-dir [/path/to/doom/base/directory] (Optional, default: '~/games/doom')\n"
  16. printf " -s|--skill [1, 2, 3, 4, 5] (Optional, default: '3')\n"
  17. printf " -r|--map_generator [none|slige|obsidian] (Optional, default: 'none')\n"
  18. printf " -m|--mods [none|vanilla|improved|beautiful|brutal|samsara] (Optional, default: 'vanilla')\n"
  19. printf " -u|--mangohud [yes|no] (Optional, default: 'no')\n"
  20. printf " -h|--help, Print help\n"
  21. exit
  22. }
  23. if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
  24. show_usage
  25. fi
  26. if [ -z "$1" ]; then
  27. show_usage
  28. fi
  29. while [ -n "$1" ]; do
  30. case "$1" in
  31. --game-dir|-d)
  32. shift
  33. echo "game directory: $1"
  34. param_game_dir=$1
  35. ;;
  36. --game|-g)
  37. shift
  38. echo "game: $1"
  39. param_iwad=$1
  40. ;;
  41. --engine|-e)
  42. shift
  43. echo "engine: $1"
  44. param_engine=$1
  45. ;;
  46. --map_limit|-l)
  47. shift
  48. echo "map_limit: $1"
  49. param_map_limit=$1
  50. ;;
  51. --skill|-s)
  52. shift
  53. echo "skill: $1"
  54. param_skill=$1
  55. ;;
  56. --map_generator|-r)
  57. shift
  58. echo "map_generator: $1"
  59. param_map_generator=$1
  60. ;;
  61. --mods|-m)
  62. shift
  63. echo "mods: $1"
  64. param_mods=$1
  65. ;;
  66. --mangohud|-u)
  67. shift
  68. echo "mangohud: $1"
  69. param_mangohud=$1
  70. ;;
  71. *)
  72. show_usage
  73. ;;
  74. esac
  75. shift
  76. done
  77. ### Configuration
  78. if [[ -z $param_game_dir ]]; then
  79. param_game_dir=~/games/doom
  80. fi
  81. config_iwads_dir=$param_game_dir/wads/iwads
  82. if [ -z "$param_mangohud" ]; then
  83. param_mangohud=no
  84. fi
  85. if [ -z "$param_map_generator" ]; then
  86. param_map_generator=none
  87. fi
  88. if [ -z "$param_skill" ]; then
  89. param_skill=3
  90. fi
  91. if [ -z "$param_mods" ]; then
  92. param_mods=vanilla
  93. fi
  94. ### check parameter values
  95. doom_game="doom doom2"
  96. echo "$doom_game" | tr ' ' '\n' | while read -r item; do
  97. if [ "$item" = "$param_iwad" ]; then touch match; fi
  98. done
  99. if [ ! -f match ]; then echo "ERROR: $param_iwad is not a valid option, valid options are: $doom_game"; exit 1; fi; rm match
  100. engine="chocolate crispy prboom dsda gzdoom"
  101. echo "$engine" | tr ' ' '\n' | while read -r item; do
  102. if [ "$item" = "$param_engine" ]; then touch match; fi
  103. done
  104. if [ ! -f match ]; then echo "ERROR: $param_engine is not a valid option, valid options are: $engine"; exit 1; fi; rm match
  105. map_limit="none vanilla nolimit boom zdoom"
  106. echo "$map_limit" | tr ' ' '\n' | while read -r item; do
  107. if [ "$item" = "$param_map_limit" ]; then touch match; fi
  108. done
  109. if [ ! -f match ]; then echo "ERROR: $param_map_limit is not a valid option, valid options are: $map_limit"; exit 1; fi; rm match
  110. map_generator="none slige obsidian"
  111. echo "$map_generator" | tr ' ' '\n' | while read -r item; do
  112. if [ "$item" = "$param_map_generator" ]; then touch match; fi
  113. done
  114. if [ ! -f match ]; then echo "ERROR: $param_map_generator is not a valid option, valid options are: $map_generator"; exit 1; fi; rm match
  115. mods="none vanilla improved beautiful brutal samsara"
  116. echo "$mods" | tr ' ' '\n' | while read -r item; do
  117. if [ "$item" = "$param_mods" ]; then touch match; fi
  118. done
  119. if [ ! -f match ]; then echo "ERROR: $param_mods is not a valid option, valid options are: $mods"; exit 1; fi; rm match
  120. mangohud_enabled="yes no"
  121. echo "$mangohud_enabled" | tr ' ' '\n' | while read -r item; do
  122. if [ "$item" = "$param_mangohud" ]; then touch match; fi
  123. done
  124. if [ ! -f match ]; then echo "ERROR: $param_mangohud is not a valid option, valid options are: $mangohud_enabled"; exit 1; fi; rm match
  125. skill="1 2 3 4 5"
  126. echo "$skill" | tr ' ' '\n' | while read -r item; do
  127. if [ "$item" = "$param_skill" ]; then touch match; fi
  128. done
  129. if [ ! -f match ]; then echo "ERROR: $param_skill is not a valid option, valid options are: $skill"; exit 1; fi; rm match
  130. ### Script
  131. get_map_file() {
  132. exclude_files="! -name *tex*.* ! -name *res*.* ! -name *fix.* ! -name *demo*.* ! -name *credits*.*"
  133. if [[ $param_map_generator == "none" ]]; then
  134. if [[ $param_map_limit == "none" ]]; then
  135. if [[ $param_engine == "chocolate" ]]; then
  136. pwadfile=$(find $param_game_dir/wads/$param_iwad/vanilla/*/*.wad ${exclude_files} -type f 2>/dev/null | shuf -n 1)
  137. elif [[ $param_engine == "crispy" ]]; then
  138. pwadfile=$(find $param_game_dir/wads/$param_iwad/{vanilla,nolimit}/*/*.wad ${exclude_files} -type f 2>/dev/null | shuf -n 1)
  139. elif [[ $param_engine == "prboom" ]]; then
  140. pwadfile=$(find $param_game_dir/wads/$param_iwad/{vanilla,nolimit,boom}/*/*.wad ${exclude_files} -type f 2>/dev/null | shuf -n 1)
  141. elif [[ $param_engine == "gzdoom" ]]; then
  142. pwadfile=$(find $param_game_dir/wads/$param_iwad/{vanilla,nolimit,boom,zdoom}/*/{*.wad,*.pk3} ${exclude_files} -type f 2>/dev/null | shuf -n 1)
  143. fi
  144. elif [[ $param_map_limit == "vanilla" ]]; then
  145. pwadfile=$(find $param_game_dir/wads/$param_iwad/vanilla/*/*.wad ${exclude_files} -type f 2>/dev/null | shuf -n 1)
  146. elif [[ $param_map_limit == "nolimit" ]]; then
  147. pwadfile=$(find $param_game_dir/wads/$param_iwad/nolimit/*/*.wad ${exclude_files} -type f 2>/dev/null | shuf -n 1)
  148. elif [[ $param_map_limit == "boom" ]]; then
  149. pwadfile=$(find $param_game_dir/wads/$param_iwad/boom/*/*.wad ${exclude_files} -type f 2>/dev/null | shuf -n 1)
  150. elif [[ $param_map_limit == "zdoom" ]]; then
  151. pwadfile=$(find $param_game_dir/wads/$param_iwad/zdoom/*/{*.wad,*.pk3} ${exclude_files} -type f 2>/dev/null | shuf -n 1)
  152. fi
  153. elif [[ $param_map_generator == "slige" ]]; then
  154. if [[ $param_map_limit == "vanilla" ]]; then
  155. echo "Creating new slige map..."
  156. pwadfile="$param_game_dir/wads/slige/slige_doom2.wad"
  157. slige_opts="-config $param_game_dir/tools/slige/slige490/slige.cfg -doom2 -levels 1 -rooms 18 -map1 -bimo -biwe -minlight 180 -nocustom"
  158. $param_game_dir/tools/slige/slige490/slige ${slige_opts} $param_game_dir/wads/slige/slige_doom2.out && $param_game_dir/tools/bsp/bsp-5.2/bsp $param_game_dir/wads/slige/slige_doom2.out -o $pwadfile
  159. echo "New slige map created... ${pwadfile}"
  160. else
  161. echo "ERROR: Slige can only make vanilla maps!"
  162. exit 1
  163. fi
  164. elif [[ $param_map_generator == "obsidian" ]]; then
  165. echo "Creating new obsidian map..."
  166. pwadfile="$param_game_dir/wads/obsidian/obsidian_doom2.wad"
  167. ~/src/Obsidian/obsidian --install ~/src/Obsidian/ --batch $pwadfile --load $param_game_dir/tools/obsidian/configs/${param_iwad}_${param_map_limit}.txt
  168. echo "New obsidian map created... ${pwadfile}"
  169. fi
  170. # Check pwad found
  171. if [[ -z $pwadfile ]]; then
  172. echo "No pwad file found"
  173. echo "### Random game settings"
  174. echo "param_iwad : $param_iwad"
  175. echo "param_engine : $param_engine"
  176. echo "PWAD file : $pwadfile"
  177. exit 1
  178. else
  179. echo "PWAD file: $pwadfile"
  180. fi
  181. # Check maps in file
  182. if [[ $param_map_generator == "none" ]]; then
  183. pwadfilename=$(awk -F/ '{print $10}' <<< ${pwadfile})
  184. elif [[ $param_map_generator == "slige" || $param_map_generator == "obsidian" ]]; then
  185. pwadfilename=$(awk -F/ '{print $8}' <<< ${pwadfile})
  186. fi
  187. pwadfilename=$(basename -- "${pwadfilename%.*}")
  188. echo "PWAD name: $pwadfilename"
  189. # Get maps from pwad
  190. gzdoom -iwad $config_iwads_dir/$param_iwad.wad -file $pwadfile -norun -hashfiles > /dev/null || true
  191. if [[ $param_iwad == "doom2" ]]; then
  192. pwadmap=$(cat fileinfo.txt | grep $pwadfilename | grep -e " MAP" -e " maps/" | awk '{print $4}' | sed -e "s/^MAP//" -e 's/,//g' | shuf -n 1)
  193. if [[ -z $pwadmap ]]; then
  194. pwadmap=$(cat fileinfo.txt | grep $pwadfilename | grep " maps/" | awk '{print $4}' | sed -e "s/^maps\/map//" -e 's/.wad,//g' | shuf -n 1)
  195. fi
  196. echo "PWAD map number: $pwadmap"
  197. mapnumbercheck=$(echo "$pwadmap" | awk '$0 ~/[^0-9]/ { print "NOT_NUMBER" }')
  198. elif [[ $param_iwad == "doom" ]]; then
  199. pwadmap=$(cat fileinfo.txt | grep $pwadfilename | grep -E " E[1-5]M" | awk '{print $4}' | shuf -n 1 | sed -r 's/[EM]+/ /g' | sed -e "s/^0//" -e 's/,//g')
  200. echo "PWAD map number: $pwadmap"
  201. elif [[ $param_iwad == "heretic" ]]; then
  202. pwadmap=$(cat fileinfo.txt | grep $pwadfilename | grep -E " E[1-5]M" | awk '{print $4}' | shuf -n 1 | sed -r 's/[EM]+/ /g' | sed -e "s/^0//" -e 's/,//g')
  203. echo "PWAD map number: $pwadmap"
  204. elif [[ $param_iwad == "hexen" ]]; then
  205. pwadmap=$(cat fileinfo.txt | grep $pwadfilename | grep -E " E[1-5]M" | awk '{print $4}' | shuf -n 1 | sed -r 's/[EM]+/ /g' | sed -e "s/^0//" -e 's/,//g')
  206. echo "PWAD map number: $pwadmap"
  207. fi
  208. # Remove temporary file
  209. rm fileinfo.txt
  210. }
  211. ###
  212. # Doom random map script
  213. ###
  214. get_map_file
  215. #while [[ -z $pwadfile || $pwadfile == *"/b_"* || $pwadfile == *"_obj_"* || $pwadfile == *"_brk"* || $pwadfile == *"/m_"* || $pwadfile == *"bmodels"* ]]
  216. while [[ -z $pwadmap || $pwadmap == "INFO" || $mapnumbercheck == "NOT_NUMBER" ]]
  217. do
  218. echo "Incorrect map \"$pwadmap\" getting another map..."
  219. unset pwadmap
  220. get_map_file
  221. done
  222. # Save map info in external file
  223. play_combination="${param_iwad},${pwadfile},${pwadmap}"
  224. play_combination=$(sed 's/ /_/g' <<< "${play_combination}")
  225. # Check played times in external file
  226. #if [[ ! "$param_map_generator" == "slige"* && ! "$param_map_generator" == "oblige" && ! "$param_map_generator" == "obsidian" ]]; then
  227. # if [ ! -z $(grep "${play_combination}" ${SCRIPT_DIR}/already_played_maps.txt) ]; then
  228. # echo "Play combination found in file, updating file"
  229. # current_times=$(cat ${SCRIPT_DIR}/already_played_maps.txt | grep ${play_combination} | awk -F, '{print $4}')
  230. # played_times=$(echo "$(($current_times + 1))")
  231. #
  232. # # Update file
  233. # sed -i "s|${play_combination},${current_times}|${play_combination},${played_times}|g" ${SCRIPT_DIR}/already_played_maps.txt
  234. # else
  235. # echo "Play combination not found in file, adding to file"
  236. # played_times="1"
  237. # new_played="${play_combination},${played_times}"
  238. # echo "${new_played}" >> ${SCRIPT_DIR}/already_played_maps.txt
  239. # fi
  240. #fi
  241. # You can have separate mods "sets" for the source ports
  242. if [[ $param_engine == "gzdoom" ]]; then
  243. if [[ "$param_iwad" == *"doom"* || "$param_iwad" == "tnt" || "$param_iwad" == "plutonia" ]]; then
  244. if [[ $param_mods == "none" ]]; then
  245. MODS=""
  246. elif [[ $param_mods == "vanilla" ]]; then
  247. #MODS="$param_game_dir/mods/vanilla/pk_doom_sfx/pk_doom_sfx_20120224.wad $param_game_dir/mods/vanilla/jovian_palette/JovPal.wad"
  248. MODS="$param_game_dir/mods/vanilla/pk_doom_sfx/pk_doom_sfx_20120224.wad $param_game_dir/mods/vanilla/dimm_pal/doom-pal.wad $param_game_dir/mods/zdoom/vanilla_essence/vanilla_essence_4_3.pk3"
  249. elif [[ $param_mods == "improved" ]]; then
  250. MODS="$param_game_dir/mods/vanilla/doom_sound_bulb/doom_sound_bulb.wad $param_game_dir/mods/vanilla/doom_sound_bulb/sound_bulb_extra_sfx.pk3 $param_game_dir/mods/vanilla/dimm_pal/doom-pal.wad $param_game_dir/mods/zdoom/smoothdoom/smoothdoom.pk3 $param_game_dir/mods/vanilla/vbright/vbright.wad $param_game_dir/mods/vanilla/softfx/softfx.wad"
  251. elif [[ $param_mods == "beautiful" ]]; then
  252. MODS="$param_game_dir/mods/vanilla/pk_doom_sfx/pk_doom_sfx_20120224.wad $param_game_dir/mods/vanilla/dimm_pal/doom-pal.wad $param_game_dir/mods/zdoom/beautiful_doom/beautiful_doom_716.pk3"
  253. elif [[ $param_mods == "brutal" ]]; then
  254. MODS="$param_game_dir/mods/vanilla/pk_doom_sfx/pk_doom_sfx_20120224.wad $param_game_dir/mods/vanilla/dimm_pal/doom-pal.wad $param_game_dir/mods/zdoom/brutal/brutal_doom/brutalv21.13.0.pk3"
  255. elif [[ $param_mods == "samsara" ]]; then
  256. MODS="$param_game_dir/mods/vanilla/dimm_pal/doom-pal.wad $param_game_dir/mods/zdoom/samsara/samsara-reincarnation_v1.0b.pk3 $param_game_dir/mods/zdoom/samsara/samsara-remixer_v1.0b.pk3 $param_game_dir/mods/zdoom/samsara/Samsara-Reincarnation_V1.0_OST.pk3"
  257. fi
  258. elif [[ "$param_iwad" == "heretic" ]]; then
  259. if [[ $param_mods == "none" ]]; then
  260. MODS=""
  261. elif [[ $param_mods == "vanilla" ]]; then
  262. MODS="$param_game_dir/mods/vanilla/dimm_pal/her-pal.wad $param_game_dir/mods/vanilla/dwarss_heretic_hq_sfx_pack/sfx.wad $param_game_dir/mods/zdoom/vanilla_essence/vanilla_essence_4_3.pk3"
  263. elif [[ $param_mods == "improved" ]]; then
  264. MODS="$param_game_dir/mods/vanilla/dimm_pal/her-pal.wad $param_game_dir/mods/vanilla/dwarss_heretic_hq_sfx_pack/sfx.wad"
  265. elif [[ $param_mods == "brutal" ]]; then
  266. MODS="$param_game_dir/mods/vanilla/dimm_pal/her-pal.wad $param_game_dir/mods/zdoom/brutal/brutal_heretic/Heretic-Shadow_Collection/1_BRUTAL_HERETIC/BrutalHereticRPG_V5.0.pk3"
  267. elif [[ $param_mods == "samsara" ]]; then
  268. echo "MOD Not available"
  269. exit 1
  270. fi
  271. elif [[ "$param_iwad" == "hexen" ]]; then
  272. if [[ $param_mods == "none" ]]; then
  273. MODS=""
  274. elif [[ $param_mods == "vanilla" ]]; then
  275. MODS="$param_game_dir/mods/vanilla/dimm_pal/hex-pal.wad"
  276. elif [[ $param_mods == "improved" ]]; then
  277. MODS="$param_game_dir/mods/vanilla/dimm_pal/hex-pal.wad $param_game_dir/mods/zdoom/vanilla_essence/vanilla_essence_4_3.pk3"
  278. elif [[ $param_mods == "brutal" ]]; then
  279. MODS="$param_game_dir/mods/vanilla/dimm_pal/hex-pal.wad $param_game_dir/mods/zdoom/brutal/brutal_hexen/Hexen/1_BRUTAL_HEXEN/BrutalHexenRPG_V4.7.pk3"
  280. elif [[ $param_mods == "samsara" ]]; then
  281. echo "MOD Not available"
  282. exit 1
  283. fi
  284. fi
  285. elif [[ $param_engine == "chocolate" ]]; then
  286. if [[ "$param_iwad" == *"doom"* || "$param_iwad" == "tnt" || "$param_iwad" == "plutonia" ]]; then
  287. if [[ $param_mods == "none" ]]; then
  288. MODS=""
  289. elif [[ $param_mods == "vanilla" ]]; then
  290. MODS="$param_game_dir/mods/vanilla/pk_doom_sfx/pk_doom_sfx_20120224.wad $param_game_dir/mods/vanilla/dimm_pal/doom-pal.wad"
  291. elif [[ $param_mods == "improved" ]]; then
  292. MODS="$param_game_dir/mods/vanilla/doom_sound_bulb/doom_sound_bulb_legacy.wad $param_game_dir/mods/vanilla/dimm_pal/doom-pal.wad $param_game_dir/mods/vanilla/vbright/vbright.wad $param_game_dir/mods/vanilla/softfx/softfx.wad $param_game_dir/mods/vanilla/vanilla_doom_smooth_weapons/vsmooth.wad -dehlump"
  293. elif [[ $param_mods == "samsara" ]]; then
  294. echo "MOD Not available"
  295. exit 1
  296. fi
  297. elif [[ "$param_iwad" == "heretic" ]]; then
  298. if [[ $param_mods == "none" ]]; then
  299. MODS=""
  300. elif [[ $param_mods == "vanilla" ]]; then
  301. MODS="$param_game_dir/mods/vanilla/dimm_pal/her-pal.wad $param_game_dir/mods/vanilla/dwarss_heretic_hq_sfx_pack/sfx.wad"
  302. elif [[ $param_mods == "samsara" ]]; then
  303. echo "MOD Not available"
  304. exit 1
  305. fi
  306. elif [[ "$param_iwad" == "hexen" ]]; then
  307. if [[ $param_mods == "none" ]]; then
  308. MODS=""
  309. elif [[ $param_mods == "vanilla" ]]; then
  310. MODS="$param_game_dir/mods/vanilla/dimm_pal/hex-pal.wad"
  311. elif [[ $param_mods == "samsara" ]]; then
  312. echo "MOD Not available"
  313. exit 1
  314. fi
  315. fi
  316. elif [[ $param_engine == "crispy" ]]; then
  317. if [[ "$param_iwad" == *"doom"* || "$param_iwad" == "tnt" || "$param_iwad" == "plutonia" ]]; then
  318. if [[ $param_mods == "none" ]]; then
  319. MODS=""
  320. elif [[ $param_mods == "vanilla" ]]; then
  321. MODS="$param_game_dir/mods/vanilla/pk_doom_sfx/pk_doom_sfx_20120224.wad $param_game_dir/mods/vanilla/dimm_pal/doom-pal.wad"
  322. elif [[ $param_mods == "improved" ]]; then
  323. MODS="$param_game_dir/mods/vanilla/doom_sound_bulb/doom_sound_bulb_legacy.wad $param_game_dir/mods/vanilla/dimm_pal/doom-pal.wad $param_game_dir/mods/vanilla/vbright/vbright.wad $param_game_dir/mods/vanilla/softfx/softfx.wad $param_game_dir/mods/vanilla/vanilla_doom_smooth_weapons/vsmooth.wad"
  324. elif [[ $param_mods == "samsara" ]]; then
  325. echo "MOD Not available"
  326. exit 1
  327. fi
  328. elif [[ "$param_iwad" == "heretic" ]]; then
  329. if [[ $param_mods == "none" ]]; then
  330. MODS=""
  331. elif [[ $param_mods == "vanilla" ]]; then
  332. MODS="$param_game_dir/mods/vanilla/dimm_pal/her-pal.wad $param_game_dir/mods/vanilla/dwarss_heretic_hq_sfx_pack/sfx.wad"
  333. elif [[ $param_mods == "samsara" ]]; then
  334. echo "MOD Not available"
  335. exit 1
  336. fi
  337. elif [[ "$param_iwad" == "hexen" ]]; then
  338. if [[ $param_mods == "none" ]]; then
  339. MODS=""
  340. elif [[ $param_mods == "vanilla" ]]; then
  341. MODS="$param_game_dir/mods/vanilla/dimm_pal/hex-pal.wad"
  342. elif [[ $param_mods == "samsara" ]]; then
  343. echo "MOD Not available"
  344. exit 1
  345. fi
  346. fi
  347. elif [[ $param_engine == "prboom" ]]; then
  348. if [[ "$param_iwad" == *"doom"* || "$param_iwad" == "tnt" || "$param_iwad" == "plutonia" ]]; then
  349. if [[ $param_mods == "none" ]]; then
  350. MODS=""
  351. elif [[ $param_mods == "vanilla" ]]; then
  352. MODS="$param_game_dir/mods/vanilla/pk_doom_sfx/pk_doom_sfx_20120224.wad $param_game_dir/mods/vanilla/dimm_pal/doom-pal.wad"
  353. elif [[ $param_mods == "improved" ]]; then
  354. MODS="$param_game_dir/mods/vanilla/doom_sound_bulb/doom_sound_bulb_legacy.wad $param_game_dir/mods/vanilla/dimm_pal/doom-pal.wad $param_game_dir/mods/vanilla/vbright/vbright.wad $param_game_dir/mods/vanilla/softfx/softfx.wad $param_game_dir/mods/vanilla/vanilla_doom_smooth_weapons/vsmooth.wad"
  355. elif [[ $param_mods == "samsara" ]]; then
  356. echo "MOD Not available"
  357. exit 1
  358. fi
  359. elif [[ "$param_iwad" == "heretic" ]]; then
  360. if [[ $param_mods == "none" ]]; then
  361. MODS=""
  362. elif [[ $param_mods == "vanilla" ]]; then
  363. MODS="$param_game_dir/mods/vanilla/dimm_pal/her-pal.wad"
  364. elif [[ $param_mods == "samsara" ]]; then
  365. echo "MOD Not available"
  366. exit 1
  367. fi
  368. elif [[ "$param_iwad" == "hexen" ]]; then
  369. if [[ $param_mods == "none" ]]; then
  370. MODS=""
  371. elif [[ $param_mods == "vanilla" ]]; then
  372. MODS="$param_game_dir/mods/vanilla/dimm_pal/hex-pal.wad"
  373. elif [[ $param_mods == "samsara" ]]; then
  374. echo "MOD Not available"
  375. exit 1
  376. fi
  377. fi
  378. fi
  379. if [[ $param_mangohud == "yes" ]]; then
  380. export MANGOHUD_DLSYM=1
  381. #export MANGOHUD_CONFIG=cpu_temp,gpu_temp,core_load,cpu_core_clock,gpu_mem_clock,cpu_power,gpu_power,cpu_mhz,ram,vram,frametime,position=top-left,height=500,font_size=24
  382. export MANGOHUD_CONFIG=cpu_temp,gpu_temp,cpu_core_clock,gpu_mem_clock,cpu_power,gpu_power,cpu_mhz,ram,vram,frametime,position=top-left,height=500,font_size=18
  383. fi
  384. if [[ $param_engine == "chocolate" ]]; then
  385. if [[ "$param_iwad" == *"doom"* || "$param_iwad" == "tnt" || "$param_iwad" == "plutonia" ]]; then
  386. commandline="chocolate-doom -config "$param_game_dir"/config/chocolate/config.ini -fullscreen -iwad $config_iwads_dir/$param_iwad.wad -merge $pwadfile $MODS -savedir $param_game_dir/savegames/$param_iwad/ -skill $param_skill -warp $pwadmap"
  387. elif [[ "$param_iwad" == "heretic" ]]; then
  388. commandline="chocolate-heretic -config "$param_game_dir"/config/chocolate/config_heretic.ini -fullscreen -iwad $config_iwads_dir/$param_iwad.wad -merge $pwadfile $MODS -savedir $param_game_dir/savegames/$param_iwad/ -skill $param_skill -warp $pwadmap"
  389. elif [[ "$param_iwad" == "hexen" ]]; then
  390. commandline="chocolate-hexen -config "$param_game_dir"/config/chocolate/config_hexen.ini -fullscreen -iwad $config_iwads_dir/$param_iwad.wad -merge $pwadfile $MODS -savedir $param_game_dir/savegames/$param_iwad/ -skill $param_skill -warp $pwadmap"
  391. fi
  392. elif [[ $param_engine == "crispy" ]]; then
  393. if [[ "$param_iwad" == *"doom"* || "$param_iwad" == "tnt" || "$param_iwad" == "plutonia" ]]; then
  394. commandline="crispy-doom -config "$param_game_dir"/config/crispy/config_nolimit.ini -fullscreen -iwad $config_iwads_dir/$param_iwad.wad -file $pwadfile $MODS -savedir $param_game_dir/savegames/$param_iwad/ -skill $param_skill -warp $pwadmap"
  395. elif [[ "$param_iwad" == "heretic" ]]; then
  396. commandline="crispy-heretic -config "$param_game_dir"/config/crispy/config_nolimit_heretic.ini -fullscreen -iwad $config_iwads_dir/$param_iwad.wad -file $pwadfile $MODS -savedir $param_game_dir/savegames/$param_iwad/ -skill $param_skill -warp $pwadmap"
  397. elif [[ "$param_iwad" == "hexen" ]]; then
  398. commandline="crispy-hexen -config "$param_game_dir"/config/crispy/config_nolimit_hexen.ini -fullscreen -iwad $config_iwads_dir/$param_iwad.wad -file $pwadfile $MODS -savedir $param_game_dir/savegames/$param_iwad/ -skill $param_skill -warp $pwadmap"
  399. fi
  400. elif [[ $param_engine == "prboom" ]]; then
  401. #commandline="prboom-plus -vidmode gl -complevel 17 -width 1920 -height 1080 -fullscreen -geom 640x360f -aspect 16:9 -iwad $config_iwads_dir/$param_iwad.wad -file $pwadfile $MODS -save $param_game_dir/savegames/$param_iwad/ -skill $param_skill -warp $pwadmap"
  402. commandline="prboom-plus -config "$param_game_dir"/config/prboom-plus/prboom-plus_boom.cfg -vidmode gl -complevel 17 -width 1920 -height 1080 -fullscreen -aspect 16:9 -iwad $config_iwads_dir/$param_iwad.wad -file $pwadfile $MODS -save $param_game_dir/savegames/$param_iwad/ -skill $param_skill -warp $pwadmap"
  403. elif [[ $param_engine == "dsda" ]]; then
  404. #commandline="dsda-doom -vidmode gl -complevel 17 -width 1920 -height 1080 -fullscreen -geom 640x360f -aspect 16:9 -iwad $config_iwads_dir/$param_iwad.wad -file $pwadfile $MODS -save $param_game_dir/savegames/$param_iwad/ -skill $param_skill -warp $pwadmap"
  405. commandline="dsda-doom -config "$param_game_dir"/config/dsda-doom/dsda-doom_boom.cfg -vidmode gl -complevel 17 -width 1920 -height 1080 -fullscreen -aspect 16:9 -iwad $config_iwads_dir/$param_iwad.wad -file $pwadfile $MODS -save $param_game_dir/savegames/$param_iwad/ -skill $param_skill -warp $pwadmap"
  406. elif [[ $param_engine == "gzdoom" ]]; then
  407. if [[ "$param_iwad" == *"doom"* || "$param_iwad" == "tnt" || "$param_iwad" == "plutonia" ]]; then
  408. commandline="gzdoom -config "$param_game_dir"/config/zdoom/config_zdoom_doom.ini -width 1920 -height 1080 -fullscreen -iwad $config_iwads_dir/$param_iwad.wad -file $pwadfile $MODS -savedir $param_game_dir/savegames/$param_iwad/ -skill $param_skill -warp $pwadmap"
  409. elif [[ "$param_iwad" == "heretic" ]]; then
  410. commandline="gzdoom -config "$param_game_dir"/config/zdoom/config_zdoom_heretic.ini -width 1920 -height 1080 -fullscreen -iwad $config_iwads_dir/$param_iwad.wad -file $pwadfile $MODS -savedir $param_game_dir/savegames/$param_iwad/ -skill $param_skill -warp $pwadmap"
  411. elif [[ "$param_iwad" == "hexen" ]]; then
  412. commandline="gzdoom -config "$param_game_dir"/config/zdoom/config_zdoom_hexen.ini -width 1920 -height 1080 -fullscreen -iwad $config_iwads_dir/$param_iwad.wad -file $pwadfile $MODS -savedir $param_game_dir/savegames/$param_iwad/ -skill $param_skill -warp $pwadmap"
  413. fi
  414. fi
  415. # Run
  416. if [[ $param_mangohud == "yes" ]]; then
  417. mangohud $commandline || true
  418. else
  419. $commandline || true
  420. fi
  421. echo "### Random game settings"
  422. echo "param_iwad : $param_iwad"
  423. echo "param_engine : $param_engine"
  424. echo "PWAD file : $pwadfile"
  425. echo "PWAD map number : $pwadmap"
  426. echo "MOD files : $MODS"
  427. echo "param_skill : $param_skill"
  428. echo "Full command line : $commandline"
  429. echo ""
  430. echo "Iwad/Engine/Map combination: ${play_combination}"
  431. echo "Iwad/Engine/Map combination played ${played_times} times"