Advertisement
Guest User

set up Half-Life and run

a guest
Jan 5th, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 6.17 KB | None | 0 0
  1.  
  2. @echo off
  3. EndLocal
  4. SetLocal EnableDelayedExpansion
  5.  
  6. :: START batch for Half-Life
  7.  
  8. :: cheking is batch started in debug mode
  9. if "%1"=="debug" set echo==echo
  10.  
  11. :: defaults
  12. set def_game=valve
  13.  
  14. set def_engine=-gl
  15. set engine0_cmd=_ _g _gl
  16.  
  17. set engine1=-software
  18. set engine1_cmd=_s _sw _soft _software
  19.  
  20. set engine2=-d3d
  21. set engine2_cmd=_x _d3 _dx _d3d
  22.  
  23. set def_heapsize=64
  24.  
  25. set def_mode=-fullscreen
  26. set mode_cmd=_ _f _ful _full _fullscreen
  27. set def_width=1280
  28. set def_height=1024
  29.  
  30. set ndef_mode=-window
  31. set ndef_width=1152
  32. set ndef_height=864
  33.  
  34. set def_bitdepth=32
  35. set ndef_bitdepth=16
  36.  
  37. set break=b brk break
  38. set default=d def default
  39. set manual=m man manual
  40.  
  41. :: hints
  42. color
  43. echo you can enter any time one of the following commands:
  44. echo   %break%
  45. echo     - to immediatelly quit without running the game
  46. echo   %default%
  47. echo     - to skip this and all next steps and run the game using default settings
  48. echo   %manual%
  49. echo     - to skip this and all next steps and enter commandline by hand
  50. echo.
  51.  
  52. :game
  53. echo Choose the game
  54. echo   [nothing] : Half-Life (%def_game%)
  55. echo   [else]    : [else]
  56. set LC_COLLATE=ru_RU.utf8
  57. ls --hide=*.*
  58. set /p game=
  59. for %%a in (%break%) do (
  60.     if "%game%"=="%%a" goto eof
  61. )
  62. for %%a in (%manual%) do (
  63.     if "%game%"=="%%a" (
  64.         set game=
  65.         goto pass
  66.     )
  67. )
  68. for %%a in (%default%) do (
  69.     if "%game%"=="%%a" (
  70.         set game=
  71.         goto default
  72.     )
  73. )
  74. if "%game%"=="" (
  75.     set game=%def_game%
  76. )
  77. if not exist %game%\ (
  78.     echo cannot find the game: %game%
  79.     goto game
  80. ) else (
  81.     set game=-game %game%
  82. )
  83.  
  84. :: engine
  85. echo Choose the engine
  86. echo   [nothing] : %def_engine%
  87. echo   s         : %engine1%
  88. echo   x         : %engine2%
  89. echo   [else]    : %def_engine%
  90. set /p engine=
  91. for %%a in (%break%) do (
  92.     if "%engine%"=="%%a" goto eof
  93. )
  94. for %%a in (%manual%) do (
  95.     if "%engine%"=="%%a" (
  96.         set engine=
  97.         goto pass
  98.     )
  99. )
  100. for %%a in (%default%) do (
  101.     if "%engine%"=="%%a" (
  102.         color 60
  103.         set engine=
  104.         goto default
  105.     )
  106. )
  107. set engine=_%engine%
  108. for %%a in (%engine1_cmd%) do (
  109.     if "%%a"=="%engine%" (
  110.         color 30
  111.         set engine=%engine1%
  112.     )
  113. )
  114. for %%a in (%engine2_cmd%) do (
  115.     if "%%a"=="%engine%" (
  116.         color 50
  117.         set engine=%engine2%
  118.     )
  119. )
  120. if not "%engine%"=="%engine1%" (
  121.     if not "%engine%"=="%engine2%" (
  122.         color 60
  123.         set engine=%def_engine%
  124.     )
  125. )
  126.  
  127. :: heapsize
  128. echo Set heapsize
  129. echo   [nothing] : %def_heapsize%M
  130. echo   [else]    : [else] (in megabytes)
  131. set /p heapsize=
  132. for %%a in (%break%) do (
  133.     if "%heapsize%"=="%%a" goto eof
  134. )
  135. for %%a in (%manual%) do (
  136.     if "%heapsize%"=="%%a" (
  137.         set heapsize=
  138.         goto pass
  139.     )
  140. )
  141. for %%a in (%default%) do (
  142.     if "%heapsize%"=="%%a" (
  143.         set heapsize=
  144.         goto default
  145.     )
  146. )
  147. if "%heapsize%"=="" (
  148.     set heapsize=%def_heapsize%
  149. )
  150. set /a heapsize=%heapsize%*1024
  151. set heapsize=-heapsize %heapsize%
  152.  
  153. :: software engine indifferent to bitdepth switches
  154. if "%engine%"=="-software" goto mode
  155.  
  156. :: bitdepth
  157. echo Set bitdepth
  158. echo   [nothing] : %def_bitdepth%
  159. echo   [else]    : %ndef_bitdepth%
  160. set /p bitdepth=
  161. for %%a in (%break%) do (
  162.     if "%bitdepth%"=="%%a" goto eof
  163. )
  164. for %%a in (%manual%) do (
  165.     if "%bitdepth%"=="%%a" (
  166.         set bitdepth=
  167.         goto pass
  168.     )
  169. )
  170. for %%a in (%default%) do (
  171.     if "%bitdepth%"=="%%a" (
  172.         set bitdepth=
  173.         goto default
  174.     )
  175. )
  176. if "%bitdepth%"=="" (
  177.     set bitdepth=-%def_bitdepth%bpp
  178. ) else (
  179.     set bitdepth=-%ndef_bitdepth%bpp
  180. )
  181.  
  182. :mode
  183. echo Run windowed or in fullscreen?
  184. echo   [nothing] : %def_mode%
  185. echo   [else]    : %ndef_mode%
  186. set /p mode=
  187. for %%a in (%break%) do (
  188.     if "%mode%"=="%%a" goto eof
  189. )
  190. for %%a in (%manual%) do (
  191.     if "%mode%"=="%%a" (
  192.         set mode=
  193.         goto pass
  194.     )
  195. )
  196. for %%a in (%default%) do (
  197.     if "%mode%"=="%%a" (
  198.         set mode=
  199.         goto default
  200.     )
  201. )
  202. set mode=_%mode%
  203. for %%a in (%mode_cmd%) do (
  204.     if "%%a"=="%mode%" (
  205.         set mode=%def_mode%
  206.     )
  207. )
  208. if not "%mode%"=="%def_mode%" (
  209.     set mode=%ndef_mode%
  210. )
  211.  
  212. :: default resolutions
  213. if "%mode%"=="%def_mode%" (
  214.     set w=%def_width%
  215.     set h=%def_height%
  216. ) else (
  217.     set w=%ndef_width%
  218.     set h=%ndef_height%
  219. )
  220.  
  221. :: resolution
  222.  
  223. :: width
  224. echo Set width resolution
  225. echo   [nothing] : %w%
  226. echo   [else]    : [else]
  227. set /p width=
  228. for %%a in (%break%) do (
  229.     if "%width%"=="%%a" goto eof
  230. )
  231. for %%a in (%manual%) do (
  232.     if "%width%"=="%%a" (
  233.         set width=
  234.         goto pass
  235.     )
  236. )
  237. for %%a in (%default%) do (
  238.     if "%width%"=="%%a" (
  239.         set width=
  240.         goto start
  241.     )
  242. )
  243. if "%width%"=="" (
  244.     set width=-width %w%
  245. ) else (
  246.     set width=-width %width%
  247. )
  248.  
  249. :: height
  250. echo Set height resolution
  251. echo   [nothing] : %h%
  252. echo   [else]    : [else]
  253. set /p height=
  254. for %%a in (%break%) do (
  255.     if "%height%"=="%%a" goto eof
  256. )
  257. for %%a in (%manual%) do (
  258.     if "%height%"=="%%a" (
  259.         set height=
  260.         goto pass
  261.     )
  262. )
  263. for %%a in (%default%) do (
  264.     if "%height%"=="%%a" (
  265.         set height=
  266.         goto start
  267.     )
  268. )
  269. if "%height%"=="" (
  270.     set height=-height %h%
  271. ) else (
  272.     set height=-height %height%
  273. )
  274.  
  275. :pass
  276. color 20
  277. echo Set the additional options
  278. echo   [nothing] : [nothing]
  279. echo   [else]    : [else]
  280. echo list of additional switches:
  281. echo   dev:     +cl_showfps  +developer  +r_speeds  +sv_cheats  +dev_overview
  282. echo            +hud_draw    -nosound    -condebug
  283. echo   limits:  -particles   -num_edicts  +fps_max
  284. echo   other:   -anyaspect   -insecure    -nomaster
  285. echo   control: -noforcemparms            -noforcemaccel
  286. echo   won:     -toconsole   -dev
  287. echo.
  288. set /p options=
  289. for %%a in (%break%) do (
  290.     if "%options%"=="%%a" goto eof
  291. )
  292.  
  293. :start
  294. %echo% start hl.exe %engine% %game% %heapsize% %mode% %video% %bitdepth% %width% %height% %startwindowed% %options%
  295. goto eof
  296.  
  297. :default
  298. if not defined engine set engine=%def_engine%
  299. if not defined game set game=-game %def_game%
  300. if not defined heapsize (
  301.     set /a heapsize=%def_heapsize%*1024
  302.     set heapsize=-heapsize !heapsize!
  303. )
  304. if not "%engine%"=="-software" if not defined bitdepth set bitdepth=-%def_bitdepth%bpp
  305. if not defined mode set mode=%def_mode%
  306. if "%mode%"=="-window" (
  307.     if not defined width set width=-width %ndef_width%
  308.     if not defined height set height=-height %ndef_height%
  309. ) else (
  310.     if not defined width set width=-width %def_width%
  311.     if not defined height set height=-height %def_height%
  312. )
  313. goto start
  314.  
  315. :eof
  316. color
  317. EndLocal
  318. exit/b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement