Subversion Repositories dc_hrp

Compare Revisions

Regard whitespace Rev 32 → Rev 33

/script/DukeDC.bat
0,0 → 1,318
@echo off
color 0C
setlocal ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION
pushd "%~dp0"
set startdir=%cd%
 
:restart
title Duke It Out In D.C. Launcher
if "%editor%"=="1" title Duke It Out In D.C. Editor Launcher
 
set exedir=%startdir%
 
set exename=eduke32
set exeproper=EDuke32
set action=playing
 
if "%editor%"=="1" (
set exename=mapster32
set exeproper=Mapster32
set action=editing
)
 
:title
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Duke It Out In D.C. º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
echo.
echo.
echo You are %action% Sunstorm Interactive's Duke It Out In D.C.
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 dc_hrp\ goto nodir
if not exist duke3d.grp echo Warning: You don't have Duke3D.grp in your directory.
 
set sha1sum=%startdir%\utils\windows\win32\sha1sum.exe
set kextract=%startdir%\utils\windows\win32\kextract.exe
if "%debug%"=="1" set kextract=%startdir%\utils\windows\win32\kextract.debug.exe
 
if exist dukedc.grp ren dukedc.grp dukedc.grp
if "%dcgrpname%"=="" set dcgrpname=dukedc.grp
if exist "%dcgrpname%" goto dcgrp_found
if not exist dukedc.grp if exist DUKEDCPP.GRP ren DUKEDCPP.GRP dukedc.grp
if not exist dukedc.grp if exist DUKEDC13.GRP ren DUKEDC13.GRP dukedc.grp
if not exist dukedc.grp if exist DC.GRP ren DC.GRP dukedc.grp
if not exist dukedc.grp goto nodcgrp
 
:dcgrp_found
call :grpchecksum
 
:nodcgrp_return
chdir /d "%exedir%"
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
 
 
:init
pause
echo.
goto check
 
:check
 
echo.
echo Launching Duke Nukem 3D . . .
echo Thanks for %action%!
echo.
 
if exist duke3d.def ren duke3d.def duke3d_dcbak.def
 
if exist duke3d_dcbak.def echo duke3d.def has been renamed to duke3d_dcbak.def to allow the add-on to operate.
 
:arguments
set args=
if exist "%exedir%\HRP\" set args=%args% -jHRP
if exist "%exedir%\polymer_hrp\" set args=%args% -jpolymer_hrp
if exist "%exedir%\duke3d_voxel.zip" set args=%args% -gduke3d_voxel.zip
if exist "%exedir%\duke3d_hrp.zip" set args=%args% -gduke3d_hrp.zip
if exist "%exedir%\hrp_update.zip" set args=%args% -ghrp_update.zip
if exist "%exedir%\maphacks.zip" set args=%args% -gmaphacks.zip
if exist "%exedir%\eduke32_mus.zip" set args=%args% -geduke32_mus.zip
set args=%args% -gdukedc.grp -mx dc_user.con
if exist "%exedir%\dc.def" set args=%args% -hdc.def
if exist "%exedir%\dukedc.def" set args=%args% -hdukedc.def
if exist "%exedir%\dukedc_hrp.zip" set args=%args% -gdukedc_hrp.zip
if exist "%exedir%\dc_hrp\" set args=%args% -jdc_hrp
if "%xxx%"=="1" if exist "%exedir%\xxx_lite.zip" set args=%args% -gxxx_lite.zip
if "%xxx%"=="1" if exist "%exedir%\xxx_lite\" set args=%args% -jxxx_lite
if "%xxx%"=="1" if exist "%exedir%\xxx_pack.zip" set args=%args% -gxxx_pack.zip
if "%xxx%"=="1" if exist "%exedir%\xxx_pack\" set args=%args% -jxxx_pack
set args=%args% %*
if "%dp%"=="1" set args=%args% -jDukePlus
 
set exe=%exename%
if "%debug%"=="1" set exe=%exename%.debug
 
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
 
if exist "%exedir%\dc_hrp\" (
chdir /d "%exedir%\dc_hrp\"
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
if %rev% EQU %oldrev% goto :eof
set /a oldrev=%oldrev% + 1
echo.
"svn.exe" log -r %oldrev%:%rev%
echo.
pause
goto :eof
 
:nodcgrp
set megaton=Steam\SteamApps\common\Duke Nukem 3D\gameroot\addons\dukedc.grp
if exist "%ProgramFiles%\%megaton%" copy "%ProgramFiles%\%megaton%" .\ && call :conprotect && goto nodcgrp_done
if exist "%ProgramFiles(x86)%\%megaton%" copy "%ProgramFiles(x86)%\%megaton%" .\ && call :conprotect && goto nodcgrp_done
title Duke It Out In D.C. for EDuke32 Installer
color 0C
 
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Duke It Out In D.C. for EDuke32 Installer º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍÍÍÍͼ
echo ³ By Hendricks266 ³
echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
echo.
echo This batch file extracts the contents of DUKEDCPP.SSI or DUKEDC13.SSI and makes
echo it into a group file, DUKEDC.GRP.
echo.
 
set kgroup=%startdir%\utils\windows\win32\kgroup.exe
if "%debug%"=="1" set kgroup=%startdir%\utils\windows\win32\kgroup.debug.exe
set unpackssi=%startdir%\utils\windows\win32\unpackssi.exe
if "%debug%"=="1" set unpackssi=%startdir%\utils\windows\win32\unpackssi.debug.exe
 
pause
:nodcgrp_top
echo.
if not exist DUKEDCPP.SSI goto check13
echo Proceeding with DUKEDCPP.SSI extraction.
mkdir dukedcpp
chdir dukedcpp
"%unpackssi%" ..\DUKEDCPP.SSI
if exist DUKETEAM.ANM ren DUKETEAM.ANM RADLOGO.ANM
if exist USER.CON ren USER.CON USER.BAK
"%kgroup%" dukedc.grp *.*
if exist dukedc.grp move dukedc.grp ..\dukedc.grp
echo DUKEDC.GRP has been added to your directory.
if not exist ..\DUKEDC*.MAP move *.MAP ..\
chdir ..
rmdir /s /q dukedcpp
echo.
echo.
if not exist DUKEDC13.SSI goto nodcgrp_done
 
:check13
if not exist DUKEDC13.SSI goto error
echo Proceeding with DUKEDC13.SSI extraction.
mkdir dukedc13
chdir dukedc13
"%unpackssi%" ..\DUKEDC13.SSI
if exist DUKETEAM.ANM ren DUKETEAM.ANM RADLOGO.ANM
if exist USER.CON ren USER.CON USER.BAK
"%kgroup%" dukedc.grp *.*
if exist ..\dukedc.grp (
if exist dukedc.grp (
move dukedc.grp ..\dukedc13.grp
echo DUKEDC13.GRP has been added to your directory.
) ) else (
if exist dukedc.grp (
move dukedc.grp ..\dukedc.grp
echo DUKEDC.GRP has been added to your directory.
) )
if not exist ..\DUKEDC*.MAP move *.MAP ..\
chdir ..
rmdir /s /q dukedc13
echo.
echo.
goto nodcgrp_done
 
:nodcgrp_done
if exist dukedc.grp (
type DCINTRO.TXT
echo.
echo.
echo.
echo Duke It Out In D.C. installed!
echo.
pause
call :grpchecksum
call :grpchecksum_results
goto nodcgrp_return
)
if not exist dukedc.grp (
echo Installation Error!
echo Contact Hendricks266 for help.
echo.
pause
goto end
)
 
: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
 
:grpchecksum
if not exist "%sha1sum%" (
echo "%sha1sum%" not found.
goto :eof
)
pushd .
if exist "%startdir%\%dcgrpname%" chdir /d %startdir%
if exist "%exedir%\%dcgrpname%" chdir /d %exedir%
echo 1b66c3ad9a65556044946dd1ca97a839fcfedc3b *%dcgrpname% | "%sha1sum%" --status --check -
if "%ERRORLEVEL%"=="0" set version=megaton && call :conprotect && popd && goto :eof
if "%ERRORLEVEL%"=="1" set version=unknown
popd
goto :eof
 
:grpchecksum_results
if "%version%"=="megaton" echo DUKEDC.GRP (Megaton Edition) checksum verified.
:: if "%version%"=="unknown" echo DUKEDC.GRP checksum does not match any known copies because one was never distributed until the Megaton Edition.
echo.
goto :eof
 
:error
echo.
echo You do not have DUKEDCPP.SSI or DUKEDC13.SSI in this directory.
:retry
echo.
set cddrive=
set /p cddrive=What is the drive letter that your Duke D.C. CD is in?
echo.
if not '%cddrive%'=='' set cddrive=%cddrive:~0,1%
if '%cddrive%'=='' goto cdno
if not exist %cddrive%:\ goto cdno
if not exist %cddrive%:\* goto cdno
if exist %cddrive%:\DUKEDC\DUKEDCPP.SSI copy %cddrive%:\DUKEDC\*.SSI .\ && goto nodcgrp_top
if exist %cddrive%:\DUKEDC\DUKEDC\DUKEDCPP.SSI copy %cddrive%:\DUKEDC\DUKEDC\*.SSI .\ && goto nodcgrp_top
if exist %cddrive%:\DC\DUKEDC\DUKEDCPP.SSI copy %cddrive%:\DC\DUKEDC\*.SSI .\ && goto nodcgrp_top
goto cdwrong
 
:cdno
echo '%cddrive%' is not valid. Please try again.
goto retry
 
:cdwrong
echo '%cddrive%' is not the correct disc. Please try again.
goto retry
 
: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
 
:end
if "%debug%"=="1" echo.
if "%debug%"=="1" pause
echo.
popd
endlocal
title %ComSpec%
color 07