;
;	Harpoon Signature Edition Installation Script
;	by Thom Robertson (butchered from Steve Tibbett's original)
;
;	This will get the destination directory from the user,
;	then unpack and copy the files from the distribution disks to the
;	destination directory.
;

(user 2)

(welcome "Thank you for purchasing the Harpoon Signature Edition!\n")

;(transcript "On installing Harpoon...")


(set tohard
	(askchoice
		(prompt "Do you wish to install to floppy disks or a hard drive?")
		(help 	"The Harpoon Signature Edition is comprised of the Harpoon game,\n"
			"the Harpoon Scenario Editor, and all four battlesets.\n"
			"This means that you will need to have six blank, unformatted disks\n"
			"to install the entire game on floppys, or 4.5 Megs of space on\n"
			"your hard drive (you may choose not to install all of Harpoon\n"
			"if you wish." @askoptions-help)
		(choices "3 1/2\" Disks" "Hard Drive")
		(default 0)
	)
)


(if tohard
	((set DestDir
		(askdir
			(prompt "On what drive should the Harpoon Signature Edition be installed?")
			(help 	(cat	"Harpoon will be installed on the device you name.  "
					"That device will need approximately 4.5 megabytes of free space "
					"(if you choose to install everything)."
					"A \"Signature\" directory will be created on that drive, and "
					"Harpoon will be installed in this directory.\n\n"
					@askdir-help))
			(default "WORK:")
			(disk)
		)
	)

	(set SigDir (tackon DestDir "Signature")
	)

	(makedir SigDir
		(prompt "I will now create the directory" SigDir ", including a drawer icon for it.")
		(help @makedir-help)
		(infos)
	))
)

;set up what we need to


(if tohard
	(

	(copyfiles
	(prompt "Preloading some commands...")
	(source "SIGNATURE_1:")
	(dest "RAM:")
	(choices "C/decomp")
	)

	)

	; else if installing to floppies

	((copyfiles
	(prompt "Preloading some commands...")
	(source "SIGNATURE_1:")
	(dest "RAM:")
	(choices "C/install" "C/Copy" "C/makedir" "system/format" "C/Delete" "C/run" "C/Execute")
	)

	(copyfiles
	(prompt "Preloading some more commands...")
	(source "SIGNATURE_1:")
	(dest "RAM:")
	(choices "C/decomp" "s/harpcopy.bat" "s/scencopy.bat")
	)

	(makedir "RAM:harptemp"
		(prompt "I will now create the directory HARPTEMP in your RAM: disk.")
		(help @makedir-help)

	))
)


; ask what things shall be installed


(set ToInstall
	(askoptions
		(prompt "Which Harpoon Products would you like to install?")
		(help 	"Harpoon is the actual game you need to play.\n"
			"Scenario Editor lets you create new missions and situations for each battleset.\n"
			"The GIUK Battleset deals with surface and air actions of NATO vs. USSR in a general war.\n"
			"The NACV Battleset continues the general war, studying Atlantic crossings and Eastern U.S. Coastal action.\n"
			"The MEDC Battleset deals with the complicated politics and military alliances in the Mediterranean.\n"
			"The IOPG Battleset Gives you new platforms and weapons, as well as new scenarios in the Indian Ocean/Persian Gulf region.\n"
			@askoptions-help)
		(choices "Harpoon" "Scenario Editor" "GIUK Battleset"
			"NACV Battleset" "MEDC Battleset" "IOPG Battleset")
		(default 63)
	)
)

; unpack and install Harpoon

(if	(bitand	1 ToInstall)
	(if tohard
		(

		(working "Now de-archiving the Harpoon game to your hard drive.\n  This will take approx. 5 minutes, so please be patient."
		)

		(set tempname (tackon SigDir "Harpoon")
		)
		(run	(cat "ram:decomp SIGNATURE_2:Harpoon/Harpoon/Harpoon.C " tempname
			)
		)

		(set tempname (tackon SigDir "Harpoon.info")
		)

		(run	(cat "ram:decomp SIGNATURE_2:Harpoon/Harpoon/Harpoon.info.C " tempname
			)
		)

		(set tempname (tackon SigDir "Harpoon.opt")
		)

		(run	(cat "ram:decomp SIGNATURE_2:Harpoon/Harpoon/Harpoon.opt.C " tempname
			)
		)

		(set tempname (tackon SigDir "Harpoon.opt.info")
		)

		(run	(cat "ram:decomp SIGNATURE_2:Harpoon/Harpoon/Harpoon.opt.info.C " tempname
			)
		)

		(set tempname (tackon SigDir "Title")
		)

		(run	(cat "ram:decomp SIGNATURE_2:Harpoon/Harpoon/Title.C " tempname
			)
		)

		(set tempname (tackon SigDir "Title.info")
		)

		(run	(cat "ram:decomp SIGNATURE_2:Harpoon/Harpoon/Title.info.C " tempname
			)
		)

		)

		; else if installing to floppies

		(
		(message "Please put a blank, unformatted disk in the internal drive.\n This will be formatted as the Harpoon game disk."
			(help 	(cat	"Harpoon will be installed on the blank disk, but it needs to be "
					"formatted first.  You can use a disk that already has data on it, "
					"but the data will be over-written and lost."
				)
			)
		)

		(working "Now formatting \"Harpoon1\".\nPlease wait 60 seconds."
		)

		(run "ram:format drive df0: name Harpoon1 NOICONS"
		)

		(working "Now making \"Harpoon1\" a bootable disk."
		)

		(run "ram:install df0:"
		)

		(message (cat	"Now it's time to build the Harpoon game disk.  This will take 15 "
				"to 20 minutes to de-archive, so please be patient. "
				"If you are creating Harpoon on floppy disks, but you only "
				"have one disk drive, you may want to think twice, as you will "
				"have to literally swap disks hundreds of times."
			 )
		)
	
		(execute "ram:harpcopy.bat"
		)

	
		)
	)
)


; unpack and install Scenedit

(if	(bitand	2 ToInstall)
	(if tohard
		(

		(working "Now de-archiving the Scenario Editor to your hard drive.\n  This will take approx. 5 minutes, so please be patient."
		)

		(set tempname (tackon SigDir "Editor")
		)
		(run	(cat "ram:decomp SIGNATURE_3:Scenedit/Scenedit/Editor.C " tempname
			)
		)

		(set tempname (tackon SigDir "Editor.info")
		)

		(run	(cat "ram:decomp SIGNATURE_3:Scenedit/Scenedit/Editor.info.C " tempname
			)
		)

		(set tempname (tackon SigDir "Scenconvert")
		)
		(run	(cat "ram:decomp SIGNATURE_3:Scenedit/Scenedit/Scenconvert.C " tempname
			)
		)

		(set tempname (tackon SigDir "Scenconvert.info")
		)

		(run	(cat "ram:decomp SIGNATURE_3:Scenedit/Scenedit/Scenconvert.info.C " tempname
			)
		)

		(set tempname (tackon SigDir "SETitle")
		)
		(run	(cat "ram:decomp SIGNATURE_3:Scenedit/Scenedit/SETitle.C " tempname
			)
		)

		(set tempname (tackon SigDir "SETitle.info")
		)

		(run	(cat "ram:decomp SIGNATURE_3:Scenedit/Scenedit/SETitle.info.C " tempname
			)
		)

		(set tempname (tackon SigDir "ScenEdit.opt")
		)
		(run	(cat "ram:decomp SIGNATURE_3:Scenedit/Scenedit/ScenEdit.opt.C " tempname
			)
		)

		)

		; else if installing to floppies

		((message "Please put a blank, unformatted disk in the internal drive.\n This will be formatted as the Scenario Editor disk."
			(help 	(cat	"The Scenario Editor will be installed on the blank disk, but it needs to be "
					"formatted first.  You can use a disk that already has data on it, "
					"but the data will be over-written and lost."
				)
			)
		)
	
		(working "Now formatting \"Scenario Editor\".\nPlease wait 60 seconds."
		)
	
		(run "ram:format drive df0: name \"Scenario Editor\" NOICONS"
		)

		(working "Now making \"Scenario Editor\" a bootable disk."
		)
	
		(run "ram:install df0:"
		)

		(message (cat	"Now it's time to build the Scenario Editor disk.  This will take 15 "
				"to 20 minutes to de-archive, so please be patient. "
				"If you are creating Harpoon on floppy disks, but you only "
				"have one disk drive, you may want to think twice, as you will "
				"have to literally swap disks hundreds of times."
			 )
		)

		(execute "ram:scencopy.bat"
		)

		)
	)

)


; unpack and install GIUK

(if	(bitand	4 ToInstall)
	(if tohard
		(

		(working "Now de-archiving the GIUK Battleset to your hard drive.\n  This will take approx. 7 minutes, so please be patient."
		)

		(set tempname (tackon SigDir "GIUK.dat")
		)
		(run	(cat "ram:decomp SIGNATURE_4:GIUK.dat.C " tempname
			)
		)

		(set tempname (tackon SigDir "GIUK.dat.info")
		)

		(run	(cat "ram:decomp SIGNATURE_4:GIUK.dat.info.C " tempname
			)
		)

		)

		; else if installing to floppies

		((message "Please put a blank, unformatted disk in the internal drive.\n This will be formatted as the GIUK Battleset disk."
			(help 	(cat	"The GIUK Battleset will be installed on the blank disk, but it needs to be "
					"formatted first.  You can use a disk that already has data on it, "
					"but the data will be over-written and lost."
				)
			)
		)
	
		(working "Now formatting \"Harpoon2\".\nPlease wait 60 seconds."
		)
	
		(run "ram:format drive df0: name \"Harpoon2\" NOICONS"
		)

		(message (cat	"Now it's time to build the GIUK Battleset disk.  This will take 5 "
				"to 10 minutes to de-archive, so please be patient. "
				"If you are creating Harpoon on floppy disks, but you only "
				"have one disk drive, you may want to think twice, as you will "
				"have to literally swap disks hundreds of times."
			 )
		)

		(working "Now de-archiving the GIUK Battleset."
		)

		(run "ram:decomp SIGNATURE_4:GIUK.dat.C Harpoon2:GIUK.dat"
		)

		(run "ram:decomp SIGNATURE_4:GIUK.dat.info.C Harpoon2:GIUK.dat.info"
		)

		)
	)

)


; unpack and install NACV

(if	(bitand	8 ToInstall)
	(if tohard
		(

		(working "Now de-archiving the NACV Battleset to your hard drive.\n  This will take approx. 7 minutes, so please be patient."
		)

		(set tempname (tackon SigDir "NACV.dat")
		)
		(run	(cat "ram:decomp SIGNATURE_3:NACV.dat.C " tempname
			)
		)

		(set tempname (tackon SigDir "NACV.dat.info")
		)
		(run	(cat "ram:decomp SIGNATURE_3:NACV.dat.info.C " tempname
			)
		)

		)

		; else if installing to floppies

		((message "Please put a blank, unformatted disk in the internal drive.\n This will be formatted as the NACV Battleset disk."
			(help 	(cat	"The NACV Battleset will be installed on the blank disk, but it needs to be "
					"formatted first.  You can use a disk that already has data on it, "
					"but the data will be over-written and lost."
				)
			)
		)
	
		(working "Now formatting \"NACV_Data\".\nPlease wait 60 seconds."
		)
	
		(run "ram:format drive df0: name \"NACV_Data\" NOICONS"
		)

		(message (cat	"Now it's time to build the NACV Battleset disk.  This will take 5 "
				"to 10 minutes to de-archive, so please be patient. "
				"If you are creating Harpoon on floppy disks, but you only "
				"have one disk drive, you may want to think twice, as you will "
				"have to literally swap disks hundreds of times."
			 )
		)

		(working "Now de-archiving the NACV Battleset."
		)

		(run "ram:decomp SIGNATURE_3:NACV.dat.C NACV_Data:NACV.dat"
		)

		(run "ram:decomp SIGNATURE_3:NACV.dat.info.C NACV_Data:NACV.dat.info"
		)

		)
	)

)


; unpack and install MEDC

(if	(bitand	16 ToInstall)
	(if tohard

		(

		(working "Now de-archiving the MEDC Battleset to your hard drive.\n  This will take approx. 7 minutes, so please be patient."
		)

		(set tempname (tackon SigDir "MEDC.dat")
		)
		(run	(cat "ram:decomp SIGNATURE_2:MEDC.dat.C " tempname
			)
		)

		(set tempname (tackon SigDir "MEDC.dat.info")
		)
		(run	(cat "ram:decomp SIGNATURE_2:MEDC.dat.info.C " tempname
			)
		)

		)

		; else if installing to floppies

		((message "Please put a blank, unformatted disk in the internal drive.\n This will be formatted as the MEDC Battleset disk."
			(help 	(cat	"The MEDC Battleset will be installed on the blank disk, but it needs to be "
					"formatted first.  You can use a disk that already has data on it, "
					"but the data will be over-written and lost."
				)
			)
		)
	
		(working "Now formatting \"MEDC_Data\".\nPlease wait 60 seconds."
		)
	
		(run "ram:format drive df0: name \"MEDC_Data\" NOICONS"
		)

		(message (cat	"Now it's time to build the MEDC Battleset disk.  This will take 5 "
				"to 10 minutes to de-archive, so please be patient. "
				"If you are creating Harpoon on floppy disks, but you only "
				"have one disk drive, you may want to think twice, as you will "
				"have to literally swap disks hundreds of times."
			 )
		)

		(working "Now de-archiving the MEDC Battleset."
		)

		(run "ram:decomp SIGNATURE_2:MEDC.dat.C MEDC_Data:MEDC.dat"
		)

		(run "ram:decomp SIGNATURE_2:MEDC.dat.info.C MEDC_Data:MEDC.dat.info"
		)

		)
	)

)


; unpack and install IOPG

(if	(bitand	32 ToInstall)
	(if tohard



		(

		(working "Now de-archiving the IOPG Battleset to your hard drive.\n  This will take approx. 7 minutes, so please be patient."
		)

		(set tempname (tackon SigDir "IOPG.dat")
		)
		(run	(cat "ram:decomp SIGNATURE_4:IOPG.dat.C " tempname
			)
		)

		(set tempname (tackon SigDir "IOPG.dat.info")
		)
		(run	(cat "ram:decomp SIGNATURE_4:IOPG.dat.info.C " tempname
			)
		)

		)


		; else if installing to floppies

		((message "Please put a blank, unformatted disk in the internal drive.\n This will be formatted as the IOPG Battleset disk."
			(help 	(cat	"The IOPG Battleset will be installed on the blank disk, but it needs to be "
					"formatted first.  You can use a disk that already has data on it, "
					"but the data will be over-written and lost."
				)
			)
		)
	
		(working "Now formatting \"IOPG_Data\".\nPlease wait 60 seconds."
		)
	
		(run "ram:format drive df0: name \"IOPG_Data\" NOICONS"
		)

		(message (cat	"Now it's time to build the IOPG Battleset disk.  This will take 5 "
				"to 10 minutes to de-archive, so please be patient. "
				"If you are creating Harpoon on floppy disks, but you only "
				"have one disk drive, you may want to think twice, as you will "
				"have to literally swap disks hundreds of times."
			 )
		)

		(working "Now de-archiving the IOPG Battleset."
		)

		(run "ram:decomp SIGNATURE_4:IOPG.dat.C IOPG_Data:IOPG.dat"
		)

		(run "ram:decomp SIGNATURE_4:IOPG.dat.info.C IOPG_Data:IOPG.dat.info"
		)

		)
	)

)



; clean up after ourselves

(delete RAM:decomp)
(delete RAM:harpcopy.bat)
(delete RAM:scencopy.bat)
(delete RAM:format)
(delete RAM:install)
(delete RAM:Copy)
(delete RAM:makedir)
(delete RAM:Delete)



(exit)




