de26f79
#!/bin/bash
de26f79
de26f79
set -e
de26f79
8e25a43
# For wop < 1.5 lived in ~/.q3a/wop, with ~/.wop/wop being a symlink to it
8e25a43
# For wop 1.5 we directly use ~/.wop/wop
8e25a43
if [ -L $HOME/.wop/wop ]; then
8e25a43
	rm $HOME/.wop/wop
8e25a43
fi
8e25a43
8e25a43
# Clean up old wop if any, note we do this undepent of the symlink existing
8e25a43
# as even older autodownloader installs ran directly from ~/.q3a/wop
8e25a43
rm -fr $HOME/.q3a/wop
8e25a43
8e25a43
if [ ! -f $HOME/.wop/wop/wop_001.pk3 ]; then
de26f79
	set +e
de26f79
	/usr/share/autodl/AutoDL.py /usr/share/quake3/worldofpadman.autodlrc
de26f79
	STATUS=$?
de26f79
	set -e
de26f79
de26f79
	# status 2 means download was ok, but the user choice not to start the game
de26f79
	if [ "$STATUS" = "0" -o "$STATUS" = "2" ]; then
8e25a43
		pushd $HOME/.wop > /dev/null
8e25a43
		unzip wop-1.5-unified.zip
8e25a43
		rm -r *.dll wop*.* "XTRAS/editing files"
de26f79
		popd > /dev/null
de26f79
	fi
de26f79
	if [ "$STATUS" != "0" ]; then
de26f79
		exit $STATUS
de26f79
	fi
de26f79
fi
de26f79
8e25a43
# We run from ~/.wop, using ~/.q3a is a bad idea as that will
76c158b
# cause com_standalone to get unset if regular quake3 is also present
76c158b
76c158b
# we're a standalone game
76c158b
CVARS="+set com_standalone 1"
76c158b
CVARS="$CVARS +set fs_basegame wop"
76c158b
CVARS="$CVARS +set fs_basepath /usr/share/wop"
76c158b
CVARS="$CVARS +set fs_homepath \"$HOME/.wop\""
76c158b
# World of Padman's default master server is different
8e25a43
CVARS="$CVARS +set sv_master1 master.worldofpadman.com:27955"
8e25a43
# WoP 1.5 has bumped the protocol version to allow using 1 master server
8e25a43
# for 1.2 and 1.5
8e25a43
CVARS="$CVARS +set protocol 69"
76c158b
# update.quake3arena.com is pretty irrelevant if you're playing wop
76c158b
CVARS="$CVARS +set cl_motd 0"
76c158b
76c158b
exec quake3 $CVARS "$@"