; Formula One Grand Prix / World Circuit replacement installer
; $VER: Install_F1GP 1.3 (26.4.96)
;
; Copyright © 1995-1996 Oliver Roberts

(complete 0)

(if (NOT (askbool
		(prompt	"This Installer script will attempt to install MicroProse's "
			"Formula One Grand Prix (or World Circuit) game to your hard "
			"drive in a friendly manner (unlike the official installer "
			"supplied with the game itself!).  If you already have the "
			"game installed on your hard drive you shouldn't need to use "
			"this script!\n\n"
			"Make sure you have booted from your hard drive, before "
			"continuing with this installation!\n\nDo you want to continue?"
		)
		(default 0)
		(help "")
	))
	(exit (quiet))
)
      
(welcome "")

(set #f1gpver
	(askchoice
		(prompt "What version of the game you have?")
		(help @askchoice-help)
		(choices "(A) Formula One Grand Prix (4 disk version)"
			"(B) World Circuit"
			"(C) Formula One Grand Prix (3 disk version)"
		)
	)
)

(set #disk1pat "~(system#?|.info|Disk#?)")
(set #disk2pat "~(system#?|.info|remove#?|Disk#?)")
(set #disk2patintroA "~(system#?|.info|remove#?|Disk#?|formula#?)")
(set #disk2patintroB "~(system#?|.info|remove#?|Disk#?|world#?)")
(set #disk3pat "#?")
(set #disk4pat "~(read#?|install#?|Disk#?|more)")
(set #disktext "\n\nPlease insert\n\n")

(if (= #f1gpver 0)
	(
		(set #disktext (cat #disktext "Formula One Grand Prix disk "))
		(set #disk2patintro #disk2patintroA)
	)
)

(if (= #f1gpver 1)
	(
		(set #disktext (cat #disktext "World Circuit disk "))
		(set #disk2patintro #disk2patintroB)
	)
)

(if (= #f1gpver 2)
	(
		(set #disktext (cat #disktext "Formula One Grand Prix disk "))
		(set #numdisks 3)
		(set #disk1pat #disk2pat)
		(set #disk2pat #disk3pat)
		(set #disk3pat #disk4pat)
	)
	(
		(set #numdisks 4)
		(if (= 0 (askchoice
			(prompt "What would you you like to happen when you click on the game icon?")
			(help @askchoice-help)
			(default 1)
			(choices "Run the intro (as if booting from disk 1)"
				"Skip the intro (as if booting from disk 2)")
			))
			(set #disk2pat #disk2patintro)
		)
	)
)

(set #destdir
	(askdir
		(prompt "Select a drawer in which to install the game (no separate drawer is created)")
		(help @askdir-help)
		(default @default-dest)
	)
)

(set @default-dest #destdir)

(askdisk
	(prompt (cat #disktext "1"))
	(dest "f1gp_disk_#1")
	(help @askdisk-help)
)

(copyfiles
	(source "f1gp_disk_#1:")
	(dest @default-dest)
	(pattern #disk1pat)
	(files)
	(infos)
	(optional "oknodelete" "force")
	(help @copyfiles-help)
)

(complete 20)

(askdisk
	(prompt (cat #disktext "2"))
	(dest "f1gp_disk_#2")
	(help @askdisk-help)
)

(copyfiles
	(source "f1gp_disk_#2:")
	(dest @default-dest)
	(pattern #disk2pat)
	(files)
	(infos)
	(optional "oknodelete" "force")
	(help @copyfiles-help)
)

(complete 60)

(askdisk
	(prompt (cat #disktext "3"))
	(dest "f1gp_disk_#3")
	(help @askdisk-help)
)

(copyfiles
	(source "f1gp_disk_#3:")
	(dest @default-dest)
	(pattern #disk3pat)
	(files)
	(infos)
	(optional "oknodelete" "force")
	(help @copyfiles-help)
)

(complete 80)

(if (= #numdisks 4)
	(
		(askdisk
			(prompt (cat #disktext "4"))
			(dest "f1gp_disk_#4")
			(help @askdisk-help)
		)
		(copyfiles
			(source "f1gp_disk_#4:")
			(dest @default-dest)
			(pattern #disk4pat)
			(files)
			(infos)
			(optional "oknodelete" "force")
			(help @copyfiles-help)
		)
	)
)

(complete 95)

(startup "Formula One Grand Prix"
	(prompt "Adding F1GP disk assigns to user-startup")
	(command 
		("Assign f1gp_disk_#1: %s\n" @default-dest)
		("Assign f1gp_disk_#2: %s\n" @default-dest)
		("Assign f1gp_disk_#3: %s\n" @default-dest)
		(if (= #numdisks 4) ("Assign f1gp_disk_#4: %s\n" @default-dest))
	)
	(help @startup-help)
)

(complete 100)

(exit
	"You must now reboot your Amiga before attempting to load "
	"the game.\n\n"
	"Oliver Roberts (Oliver@defstar.gre.ac.uk)\n"
	"http://defstar.gre.ac.uk/~oliver/"
)
