;** STRINGS *************************************************************************

;** DEUTSCH **

(if (= "deutsch" @language)
(

(set #MSG_ASKWHAT "Welche Dateien sollen installiert werden?")
(set #MSG_ASK1 "Einstellungsprogramm")
(set #MSG_ASK2 "Deutsche Katalog-Dateien für das Einstellungsprogramm")
(set #MSG_ASK3 "TCP Plugins")
(set #MSG_ASK4 "MODs für P61A Musik Plugin (von Johan Engström)")

(set #MSG_DOOMDIR "Wo befindet sich das DOOM Verzeichnis (die WAD Datei sollte sich dort befinden)?")
(set #MSG_COPY_PREFS "Kopiere Einstellungsprogramm")
(set #MSG_MAKE_CATALOGS "Erzeuge \"catalogs\" Verzeichnis")
(set #MSG_MAKE_DEUTSCH "Erzeuge \"deutsch\" Verzeichnis")
(set #MSG_COPY_CATALOGS "Kopiere deutsche Katalog-Datei")
(set #MSG_MAKE_DASUPPORT "Erzeuge \"DoomAttackSupport\" Verzeichnis")
(set #MSG_MAKE_PLUGIN "Erzeuge \"plugin\" Verzeichnis")
(set #MSG_COPY_PLUGIN "Kopiere TCP Plugins")
(set #MSG_MAKE_MODS "Erzeuge \"mods\" Verzeichnis")
(set #MSG_COPY_MODS "Kopiere MODs")

(set #MSG_NOHELP "\nKeine Hilfe verfügbar. Sorry ...")
(set #MSG_NOP "\nNichts zu tun!?")
(set #MSG_DONE "\nInstallation beendet!")

(set #LANG_FOUND 1)

)
)


;** DEFAULT STRINGS = ENGLISH *******************************************************

(if (= 0 #LANG_FOUND)
(

(set #MSG_ASKWHAT "What files shall be installed?")
(set #MSG_ASK1 "Prefs program")
(set #MSG_ASK2 "German catalog files for prefs program")
(set #MSG_ASK3 "TCP Plugins")
(set #MSG_ASK4 "MODs for P61A music plugin (by Johan Engström)")

(set #MSG_DOOMDIR "Where is the DOOM directory (the one containing the WAD file?)")
(set #MSG_COPY_PREFS "Copying prefs program")
(set #MSG_MAKE_CATALOGS "Creating \"catalogs\" directory")
(set #MSG_MAKE_DEUTSCH "Creating \"deutsch\" directory")
(set #MSG_COPY_CATALOGS "Copying german catalog file")
(set #MSG_MAKE_DASUPPORT "Creating \"DoomAttackSupport\" directory")
(set #MSG_MAKE_PLUGIN "Creating \"plugin\" directory")
(set #MSG_COPY_PLUGIN "Copying TCP plugins")
(set #MSG_MAKE_MODS "Creating \"mods\" directory")
(set #MSG_COPY_MODS "Copying MODs")

(set #MSG_NOHELP "\nNo help available. Sorry ...")
(set #MSG_NOP "\nNothing to do!?")
(set #MSG_DONE "\nInstallation complete!")

)
)


;** Install what ********************************************************************

(set #what
	(askoptions
		(prompt #MSG_ASKWHAT)
		(choices #MSG_ASK1 #MSG_ASK2 #MSG_ASK3 #MSG_ASK4)
		(help #MSG_NOHELP)
	)
)

(if (= 0 #what)
	(exit #MSG_NOP (quiet))
)

;** Get Doom direcotry **************************************************************

(set #doomdir
	(expandpath
		(askdir
			(prompt #MSG_DOOMDIR)
			(help #MSG_NOHELP)
			(default "ram:")
		)
	)
)

;** Copy Prefs program ***************************************************************

(if (<> 0 (BITAND 1 #what))
	(copyfiles
		(prompt #MSG_COPY_PREFS)
		(source "DoomAttackPrefs")
		(dest #doomdir)
		(confirm)
		(help #MSG_NOHELP)
	)
)


;** Copy catalog files ***************************************************************

(if (<> 0 (BITAND 2 #what))
	(
		(if (= 0 (exists (tackon #doomdir "catalogs")))
			(makedir (tackon #doomdir "catalogs")
				(prompt #MSG_MAKE_CATALOGS)
				(help #MSG_NOHELP)
				(confirm)
			)
		)
		
		(if (= 0 (exists (tackon #doomdir "catalogs/deutsch")))
			(makedir (tackon #doomdir "catalogs/deutsch")
				(prompt #MSG_MAKE_DEUTSCH)
				(help #MSG_NOHELP)
				(confirm)
			)
		)
		
		(copyfiles
			(prompt #MSG_COPY_CATALOGS)
			(source "catalogs/deutsch/DAPrefs.catalog")
			(dest (tackon #doomdir "catalogs/deutsch"))
			(help #MSG_NOHELP)
			(confirm)
		)
	)
)

;** Copy TCP plugins **************************************************************

(if (<> 0 (BITAND 4 #what))
	(
		(if (= 0 (exists (tackon #doomdir "DoomAttackSupport")))
			(makedir (tackon #doomdir "DoomAttackSupport")
				(prompt #MSG_MAKE_DASUPPORT)
				(help #MSG_NOHELP)
				(confirm)
			)
		)
		
		(if (= 0 (exists (tackon #doomdir "DoomAttackSupport/plugin")))
			(makedir (tackon #doomdir "DoomAttackSupport/plugin")
				(prompt #MSG_MAKE_PLUGIN)
				(help #MSG_NOHELP)
				(confirm)
			)
		)
		
		(copyfiles
			(prompt #MSG_COPY_PLUGIN)
			(source "plugin")
			(pattern "#?")
			(dest (tackon #doomdir "DoomAttackSupport/plugin"))
			(help #MSG_NOHELP)
			(confirm)
		)
	)
)

;** Copy mods *****************************************************************

(if (<> 0 (BITAND 8 #what))
	(
		(if (= 0 (exists (tackon #doomdir "mods")))
			(makedir (tackon #doomdir "mods")
				(prompt #MSG_MAKE_MODS)
				(help #MSG_NOHELP)
				(confirm)
			)
		)
		
		(copyfiles
			(prompt #MSG_COPY_MODS)
			(source "mods")
			(pattern "#?")
			(dest (tackon #doomdir "mods"))
			(help #MSG_NOHELP)
			(confirm)
		)
	)
)

;** THE END ********************************************************************

(exit #MSG_DONE (quiet))

