Subversion Repositories nw_plus

Compare Revisions

Regard whitespace Rev HEAD → Rev 1

/nw_plus/NWinter.bat
1,105 → 1,51
@echo off
color 0C
setlocal ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION
pushd "%~dp0"
set startdir=%cd%
@color 0C
 
:restart
title Duke: Nuclear Winter Plus Launcher
if "%editor%"=="1" title Duke: Nuclear Winter Plus Editor Launcher
title Duke: Nuclear Winter Plus Batch Launcher
 
set exedir=%startdir%
set addondir=%startdir%
set addonhrpdir=%startdir%
set dir=%cd%
set nwver=30
set hrp=
set hrpu=
 
set exename=eduke32
set exeproper=EDuke32
set action=playing
 
if "%editor%"=="1" (
set exename=mapster32
set exeproper=Mapster32
set action=editing
)
 
set addonver=r005
 
:title
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Duke: Nuclear Winter Plus º
echo ÈÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÑÍÍÍͼ
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Duke: Nuclear Winter Plus Batch Launcher º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍͼ
echo ³ By Hendricks266 ³
echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
echo.
echo You are %action% Simply Silly Software's Duke: Nuclear Winter with the various
echo You are playing Simply Silly Software's Duke: Nuclear Winter with the various
echo enhancements of Duke: Nuclear Winter Plus, maintained by Hendricks266.
echo.
 
 
if "%xxx%"=="1" echo Using XXX mode.
if "%dp%"=="1" echo Using Duke Plus by DeeperThought.
if "%debug%"=="1" echo Using debug mode.
 
if "%debug%"=="1" echo DEBUG: Command Line Input: %*
 
:recheck
if not exist %exename%.exe goto execheck
:execheck_done
set exedir=%cd%
if "%debug%"=="1" echo DEBUG: %exeproper% Directory: "%exedir%"
 
if not exist eduke32.exe goto eduke32check
:eduke32check_done
if exist NWDuke.rt_ del /f /q NWDuke.rt_
if exist NWSanta.grp del /f /q NWSanta.grp
if not exist nw_plus\ goto nodir
if not exist duke3d.grp echo Warning: You don't have Duke3D.grp in your directory.
 
if exist nwinter\ set addonhrpdir=%cd%
:addondircheck
 
chdir nw_plus
set addondir=%cd%
if exist nwinter\ set addonhrpdir=%cd%
if exist nw_plus\ goto addondircheck
if "%debug%"=="1" echo DEBUG: NW+ Directory: "%addondir%".
if "%debug%"=="1" echo DEBUG: NWHRP Directory: "%addonhrpdir%".
 
set kextract=%addondir%\utils\windows\win32\kextract.exe
if "%debug%"=="1" set kextract=%addondir%\utils\windows\win32\kextract.debug.exe
set bspatch=%addondir%\utils\windows\win32\bspatch.exe
set sha1sum=%addondir%\utils\windows\win32\sha1sum.exe
 
if "%nwgrpname%"=="" set nwgrpname=nwinter.grp
if not exist "%exedir%\%nwgrpname%" if not exist "%addondir%\%nwgrpname%" if exist "%exedir%\nwinter_demo.grp" set nwgrpname=nwinter_demo.grp
if not exist "%exedir%\%nwgrpname%" if not exist "%addondir%\%nwgrpname%" if exist "%addondir%\nwinter_demo.grp" set nwgrpname=nwinter_demo.grp
if not exist "%exedir%\%nwgrpname%" if not exist "%addondir%\%nwgrpname%" goto nonwgrp
 
if exist nwinter.grp ren nwinter.grp nwinter.grp
call :grpchecksum
:nonwgrp_return
if not "%version%"=="demo" (
if not exist nwl1.map goto mapextract
if not exist nwl2.map goto mapextract
if not exist nwl3.map goto mapextract
if not exist nwl4.map goto mapextract
if not exist nwl5.map goto mapextract
if not exist nwl6.map goto mapextract
if not exist nwl7.map goto mapextract
if not exist nwl8.map goto mapextract
if not exist nwflag_%addonver%.h266 goto updateextract
)
 
 
 
 
chdir /d "%exedir%"
if not exist duke3d.grp Warning: You don't have Duke3D.grp in your directory.
if exist NWINTER.GRP move NWINTER.GRP nw_plus\
cd nw_plus
if not exist NWINTER.GRP goto nonwgrp
:nonwgrp_done
if not exist nwflag%nwver%.h266 goto extract
if not exist nwl1.map goto extract
if not exist nwl2.map goto extract
if not exist nwl3.map goto extract
if not exist nwl4.map goto extract
if not exist nwl5.map goto extract
if not exist nwl6.map goto extract
if not exist nwl7.map goto extract
if not exist nwl8.map goto extract
cd ..
echo.
echo To switch your character, open the console (~) and type one of the following:
echo Duke: "setvar skin 0".
echo Santa: "setvar skin 1".
echo.
echo.
echo.
echo.
echo.
echo.
 
:init
pause
108,98 → 54,27
 
:check
 
if exist duke3d_hrp.zip set hrp=/gduke3d_hrp.zip
if exist hrp_update.zip set hrpu=/ghrp_update.zip
 
echo.
echo Launching Duke Nukem 3D . . .
echo Thanks for %action%!
echo Thanks for playing!
echo.
echo Please leave this window open for the entire duration of your game.
echo It will close automatically.
 
if "%editor%"=="1" (
type "%exedir%\names.h" > "%exedir%\NWNames.h"
echo. >> "%exedir%\NWNames.h"
type "%addondir%\NWNames.def" >> "%exedir%\NWNames.h"
)
::if exist *.art ren *.art *.abk
 
:arguments
set args=
if exist "%exedir%\HRP\" set args=%args% -j HRP
if exist "%exedir%\polymer_hrp\" set args=%args% -j polymer_hrp
if exist "%exedir%\duke3d_voxel.zip" set args=%args% -g duke3d_voxel.zip
if exist "%exedir%\duke3d_hrp.zip" set args=%args% -g duke3d_hrp.zip
if exist "%exedir%\hrp_update.zip" set args=%args% -g hrp_update.zip
if exist "%exedir%\maphacks.zip" set args=%args% -g maphacks.zip
if exist "%exedir%\eduke32_mus.zip" set args=%args% -g eduke32_mus.zip
if exist "%addondir%" if not "%addondir%"=="%exedir%" set args=%args% -j "%addondir:\=/%"
if exist "%addonhrpdir%" if not "%addonhrpdir%"=="%exedir%" if not "%addonhrpdir%"=="%addondir%" set args=%args% -j "%addonhrpdir:\=/%"
set args=%args% -g %nwgrpname% -h nwinter.def -x NWEDuke.con
if "%editor%"=="1" set args=%args% -namesfile NWNames.h
if "%dp%"=="1" set args=%args% -h nw_dp.def -x NWDP.con
if "%xxx%"=="1" if exist "%exedir%\xxx_lite.zip" set args=%args% -g xxx_lite.zip
if "%xxx%"=="1" if exist "%exedir%\xxx_lite\" set args=%args% -j xxx_lite
if "%xxx%"=="1" if exist "%exedir%\xxx_pack.zip" set args=%args% -g xxx_pack.zip
if "%xxx%"=="1" if exist "%exedir%\xxx_pack\" set args=%args% -j xxx_pack
if "%xxx%"=="1" set args=%args% -h nw_xxx.def
if "%xxx%"=="1" if "%dp%"=="1" set args=%args% -h nw_dp_xxx.def -x NWDPXXX.con
set args=%args% %*
if "%dp%"=="1" set args=%args% -j DukePlus
eduke32 /xNWEDuke.con /hnwinter.def /jnw_plus /gNWINTER.GRP %hrp% %hrpu% %*
 
set exe=%exename%
if "%debug%"=="1" set exe=%exename%.debug
::if exist *.abk ren *.abk *.art
 
if exist %exe%.bat (
if "%debug%"=="1" echo DEBUG: Final Command Line: call %exe%.bat %args%
call %exe%.bat %args%
) else (
if "%debug%"=="1" echo DEBUG: Final Command Line: start %exe%.exe %args%
start %exe%.exe %args%
)
 
set svnpath=0
if "%svnpath%"=="0" if exist "%startdir%\svn\bin\svn.exe" set svnpath=%startdir%\svn\bin
if "%svnpath%"=="0" if exist "%exedir%\svn\bin\svn.exe" set svnpath=%exedir%\svn\bin
if "%svnpath%"=="0" if exist "%ProgramFiles%\SlikSvn\bin\svn.exe" set svnpath=%ProgramFiles%\SlikSvn\bin
if "%svnpath%"=="0" if exist "%ProgramFiles(x86)%\SlikSvn\bin\svn.exe" set svnpath=%ProgramFiles(x86)%\SlikSvn\bin
if "%svnpath%"=="0" if exist "%ProgramFiles%\Subversion\bin\svn.exe" set svnpath=%ProgramFiles%\Subversion\bin
if "%svnpath%"=="0" if exist "%ProgramFiles(x86)%\Subversion\bin\svn.exe" set svnpath=%ProgramFiles(x86)%\Subversion\bin
if "%svnpath%"=="0" if exist "%ProgramFiles%\TortoiseSVN\bin\svn.exe" set svnpath=%ProgramFiles%\TortoiseSVN\bin
if "%svnpath%"=="0" if exist "%ProgramFiles(x86)%\TortoiseSVN\bin\svn.exe" set svnpath=%ProgramFiles(x86)%\TortoiseSVN\bin
if "%svnpath%"=="0" for %%S in (svn.exe) do if exist "%%~dp$PATH:S" set svnpath=%%~dp$PATH:S
 
chdir /d "%addondir%"
if not "%svnpath%"=="0" call :svn_action
chdir /d "%addonhrpdir%"
if not "%svnpath%"=="0" call :svn_action
 
goto end
 
:svn_action
set PATH=%PATH%;%svnpath%
for /f "delims=" %%a in ('svnversion.exe .') do @set oldrev=%%a
if "%oldrev%"=="exported" goto :eof
if "%oldrev%"=="Unversioned directory" goto :eof
"svn.exe" update
for /f "delims=" %%a in ('svnversion.exe .') do @set rev=%%a
set oldrev=%oldrev:M=%
set oldrev=%oldrev:S=%
set oldrev=%oldrev:P=%
set rev=%rev:M=%
set rev=%rev:S=%
set rev=%rev:P=%
if %rev% EQU %oldrev% goto :eof
set /a oldrev=%oldrev% + 1
echo.
"svn.exe" log -r %oldrev%:%rev%
echo.
pause
goto :eof
 
:nonwgrp
set megaton=Steam\SteamApps\common\Duke Nukem 3D\gameroot\addons\nwinter.grp
if exist "%ProgramFiles%\%megaton%" copy "%ProgramFiles%\%megaton%" .\ && call :conprotect && goto nonwgrp_done
if exist "%ProgramFiles(x86)%\%megaton%" copy "%ProgramFiles(x86)%\%megaton%" .\ && call :conprotect && goto nonwgrp_done
echo.
echo Error: You don't have NWINTER.GRP in your directory.
 
 
:retry
echo.
set cddrive=
209,92 → 84,42
if '%cddrive%'=='' goto cdno
if not exist %cddrive%:\ goto cdno
if not exist %cddrive%:\* goto cdno
if exist %cddrive%:\GAMEDATA\NWINTER.GRP copy %cddrive%:\GAMEDATA\NWINTER.GRP .\nwinter.grp && goto nonwgrp_done
if exist %cddrive%:\NWINTER\GAMEDATA\NWINTER.GRP copy %cddrive%:\NWINTER\GAMEDATA\NWINTER.GRP .\nwinter.grp && goto nonwgrp_done
if exist %cddrive%:\NW\GAMEDATA\NWINTER.GRP copy %cddrive%:\NW\GAMEDATA\NWINTER.GRP .\nwinter.grp && goto nonwgrp_done
goto cdwrong
 
:nonwgrp_done
if not exist %cddrive%:\GAMEDATA\NWINTER.GRP goto cdw
copy %cddrive%:GAMEDATA\NWINTER.GRP .\
pause
echo.
if exist nwinter.grp (
type NWINTRO.TXT
echo.
pause
call :grpchecksum
call :grpchecksum_results
goto nonwgrp_return
)
if not exist nwinter.grp (
echo Installation Error!
echo Contact Hendricks266 for help.
echo.
pause
goto end
)
goto nonwgrp_done
 
:grpchecksum
if not exist "%sha1sum%" (
echo "%sha1sum%" not found.
goto :eof
)
pushd .
if exist "%addondir%\%nwgrpname%" chdir /d %addondir%
if exist "%exedir%\%nwgrpname%" chdir /d %exedir%
echo a6728f621f121f9db02ee67c39efdbb5eea95711 *%nwgrpname% | "%sha1sum%" --status --check -
if "%ERRORLEVEL%"=="0" set version=full&& popd && goto :eof
if "%ERRORLEVEL%"=="1" echo 1b33b2cbb7101b5b18b15855392f55575413ecc3 *%nwgrpname% | "%sha1sum%" --status --check -
if "%ERRORLEVEL%"=="0" set version=demo&& popd && goto :eof
if "%ERRORLEVEL%"=="1" set version=unknown
popd
goto :eof
 
:grpchecksum_results
if "%version%"=="full" echo NWINTER.GRP checksum verified.
if "%version%"=="demo" echo NWINTER.GRP (demo version) checksum verified.
if "%version%"=="unknown" echo NWINTER.GRP checksum does not match. You may have a bad copy.
echo.
goto :eof
 
:cdno
echo '%cddrive%' is not valid. Please try again.
goto retry
 
:cdwrong
:cdw
echo '%cddrive%' is not the correct disc. Please try again.
goto retry
 
:mapextract
echo Extracted maps not found or patched. Proceeding to installation.
goto extract
 
:updateextract
echo Map patch update required. Proceeding to installation.
goto extract
 
:extract
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Installation º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Duke: Nuclear Winter Plus Installation º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍͼ
echo ³ By Hendricks266 ³
echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
echo.
call :grpchecksum
call :grpchecksum_results
if not exist nwl1.patch goto nopatch
if not exist nwl2.patch goto nopatch
if not exist nwl3.patch goto nopatch
if not exist nwl4.patch goto nopatch
if not exist nwl5.patch goto nopatch
if not exist nwl6.patch goto nopatch
if not exist nwl7.patch goto nopatch
if not exist nwl8.patch goto nopatch
mkdir nw_preserve
if exist nwl*.map move /y nwl*.map nw_preserve\
if exist "%exedir%\nwl*.map" move /y "%exedir%\nwl*.map" nw_preserve\
:: TODO: eliminate the need for the if exist checks; tighten up path handling
set grp=nwinter.grp
if exist "%addondir%\%nwgrpname%" set grp=%addondir%\%nwgrpname%
if exist "%exedir%\%nwgrpname%" set grp=%exedir%\%nwgrpname%
"%kextract%" "%grp%" E2L*.MAP
if not exist nwl1.ips goto noips
if not exist nwl2.ips goto noips
if not exist nwl3.ips goto noips
if not exist nwl4.ips goto noips
if not exist nwl5.ips goto noips
if not exist nwl6.ips goto noips
if not exist nwl7.ips goto noips
if not exist nwl8.ips goto noips
if exist nwl*.map del /f /q nwl*.map
if exist ..\nwl*.map del /f /q ..\nwl*.map
utils\windows\win32\kextract.exe NWINTER.GRP E2L*.MAP
ren E2L1.MAP nwl1.map
ren E2L2.MAP nwl2.map
ren E2L3.MAP nwl3.map
309,23 → 134,31
echo Map patching will now begin.
echo.
pause
echo.
"%bspatch%" nwl1.map nwl1.map nwl1.patch
"%bspatch%" nwl2.map nwl2.map nwl2.patch
"%bspatch%" nwl3.map nwl3.map nwl3.patch
"%bspatch%" nwl4.map nwl4.map nwl4.patch
"%bspatch%" nwl5.map nwl5.map nwl5.patch
"%bspatch%" nwl6.map nwl6.map nwl6.patch
"%bspatch%" nwl7.map nwl7.map nwl7.patch
"%bspatch%" nwl8.map nwl8.map nwl8.patch
echo
utils\windows\win32\uips.exe a nwl1.ips nwl1.map
utils\windows\win32\uips.exe a nwl2.ips nwl2.map
utils\windows\win32\uips.exe a nwl3.ips nwl3.map
utils\windows\win32\uips.exe a nwl4.ips nwl4.map
utils\windows\win32\uips.exe a nwl5.ips nwl5.map
utils\windows\win32\uips.exe a nwl6.ips nwl6.map
utils\windows\win32\uips.exe a nwl7.ips nwl7.map
utils\windows\win32\uips.exe a nwl8.ips nwl8.map
if exist nwpatch*.h266 del /f /q nwpatch*.h266
if exist nwflag*.h266 del /f /q nwflag*.h266
echo Do not delete this file! You will be forced to reinstall NW+ and repatch the maps. >nwflag_%addonver%.h266
attrib +r nwflag_%addonver%.h266
echo Do not delete this file! You will be force to reinstall NW+ and repatch the maps. >nwflag%nwver%.h266
attrib +r nwflag%nwver%.h266
del /f /q nwl1.ips
del /f /q nwl2.ips
del /f /q nwl3.ips
del /f /q nwl4.ips
del /f /q nwl5.ips
del /f /q nwl6.ips
del /f /q nwl7.ips
del /f /q nwl8.ips
echo.
echo Patching complete!
:scanning
chdir "%exedir%"
cd ..
echo.
echo Scanning directory for potential problems.
if exist nwl1.mhk goto mhkfound
349,11 → 182,6
if exist TILES014.ART goto artfound
if exist TILES015.ART goto artfound
:artfound_done
call :checksum c6b8ca33ea6a2ec46b8dfeca4f9a3d5e078d0789 NWACTOR.CON "NWINTER file detected and neutralized:"
call :checksum fdb91aa2912f16232ed9020a7d8ec35834ef58c8 NWDEFS.CON "NWINTER file detected and neutralized:"
call :checksum 2bb2ddc7319e0935569b724f3c67cb953fdb79d6 NWINTER.CON "NWINTER file detected and neutralized:"
call :checksum 5ae347733be1f87f35d1930186de1ed764f4682f NWSNOW.CON "NWINTER file detected and neutralized:"
call :checksum 5df8b3b4216dcfdb8bc0adf6241f8a893eacfd98 NWUSER.CON "NWINTER file detected and neutralized:"
if exist NWinter.con goto confound
if exist NWActor.con goto confound
if exist NWDefs.con goto confound
364,36 → 192,13
if exist NWSnow.con goto confound
if exist NWUser.con goto confound
:confound_done
call :conprotect
chdir /d "%addondir%"
echo.
pause
goto restart
 
:conprotect
pushd "%exedir%"
if not exist GAME.CON "%kextract%" DUKE3D.GRP GAME.CON
if not exist DEFS.CON "%kextract%" DUKE3D.GRP DEFS.CON
if not exist USER.CON "%kextract%" DUKE3D.GRP USER.CON
popd
goto :eof
 
:checksum
if not exist "%sha1sum%" (
echo "%sha1sum%" not found.
goto :eof
)
if not exist "%~2" goto :eof
echo %~1 *%~2 | "%sha1sum%" --status --check -
if "%ERRORLEVEL%"=="0" (
ren "%~2" "NWOld_%addonver%_%~nx2"
echo %~3 %~nx2
)
goto :eof
 
:nopatch
:noips
echo.
echo Error: You don't have all the *.patch files in your directory.
echo Error: You don't have all the *.ips files in your directory.
echo Aborting installation.
echo Map patching is required for NW+ to function correctly.
echo.
404,7 → 209,7
echo.
echo Problematic .mhk files have been found in your directory.
echo Unless you have knowingly made a modification to NW's map hacks,
echo the presence of these files in your %exeproper% directory will
echo the presence of these files in your EDuke32 directory will
echo cause NW+ to function incorrectly.
echo.
echo nwl1.mhk
423,7 → 228,7
echo.
echo Problematic .art files have been found in your directory.
echo Unless you have knowingly made a modification to NW's art,
echo the presence of these files in your %exeproper% directory will
echo the presence of these files in your EDuke32 directory will
echo cause NW+ to function incorrectly.
echo.
echo TILES005.ART
441,7 → 246,7
echo.
echo Problematic .con files have been found in your directory.
echo Unless you have knowingly made a modification to NW's programming,
echo the presence of these files in your %exeproper% directory will
echo the presence of these files in your EDuke32 directory will
echo cause NW+ to function incorrectly.
echo.
echo NWinter.con
455,7 → 260,7
echo NWSnow.con
echo.
echo IF THESE ARE THE ORIGINAL NUCLEAR WINTER CON FILES, OR THEY COME FROM
echo AN OUTDATED VERSION OF NW+, REMOVE THEM FROM YOUR %exeproper% DIRECTORY
echo AN OUTDATED VERSION OF NW+, REMOVE THEM FROM YOUR EDUKE32 DIRECTORY
echo IMMEDIATELY!
echo NW+ uses modified .con files to fix programming errors created by
echo the original programmers. Due to improvements made to the levels,
462,15 → 267,34
echo NW+ will have major errors if the included .con files are not used.
goto confound_done
 
:execheck
if exist %exename%.bat goto execheck_done
if exist %exename%.exe goto recheck
set prevdir=%cd%
if not "%cd%"=="%cd:~0,3%" chdir ..
if not "%cd%"=="%prevdir%" goto execheck
echo Warning: You don't have %exeproper% in your directory.
chdir /d "%startdir%"
goto execheck_done
:eduke32check
if exist eduke32.bat goto eduke32check_done
if exist ..\eduke32.exe (
cd ..
goto recheck
)
if exist ..\..\eduke32.exe (
cd ..\..
goto recheck
)
if exist ..\..\..\eduke32.exe (
cd ..\..\..
goto recheck
)
if exist ..\eduke32.bat (
cd ..
goto eduke32check_done
)
if exist ..\..\eduke32.bat (
cd ..\..
goto eduke32check_done
)
if exist ..\..\..\eduke32.bat (
cd ..\..\..
goto eduke32check_done
)
echo Warning: You don't have EDuke32 in your directory.
goto eduke32check_done
 
:nodir
echo.
481,10 → 305,11
goto end
 
:end
if "%debug%"=="1" echo.
if "%debug%"=="1" pause
set hrp=
set hrpu=
echo.
popd
endlocal
title %ComSpec%
color 07
@color 07
@title %ComSpec%
cd %dir%
@echo on
goto :eof