Advertisement
Guest User

set up Alpha Half-Life and run

a guest
Jan 5th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 7.89 KB | None | 0 0
  1.  
  2. @echo off
  3. SetLocal EnableDelayedExpansion
  4.  
  5. :: START batch for Alpha Half-Life
  6.  
  7. :: cheking if batch started in debug mode
  8. if "%1"=="debug" set echo==echo
  9.  
  10. :: defaults
  11. set def_engine=enginegl
  12. set engine_cmd=_ _g _gl
  13. set ndef_engine=engine
  14.  
  15. set def_game=valve
  16. set def_heapsize=64
  17.  
  18. set def_mode=fullscreen
  19. set mode_cmd=_ _f _ful _full _fullscreen
  20. set def_width=1280
  21. set def_height=1024
  22.  
  23. set ndef_mode=window
  24. set ndef_width=1200
  25. set ndef_height=900
  26.  
  27. set def_bitdepth=32
  28. set ndef_bitdepth=16
  29.  
  30. set def_video=14
  31.  
  32. set break=b brk break
  33. set default=d def default
  34. set manual=m man manual
  35.  
  36. :: hints
  37. color
  38. echo you can enter any time one of the following commands:
  39. echo   %break%
  40. echo     - to immediatelly quit without running the game
  41. echo   %default%
  42. echo     - to skip this and all next steps and run the game using default settings
  43. echo   %manual%
  44. echo     - to skip this and all next steps and enter commandline by hand
  45. echo.
  46.  
  47. :engine
  48. echo Choose the engine
  49. echo   [nothing] : %def_engine%
  50. echo   [else]    : %ndef_engine%
  51. set /p engine=
  52. for %%a in (%break%) do (
  53.     if "%engine%"=="%%a" goto eof
  54. )
  55. for %%a in (%manual%) do (
  56.     if "%engine%"=="%%a" goto manual
  57. )
  58. for %%a in (%default%) do (
  59.     if "%engine%"=="%%a" (
  60.         color 60
  61.         set engine=
  62.         goto default
  63.     )
  64. )
  65. set engine=_%engine%
  66. for %%a in (%engine_cmd%) do (
  67.     if "%%a"=="%engine%" (
  68.         color 60
  69.         set engine=%def_engine%
  70.     )
  71. )
  72. if not "%engine%"=="%def_engine%" (
  73.     color 30
  74.     set engine=%ndef_engine%
  75. )
  76.  
  77. :game
  78. echo Choose the game
  79. echo   [nothing] : Alpha (%def_game%)
  80. echo   [else]    : [else]
  81. ls --hide=*.*
  82. set /p game=
  83. for %%a in (%break%) do (
  84.     if "%game%"=="%%a" goto eof
  85. )
  86. for %%a in (%manual%) do (
  87.     if "%game%"=="%%a" (
  88.         set game=
  89.         goto pass
  90.     )
  91. )
  92. for %%a in (%default%) do (
  93.     if "%game%"=="%%a" (
  94.         set game=
  95.         goto default
  96.     )
  97. )
  98. if "%game%"=="" (
  99.     set game=%def_game%
  100. )
  101. if not exist %game%\ (
  102.     echo cannot find the game: %game%
  103.     goto game
  104. ) else (
  105.     set game=-game %game%
  106. )
  107.  
  108. :heapsize
  109. echo Set heapsize
  110. echo   [nothing] : %def_heapsize%M
  111. echo   [else]    : [else] (in megabytes)
  112. set /p heapsize=
  113. for %%a in (%break%) do (
  114.     if "%heapsize%"=="%%a" goto eof
  115. )
  116. for %%a in (%manual%) do (
  117.     if "%heapsize%"=="%%a" (
  118.         set heapsize=
  119.         goto pass
  120.     )
  121. )
  122. for %%a in (%default%) do (
  123.     if "%heapsize%"=="%%a" (
  124.         set heapsize=
  125.         goto default
  126.     )
  127. )
  128. if "%heapsize%"=="" (
  129.     set heapsize=%def_heapsize%
  130. )
  131. set /a heapsize=%heapsize%*1024
  132. set heapsize=-heapsize %heapsize%
  133.  
  134. :: engine and enginegl use different video switches
  135. if "%engine%"=="engine" (
  136.     set wcmd=+vid_config_x
  137.     set hcmd=+vid_config_y
  138.     goto video
  139. ) else (
  140.     set wcmd=-width
  141.     set hcmd=-height
  142. )
  143.  
  144. :bitdepth
  145. echo Set bitdepth
  146. echo   [nothing] : %def_bitdepth%
  147. echo   [else]    : %ndef_bitdepth%
  148. set /p bitdepth=
  149. for %%a in (%break%) do (
  150.     if "%bitdepth%"=="%%a" goto eof
  151. )
  152. for %%a in (%manual%) do (
  153.     if "%bitdepth%"=="%%a" (
  154.         set bitdepth=
  155.         goto pass
  156.     )
  157. )
  158. for %%a in (%default%) do (
  159.     if "%bitdepth%"=="%%a" (
  160.         set bitdepth=
  161.         goto default
  162.     )
  163. )
  164. if "%bitdepth%"=="" (
  165.     set bitdepth=-bpp %def_bitdepth%
  166. ) else (
  167.     set bitdepth=-bpp %ndef_bitdepth%
  168. )
  169.  
  170. :mode
  171. echo Run windowed or in fullscreen?
  172. echo   [nothing] : %def_mode%
  173. echo   [else]    : %ndef_mode%
  174. set /p mode=
  175. for %%a in (%break%) do (
  176.     if "%mode%"=="%%a" goto eof
  177. )
  178. for %%a in (%manual%) do (
  179.     if "%mode%"=="%%a" (
  180.         set mode=
  181.         goto pass
  182.     )
  183. )
  184. for %%a in (%default%) do (
  185.     if "%mode%"=="%%a" (
  186.         set mode=
  187.         goto default
  188.     )
  189. )
  190. set mode=_%mode%
  191. for %%a in (%mode_cmd%) do (
  192.     if "%%a"=="%mode%" (
  193.         set mode=%def_mode%
  194.     )
  195. )
  196. if not "%mode%"=="%def_mode%" (
  197.     set mode=%ndef_mode%
  198. )
  199.  
  200. :: default resolutions
  201. if "%mode%"=="%def_mode%" (
  202.     set w=%def_width%
  203.     set h=%def_height%
  204. ) else (
  205.     set w=%ndef_width%
  206.     set h=%ndef_height%
  207. )
  208.  
  209. :: skip specific options for software engine
  210. goto resolution
  211.  
  212. :video
  213. echo Set vid_mode
  214. echo   [nothing] : %def_video%
  215. echo   [else]    : [else]
  216. echo list of possible values:
  217. echo windowed
  218. echo   0 for 320x240
  219. echo   1 for 640x480
  220. echo   2 for user-defined
  221. echo fullscreen
  222. echo   3 for 320x240
  223. echo   4 for 640x480
  224. echo   5 for 800x600
  225. echo   6 for 1024x768
  226. echo   7 for 1280x1024
  227. set /p video=
  228. for %%a in (%break%) do (
  229.     if "%video%"=="%%a" goto eof
  230. )
  231. for %%a in (%manual%) do (
  232.     if "%video%"=="%%a" (
  233.         set video=
  234.         goto pass
  235.     )
  236. )
  237. for %%a in (%default%) do (
  238.     if "%video%"=="%%a" (
  239.         set video=
  240.         goto start
  241.     )
  242. )
  243. if "%video%"=="" (
  244.     set video=+vid_mode %def_video%
  245. ) else (
  246.     set video=+vid_mode %video%
  247. )
  248.  
  249. :: check for windowed mode
  250. if not "%video%"=="+vid_mode 2" (
  251.     goto pass
  252. )
  253. set w=%ndef_width%
  254. set h=%ndef_height%
  255. set startwindowed=-startwindowed
  256.  
  257. :resolution
  258.  
  259. :: width
  260. echo Set width resolution
  261. echo   [nothing] : %w%
  262. echo   [else]    : [else]
  263. set /p width=
  264. for %%a in (%break%) do (
  265.     if "%width%"=="%%a" goto eof
  266. )
  267. for %%a in (%manual%) do (
  268.     if "%width%"=="%%a" (
  269.         set width=
  270.         goto pass
  271.     )
  272. )
  273. for %%a in (%default%) do (
  274.     if "%width%"=="%%a" (
  275.         set width=
  276.         goto start
  277.     )
  278. )
  279. if "%width%"=="" (
  280.     set width=%wcmd% %w%
  281. ) else (
  282.     set width=%wcmd% %width%
  283. )
  284.  
  285. :: height
  286. echo Set height resolution
  287. echo   [nothing] : %h%
  288. echo   [else]    : [else]
  289. set /p height=
  290. for %%a in (%break%) do (
  291.     if "%height%"=="%%a" goto eof
  292. )
  293. for %%a in (%manual%) do (
  294.     if "%height%"=="%%a" (
  295.         set height=
  296.         goto pass
  297.     )
  298. )
  299. for %%a in (%default%) do (
  300.     if "%height%"=="%%a" (
  301.         set height=
  302.         goto start
  303.     )
  304. )
  305. if "%height%"=="" (
  306.     set height=%hcmd% %h%
  307. ) else (
  308.     set height=%hcmd% %height%
  309. )
  310.  
  311. :pass
  312. color 20
  313. echo Set the additional options
  314. echo   [nothing] : [nothing]
  315. echo   [else]    : [else]
  316. call :switches
  317. set /p options=
  318. for %%a in (%break%) do (
  319.     if "%options%"=="%%a" goto eof
  320. )
  321.  
  322. :start
  323. %echo% start %engine%.exe %game% %heapsize% %video% %bitdepth% %width% %height% %mode% %startwindowed% %options%
  324. goto eof
  325.  
  326. :manual
  327. color 47
  328. echo WARNING: you have choosed to skip hints and enter the commandline manually.
  329. echo   [nothing] : [nothing]
  330. echo   [else]    : [else]
  331. echo Enter full command to start game, e. g.:
  332. echo.
  333. echo   %def_engine%.exe -game %def_game% -heapsize 16384 -%def_mode% -width %def_width% -height %def_height% -bpp %def_bitdepth% +vid_config_x %def_width% +vid_config_y %def_height% +vid_mode %def_video% +map somemap
  334. echo.
  335. call :switches
  336. set /p cmdline=
  337. for %%a in (%break%) do (
  338.     if "%cmdline%"=="%%a" goto eof
  339. )
  340. %echo% start %cmdline%
  341. goto eof
  342.  
  343. :default
  344. if not defined engine set engine=%def_engine%
  345. if not defined game set game=-game %def_game%
  346. if not defined heapsize (
  347.     set /a heapsize=%def_heapsize%*1024
  348.     set heapsize=-heapsize !heapsize!
  349. )
  350. if "%engine%"=="engine" (
  351.     if not defined video set video=+vid_mode %def_video%
  352.     if "%video%"=="+vid_mode 2" (
  353.         if not defined width set width=+vid_config_x %ndef_width%
  354.         if not defined height set height=+vid_config_y %ndef_height%
  355.     )
  356. ) else (
  357.     if not defined bitdepth set bitdepth=-bpp %def_bitdepth%
  358.     if not defined mode set mode=%def_mode%
  359.     if "%mode%"=="-window" (
  360.         if not defined width set width=-width %ndef_width%
  361.         if not defined height set height=-height %ndef_height%
  362.     ) else (
  363.         if not defined width set width=-width %def_width%
  364.         if not defined height set height=-height %def_height%
  365.     )
  366. )
  367. goto start
  368.  
  369. :eof
  370. color
  371. EndLocal
  372. exit/b
  373.  
  374. :switches
  375. echo list of additional switches:
  376. echo   memory:  -winlock       -winlockunlock
  377. echo   draw:    -nodirectdraw  -startwindowed  -nowindirect     -noautostretch
  378. echo            -notriplebuf   -novbeaf        -nofulldib       -dibonly
  379. echo            -allow360      -noforcevga     +vid_window_x X  +vid_window_y Y
  380. echo            -resetwinpos
  381. echo   sound:   -wavonly       -nocdaudio      -nosound         -primarysound
  382. echo            -snoforceformat
  383. echo   control: -dinput
  384. echo   net:     -listen NUM
  385. echo   ? :      -basedir DIR   -sndspeed MHz   -sndbits BITS    -cddev DEV
  386. echo            -nomtex        -ip
  387. echo.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement