2021-07-08 09:38:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-11-23 10:18:57 +00:00
|
|
|
get_library()
|
|
|
|
{
|
|
|
|
if ! [ -f ./$1 ]; then
|
|
|
|
echo "[SteamPlay-FTEQW] No game.so for $1 found, checking..."
|
|
|
|
if ! [ -f ./$2 ]; then
|
|
|
|
echo "[SteamPlay-FTEQW] Grabbing new library..."
|
|
|
|
wget https://www.frag-net.com/dl/lib/$2
|
|
|
|
fi
|
|
|
|
tar xvfz ./$2
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-10-21 14:25:58 +00:00
|
|
|
PLAY_RERELEASE=1
|
|
|
|
|
2021-07-08 09:38:55 +00:00
|
|
|
# there's run & wait-before-run, we only care about the latter.
|
|
|
|
COMMANDTYPE=$1
|
|
|
|
|
|
|
|
# this is how Steam tries to run the game
|
|
|
|
if [ "$COMMANDTYPE" == "wait-before-run" ]; then
|
2021-11-23 16:55:18 +00:00
|
|
|
# dependency check...
|
|
|
|
if ! [ -x "$(command -v wget)" ]; then
|
|
|
|
xmessage "You don't have wget installed. Please install wget."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
if ! [ -x "$(command -v unzip)" ]; then
|
|
|
|
xmessage "You don't have unzip installed. Please install unzip."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2021-07-08 09:38:55 +00:00
|
|
|
# used to decipher which game we'll play
|
|
|
|
GAMEBINARY=$(basename "$2")
|
|
|
|
# steam game dir
|
|
|
|
GAMEDIR=$(dirname "$2")
|
|
|
|
|
|
|
|
# we have an unknown amount of parameters, let's make sure we get them
|
|
|
|
# make sure this is quotes, because HeXen II has a space in its path
|
|
|
|
PARMARR=( "$@" )
|
|
|
|
ARGLEN=${#PARMARR[@]}
|
|
|
|
|
|
|
|
# get every parameter after the second (game location) and put it into
|
|
|
|
# its own variable to pass over later
|
|
|
|
GAMEARGS=${PARMARR[@]:2:$ARGLEN-1}
|
|
|
|
|
2021-11-23 16:55:18 +00:00
|
|
|
# Do we have a system-wide install of FTEQW?
|
|
|
|
if [ -x "$(command -v fteqw)" ]; then
|
|
|
|
ENGINE=fteqw
|
|
|
|
else
|
|
|
|
# If we don't... use a SteamPlay-FTEQW one
|
|
|
|
SCRPATH="$( cd "$( dirname $(readlink -nf $0) )" && pwd )"
|
|
|
|
PATH="$SCRPATH":"$PATH"
|
|
|
|
ENGINE=fteqw-sdl2
|
|
|
|
|
|
|
|
# If we don't have it, grab the latest version!
|
|
|
|
if [ ! -f "$SCRPATH/fteqw-sdl2" ]; then
|
|
|
|
cd "$SCRPATH"
|
|
|
|
wget https://www.fteqw.org/dl/fteqw-sdl2-linux64.zip
|
|
|
|
unzip fteqw-sdl2-linux64.zip
|
|
|
|
rm fteqw-sdl2-linux64.zip readme.txt
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-08-20 07:23:08 +00:00
|
|
|
if [ "$GAMEBINARY" == "Quake_x64_steam.exe" ]; then
|
2021-10-21 14:25:58 +00:00
|
|
|
if [ $PLAY_RERELEASE == 1 ]; then
|
2021-11-23 16:55:18 +00:00
|
|
|
$ENGINE -basedir "$GAMEDIR" $GAMEARGS
|
2021-10-21 14:25:58 +00:00
|
|
|
else
|
|
|
|
NEWPATH=$(dirname "$GAMEDIR")
|
2021-11-23 16:55:18 +00:00
|
|
|
$ENGINE -basedir "$NEWPATH" -quake $GAMEARGS
|
2021-10-21 14:25:58 +00:00
|
|
|
fi
|
2021-08-20 07:23:08 +00:00
|
|
|
elif [ "$GAMEBINARY" == "Winquake.exe" ]; then
|
2021-11-23 16:55:18 +00:00
|
|
|
$ENGINE -basedir "$GAMEDIR" $GAMEARGS
|
2021-07-08 09:38:55 +00:00
|
|
|
elif [ "$GAMEBINARY" == "qwcl.exe" ]; then
|
2021-11-23 16:55:18 +00:00
|
|
|
$ENGINE -basedir "$GAMEDIR" -game qw $GAMEARGS
|
2021-07-08 09:38:55 +00:00
|
|
|
elif [ "$GAMEBINARY" == "Glquake.exe" ]; then
|
2021-11-23 16:55:18 +00:00
|
|
|
$ENGINE -basedir "$GAMEDIR" -quake $GAMEARGS
|
2021-07-08 09:38:55 +00:00
|
|
|
elif [ "$GAMEBINARY" == "glqwcl.exe" ]; then
|
2021-11-23 16:55:18 +00:00
|
|
|
$ENGINE -basedir "$GAMEDIR" -quake -game qw $GAMEARGS
|
2021-07-08 09:38:55 +00:00
|
|
|
elif [ "$GAMEBINARY" == "quake3.exe" ]; then
|
2021-11-23 16:55:18 +00:00
|
|
|
$ENGINE -basedir "$GAMEDIR" -quake3 $GAMEARGS
|
2021-07-08 09:38:55 +00:00
|
|
|
elif [ "$GAMEBINARY" == "quake2.exe" ]; then
|
2021-11-23 10:18:57 +00:00
|
|
|
cd "$GAMEDIR"
|
|
|
|
get_library baseq2/game.so q2-baseq2.tgz
|
|
|
|
get_library ctf/game.so q2-ctf.tgz
|
|
|
|
get_library rogue/game.so q2-rogue.tgz
|
|
|
|
get_library xatrix/game.so q2-xatrix.tgz
|
2021-11-23 16:55:18 +00:00
|
|
|
$ENGINE -basedir "$GAMEDIR" -quake2 $GAMEARGS
|
2021-07-08 09:38:55 +00:00
|
|
|
elif [ "$GAMEBINARY" == "glh2.exe" ]; then
|
2021-11-23 16:55:18 +00:00
|
|
|
$ENGINE -basedir "$GAMEDIR" -hexen2 $GAMEARGS
|
2021-07-08 09:38:55 +00:00
|
|
|
else
|
2021-11-23 16:55:18 +00:00
|
|
|
$ENGINE -basedir "$GAMEDIR" $GAMEARGS
|
2021-07-08 09:38:55 +00:00
|
|
|
fi
|
|
|
|
fi
|