#!/bin/bash
set -e
if [ ! -f $HOME/.q3a/wop/wop_006.pk3 ]; then
set +e
/usr/share/autodl/AutoDL.py /usr/share/quake3/worldofpadman.autodlrc
STATUS=$?
set -e
# status 2 means download was ok, but the user choice not to start the game
if [ "$STATUS" = "0" -o "$STATUS" = "2" ]; then
mkdir -p $HOME/.q3a/wop/extras
pushd $HOME/.q3a/wop > /dev/null
# install wop 1.1
sh ../worldofpadman.run --nox11 --noexec --target .
tar xf readme.tar
tar xf extras.tar -C extras wop_dvd_cover*
tar xf wop-data.tar
rm -r bin setup.sh setup.data *.tar ../worldofpadman.run
# install 1.2 patch
sh ../wop_patch_1_2.run --nox11 --noexec --target .
tar xf extras.tar
tar xf wop-data-1.2.tar
rm -r bin setup.sh setup.data *.tar ../wop_patch_1_2.run
popd > /dev/null
fi
if [ "$STATUS" != "0" ]; then
exit $STATUS
fi
fi
# We used to run from under ~/.q3a, but that is a bad idea as that will
# cause com_standalone to get unset if regular quake3 is also present
# So now we run from ~/.wop, but we keep the data files under
# ~/.q3a for compatibilities with older autodl "installs"
mkdir -p $HOME/.wop
ln -f -s ../.q3a/wop $HOME/.wop/wop
# we're a standalone game
CVARS="+set com_standalone 1"
CVARS="$CVARS +set fs_basegame wop"
CVARS="$CVARS +set fs_basepath /usr/share/wop"
CVARS="$CVARS +set fs_homepath \"$HOME/.wop\""
# World of Padman's default master server is different
CVARS="$CVARS +set sv_master1 wopmaster.kickchat.com:27955"
# update.quake3arena.com is pretty irrelevant if you're playing wop
CVARS="$CVARS +set cl_motd 0"
exec quake3 $CVARS "$@"