#!/bin/sh 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 } PLAY_RERELEASE=1 # 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 # 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} if [ "$GAMEBINARY" == "Quake_x64_steam.exe" ]; then if [ $PLAY_RERELEASE == 1 ]; then fteqw -basedir "$GAMEDIR" $GAMEARGS else NEWPATH=$(dirname "$GAMEDIR") fteqw -basedir "$NEWPATH" -quake $GAMEARGS fi elif [ "$GAMEBINARY" == "Winquake.exe" ]; then fteqw -basedir "$GAMEDIR" $GAMEARGS elif [ "$GAMEBINARY" == "qwcl.exe" ]; then fteqw -basedir "$GAMEDIR" -game qw $GAMEARGS elif [ "$GAMEBINARY" == "Glquake.exe" ]; then fteqw -basedir "$GAMEDIR" -quake $GAMEARGS elif [ "$GAMEBINARY" == "glqwcl.exe" ]; then fteqw -basedir "$GAMEDIR" -quake -game qw $GAMEARGS elif [ "$GAMEBINARY" == "quake3.exe" ]; then fteqw -basedir "$GAMEDIR" -quake3 $GAMEARGS elif [ "$GAMEBINARY" == "quake2.exe" ]; then 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 fteqw -basedir "$GAMEDIR" -quake2 $GAMEARGS elif [ "$GAMEBINARY" == "glh2.exe" ]; then fteqw -basedir "$GAMEDIR" -hexen2 $GAMEARGS else fteqw -basedir "$GAMEDIR" $GAMEARGS fi fi