@echo off
%nolog% echo **************New session log****************>>%doombat%doombat.log
:: log command line
echo Entered at Dos prompt: %1 %2 %3 %4 %5 %6 %7 %8 %9>>%doombat%doombat.log 
:: check to see if batch file is locked
if "%doom_access%"=="locked" goto lock
:: If batch file was never locked
goto unlock
:lock

echo Doom is password protected. Type in the password and hit 
echo Enter when ready
:: Get input
%doombatc%doombatc>%tempbat%temp.bat
call %tempbat%temp.bat
%nolog% echo Entered for password %lok%>>%doombat%doombat.log

:: check to see if correct password was entered
if "%lok%"=="%lockdume10%" goto unlock
:: if incorrect password is entered
goto nopwd 
:unlock

:: Batch file unlocked
:: clear variable
set lok=
%nolog% echo Doombat is Unlocked. Access Ok>>%doombat%doombat.log
echo Doombat is unlocked. Access OK

goto nolock
:unlocked
:: if batch file was never locked
%nolog% echo Doombat was not locked. Access OK>>%doombat%doombat.log
echo Doombat was not locked. Access OK
:nolock
:: get commands from Dos command line 
if "%1"=="nomonsters" goto nomonsters
if "%1"=="respawn" goto respawn
if "%1"=="skill" goto skill
if "%1"=="preview" goto doombat 
if "%1"=="make_batch_file" goto batch
if "%1"=="goto_label" goto %2
if "%1"=="about" goto about
if "%1"=="reset_values" goto resetval
if "%1"=="doom1" goto doom1
if "%1"=="doom2" goto doom2
if "%1"=="wad" goto next
if "%1"=="warp" goto warp
if "%1"=="help" goto help
if "%1"=="quit" goto end
if "%1"=="nomonsters" goto nomonsters
if "%1"=="parameters" goto parameters
:start
echo *****************************************************
echo *                                                   *
echo *          Doom and Doom2 Batch file creator        *
echo *                  and launcher                     *
echo *                    V. 1.4a                        *
echo *              by Mark David Bowman                 *
echo *                                                   *
echo *****************************************************

:doom12
echo *******************************************************
echo *  Do you want to launch Doom or create a batch file? *
echo *******************************************************                        
echo A=Launch Doom
echo B=Create Batch file
echo Hit ctrl+c to exit
echo.
echo.
echo Type A or B, and hit enter when ready
:: get user input
%doombatc%doombatc>%tempbat%temp.bat
call %tempbat%temp.bat
%nolog% echo selection/command %lok% entered>>%doombat%doombat.log
:: input/internal command line
%nolog% if "%lok%"=="A" echo Launch Doom selected>>%doombat%doombat.log 
%nolog% if "%lok%"=="B" echo Create batch file selected>>%doombat%doombat.log
%nolog% if "%lok%"=="a" echo Launch Doom selected>>%doombat%doombat.log 
%nolog% if "%lok%"=="b" echo Create batch file selected>>%doombat%doombat.log

if "%lok%"=="A" echo Launch Doom
if "%lok%"=="B" echo Create Batch file
if "%lok%"=="a" echo Launch Doom
if "%lok%"=="b" echo Create batch file
if "%lok%"=="A" goto launch
if "%lok%"=="B" goto nolaunch
if "%lok%"=="a" goto launch
if "%lok%"=="b" goto nolaunch
if "%lok%"=="help" goto help
if "%lok%"=="quit" goto end
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="respawn" goto respawn
if "%lok%"=="skill" goto skill
if "%lok%"=="preview" goto doombat
if "%lok%"=="restart" goto start
if "%lok%"=="make_batch_file" goto batch
if "%lok%"=="launch_doom" goto launchnb
if "%lok%"=="goto_label" goto labl
if "%lok%"=="about" goto about
if "%lok%"=="reset_values" goto resetval
if "%lok%"=="shell" %comspec%
if "%lok%"=="doom_version" goto doomvers
if "%lok%"=="doom1" goto doom1
if "%lok%"=="doom2" goto doom2
if "%lok%"=="wad" goto next
if "%lok%"=="warp" goto warp
if "%lok%"=="help" goto help
if "%lok%"=="quit" goto end
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="parameters" goto parameters
goto doom12
:resetval
:: clear values that were entered for doom batch file/launch
echo Resetting values
set batchfile=
set doombat1=
set doomwad=
set nomosters=
set respawn=
set skill=
set warp=
set dmbat=
goto start
:labl
echo Type in label you want to goto and hit enter when ready
:: Get user input
%doombatc%doombatc>%tempbat%temp.bat
call %tempbat%temp.bat
%nolog% echo Going to label %lok%>>%doombat%doombat.log
:: goto label user inputted
goto %lok%


:: Kind of useless (a label not found message would appear if  
:: an incorrect label or no label was entered).
goto start
:help
:: Get help
echo Just answer the prompts and Doom bat will either create a batch file,
echo or launch Doom or Doom2 Type   to return to Doombat
echo  Commands that can be typed at most prompt, or the Dos command line:
echo quit- Quit Doombat
echo nomonsters- goto nomonsters prompt
echo respawn- goto respawn2 prompt
echo skill- goto skill prompt
echo restart- goto doombat prompt
echo make_batch_file- make the batchfile
echo launch_doom- launch Doom
echo goto_label- goes to a subroutine in this batch file
echo  Note: Subroutine labels start with a :, but don't type
echo in the colon when typing in the label name. This command  
echo allows you to do strange things, and it is possible to lock
echo up your computer with it.
echo about- shows version number and name of author, then exits
echo reset_values- Clears everything you've entered
echo doom1- Select doom1
echo wad- Goto wad prompt 
echo Hit a key to continue
pause>nul
echo warp- goto warp prompt 
echo help- This screen 
echo doom_version- Goto doom  version prompt
echo doom2- select doom2
echo nomonsters- Goto nomonsters prompt
echo parameters- Goto parameters prompt
echo Hit a key to continue
pause>nul
:: loop back to near beginning of batch file
goto start
:about
echo.
echo Doombat 1.4a by Mark David Bowman
echo.
echo.
goto end
:: Launch doom
:launch
:: set value that tells program to launch Doom instead of making a batch file
set batchfile=no
goto zaqq

:nolaunch
:: set value that to tell the program to make batch file intead of 
:: launching Doom
set batchfile=yes
:zaqq

if %batchfile% == no goto doomvers
echo.
echo.
echo *******************************************************
echo * What name do you want to give your Doom batch file? *
echo * Enter a name that is no more than 8 characters      *
echo *       or hit ctrl+c to leave program                *
echo *******************************************************
echo.
echo.
:: get user input
%doombatc%doombatc>%tempbat%temp.bat
call %tempbat%temp.bat
:: set name of batch file
set dmbat=%lok%
echo Creating batch file %dmbat%.bat
%nolog% echo Batch file name: %lok%.bat>>%doombat%doombat.log
:doomvers
echo.
echo.
echo Are you using Doom 1 or 2?  
echo A=Doom1
echo B=Doom2
echo Hit ctrl+c to exit
echo.
echo.
echo Type A, or B, and hit enter when ready
:: get user input
%doombatc%doombatc>%tempbat%temp.bat
call %tempbat%temp.bat
%nolog% echo selection/command %lok% entered>>%doombat%doombat.log
:: menu selection/command line
%nolog% if "%lok%"=="A" echo Doom version: Doom 1>>%doombat%doombat.log 
%nolog% if "%lok%"=="B" echo Doom version: Doom 2>>%doombat%doombat.log
%nolog% if "%lok%"=="a" echo Doom version: Doom 1>>%doombat%doombat.log 
%nolog% if "%lok%"=="b" echo Doom version: Doom 2>>%doombat%doombat.log
if "%lok%"=="A" echo Doom version: Doom 1
if "%lok%"=="B" echo Doom version: Doom 2
if "%lok%"=="a" echo Doom version: Doom 1
if "%lok%"=="b" echo Doom version: Doom 2
if "%lok%"=="A" goto doom1
if "%lok%"=="B" goto doom2
if "%lok%"=="a" goto doom1
if "%lok%"=="b" goto doom2
if "%lok%"=="help" goto help
if "%lok%"=="quit" goto end
if "%lok%"=="doom1" goto doom1
if "%lok%"=="doom2" goto doom2
if "%lok%"=="wad" goto next
if "%lok%"=="shell" %comspec% 
if "%lok%"=="doom_version" goto doomvers

if "%lok%"=="warp" goto warp
if "%lok%"=="help" goto help
if "%lok%"=="quit" goto end
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="parameters" goto parameters
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="respawn" goto respawn2
if "%lok%"=="skill" goto skill
if "%lok%"=="preview" goto doombat
if "%lok%"=="restart" goto start
if "%lok%"=="make_batch_file" goto batch
if "%lok%"=="launch_doom" goto launchnb
if "%lok%"=="goto_label" goto labl
if "%lok%"=="about" goto about
if "%lok%"=="reset_values" goto resetval
if "%lok%"=="doom1" goto doom1
if "%lok%"=="doom2" goto doom2
if "%lok%"=="wad" goto next
if "%lok%"=="warp" goto warp
if "%lok%"=="help" goto help
if "%lok%"=="quit" goto end
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="parameters" goto parameters


goto doomvers
:: set doom version
:doom1
set doombat1=doom
goto next

:doom2
set doombat1=doom2
goto next

:next
echo **************************************************************************
echo * Which wad files do you want to run? Type in the name of the wad files, *
echo *  S to skip this selection or hit ctrl+c to leave program               *
echo **************************************************************************
:: get user input
%doombatc%doombatc>%tempbat%temp.bat                                        
call %tempbat%temp.bat
:: log/command line/user selection
%nolog% echo Entered for choice/command/Wad file: %lok%>>%doombat%doombat.log
echo Entered for choice/command/Wad file: %lok%
:: goto next prompt
if "%lok%"=="s" goto warp
if "%lok%"=="S" goto warp
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="respawn" goto respawn2
if "%lok%"=="skill" goto skill
if "%lok%"=="preview" goto doombat
if "%lok%"=="restart" goto start
if "%lok%"=="make_batch_file" goto batch
if "%lok%"=="launch_doom" goto launchnb
if "%lok%"=="goto_label" goto labl
if "%lok%"=="about" goto about
if "%lok%"=="reset_values" goto resetval
if "%lok%"=="doom1" goto doom1
if "%lok%"=="doom2" goto doom2
if "%lok%"=="wad" goto next
if "%lok%"=="warp" goto warp
if "%lok%"=="shell" %comspec% 
if "%lok%"=="doom_version" goto doomvers

if "%lok%"=="help" goto help
if "%lok%"=="quit" goto end
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="parameters" goto parameters
:: set doom wad file
set doomwad=-file %lok%

:warp
echo.
echo *************************************************************
echo * Type in number of level to warp to or S to skip this part *
echo *************************************************************
echo.
echo Notes:
echo If you want to use nomonsters hit enter scince warp is needed to use it.
echo You'll start on the first level. With Doom 1 seperate the level/episode
echo numbers with a space
:: get user input
%doombatc%doombatc>%tempbat%temp.bat
call %tempbat%temp.bat
:: log/command line/user selection/warp to
%nolog% echo Entered for choice/command/Warp to: %lok%>>%doombat%doombat.log
echo Entered for choice/command/Warp to: %lok%
:: goto next prompt
if "%lok%"=="S" goto nomonsters
if "%lok%"=="s" goto nomonsters
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="respawn" goto respawn2
if "%lok%"=="skill" goto skill
if "%lok%"=="preview" goto doombat
if "%lok%"=="restart" goto start
if "%lok%"=="make_batch_file" goto batch
if "%lok%"=="launch_doom" goto launchnb
if "%lok%"=="goto_label" goto labl
if "%lok%"=="about" goto about
if "%lok%"=="reset_values" goto resetval
if "%lok%"=="doom1" goto doom1
if "%lok%"=="doom2" goto doom2
if "%lok%"=="wad" goto next
if "%lok%"=="warp" goto warp
if "%lok%"=="help" goto help
if "%lok%"=="shell" %comspec% 
if "%lok%"=="doom_version" goto doomvers
if "%lok%"=="quit" goto end
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="parameters" goto parameters
:: set level
set warp=-warp %lok%




:nomonsters
echo.
echo *****************
echo * No Monsters?  *
echo *****************
echo.
echo Y/N?
:: get user input
%doombatc%doombatc>%tempbat%temp.bat
call %tempbat%temp.bat
:: log/command line/user selection
%nolog% echo No monsters: %lok%>>%doombat%doombat.log
echo No Monsters: %lok%
if "%lok%"=="n" goto respawn2
if "%lok%"=="N" goto respawn2
if "%lok%"=="y" goto nomon
if "%lok%"=="Y" goto nomon
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="respawn" goto respawn2
if "%lok%"=="skill" goto skill
if "%lok%"=="preview" goto doombat
if "%lok%"=="restart" goto start
if "%lok%"=="make_batch_file" goto batch
if "%lok%"=="launch_doom" goto launchnb
if "%lok%"=="goto_label" goto labl
if "%lok%"=="about" goto about
if "%lok%"=="reset_values" goto resetval
if "%lok%"=="doom1" goto doom1
if "%lok%"=="doom2" goto doom2
if "%lok%"=="wad" goto next
if "%lok%"=="warp" goto warp
if "%lok%"=="help" goto help
if "%lok%"=="shell" %comspec%
if "%lok%"=="doom_version" goto doomvers

if "%lok%"=="quit" goto end
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="parameters" goto parameters

goto nomonsters
:nomon
:: set nomonsters
set nomonsters=-nomonsters

:respawn2
echo.
echo *********************
echo * Respawn Monsters? *
echo *********************
echo.
echo Y/N?
:: get user input
%doombatc%doombatc>%tempbat%temp.bat
call %tempbat%temp.bat
:: log/command line/userselection
%nolog% echo Respawn monsters/command: %lok%>>%doombat%doombat.log
echo Respawn monsters/command: %lok%
if "%lok%"=="n" goto skill
if "%lok%"=="N" goto skill
if "%lok%"=="Y" goto respawn
if "%lok%"=="y" goto respawn
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="respawn" goto respawn2
if "%lok%"=="skill" goto skill
if "%lok%"=="preview" goto doombat
if "%lok%"=="restart" goto start
if "%lok%"=="make_batch_file" goto batch
if "%lok%"=="launch_doom" goto launchnb
if "%lok%"=="goto_label" goto labl
if "%lok%"=="about" goto about
if "%lok%"=="reset_values" goto resetval
if "%lok%"=="doom1" goto doom1
if "%lok%"=="doom2" goto doom2
if "%lok%"=="wad" goto next
if "%lok%"=="warp" goto warp
if "%lok%"=="shell" %comspec% 
if "%lok%"=="doom_version" goto doomvers

if "%lok%"=="help" goto help
if "%lok%"=="quit" goto end
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="parameters" goto parameters

goto respawn2
:respawn
:: set respawn
set respawn=-respawn

:skill
echo.
echo **********************************************
echo * Skill level? 1-5? Type S to skip this part *
echo **********************************************
echo.
echo.
:: get user input
%doombatc%doombatc>%tempbat%temp.bat
call %tempbat%temp.bat
:: log/command line/user selection
%nolog% echo Entered for choice/Skill level/command: %lok%>>%doombat%doombat.log
echo Entered for choice/Skill level: %lok%
:: goto next prompt
if "%lok%"=="S" goto parameters
if "%lok%"=="s" goto parameters
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="shell" %comspec% 
if "%lok%"=="doom_version" goto doomvers

if "%lok%"=="respawn" goto respawn2
if "%lok%"=="skill" goto skill
if "%lok%"=="preview" goto doombat
if "%lok%"=="restart" goto start
if "%lok%"=="make_batch_file" goto batch
if "%lok%"=="launch_doom" goto launchnb
if "%lok%"=="goto_label" goto labl
if "%lok%"=="about" goto about
if "%lok%"=="reset_values" goto resetval
if "%lok%"=="doom1" goto doom1
if "%lok%"=="doom2" goto doom2
if "%lok%"=="wad" goto next
if "%lok%"=="warp" goto warp
if "%lok%"=="help" goto help
if "%lok%"=="quit" goto end
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="parameters" goto parameters
:: set skill
set skill=-skill %lok%


:parameters
echo ********************************************************************
echo * Are there any extra Doom command line parameters you want to add *
echo * to your batch file? Type them in , leave blank, or hit ctrl+c to *
echo * leave this program                                               *
echo ********************************************************************
:: get user inpput
%doombatc%doombatc>%tempbat%temp.bat
call %tempbat%temp.bat
%nolog% echo Extra parameters entered were: %lok%>>%doombat%doombat.log
echo Extra parameters entered were: %lok%
:: set doom parameters
set doomparam=%lok%
%nolog% echo ********************************************************>>%doombat%doombat.log

:doombat

echo This is what the command looks like 
echo %doombat1% %doomparam% %doomwad% %warp% %nomonsters% %respawn% %skill%
echo Type in command or hit enter to proceed 

%doombatc%doombatc>%tempbat%temp.bat
call %tempbat%temp.bat
%nolog% echo Entered for command (proceeding if blank): %lok%>>%doombat%doombat.log
echo Entered for command (proceeding if blank): %lok%

if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="respawn" goto respawn2
if "%lok%"=="skill" goto skill
if "%lok%"=="preview" goto doombat
if "%lok%"=="restart" goto start
if "%lok%"=="make_batch_file" goto batch
if "%lok%"=="launch_doom" goto launchnb
if "%lok%"=="goto_label" goto labl
if "%lok%"=="about" goto about
if "%lok%"=="reset_values" goto resetval
if "%lok%"=="doom1" goto doom1
if "%lok%"=="doom2" goto doom2
if "%lok%"=="wad" goto next
if "%lok%"=="warp" goto warp
if "%lok%"=="shell" %comspec% 
if "%lok%"=="doom_version" goto doomvers

if "%lok%"=="help" goto help
if "%lok%"=="quit" goto end
if "%lok%"=="nomonsters" goto nomonsters
if "%lok%"=="parameters" goto parameters


:: launch doom
if "%batchfile%"=="no" goto launchnb
:: make batchfile
if "%batchfile%"=="yes" goto batch

goto end
:: make batch file
:batch
echo Making batch file....
echo @echo off>>%dmbat%.bat
echo rem  ******************************************************>>%dmbat%.bat
echo rem  * This batch file was created by Mark David Bowman's *>>%dmbat%.bat 
echo rem  *    DOOMBAT program. DOOMBAT can be obtained on     *>>%dmbat%.bat
echo rem  *        FTP.CDROM.COM, and anywhere else            *>>%dmbat%.bat
echo rem  *            this program winds up at.               *>>%dmbat%.bat
echo rem  ******************************************************>>%dmbat%.bat
:: enter values into batch file
echo %doombat1% %doomparam% %doomwad% %warp% %nomonsters% %respawn% %skill%>>%dmbat%.bat
echo Done!.....
goto end
:nopwd
:: invalid password (beginning of program)
echo Access to Doom/Doom2 is denied.
:: end without goodbye message (how mean :)
goto end2
:launchnb
:: launch doom with values
%doombat1% %doomparam% %doomwad% %warp% %nomonsters% %respawn% %skill%

:end
echo    Thank you for using Doom.bat by Mark David Bowman
:end2
