#!/bin/bash
innst=~/.doomsday
program=/usr/games/bin/doomsday
katalog=/usr/share/games/deng
spillinnst=$innst/$1

if test -z $1; then echo "Du må velge et spill"; exit; fi
if ! test -d $innst; then mkdir $innst; fi
if ! test -d $spillinnst; then mkdir $spillinnst; fi

case $1 in
doom)
spill=jdoom
filer="$katalog/Data/jDoom/doom.wad"
;;
doomplut)
spill=jdoom
filer="$katalog/Data/jDoom/plutonia.wad"
;;
doomtnt)
spill=jdoom
filer="$katalog/Data/jDoom/tnt.wad"
;;
heretic)
spill=jheretic
filer="$katalog/Data/jHeretic/heretic.wad"
;;
hexen)
spill=jhexen
filer="$katalog/Data/jHexen/hexen.wad"
;;
hexendk)
spill=jhexen
filer="$katalog/Data/jHexen/hexen.wad $katalog/Data/jHexen/hexdd.wad"
esac

case $spill in
jdoom)
ded=" -def $katalog/Defs/jDoom/jDRP.ded"
filer="$filer $katalog/Data/jDoom/jDRP.pk3 $katalog/Data/jDoom/Details.pk3 $katalog/Data/jDoom/d1music.pk3"
;;
jheretic)
filer="$filer $katalog/Data/jHeretic/musichq.zip $katalog/Data/jHeretic/Heretic_teksturer_Razumen.pk3 $katalog/Data/jHeretic/jHRP.pk3"
;;
jhexen)
filer="$filer $katalog/Data/jHexen/jXRP.pk3 $katalog/Data/jHexen/musichq.zip $katalog/Data/jHexen/Hexen_teksturer_Razumen.pk3"
;;
esac

$program -game $spill -file $filer -userdir $spillinnst$ded
