@echo off
rem status0 - install.bat not successful
rem status1 - ready to rock
rem status2 - ready, minimum install - NOT USED
rem status3 - temp uninstalled

:startup
egypt\be.exe sa bold cyan on black /cls
if not exist egypt\egypt.wad goto dirfail

echo EGYPTIAN DOOM STARTUP
echo =====================
echo ...
echo ...

if exist egypt\status0.dum goto notinstalled
if exist egypt\status3.dum goto reinstall

 :run
 echo Please select action:
 echo ...
 echo 1 - Start.
 echo 2 - Temporary uninstall.   - Make doom2 available for normal playing.
 echo 3 - Complete uninstall.    - Remove all Egyptian files from doom2.
 echo 4 - Exit.
 echo ...

 choice /c:1234

 if errorlevel 4 goto end
 if errorlevel 3 goto compuninstall
 if errorlevel 2 goto tempuninstall

 echo Ready to rock...
 egyptian.exe -file egypt\egypt.wad egypt\egyptspr.wad egypt\egyptext.wad
 pause
 egypt\be.exe sa white on black /cls
 goto q_end

  :tempuninstall
  egypt\be.exe sa white on blue /cls
  echo Restoring your doom2.wad...
  egypt\nwt.exe -restore
  echo ...
  echo If NWT returned error #3 here, please abort now! (ctrl-break)
  echo ...
  pause
  echo ...
  move egyptian.exe egypt
  move egypt\status1.dum egypt\status3.dum
  echo ...
  pause
  egypt\be.exe sa bold white on green /cls
  echo Egyptian Doom is now temporary uninstalled.
  echo This means that you can use doom2 as usual.
  echo If you want to reinstall, just run egypt.bat again.
  echo ...
  pause
  goto end

  :compuninstall
  egypt\be.exe sa bold white on red /cls
  echo Complete uninstall.
  echo ...
  echo This will delete all Egyptian Doom files, keeping only the installation
  echo stuff found in the egypt directory.
  echo ...
  choice /c:yn Ok to continue

  if errorlevel 2 goto startup
  egypt\be.exe sa white on blue /cls
  echo Restoring your doom2.wad...
  egypt\nwt.exe -restore
  cd egypt
  rename status*.dum status0.dum
  pause
  z-unst.bat
  goto end


 :reinstall
 egypt\be.exe sa bold white on blue /cls
 echo Egyptian Doom is temporary uninstalled.
 echo ...
 choice /c:yn Do you want to reinstall now 

 if errorlevel 2 goto end
 egypt\be.exe sa white on blue /cls
 echo Reinstalling...
 egypt\nwt -merge egypt\egyptspr.wad
 echo ...
 echo If NWT returned error #3 here, please abort now! (ctrl-break)
 echo ...
 pause
 echo ...
 move egypt\egyptian.exe .
 move egypt\status3.dum egypt\status1.dum
 pause
 goto startup


:dirfail
egypt\be.exe sa bold white on red /cls
echo *** Unable to find ...\doom2\egypt
echo     Read egypt.txt for installing info.
echo ...
pause
goto end

:notinstalled
egypt\be.exe sa bold white on red /cls
echo *** Egyptian Doom has not been correctly installed,
echo     run install.bat from your ...\doom2\egypt directory.
echo ...
pause
goto end

:end
egypt\be.exe sa white on black /cls
echo Bye!
:q_end
