de26f79
#!/bin/bash
de26f79
de26f79
set -e
de26f79
de26f79
. /usr/share/opengl-games-utils/opengl-game-functions.sh
de26f79
de26f79
checkDriOK "Urban Terror"
de26f79
326117c
# urbanterror < 4.1.1 lived in ~/.q3a/q3ut4, with ~/.q3ut4/q3ut4 being a
326117c
# symlink to it. For urbanterror 4.1.1 we directly use ~/.q3ut4/q3ut4
326117c
if [ -L $HOME/.q3ut4/q3ut4 ]; then
326117c
	rm $HOME/.q3ut4/q3ut4
326117c
fi
326117c
326117c
# Clean up old urbanterror if any, note we do this undepent of the symlink
326117c
# existing as even older autodownloader installs ran directly from ~/.q3a/q3ut4
326117c
rm -fr $HOME/.q3a/q3ut4
326117c
326117c
if [ ! -f ~/.q3ut4/q3ut4/zpak000.pk3 ]; then
de26f79
  set +e
de26f79
  /usr/share/autodl/AutoDL.py /usr/share/quake3/urbanterror.autodlrc
de26f79
  STATUS=$?
de26f79
  set -e
de26f79
  # status 2 means download was ok, but the user choice not to start the game
de26f79
  if [ "$STATUS" = "0" -o "$STATUS" = "2" ]; then
326117c
    pushd ~/.q3ut4 > /dev/null
326117c
    unzip -qq -u UrbanTerror411.zip
4816465
    # remove any old versions (if present) otherwise the mv fails
4816465
    rm -fr q3ut4
4816465
    mv UrbanTerror/q3ut4 .
326117c
    rm -r UrbanTerror UrbanTerror411.zip
de26f79
    popd > /dev/null
de26f79
  fi
de26f79
  if [ "$STATUS" != "0" ]; then
de26f79
    exit $STATUS
de26f79
  fi
de26f79
fi
de26f79
326117c
# We run from ~/.q3ut4, using ~/.q3a is a bad idea as that will
326117c
# cause com_standalone to not get set if regular quake3 is also present
326117c
CVARS="+set com_basegame q3ut4"
326117c
CVARS="$CVARS +set com_homepath .q3ut4"
76c158b
CVARS="$CVARS +set fs_basepath /usr/share/q3ut4"
76c158b
# Urban Terror's default master server is different
76c158b
CVARS="$CVARS +set sv_master1 master.urbanterror.net"
76c158b
# update.quake3arena.com is pretty irrelevant if you're playing ut
76c158b
CVARS="$CVARS +set cl_motd 0"
76c158b
# And last some Urban Terror specific settings
76c158b
CVARS="$CVARS +set com_hunkMegs 256 +set cl_allowdownload 1"
76c158b
76c158b
exec quake3 $CVARS "$@"