;
;$VER: Zeewolf HD Installer script v1.08 (c) 1996-1997 John Girvin
;

(welcome "Welcome to the Zeewolf Hard Drive Installer")
(set @app-name "Zeewolf HD")
(set #ZROOTDIR "DH0:")
(set #ZDESTDIR #ZDESTDIR)
(set #ZVERSION 0)

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

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

(message "\n\nWelcome to the Zeewolf 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 1.08\n\n"
		 "Click 'Proceed' to begin."
)

(set #ZROOTDIR
	(askdir
		(prompt "Where would you like Zeewolf installed?\n"
				"(a new drawer called 'Zeewolf' will be created here)"
		)
		(help @askdir-help)
		(default "DH0:")
	)
)
(set #ZDESTDIR (tackon #ZROOTDIR "Zeewolf/"))
(set @default-dest #ZDESTDIR)
(set #ZDATFILE (tackon #ZDESTDIR "Zeewolf.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 Zeewolf_HD?\n"
				"(this may be changed later by editing the tooltypes of Zeewolf_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 Zeewolf_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
	(askchoice
		(prompt "Please select the default starting mission to use:\n"
				"(this may be changed later by either\n"
				"editing the tooltypes of Zeewolf_HD\n"
				"or using the cheat GUI)"
		)
		(help @askchoice-help)
		(choices "Mission 1" "Mission 5" "Mission 9" "Mission 13"
				 "Mission 17" "Mission 21" "Mission 25" "Mission 29"
        )
		(default #ZSTARTMISSION)
	)
)

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

(message "\n\n\nPlease insert your Zeewolf 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 #ZVERSION  (run (cat "ZMakeDat " #ZSRCDRIVE " " #ZDATFILE)))

(if (OR (> #ZVERSION 3) (< #ZVERSION 1))
	(abort (cat "Could not create disk image!\n\nError: " #ZVERSION))
)

(set #ZBOOTNAME (cat "ZBoot" #ZVERSION))

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

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

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

(tooltype
	(prompt "Setting trainer program icon tooltypes")
	(dest (cat #ZDESTDIR "Zeewolf_HD"))
	(settooltype "START_MISSION" (cat (+ 1 (* #ZSTARTMISSION 4))))
)

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

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

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

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

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

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

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

(copyfiles
	(prompt (cat "Copying HD loader version " #ZVERSION))
	(help @copyfiles-help)
	(source #ZBOOTNAME)
	(newname "ZBoot")
	(dest #ZDESTDIR)
	(nogauge)
	(noposition)
	(optional fail force)
)
