Advertisement
Guest User

set up Quake and run

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