; $VER: Install_TaskForce 1.10 (02.01.99)

(complete 0)

; version check
(if (< (/ (getversion) 65536) 37)
    (abort "You must be using Kickstart 2.04 or higher to run TaskForce.")
)

(welcome)

(set @default-dest
	(askdir
		(prompt "Please choose a directory where to install the game. A directory named \"TaskForce\" will be created.")
		(help @askdir-help)
		(default @default-dest)
	)
)

(complete 10)

(set #missions 63)	; default selected missions
(if (> @user-level 1)
	(set #missions
		(askoptions
			(prompt "Select the missions you wish to install.")
			(help (cat
				"It is recommended to install all missions.\n\n"
				"The number in brackets indicates whether it is a "
				"scenario for one or two human players."
			))
			(choices "First Contact (1)" "Hide & Seek (1)" "Plasma! (1)" "Prison (1)" "Project: Pygmalion (1)" "Urban Combat (2)")
			(default #missions)
		)
	)
)

(complete 20)

(set #instdir (tackon @default-dest "TaskForce") )

(makedir #instdir (infos))
(makedir (tackon #instdir "Briefings"))
(makedir (tackon #instdir "Games"))
(makedir (tackon #instdir "Missions"))
(makedir (tackon #instdir "Missions/OnePlayer"))
(makedir (tackon #instdir "Missions/TwoPlayers"))

(complete 30)

(copyfiles
	(prompt "Copying game files...")
	(help @copyfiles-help)
	(source "")
	(dest #instdir)
	(choices "TaskForce" "Editor" "Data" "Docs" "Briefings.info")
	(infos)
)

(complete 65)

(working "\n\n\nTaskForce is now installing the mission files...")

(set n 0)
(while
	(set #missionfiles
		(select n
			"OnePlayer/First Contact"
			"OnePlayer/Hide & Seek"
			"OnePlayer/Plasma"
			"OnePlayer/Prison"
			"OnePlayer/Pygmalion"
			"TwoPlayers/Urban Combat"
			""
		)
	)
(
	(if (IN #missions n)
		(
		    (copyfiles
				(source "Missions/")
				(dest (pathonly (tackon (tackon #instdir "Missions/") #missionfiles) ) )
				(choices (cat #missionfiles ".mission"))
				(nogauge)
			)
			(copyfiles
				(source "Briefings/")
				(dest (tackon #instdir "Briefings"))
				(choices (fileonly #missionfiles))
				(infos)
				(nogauge)
			)
		)
	)
	(set n (+ n 1))
	(complete (+ 65 (* n 4)))
))

(copylib
	(prompt "Installing reqtools.library")
	(help @copylib-help)
	(source "Libs/reqtools.library")
	(dest "LIBS:")
	(confirm)
)

(complete 100)
