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
cf3d6e0
if [ ! -f ~/.q3ut4/q3ut4/zUrT42_0001.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
cf3d6e0
    unzip -qq -o -u UrbanTerror42_full023.zip
4816465
    # remove any old versions (if present) otherwise the mv fails
4816465
    rm -fr q3ut4
cf3d6e0
    mv UrbanTerror42/q3ut4 .
cf3d6e0
    rm -r UrbanTerror42 UrbanTerror42_full023.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
cf3d6e0
CVARS="$CVARS +set sv_master1 master.urbanterror.info:27900"
76c158b
# update.quake3arena.com is pretty irrelevant if you're playing ut
76c158b
CVARS="$CVARS +set cl_motd 0"
cf3d6e0
# ut qvm files use unaligned stores and loads
cf3d6e0
CVARS="$CVARS +set qvm_unaligned 1"
76c158b
# And last some Urban Terror specific settings
cf3d6e0
CVARS="$CVARS +set com_hunkMegs 512 +set cl_allowdownload 1"
76c158b
76c158b
exec quake3 $CVARS "$@"