/*
    This INSTALL script conducts the installation of Alien Legacy
    to the user's hardisk.
*/

@DefineProject
  @Name                 = "Alien Legacy"                /* Product Textual Name:  */
  @Version              = "1.00"
  @SubDir               = "\\Sierra\\Alien"    /* Default installation directory */
  @OutDrive             = C                                             /* Default installation drive */
  @Requires             @HardDisk
  @InDiskBell   = 1
@EndProject

//for testing only - remove when not testing
//@Simulate
//  @CPU = 486
//  @OSMajor = 5
//  @OSMinor = 0
//  @VideoCard = 86
//@EndSimulate
//for testing only - remove when not testing

@DefineVars
  @Qstring @Sub1        = ""
  @Integer @Num         = 0
  @Integer @Space       = 21200000
@EndVars

START:
@FlushOptions()

@Display
  @Cls
     This program will install Alien Legacy Version @Version on your computer.
     You may press the [Esc] key at any time to abort the installation.

     System Requirements:
			  386 or better CPU
			  DOS 5.0 or higher
			  4 megabytes of RAM
			  Hard Disk with 21 megabytes available
			  VGA color adapter and monitor
			  Microsoft compatible mouse

     Sound Card Support:
			 AdLib
			 Sound Blaster
			 Sound Blaster Pro
			 Pro Audio Spectrum
			 Gravis Ultrasound

				      @Pause

  @Cls
  Alien Legacy requires 570K of free conventional memory and 2.5 megabytes
  of free XMS memory.  On a machine with the minimum memory configuration
  (4 megabytes), 512K are left free for utility programs such as SMARTDRV.
  It is highly recommended that SMARTDRV be installed with at least a 512K
  cache size to speed file I/O operations.  The "Make Boot Disk" option can
  be selected to provide the necessary setup conditions to run Alien Legacy
  including the SMARTDRV utility.











				      @Pause
@EndDisplay

/* check for minimum CPU */
@If (@CPU < 386)
  @Display
	  Alien Legacy requires at least a 386 processor to run.
	  Your system has a @CPU processor.
	@Abort
  @EndDisplay
@Endif

/* check for minimum version of DOS */
@If (@OSMajor < 5 || (@OSMajor >= 5 && @OSMinor < 0))
  @Display
       Alien Legacy requires that your operating system version be at
       least 5.0. You are currently running version @OSMajor.@OSMinor.
    @Abort
  @EndDisplay
@Endif

/* check for required video adapter card */
@If (@VideoCard < 86)
  @Display
   Alien Legacy requires a video adapter capable of 320 x 200 x 256 colors.
   You do not have a suitable video adapter.
    @Abort
  @EndDisplay
@Endif

/* check for minimum free conventional memory */
@If (@RAMAvail < 570K)
  @Display

      You do not have 570K of free conventional memory.  Using a boot
      disk may free enough to run Alien Legacy.  You will need a blank
      formatted diskette to create a boot disk.  If you do not have one
      you should abort the installation at this point and run INSTALL
      again when a disk is available.











				      @Pause
  @EndDisplay
@Endif

/* display selection menu and get user's choice */
MENU:
@GetOption
  @LocalWindow(10,37)
	    You may install Alien Legacy onto your hard drive or 
	    make a boot disk by choosing one of the options below.


  @Option 1 = "Install Alien Legacy"
  @Option 2 = "Make Boot Disk"
@EndOption

// if they picked option 2 ('[!' means "Set Non-Membership")
@If (1 [! @Option)
  @Goto MAKEBOOT
@Endif

/* Install */

INSTALL:
/* ask user which drive to install to */
@GetOutDrive
  @Suppress(0,21)       /* suppress all floppy, netork, and CD-ROM drives */
  @LocalWindow(11,37)
  @CLS

	 Please select a disk drive on which to install Alien Legacy.
















	     Use the [Up Arrow], [Down Arrow], [Pg Up], & [Pg Dn]
	     keys to move the bar and then press the [Enter] key.
@EndOutDrive

/* test for required space on drive user selected */
@If (@DiskFree(@OutDrive) < @Space)
  @Display
      You only have @DiskFree(@OutDrive) bytes available on drive @Outdrive, and you
      need at least @Space bytes available to install Alien Legacy.
    @Abort
  @EndDisplay
@Endif

@GetSubdir
  @LocalWindow(5,45)
  @CLS

	     Please specify the desired destination sudirectory.

  @PROMPT = " Which subdirectory ([Enter] = @SubDir)? "
@EndSubdir

//now we create the directory
@ChDrive(@OutDrive)
@ChDir("\\")

@Num = 0
LOOPX:
    @Sub1 = "@StrToken("@Subdir", @Num, "\\")"
    @If (@StrLen("@Sub1") != 0)
	@MkDir ("@Sub1")
	@ChDir ("@Sub1")
	@Num = @Eval(@Num + 1)
	@Goto LOOPX
    @Else
	@MkDir ("SAVES")
	@Goto CONTINUX
    @Endif
CONTINUX:

@ChDir ("@Subdir")

//here we're sitting in the game directory - install the files
@DefineDisk
  @Label = "DISK 1/7"
  @BeginLib ALIEN1.RED
    @File *.*
  @EndLib
@EndDisk
@DefineDisk
  @Label = "DISK 2/7"
  @BeginLib ALIEN2.RED
    @File *.*
  @EndLib
@EndDisk
@DefineDisk
  @Label = "DISK 3/7"
  @BeginLib ALIEN3.RED
    @File *.*
  @EndLib
@EndDisk
@DefineDisk
 @Label = "DISK 4/7"
 @BeginLib ALIEN4.RED
  @File *.*
@EndLib
@EndDisk
@DefineDisk
  @Label = "DISK 5/7"
  @BeginLib ALIEN5.RED
    @File *.*
  @EndLib
@EndDisk
@DefineDisk
  @Label = "DISK 6/7"
  @BeginLib ALIEN6.RED
    @File *.*
  @EndLib
@EndDisk
@DefineDisk
  @Label = "DISK 7/7"
  @BeginLib ALIEN7.RED
    @File *.*
  @EndLib
@EndDisk
@Copy("@OutDrive:@Subdir\\CAMPAIGN.SCN", "@OutDrive:@Subdir\\CAMPAIGN.TMP")

@Goto FINISH

/* make a boot disk */
MAKEBOOT:
@Display




	     Please insert a formatted blank disk into Drive A






				      @Pause
@EndDisplay

@Display
			  Making the Boot Disk...

	@System ("SYS @BootDrive:\\ A: > NUL:")
	
	// copy command.com over if it's not already there
	@If (@Exists("A:\\COMMAND.COM") == @False)
		@System ("COPY @BootDrive:\\COMMAND.COM A: > NUL:")
	@EndIf
	// handle one case of command.com not being in the root of the boot drive
	@If (@Exists("A:\\COMMAND.COM") == @False)
		@System ("COPY @BootDrive:\\DOS\\COMMAND.COM A: > NUL:")
	@EndIf
	
	// erase any existing autoexec.bat on A: and build a new one
	@If (@Exists("A:\\AUTOEXEC.BAT"))
		@Delete("A:\\AUTOEXEC.BAT")
	@EndIf
	@If (@ExtTotal < 4M)
	  @Write ("A:\\AUTOEXEC.BAT", "wt", "@BootDrive:\\DOS\\SMARTDRV.EXE 512\r\n")
	@Else
	  @Write ("A:\\AUTOEXEC.BAT", "wt", "@BootDrive:\\DOS\\SMARTDRV.EXE 2048\r\n")
	@Endif
	@Write ("A:\\AUTOEXEC.BAT", "at", "REM Edit the line below to run YOUR mouse driver.\r\n")
	@Write ("A:\\AUTOEXEC.BAT", "at", "@BootDrive:\\MOUSE\\MOUSE\r\n")
	@Write ("A:\\AUTOEXEC.BAT", "at", "@OutDrive:\r\n")
	
	// erase any existing config.sys on A: and build a new one
	@If (@Exists("A:\\CONFIG.SYS"))
		@Delete("A:\\CONFIG.SYS")
	@EndIf
	@Write ("A:\\CONFIG.SYS", "wt", "DEVICE = @BootDrive:\\DOS\\HIMEM.SYS\r\n")
	@Write ("A:\\CONFIG.SYS", "at", "DOS=HIGH\r\n")
	@Write ("A:\\CONFIG.SYS", "at", "FILES = 25\r\n")
	@Write ("A:\\CONFIG.SYS", "at", "BUFFERS = 20\r\n")
	@Write ("A:\\CONFIG.SYS", "at", "BREAK = ON\r\n")
@EndDisplay

@Display

      Please remove your boot disk so that INSTALL can proceed with the
      installation of Alien Legacy.  Before using your boot disk be sure
      to edit the autoexec.bat file to add your mouse driver and sound
      card driver.












				      @Pause
@EndDisplay

@Goto MENU

FINISH:
@Finish

  INSTALL has completed the installation of Alien Legacy on your system.
  If you are not using a boot disk and wish to play Alien Legacy now, change
  to the drive and directory chosen during the installation and type:

			  AL [Enter]


  If you are using a boot disk insert it into your boot drive and
  re-boot your system. Then change to the drive and directory
  chosen during the installation and type:

			  AL [Enter]


					  @Pause
@EndFinish
