@REM 2010-11-18 - For project Atlas/Map 
@setlocal
@set USRCMD=%1
@if "%1x" == "x" goto DNCMD
@if "%1x" == "NOPAUSEx" goto DNCMD
@echo ERROR: Only input is NOPAUSE
@goto END

:DNCMD
@set PROJ=Atlas
@echo This will re-start the process of building, from
@echo source, the Atlas.dsw/dsp set of files. However,
@echo the DSW/DSP files here have been MODIFIED in a 
@echo number of ways, like including the win_ulib.dsp,
@echo and splitting the COMMON Atlas/Map sources into libAtlas
@echo *** ARE YOU SURE YOU WANT TO DO THIS? *** Ctrl+C to abort...
@pause
@echo *** ARE YOU SURE? *** Ctrl+C to abort...
@pause

@call chkinps %PROJ%

@if EXIST %PROJ%.ncb @del %PROJ%.ncb >nul 2>&1
@if EXIST %PROJ%.ncb (
@echo.
@echo ERROR: Can NOT delete %PROJ%.ncb
@echo This suggest MSVC is still open on this project...
@echo Close MSVC before continuing...
@echo.
@pause

)

@call killall %USRCMD%

@echo.
@echo Continue to BUILD the DSP files?
@if "%USRCMD%x" == "NOPAUSEx" goto DNP1
@pause
:DNP1

@REM call amsrcs -d extra -r %PROJ%.inp
call amsrcs -r %PROJ%.inp
@if ERRORLEVEL 1 (

@echo.
@echo ERROR: THe scripts exited with ERROR LEVEL %ERRORLEVEL%
@echo Check the result carefully before continuing...
#echo.
@pause

)

call copyit %USRCMD%

@set TEMPF=C:\GTools\perl\temp.amsrcs04.pl.txt
@if EXIST %TEMPF% (
@copy %TEMPF% tempbuild.txt >nul
) else (
@echo Can NOT locate %TEMPF%
)

@if EXIST Default.dsw (
@echo Correcting the DSW using Default.dsw...
@copy Default.dsw %PROJ%.dsw >nul
)

@echo.
@echo Start MSVC?
@if "%1x" == "NOPAUSEx" goto DNP2
@pause
:DNP2

start %PROJ%.dsw

@call updinps %PROJ%

:END
