;
;$VER: Zeewolf 2 HD Installer script v2.00 (c) 1996-1997 John Girvin
;

(welcome "Welcome to the Zeewolf 2 Hard Drive Installer")
(set @app-name (cat "Zeewolf_2_HD"))
(set #ZROOTDIR "DH0:")
(set #ZDESTDIR #ZDESTDIR)
(set #ZMDRET 0)

(set #ZSRCDRIVE 0)
(set #ZUSEGUI 0)
(set #ZDEFTRAINERS 0)
(set #ZSTARTMISSION 1)

(if
	(<> @user-level 2)
	(abort "You must select 'Expert' user level")
)

(message "\n\nWelcome to the Zeewolf 2 Hard Drive Installer\n"
		 "(c) 1996-1997 John Girvin\n\n"
		 "Please read the documentation thoroughly before"
		 " attempting to use this installer!\n\n"
		 "This is version 2.00\n\n"
		 "Click 'Proceed' to begin."
)

(set #ZROOTDIR
	(askdir
		(prompt "Where would you like Zeewolf 2 installed?\n"
				"(a new drawer called 'Zeewolf2' will be created here)"
		)
		(help @askdir-help)
		(default "DH0:")
	)
)
(set #ZDESTDIR (tackon #ZROOTDIR "Zeewolf2/"))
(set @default-dest #ZDESTDIR)
(set #ZDATFILE (tackon #ZDESTDIR "Zeewolf2.dat"))

(set #ZSRCDRIVE
	(askchoice
		(prompt "Which drive do you wish to install from?")
		(help @askchoice-help)
		(choices "DF0:" "DF1:" "DF2:" "DF3:")
		(default #ZSRCDRIVE)
	)
)

(set #ZUSEGUI
	(askchoice
		(prompt "Do you want the cheat GUI to appear every time you load Zeewolf2_HD?\n"
				"(this may be changed later by editing the tooltypes of Zeewolf2_HD)"
		)
		(help @askchoice-help)
		(choices "Yes" "No")
		(default #ZUSEGUI)
	)
)

(set #ZDEFTRAINERS
	(askoptions
		(prompt "Please select the default trainers to use:\n"
				"(these may be changed later by either\n"
				"editing the tooltypes of Zeewolf2_HD\n"
				"or using the cheat GUI)"
		)
		(help @askoptions-help)
		(choices "Infinite lives"	"Infinite armor"	"Infinite cannon"
				 "Infinite rockets" "Infinite AAMs"		"Infinite fuel"
    	)
		(default #ZDEFTRAINERS)
	)
)

(set #ZSTARTMISSION
	(asknumber
		(prompt "Please enter the default starting mission to use:\n"
				"(this may be changed later by either\n"
				"editing the tooltypes of Zeewolf2_HD\n"
				"or using the cheat GUI)"
		)
		(help @asknumber-help)
		(range 1 32)
		(default #ZSTARTMISSION)
	)
)

(makedir #ZDESTDIR
	(prompt "I will now create the directory '" #ZDESTDIR "'")
	(help @makedir-help)
	(infos)
	(confirm)
)

(message "\n\n\nPlease insert your Zeewolf 2 game disk in drive DF"
  		 #ZSRCDRIVE
		 ":\n\n"
		 "Click 'Proceed' when disk has been inserted and"
		 " disk activity has stopped."
)

(working "Creating disk image in '" #ZDATFILE "'")
(set #ZMDRET  (run (cat "Z2MakeDat " #ZSRCDRIVE " " #ZDATFILE)))

(if (<> #ZMDRET 0)
	(abort (cat "Could not create disk image!\n\nError: " #ZMDRET))
)

(copyfiles
	(prompt "Copying HD drawer icon")
	(help @copyfiles-help)
	(source "Zeewolf2_icon")
	(newname "Zeewolf2.info")
	(dest #ZROOTDIR)
	(nogauge)
	(optional fail force)
)

(copyfiles
	(prompt "Copying trainer program")
	(help @copyfiles-help)
	(source "Zeewolf2_HD")
	(dest #ZDESTDIR)
	(nogauge)
	(noposition)
	(optional fail force)
)

(copyfiles
	(prompt "Copying trainer program icon")
	(help @copyfiles-help)
	(source "Zeewolf2_HD_icon")
	(newname "Zeewolf2_HD.info")
	(dest #ZDESTDIR)
	(nogauge)
	(optional fail force)
)

(tooltype
	(prompt "Setting trainer program icon tooltypes")
	(dest (cat #ZDESTDIR "Zeewolf2_HD"))
	(settooltype "START_MISSION" (cat #ZSTARTMISSION))
)

(if (= #ZUSEGUI 1)
	(tooltype
		(prompt "Setting trainer program icon tooltypes")
		(dest (cat #ZDESTDIR "Zeewolf2_HD"))
		(settooltype "NOGUI" "")
	)
)

(if (<> 0 (IN #ZDEFTRAINERS 0))
	(tooltype
		(prompt "Setting trainer program icon tooltypes")
		(dest (cat #ZDESTDIR "Zeewolf2_HD"))
		(settooltype "INF_LIVES" "")
	)
)

(if (<> 0 (IN #ZDEFTRAINERS 1))
	(tooltype
		(prompt "Setting trainer program icon tooltypes")
		(dest (cat #ZDESTDIR "Zeewolf2_HD"))
		(settooltype "INF_ARMOR" "")
	)
)

(if (<> 0 (IN #ZDEFTRAINERS 2))
	(tooltype
		(prompt "Setting trainer program icon tooltypes")
		(dest (cat #ZDESTDIR "Zeewolf2_HD"))
		(settooltype "INF_CANNON" "")
	)
)

(if (<> 0 (IN #ZDEFTRAINERS 3))
	(tooltype
		(prompt "Setting trainer program icon tooltypes")
		(dest (cat #ZDESTDIR "Zeewolf2_HD"))
		(settooltype "INF_ROCKET" "")
	)
)

(if (<> 0 (IN #ZDEFTRAINERS 4))
	(tooltype
		(prompt "Setting trainer program icon tooltypes")
		(dest (cat #ZDESTDIR "Zeewolf2_HD"))
		(settooltype "INF_AAM" "")
	)
)

(if (<> 0 (IN #ZDEFTRAINERS 5))
	(tooltype
		(prompt "Setting trainer program icon tooltypes")
		(dest (cat #ZDESTDIR "Zeewolf2_HD"))
		(settooltype "INF_FUEL" "")
	)
)

(copyfiles
	(prompt "Copying HD loader")
	(help @copyfiles-help)
	(source "Z2Boot")
	(dest #ZDESTDIR)
	(nogauge)
	(noposition)
	(optional fail force)
)
