Subversion Repositories nw_plus

Rev

Rev 68 | Rev 70 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. @echo off
  2. color 0C
  3. setlocal ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION
  4. pushd "%~dp0"
  5. set startdir=%cd%
  6.  
  7. :restart
  8. title Duke: Nuclear Winter Plus Launcher
  9. if "%editor%"=="1" title Duke: Nuclear Winter Plus Editor Launcher
  10.  
  11. set exedir=%startdir%
  12. set addondir=%startdir%
  13. set addonhrpdir=%startdir%
  14.  
  15. set exename=eduke32
  16. set exeproper=EDuke32
  17. set action=playing
  18.  
  19. if "%editor%"=="1" (
  20. set exename=mapster32
  21. set exeproper=Mapster32
  22. set action=editing
  23. )
  24.  
  25. set addonver=r004
  26.  
  27. :title
  28. echo                          ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  29. echo                          º Duke: Nuclear Winter Plus º
  30. echo                          ÈÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÑÍÍÍͼ
  31. echo                               ³ By Hendricks266 ³
  32. echo                               ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
  33. echo.
  34. echo You are %action% Simply Silly Software's Duke: Nuclear Winter with the various
  35. echo enhancements of Duke: Nuclear Winter Plus, maintained by Hendricks266.
  36. echo.
  37.  
  38.  
  39. if "%xxx%"=="1" echo Using XXX mode.
  40. if "%dp%"=="1" echo Using Duke Plus by DeeperThought.
  41. if "%debug%"=="1" echo Using debug mode.
  42.  
  43. if "%debug%"=="1" echo DEBUG: Command Line Input: %*
  44.  
  45. :recheck
  46. if not exist %exename%.exe goto execheck
  47. :execheck_done
  48. set exedir=%cd%
  49. if "%debug%"=="1" echo DEBUG: %exeproper% Directory: "%exedir%"
  50.  
  51. if not exist nw_plus\ goto nodir
  52. if not exist duke3d.grp echo Warning: You don't have Duke3D.grp in your directory.
  53.  
  54. if exist nwinter\ set addonhrpdir=%cd%
  55. :addondircheck
  56.  
  57. chdir nw_plus
  58. set addondir=%cd%
  59. if exist nwinter\ set addonhrpdir=%cd%
  60. if exist nw_plus\ goto addondircheck
  61. if "%debug%"=="1" echo DEBUG: NW+ Directory: "%addondir%".
  62. if "%debug%"=="1" echo DEBUG: NWHRP Directory: "%addonhrpdir%".
  63.  
  64. set kextract=%addondir%\utils\windows\win32\kextract.exe
  65. if "%debug%"=="1" set kextract=%addondir%\utils\windows\win32\kextract.debug.exe
  66. set bspatch=%addondir%\utils\windows\win32\bspatch.exe
  67. set sha1sum=%addondir%\utils\windows\win32\sha1sum.exe
  68.  
  69. if "%nwgrpname%"=="" set nwgrpname=nwinter.grp
  70. if not exist "%exedir%\%nwgrpname%" if not exist "%addondir%\%nwgrpname%" if exist "%exedir%\nwinter_demo.grp" set nwgrpname=nwinter_demo.grp
  71. if not exist "%exedir%\%nwgrpname%" if not exist "%addondir%\%nwgrpname%" if exist "%addondir%\nwinter_demo.grp" set nwgrpname=nwinter_demo.grp
  72. if not exist "%exedir%\%nwgrpname%" if not exist "%addondir%\%nwgrpname%" goto nonwgrp
  73.  
  74. if exist nwinter.grp ren nwinter.grp nwinter.grp
  75. call :grpchecksum
  76. :nonwgrp_return
  77. if not "%version%"=="demo" (
  78. if not exist nwl1.map goto mapextract
  79. if not exist nwl2.map goto mapextract
  80. if not exist nwl3.map goto mapextract
  81. if not exist nwl4.map goto mapextract
  82. if not exist nwl5.map goto mapextract
  83. if not exist nwl6.map goto mapextract
  84. if not exist nwl7.map goto mapextract
  85. if not exist nwl8.map goto mapextract
  86. if not exist nwflag_%addonver%.h266 goto updateextract
  87. )
  88.  
  89.  
  90.  
  91.  
  92. chdir /d "%exedir%"
  93. echo.
  94. echo To switch your character, open the console (~) and type one of the following:
  95. echo Duke: "setvar skin 0".
  96. echo Santa: "setvar skin 1".
  97. echo.
  98. echo.
  99. echo.
  100. echo.
  101. echo.
  102. echo.
  103.  
  104. :init
  105. pause
  106. echo.
  107. goto check
  108.  
  109. :check
  110.  
  111. echo.
  112. echo Launching Duke Nukem 3D . . .
  113. echo Thanks for %action%!
  114. echo.
  115.  
  116. if "%editor%"=="1" (
  117. type "%exedir%\names.h" > "%exedir%\NWNames.h"
  118. echo. >> "%exedir%\NWNames.h"
  119. type "%addondir%\NWNames.def" >> "%exedir%\NWNames.h"
  120. )
  121.  
  122. :arguments
  123. set args=
  124. if exist "%exedir%\HRP\" set args=%args% -jHRP
  125. if exist "%exedir%\polymer_hrp\" set args=%args% -jpolymer_hrp
  126. if exist "%exedir%\duke3d_voxel.zip" set args=%args% -gduke3d_voxel.zip
  127. if exist "%exedir%\duke3d_hrp.zip" set args=%args% -gduke3d_hrp.zip
  128. if exist "%exedir%\hrp_update.zip" set args=%args% -ghrp_update.zip
  129. if exist "%exedir%\maphacks.zip" set args=%args% -gmaphacks.zip
  130. if exist "%exedir%\eduke32_mus.zip" set args=%args% -geduke32_mus.zip
  131. if exist "%addondir%" if not "%addondir%"=="%exedir%" set args=%args% -j"%addondir:\=/%"
  132. if exist "%addonhrpdir%" if not "%addonhrpdir%"=="%exedir%" if not "%addonhrpdir%"=="%addondir%" set args=%args% -j"%addonhrpdir:\=/%"
  133. set args=%args% -g%nwgrpname% -hnwinter.def -xNWEDuke.con
  134. if "%editor%"=="1" set args=%args% -namesfile NWNames.h
  135. if "%dp%"=="1" set args=%args% -hnw_dp.def -xNWDP.con
  136. if "%xxx%"=="1" if exist "%exedir%\xxx_lite.zip" set args=%args% -gxxx_lite.zip
  137. if "%xxx%"=="1" if exist "%exedir%\xxx_lite\" set args=%args% -jxxx_lite
  138. if "%xxx%"=="1" if exist "%exedir%\xxx_pack.zip" set args=%args% -gxxx_pack.zip
  139. if "%xxx%"=="1" if exist "%exedir%\xxx_pack\" set args=%args% -jxxx_pack
  140. if "%xxx%"=="1" set args=%args% -hnw_xxx.def
  141. if "%xxx%"=="1" if "%dp%"=="1" set args=%args% -hnw_dp_xxx.def -xNWDPXXX.con
  142. set args=%args% %*
  143. if "%dp%"=="1" set args=%args% -jDukePlus
  144.  
  145. set exe=%exename%
  146. if "%debug%"=="1" set exe=%exename%.debug
  147.  
  148. if exist %exe%.bat (
  149. if "%debug%"=="1" echo DEBUG: Final Command Line: call %exe%.bat %args%
  150. call %exe%.bat %args%
  151. ) else (
  152. if "%debug%"=="1" echo DEBUG: Final Command Line: start %exe%.exe %args%
  153. start %exe%.exe %args%
  154. )
  155.  
  156. set svnpath=0
  157. if "%svnpath%"=="0" if exist "%startdir%\svn\bin\svn.exe" set svnpath=%startdir%\svn\bin
  158. if "%svnpath%"=="0" if exist "%exedir%\svn\bin\svn.exe" set svnpath=%exedir%\svn\bin
  159. if "%svnpath%"=="0" if exist "%ProgramFiles%\SlikSvn\bin\svn.exe" set svnpath=%ProgramFiles%\SlikSvn\bin
  160. if "%svnpath%"=="0" if exist "%ProgramFiles(x86)%\SlikSvn\bin\svn.exe" set svnpath=%ProgramFiles(x86)%\SlikSvn\bin
  161. if "%svnpath%"=="0" if exist "%ProgramFiles%\Subversion\bin\svn.exe" set svnpath=%ProgramFiles%\Subversion\bin
  162. if "%svnpath%"=="0" if exist "%ProgramFiles(x86)%\Subversion\bin\svn.exe" set svnpath=%ProgramFiles(x86)%\Subversion\bin
  163. if "%svnpath%"=="0" if exist "%ProgramFiles%\TortoiseSVN\bin\svn.exe" set svnpath=%ProgramFiles%\TortoiseSVN\bin
  164. if "%svnpath%"=="0" if exist "%ProgramFiles(x86)%\TortoiseSVN\bin\svn.exe" set svnpath=%ProgramFiles(x86)%\TortoiseSVN\bin
  165. if "%svnpath%"=="0" for %%S in (svn.exe) do if exist "%%~dp$PATH:S" set svnpath=%%~dp$PATH:S
  166.  
  167. chdir /d "%addondir%"
  168. if not "%svnpath%"=="0" call :svn_action
  169. chdir /d "%addonhrpdir%"
  170. if not "%svnpath%"=="0" call :svn_action
  171.  
  172. goto end
  173.  
  174. :svn_action
  175. set PATH=%PATH%;%svnpath%
  176. for /f "delims=" %%a in ('svnversion.exe .') do @set oldrev=%%a
  177. if "%oldrev%"=="exported" goto :eof
  178. if "%oldrev%"=="Unversioned directory" goto :eof
  179. "svn.exe" update
  180. for /f "delims=" %%a in ('svnversion.exe .') do @set rev=%%a
  181. if %rev% EQU %oldrev% goto :eof
  182. set /a oldrev=%oldrev% + 1
  183. echo.
  184. "svn.exe" log -r %oldrev%:%rev%
  185. echo.
  186. pause
  187. goto :eof
  188.  
  189. :nonwgrp
  190. set megaton=Steam\SteamApps\common\Duke Nukem 3D\gameroot\addons\nwinter.grp
  191. if exist "%ProgramFiles%\%megaton%" copy "%ProgramFiles%\%megaton%" .\ && call :conprotect && goto nonwgrp_done
  192. if exist "%ProgramFiles(x86)%\%megaton%" copy "%ProgramFiles(x86)%\%megaton%" .\ && call :conprotect && goto nonwgrp_done
  193. echo.
  194. echo Error: You don't have NWINTER.GRP in your directory.
  195.  
  196.  
  197. :retry
  198. echo.
  199. set cddrive=
  200. set /p cddrive=What is the drive letter that your Nuclear Winter CD is in?
  201. echo.
  202. if not '%cddrive%'=='' set cddrive=%cddrive:~0,1%
  203. if '%cddrive%'=='' goto cdno
  204. if not exist %cddrive%:\ goto cdno
  205. if not exist %cddrive%:\* goto cdno
  206. if exist %cddrive%:\GAMEDATA\NWINTER.GRP copy %cddrive%:\GAMEDATA\NWINTER.GRP .\nwinter.grp && goto nonwgrp_done
  207. if exist %cddrive%:\NWINTER\GAMEDATA\NWINTER.GRP copy %cddrive%:\NWINTER\GAMEDATA\NWINTER.GRP .\nwinter.grp && goto nonwgrp_done
  208. if exist %cddrive%:\NW\GAMEDATA\NWINTER.GRP copy %cddrive%:\NW\GAMEDATA\NWINTER.GRP .\nwinter.grp && goto nonwgrp_done
  209. goto cdwrong
  210.  
  211. :nonwgrp_done
  212. echo.
  213. if exist nwinter.grp (
  214. type NWINTRO.TXT
  215. echo.
  216. pause
  217. call :grpchecksum
  218. call :grpchecksum_results
  219. goto nonwgrp_return
  220. )
  221. if not exist nwinter.grp (
  222. echo Installation Error!
  223. echo Contact Hendricks266 for help.
  224. echo.
  225. pause
  226. goto end
  227. )
  228.  
  229. :grpchecksum
  230. if not exist "%sha1sum%" (
  231. echo "%sha1sum%" not found.
  232. goto :eof
  233. )
  234. pushd .
  235. if exist "%addondir%\%nwgrpname%" chdir /d %addondir%
  236. if exist "%exedir%\%nwgrpname%" chdir /d %exedir%
  237. echo a6728f621f121f9db02ee67c39efdbb5eea95711 *%nwgrpname% | "%sha1sum%" --status --check -
  238. if "%ERRORLEVEL%"=="0" set version=full && popd && goto :eof
  239. if "%ERRORLEVEL%"=="1" echo 1b33b2cbb7101b5b18b15855392f55575413ecc3 *%nwgrpname% | "%sha1sum%" --status --check -
  240. if "%ERRORLEVEL%"=="0" set version=demo && popd && goto :eof
  241. if "%ERRORLEVEL%"=="1" set version=unknown
  242. popd
  243. goto :eof
  244.  
  245. :grpchecksum_results
  246. if "%version%"=="full" echo NWINTER.GRP checksum verified.
  247. if "%version%"=="demo" echo NWINTER.GRP (demo version) checksum verified.
  248. if "%version%"=="unknown" echo NWINTER.GRP checksum does not match. You may have a bad copy.
  249. echo.
  250. goto :eof
  251.  
  252. :cdno
  253. echo '%cddrive%' is not valid.  Please try again.
  254. goto retry
  255.  
  256. :cdwrong
  257. echo '%cddrive%' is not the correct disc.  Please try again.
  258. goto retry
  259.  
  260. :mapextract
  261. echo Extracted maps not found or patched. Proceeding to installation.
  262. goto extract
  263.  
  264. :updateextract
  265. echo Map patch update required. Proceeding to installation.
  266. goto extract
  267.  
  268. :extract
  269. echo.
  270. echo                                ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  271. echo                                º Installation º
  272. echo                                ÈÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  273. echo.
  274. call :grpchecksum
  275. call :grpchecksum_results
  276. if not exist nwl1.patch goto nopatch
  277. if not exist nwl2.patch goto nopatch
  278. if not exist nwl3.patch goto nopatch
  279. if not exist nwl4.patch goto nopatch
  280. if not exist nwl5.patch goto nopatch
  281. if not exist nwl6.patch goto nopatch
  282. if not exist nwl7.patch goto nopatch
  283. if not exist nwl8.patch goto nopatch
  284. mkdir nw_preserve
  285. if exist nwl*.map move /y nwl*.map nw_preserve\
  286. if exist "%exedir%\nwl*.map" move /y "%exedir%\nwl*.map" nw_preserve\
  287. :: TODO: eliminate the need for the if exist checks; tighten up path handling
  288. set grp=nwinter.grp
  289. if exist "%addondir%\%nwgrpname%" set grp=%addondir%\%nwgrpname%
  290. if exist "%exedir%\%nwgrpname%" set grp=%exedir%\%nwgrpname%
  291. "%kextract%" "%grp%" E2L*.MAP
  292. ren E2L1.MAP nwl1.map
  293. ren E2L2.MAP nwl2.map
  294. ren E2L3.MAP nwl3.map
  295. ren E2L4.MAP nwl4.map
  296. ren E2L5.MAP nwl5.map
  297. ren E2L6.MAP nwl6.map
  298. ren E2L7.MAP nwl7.map
  299. ren E2L8.MAP nwl8.map
  300. if exist nwpatch*.h266 del /f /q nwpatch*.h266
  301. if exist nwflag*.h266 del /f /q nwflag*.h266
  302. echo.
  303. echo Map patching will now begin.
  304. echo.
  305. pause
  306. echo
  307. "%bspatch%" nwl1.map nwl1.map nwl1.patch
  308. "%bspatch%" nwl2.map nwl2.map nwl2.patch
  309. "%bspatch%" nwl3.map nwl3.map nwl3.patch
  310. "%bspatch%" nwl4.map nwl4.map nwl4.patch
  311. "%bspatch%" nwl5.map nwl5.map nwl5.patch
  312. "%bspatch%" nwl6.map nwl6.map nwl6.patch
  313. "%bspatch%" nwl7.map nwl7.map nwl7.patch
  314. "%bspatch%" nwl8.map nwl8.map nwl8.patch
  315. if exist nwpatch*.h266 del /f /q nwpatch*.h266
  316. if exist nwflag*.h266 del /f /q nwflag*.h266
  317. echo Do not delete this file! You will be forced to reinstall NW+ and repatch the maps. >nwflag_%addonver%.h266
  318. attrib +r nwflag_%addonver%.h266
  319. echo.
  320. echo Patching complete!
  321. :scanning
  322. chdir "%exedir%"
  323. echo.
  324. echo Scanning directory for potential problems.
  325. if exist nwl1.mhk goto mhkfound
  326. if exist nwl1demo.mhk goto mhkfound
  327. if exist nwl2.mhk goto mhkfound
  328. if exist nwl3.mhk goto mhkfound
  329. if exist nwl4.mhk goto mhkfound
  330. if exist nwl5.mhk goto mhkfound
  331. if exist nwl6.mhk goto mhkfound
  332. if exist nwl7.mhk goto mhkfound
  333. if exist nwl8.mhk goto mhkfound
  334. if exist _nwzoo.mhk goto mhkfound
  335. :mhkfound_done
  336. if exist TILES005.ART goto artfound
  337. if exist TILES006.ART goto artfound
  338. if exist TILES007.ART goto artfound
  339. if exist TILES008.ART goto artfound
  340. if exist TILES009.ART goto artfound
  341. if exist TILES012.ART goto artfound
  342. if exist TILES013.ART goto artfound
  343. if exist TILES014.ART goto artfound
  344. if exist TILES015.ART goto artfound
  345. :artfound_done
  346. call :checksum c6b8ca33ea6a2ec46b8dfeca4f9a3d5e078d0789 NWACTOR.CON "NWINTER file detected and neutralized:"
  347. call :checksum fdb91aa2912f16232ed9020a7d8ec35834ef58c8 NWDEFS.CON "NWINTER file detected and neutralized:"
  348. call :checksum 2bb2ddc7319e0935569b724f3c67cb953fdb79d6 NWINTER.CON "NWINTER file detected and neutralized:"
  349. call :checksum 5ae347733be1f87f35d1930186de1ed764f4682f NWSNOW.CON "NWINTER file detected and neutralized:"
  350. call :checksum 5df8b3b4216dcfdb8bc0adf6241f8a893eacfd98 NWUSER.CON "NWINTER file detected and neutralized:"
  351. if exist NWinter.con goto confound
  352. if exist NWActor.con goto confound
  353. if exist NWDefs.con goto confound
  354. if exist NWDP.con goto confound
  355. if exist NWDPCode.con goto confound
  356. if exist NWDPXXX.con goto confound
  357. if exist NWEDuke.con goto confound
  358. if exist NWSnow.con goto confound
  359. if exist NWUser.con goto confound
  360. :confound_done
  361. call :conprotect
  362. chdir /d "%addondir%"
  363. echo.
  364. pause
  365. goto restart
  366.  
  367. :conprotect
  368. pushd "%exedir%"
  369. if not exist GAME.CON "%kextract%" DUKE3D.GRP GAME.CON
  370. if not exist DEFS.CON "%kextract%" DUKE3D.GRP DEFS.CON
  371. if not exist USER.CON "%kextract%" DUKE3D.GRP USER.CON
  372. popd
  373. goto :eof
  374.  
  375. :checksum
  376. if not exist "%sha1sum%" (
  377. echo "%sha1sum%" not found.
  378. goto :eof
  379. )
  380. if not exist "%~2" goto :eof
  381. echo %~1 *%~2 | "%sha1sum%" --status --check -
  382. if "%ERRORLEVEL%"=="0" (
  383. ren "%~2" "NWOld_%addonver%_%~nx2"
  384. echo %~3 %~nx2
  385. )
  386. goto :eof
  387.  
  388. :nopatch
  389. echo.
  390. echo Error: You don't have all the *.patch files in your directory.
  391. echo Aborting installation.
  392. echo Map patching is required for NW+ to function correctly.
  393. echo.
  394. pause
  395. goto end
  396.  
  397. :mhkfound
  398. echo.
  399. echo Problematic .mhk files have been found in your directory.
  400. echo Unless you have knowingly made a modification to NW's map hacks,
  401. echo the presence of these files in your %exeproper% directory will
  402. echo cause NW+ to function incorrectly.
  403. echo.
  404. echo nwl1.mhk
  405. echo nwl1demo.mhk
  406. echo nwl2.mhk
  407. echo nwl3.mhk
  408. echo nwl4.mhk
  409. echo nwl5.mhk
  410. echo nwl6.mhk
  411. echo nwl7.mhk
  412. echo nwl8.mhk
  413. echo _nwzoo.mhk
  414. goto mhkfound_done
  415.  
  416. :artfound
  417. echo.
  418. echo Problematic .art files have been found in your directory.
  419. echo Unless you have knowingly made a modification to NW's art,
  420. echo the presence of these files in your %exeproper% directory will
  421. echo cause NW+ to function incorrectly.
  422. echo.
  423. echo TILES005.ART
  424. echo TILES006.ART
  425. echo TILES007.ART
  426. echo TILES008.ART
  427. echo TILES009.ART
  428. echo TILES012.ART
  429. echo TILES013.ART
  430. echo TILES014.ART
  431. echo TILES015.ART
  432. goto artfound_done
  433.  
  434. :confound
  435. echo.
  436. echo Problematic .con files have been found in your directory.
  437. echo Unless you have knowingly made a modification to NW's programming,
  438. echo the presence of these files in your %exeproper% directory will
  439. echo cause NW+ to function incorrectly.
  440. echo.
  441. echo NWinter.con
  442. echo NWEDuke.con
  443. echo NWDefs.con
  444. echo NWUser.con
  445. echo NWDP.con
  446. echo NWDPCode.con
  447. echo NWDPXXX.con
  448. echo NWActor.con
  449. echo NWSnow.con
  450. echo.
  451. echo IF THESE ARE THE ORIGINAL NUCLEAR WINTER CON FILES, OR THEY COME FROM
  452. echo AN OUTDATED VERSION OF NW+, REMOVE THEM FROM YOUR %exeproper% DIRECTORY
  453. echo IMMEDIATELY!
  454. echo NW+ uses modified .con files to fix programming errors created by
  455. echo the original programmers. Due to improvements made to the levels,
  456. echo NW+ will have major errors if the included .con files are not used.
  457. goto confound_done
  458.  
  459. :execheck
  460. if exist %exename%.bat goto execheck_done
  461. if exist %exename%.exe goto recheck
  462. set prevdir=%cd%
  463. if not "%cd%"=="%cd:~0,3%" chdir ..
  464. if not "%cd%"=="%prevdir%" goto execheck
  465. echo Warning: You don't have %exeproper% in your directory.
  466. chdir /d "%startdir%"
  467. goto execheck_done
  468.  
  469. :nodir
  470. echo.
  471. echo Error: "nw_plus" data directory not found.
  472. echo Aborting launch.
  473. echo.
  474. pause
  475. goto end
  476.  
  477. :end
  478. if "%debug%"=="1" echo.
  479. if "%debug%"=="1" pause
  480. echo.
  481. popd
  482. endlocal
  483. title %ComSpec%
  484. color 07
  485.