@echo.
@echo. Welcome Worthy Doomer to the Installation of PDOOM2.WAD!
@echo.
@echo. Installation will only work with DOOM 2.
@echo. Hit CTRL-C NOW if you have the wrong version.
@echo.
pause
@echo.
@echo. This will take some seconds, be patient.
@echo.
@rem Check main WAD
@if not exist doom2.wad goto miss
@echo @echo. Restoration > restore.bat
@echo doom2.exe -file pdoom2.wad > pd2.bat 
@rem
@rem Check EXE Patch
@if not exist doom2.exe goto miss
@if not exist pdoom2.deh goto miss
@rem
@rem Install EXE Patch
@copy doom2.exe doomhack.exe
@echo rm doomhack.exe >> restore.bat
@rem
@dehacked -reload -load pdoom2.deh > hacked.log
@if not ERRORLEVEL 0 goto fail 
@rem Modify game command
@echo doomhack.exe -file pdoom2.wad > pd2.bat 
@echo Warning: for network games, rename doomhack.exe to doom2.exe
@echo but first save doom2.exe somewhere!
@echo This is true if you use SETUP, IPXSETUP or SERSETUP.
@rem
@rem Install Sprites or Flats in WAD
@if not exist pdoom2.wad goto miss
@echo deusf -res pdoom2.wad >> restore.bat
@echo  Completing sprites and flats, please wait...
@deusf -main .\doom2.wad -as pdoom2.wad> deusf.log
@if not ERRORLEVEL 0 goto fail 
@rem
@rem
@echo Installation succeeded.
@echo type PD2 to play the modified game.
@echo type RESTORE to uninstall.
@goto end
:fail
@echo. Installation failed: A tool didn't work.
@echo. See hack.log or deusf.log for details.
@goto end
:miss
@echo. Installation impossible: some files are missing.
@echo. Did you have deusf.exe and dehacked.exe ?
@echo. Please copy all your files in the main game directory.
@echo. And try install again.
@goto end
:end
