;; Install script generated by InstallWizard
;; InstallWizard is copyright 1999 JF Fabre

(set GameDir "TheatreOfDeath")

;try to figure out a place where the user usually installs his games
(if (exists "Games:" (noreq) )
    (set @default-dest "Games:")
    (if (exists "SYS:Games" (noreq) )
        (set @default-dest "SYS:Games")
        (if (exists "Work:Games" (noreq) )
            (set @default-dest "Work:Games")
            (if (exists "JEUX:" (noreq) )
               (set @default-dest "JEUX:")
               (set @default-dest "SYS:")
            )
        )
    )
)
(set #dest
     (tackon (askdir (prompt "Where would you like " @app-name " installed?\n"
                             "A drawer called " GameDir " will be created.")
                     (help @askdir-help)
                     (default @default-dest)
                     (newpath)
             )
     GameDir
     )
)

(set @default-dest #dest)

(message "\n\n\nThis loader needs the JST program (NOT INCLUDED)\n to be copied in your path\n\n(if you don't have it already)\n\nJST is available from aminet (game/patch) or on my site\n\nhttp://perso.club-internet.fr/jffabre/amiga/patches.html")


(makedir @default-dest
	(help @makedir-help)
	(infos)
)

(copyfiles
	(help @copyfiles-help)
	(source "TheatreOfDeathhd.readme")
	(dest @default-dest)
	(infos)
)

(set #diskno 1)

;; end init
(set #currentdisk "Blank #")

	(askdisk
	  (prompt ("\n\n\n\n\n\nPlease insert %s disk %ld in any drive" @app-name #diskno))
	  (dest	  #currentdisk)
	  (help	  ("Insert disk %ld in any drive or you'll wait for a while!" #diskno) )
	)

	(copyfiles (source ("%s:" #currentdisk))
           (dest @default-dest)
	   (all)
	)

;; patch the executable

;; protection

(if
	(= 0 (run ("multifr >NIL: hfs 117D66164DEC07EC hrs 117D4E714DEC07EC %s" (tackon @default-dest "game") )) )
	("")
	(abort "Could not patch executable!")
)

;; hardware disk check

(if
	(= 0 (run ("multifr >NIL: hfs BFE00166F66100 hrs BFE0014E716100 %s" (tackon @default-dest "game") )) )
	("")
	(abort "Could not patch executable!")
)

;; built-in references to DF0:

(if
	(= 0 (run ("multifr >NIL: fs DF0: rs TOD: %s CI" (tackon @default-dest "game") )) )
	("")
	(abort "Could not patch executable!")
)
(if
	(= 0 (run ("multifr >NIL: fs DF0: rs TOD: %s CI" (tackon @default-dest "newintro") )) )
	("")
	(abort "Could not patch executable!")
)

;; end patch

(set #diskno (+ #diskno 1))

(message "Please insert disk 2 in any drive\n\nafter having removed disk 1")

(set #currentdisk "Blank #")

	(askdisk
	  (prompt ("\n\n\n\n\n\nPlease insert %s disk %ld in any drive" @app-name #diskno))
	  (dest	  #currentdisk)
	  (help	  ("Insert disk %ld in any drive or you'll wait for a while!" #diskno) )
	)

	(copyfiles (source ("%s:" #currentdisk))
           (dest @default-dest)
	   (all)
	)


;; end copy floppies
(copyfiles
	(help @copyfiles-help)
	(source "RunGame")
	(dest @default-dest)
)

(copyfiles
	(help @copyfiles-help)
	(source "RunGame.icon")
	(dest @default-dest)
	(newname "RunGame.info")
)

;; patch executable

