@echo off
if "%1"=="/uninst" goto uninst
:setup
if not exist duke3d.exe goto noduke
if not exist duke3d.grp goto noduke
if not exist sst_data.dat goto wiped
if exist sst_tc.ins goto sstexist
if exist sst_full.ins goto sstfull
 
cls
echo =============================================================================
echo        STARSHIP TROOPERS TOTAL CONVERSION demo, BGAME PRODUCTIONS 1999.
echo =============================================================================
echo.
echo  Starship Troopers TC demo is not installed
echo.
echo     1. Install Starship Troopers TC demo for Duke Nukem v1.3
echo     2. View the Help file
echo     3. Exit
echo.
choice /n /c:1234 Choose an option:
if errorlevel 3 goto exit
if errorlevel 2 goto help
if errorlevel 1 goto dukev13

:sstexist
cls
echo =============================================================================
echo        STARSHIP TROOPERS TOTAL CONVERSION demo, BGAME PRODUCTIONS 1999.
echo =============================================================================
echo.
echo  Starship Troopers TC demo is installed
echo.
echo     1. Uninstall Starship Troopers TC demo
echo     2. Run SST TC demo
echo     3. View the SSTDEMO.TXT file
echo     4. Exit
echo.
choice /n /c:1234  Choose an option:
if errorlevel 4 goto exit
if errorlevel 3 goto help
if errorlevel 2 goto run
if errorlevel 1 goto uninst

:uninst
cls
echo =============================================================================
echo        STARSHIP TROOPERS TOTAL CONVERSION demo, BGAME PRODUCTIONS 1999.
echo =============================================================================
echo.
echo Deleting SST TC files...
 del cineov2.anm
del tiles000.art
del tiles005.art
del tiles006.art
del tiles007.art
del tiles008.art
del tiles009.art
del tiles012.art
del tiles014.art
del GAME.CON
del demo1.dmo
del sst_tc.ico
del sstdemo.map
del sst01.mid
del demoend1.wav
del demoend2.wav
del null.wav
del sst001.wav
del sst004.wav
del sst009.wav
del sst010.wav
del sst011.wav
del sst012.wav
del sst013.wav
del sst014.wav
del sst015.wav
del sst016.wav
del sst017.wav
del sst028.wav
del sst029.wav
del sst030.wav
del sst031.wav
del sst032.wav
del sst035.wav
del sst036.wav
del sst037.wav
del sstb09.wav
del sst_tc.ins
del sst_demo.ins
echo.
echo Recovering backup files...
if exist cineov2.st_ rename cineov2.st_ cineov2.anm
if exist game.st_ rename game.st_ game.con
if exist demo1.st_ rename demo1.st_ demo1.dmo
if exist demo2.st_ rename demo2.st_ demo2.dmo
if exist _tile000.st_ rename _tile000.st_ tiles000.art
if exist _tile005.st_ rename _tile005.st_ tiles005.art
if exist _tile006.st_ rename _tile006.st_ tiles006.art
if exist _tile007.st_ rename _tile007.st_ tiles007.art
if exist _tile008.st_ rename _tile008.st_ tiles008.art
if exist _tile009.st_ rename _tile009.st_ tiles009.art
if exist _tile012.st_ rename _tile012.st_ tiles012.art
if exist _tile014.st_ rename _tile014.st_ tiles014.art

cls
echo =============================================================================
echo        STARSHIP TROOPERS TOTAL CONVERSION demo, BGAME PRODUCTIONS 1999.
echo =============================================================================
echo.
echo  Do you want to COMPLETELY remove the SST TC demo install files from your
echo  disk?
echo.
echo  If you answer YES, files SST_HELP.TXT, SST_HELP.RTF and SST_DATA.DAT will be
echo  deleted from this directory, and you will not be able to reinstall the demo.
echo. 
echo  If you answer NO, only the game files will be removed, and you will be able
echo  to reinstall the demo at a later date.
echo.
echo  Would you like to remove the SST TC installation files?
choice /n   [Y]ES [N]O:
if errorlevel 2 goto onlygame
if errorlevel 1 goto wipe

:wipe
del sst_data.dat
if exist sst_help.rtf del sst_help.rtf
if exist sst_help.rtf del sst_help.txt
if exist read1st.txt del read1st.txt
echo.
echo SST TC installation removed. You will have to uncompress SSTDEMO2.ZIP again
echo if you wish to install it again.
echo.
echo Hit a key...
pause >nul
goto exit

:onlygame
echo.
echo  Starship Troopers TC demo is uninstalled. Run this program again if you want
echo  to install it again.
echo.
echo  Hit a key...
pause >nul
goto exit

:dukev13
cls
echo =============================================================================
echo        STARSHIP TROOPERS TOTAL CONVERSION demo, BGAME PRODUCTIONS 1999.
echo =============================================================================
echo.
if exist *.voc goto wavs
echo Backing up Duke Nukem files...
if exist cineov2.anm rename cineov2.anm cineov2.st_
if exist game.con rename game.con game.st_
if exist demo1.dmo rename demo1.dmo demo1.st_
if exist demo2.dmo rename demo2.dmo demo2.st_
if exist tiles000.art rename tiles000.art _tile000.st_
if exist tiles005.art rename tiles005.art _tile005.st_
if exist tiles006.art rename tiles006.art _tile006.st_
if exist tiles007.art rename tiles007.art _tile007.st_
if exist tiles008.art rename tiles008.art _tile008.st_
if exist tiles009.art rename tiles009.art _tile009.st_
if exist tiles012.art rename tiles012.art _tile012.st_
if exist tiles014.art rename tiles014.art _tile014.st_
echo.
echo Exploding Starship Troopers TC files...
copy sst_data.dat sst_data.exe >nul
sst_data.exe
del sst_data.exe

:endsetup
cls
echo DELETING THIS FILE WILL CAUSE ERRORS IN SST TC DEMO SETUP >sst_tc.ins
echo DELETING THIS FILE WILL CAUSE ERRORS IN SST TC SETUP >sst_demo.ins

echo =============================================================================
echo        STARSHIP TROOPERS TOTAL CONVERSION demo, BGAME PRODUCTIONS 1999.
echo =============================================================================
echo.
echo  Starship Troopers TC demo setup is complete. Run Duke3d.exe to play the game.
echo  There is a nifty little SST TC icon in this directory if you wish to make a
echo  Windows shortcut. :)
echo.
echo  Would you like to run the demo now?
choice /n [Y]ES [N]O:
if errorlevel 2 goto setexit
if errorlevel 1 goto run


:run
echo.
echo  Remember, to play the demo map you have to select the LUNAR APOCALYPSE
echo  episode! Otherwise the game will drop back to DOS with an error message!
echo.
echo  Hit a key to start blasting the bugs!
pause >nul
echo.
duke3d.exe
goto hardexit

:help
cls
echo =============================================================================
echo        STARSHIP TROOPERS TOTAL CONVERSION demo, BGAME PRODUCTIONS 1999.
echo =============================================================================
echo.
echo  Help File
echo.
echo     1. I am in Windows and I want to read the Rich Text Format (.rtf) version.
echo     2. I am in DOS and I want to read the Text Format version (.txt).
echo     3. I am in DOS, but the option 2 did nothing?!
echo     4. Return
echo.
choice /n /c:1234 Choose an option:
if errorlevel 4 goto back
if errorlevel 3 goto type
if errorlevel 2 goto edit
if errorlevel 1 goto rtf

:back
goto setup

:rtf
echo.
echo  Please wait...
start sst_help.rtf
goto setup

:edit
edit sst_help.txt
goto setup

:type
type sst_help.txt |more
goto setup

:wavs
echo  It seems there are *.voc files in this directory. They could cause wrong
echo  sounds to be played in the game.
echo  A subdirectory named VOCS will be made, please move all of the *.voc files
echo  in there and restart the installation...
echo.
echo  A dedicated Duke Nukem copy is recommended for this TC.
echo.
echo  Hit a key to continue...
pause>nul
md vocs
goto exit

:sstfull
echo =============================================================================
echo        STARSHIP TROOPERS TOTAL CONVERSION demo, BGAME PRODUCTIONS 1999.
echo =============================================================================
echo.
echo  ERROR: Full version of SST TC is already installed in this directory.
echo.
echo  This demo cannot be installed over a full copy of SST TC. 
echo.
echo  Hit a key to continue...


:noduke
cls
echo =============================================================================
echo        STARSHIP TROOPERS TOTAL CONVERSION demo, BGAME PRODUCTIONS 1999.
echo =============================================================================
echo.
echo  ERROR: Setup files are not in the right directory.
echo.
echo  Please copy the SST TC demo setup files to your Duke Nukem directory.
echo  A dedicated copy of Duke Nukem is recommended.
echo.
echo  Hit a key to continue...
pause>nul
goto exit

:wiped
cls
echo =============================================================================
echo        STARSHIP TROOPERS TOTAL CONVERSION demo, BGAME PRODUCTIONS 1999.
echo =============================================================================
echo.
echo  ERROR: Data file not found.
echo.
echo  Could not find SST_DATA.DAT. Please make sure that all of the files
echo  distributed in SSTDEMO2.ZIP are unzipped into the same directory.
echo.
echo  Hit a key to continue...
pause>nul
goto exit



:setexit
echo.
echo  To play the game, run DUKE3D.EXE.
echo.
echo  Remember, to play the demo map you have to select the LUNAR APOCALYPSE
echo  episode! Otherwise the game will drop back to DOS with an error message!

goto hardexit

:exit
echo.
echo  bye!

:hardexit
