
;----------------------------

;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:")
            )
        )
    )
)

(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")

(set #game_ver
	(askchoice
		(prompt "Which version of Lemmings \ndo you want to install")
		(help	@askoptions-help)
		(choices
		   "2 disk version (PAL/NTSC)"
		   "budget version (PAL)"
		   "ohno more lemmings (PAL/NTSC)"
		   "ohno more lemmings (dos track)"
		   "Lemmings CDTV (CD-ROM)"
		   "Holiday Lemmings (dos disk)"
		   "Holiday Lemmings 93&94 (dos disk)"
		)
	)
)


(set default-dest
(askdir
	(prompt ("Where should %s installed ?\nA drawer \"%s\" will automatically created." @app-name @app-name))
	(help @askdir-help)
	(default @default-dest)
	(disk)
)
)

(set #dest (tackon default-dest @app-name))
(set @default-dest #dest)

(if (< #game_ver 4)
    (

(set #CI_unit
	(askchoice
		(prompt "From which disk unit do you want\nto install the game")
		(help	@askoptions-help)
		(choices
		   "DF0:"
		   "DF1:"
		   "DF2:"
		   "DF3:"
		)
	)
)

(set #CI_drive ("DF%ld:" #CI_unit))


;----------------------------

(copyfiles
	(help @copyfiles-help)
	(source "LemmingsHD")
	(dest @default-dest)
	(infos)
)
  )

)

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

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

(if (= #game_ver 0)
    (

(message ("\nInsert %s disk 1 into drive %s !" @app-name #CI_drive))
	(if
		(= 0 (run ("rippsyfiles %ld \"%s\" 'main' <>CON:0/0/350/200/Ripping/CLOSE/WAIT" #CI_unit @default-dest)))
		("")
		(abort "\"rippsyfiles\" must be in your path !")
	)

(message ("\nInsert %s disk 2 into drive %s !" @app-name #CI_drive))
	(if
		(= 0 (run ("rippsyfiles %ld \"%s\" <>CON:0/0/350/200/Ripping/CLOSE/WAIT" #CI_unit @default-dest)))
		("")
		(abort "\"rippsyfiles\" must be in your path !")
	)

(exit)
    )
)

(if (= #game_ver 1)
    (

(message ("\nInsert Lemmings Budget disk into drive %s !" #CI_drive))
	(if
		(= 0 (run ("rippsyfiles %ld \"%s\" 'main' <>CON:0/0/350/200/Ripping/CLOSE/WAIT" #CI_unit @default-dest)))
		("")
		(abort "\"rippsyfiles\" must be in your path !")
	)

(exit)
    )
)


(if (= #game_ver 2)
    (

(message ("\nInsert Oh No More Lemmings disk into drive %s !" #CI_drive))
	(if
		(= 0 (run ("rippsyfiles %ld \"%s\" <>CON:0/0/350/200/Ripping/CLOSE/WAIT" #CI_unit @default-dest)))
		("")
		(abort "\"rippsyfiles\" must be in your path !")
	)

(exit)
    )
)


(if (= #game_ver 3)
    (

(message ("\nInsert Oh No More Lemmings disk into drive %s !" #CI_drive))
	(if
		(= 0 (run ("disk2file %ld ram:ohno.tmp <>\"CON:0/0/350/200/Making temp diskfile/CLOSE/WAIT\"" #CI_unit)))
		("")
		(abort "\"disk2file\" must be in your path !")
	)

	(if
		(= 0 (run ("ripohno ram:ohno.tmp \"%s\" <>CON:0/0/350/200/Ripping/CLOSE/WAIT" @default-dest)))
		("")
		(abort "\"ripohno\" must be in your path !")
	)

	(delete "ram:ohno.tmp")
(exit)
    )
)

(if (= #game_ver 4)
    (

(askdisk
	(prompt	"\n\n\n\n\n\nPlease insert Lemmings CDTV CD-ROM in any drive")
	(dest		"LEMMINGS_PLANETSIDE")
	(help		"Insert the CD any CD-ROM drive\nor you'll wait for a while!")
)

(makedir (tackon @default-dest "LEMGRAPHICS")
	(help @makedir-help)
)

(makedir (tackon @default-dest "LEMLEVELS")
	(help @makedir-help)
)

(makedir (tackon @default-dest "LEMMISC1")
	(help @makedir-help)
)

(makedir (tackon @default-dest "LEMMISC2")
	(help @makedir-help)
)

(makedir (tackon @default-dest "LEMMUSIC")
	(help @makedir-help)
)

(makedir (tackon @default-dest "LEMSAMPLES")
	(help @makedir-help)
)


(copyfiles (source "LEMMINGS_PLANETSIDE:LEMLEVELS")
        (dest (tackon @default-dest "LEMLEVELS") )
	(all)
)

(copyfiles (source "LEMMINGS_PLANETSIDE:LEMSAMPLES")
        (dest (tackon @default-dest "LEMSAMPLES") )
	(all)
)

(copyfiles (source "LEMMINGS_PLANETSIDE:LEMMUSIC")
        (dest (tackon @default-dest "LEMMUSIC") )
	(all)
)

(copyfiles (source "LEMMINGS_PLANETSIDE:LEMGRAPHICS")
        (dest (tackon @default-dest "LEMGRAPHICS") )
	(all)
)

(copyfiles (source "LEMMINGS_PLANETSIDE:LEMMISC1")
        (dest (tackon @default-dest "LEMMISC1") )
	(all)
)

(copyfiles (source "LEMMINGS_PLANETSIDE:LEMMISC2")
        (dest (tackon @default-dest "LEMMISC2") )
	(all)
)

(copyfiles
	(help @copyfiles-help)
	(source "LEMMINGS_PLANETSIDE:lemmings")
	(dest @default-dest)
)

(copyfiles
	(help @copyfiles-help)
	(source "LEMMINGS_PLANETSIDE:intro")
	(dest @default-dest)
)

(copyfiles
	(help @copyfiles-help)
	(source "LEMMINGS_PLANETSIDE:PlayLemmings.info")
	(dest @default-dest)
)


(copyfiles
	(help @copyfiles-help)
	(source "PlayLemmings")
	(dest @default-dest)
)

   )
)

(if (= #game_ver 5)
    (

(askdisk
	(prompt	"\n\n\n\n\n\nPlease insert Holidays Lemmings disk in any drive")
	(dest		"Holiday Lemmings")
	(help		"Insert the floppy any drive\nor you'll wait for a while!")
)
(copyfiles (source "Holiday Lemmings:")
        (dest @default-dest)
	(all)
)

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

)

(if (= #game_ver 6)
    (

(askdisk
	(prompt	"\n\n\n\n\n\nPlease insert Holidays Lemmings disk in any drive")
	(dest		"Holiday Lemmings 93&94")
	(help		"Insert the floppy any drive\nor you'll wait for a while!")
)
(copyfiles (source "Holiday Lemmings 93&94:HolidayLemmings94")
        (dest @default-dest)
	(all)
)

(copyfiles (source "HolidayLemmings.icon")
        (dest @default-dest)
	(newname "HolidayLemmings1994.info")
)

(delete (tackon (@default-dest "Holiday Lemmings 1994")))
(delete (tackon (@default-dest "Holiday Lemmings 1994.info")))
)

)
