#!/bin/sh
set -e

domain=drascula

if [ $(which gettext) ]; then
	gettext="gettext --domain=$domain -s --"
else
	gettext=echo
fi

usage()
{
	$gettext "Usage: drascula [OPTION]"
	$gettext "Start Drascula: The Vampire Strikes Back"
	echo
	$gettext "--help        display this help and exit"
	$gettext "--version     display version information and exit"
	$gettext "--de          play the German version of Drascula"
	$gettext "--fr          play the French version of Drascula"
	$gettext "--it          play the Italian version of Drascula"
	$gettext "--es          play the Spanish version of Drascula"
}

version()
{
	$gettext "Drascula: The Vampire Strikes Back 1.0"
	$gettext "Copyright (C) Alcachofa Soft S.L"
	$gettext "ScummVM engine Copyright (C) The ScummVM Team"
}

if [ "$#" -gt "1" ]; then
	usage
	exit 1
elif [ "$#" -lt "1" ]; then
	/usr/games/scummvm -m 128 -p /usr/share/scummvm/drascula/en drascula
else
	case "$1" in
	--help)
		usage
		;;
	--version)
		version
		;;
	--de)
		if [ -f /usr/share/scummvm/drascula/de/drascula.dat ]
		then
		  /usr/games/scummvm -q de -n -m 128 -p /usr/share/scummvm/drascula/de drascula
		else
		  $gettext "Please install the drascula-german package."
		fi
		;;

	--fr)
		if [ -f /usr/share/scummvm/drascula/fr/drascula.dat ]
		then
		  /usr/games/scummvm -q fr -n -m 128 -p /usr/share/scummvm/drascula/fr drascula
		else
		  $gettext "Please install the drascula-french package."
		fi
		;;
	--it)
		if [ -f /usr/share/scummvm/drascula/it/drascula.dat ]
		then
		  /usr/games/scummvm -q it -n -m 128 -p /usr/share/scummvm/drascula/it drascula
		else
		  $gettext "Please install the drascula-italian package."
		fi
		;;
	--es)
		if [ -f /usr/share/scummvm/drascula/es/drascula.dat ]
		then
		  /usr/games/scummvm -q es -n -m 128 -p /usr/share/scummvm/drascula/es drascula
		else
		  $gettext "Please install the drascula-spanish package."
		fi
		;;
	*)
		usage
		exit 1
		;;
	esac
fi

exit 0
