-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfteqw_wrapper
executable file
·93 lines (83 loc) · 2.71 KB
/
fteqw_wrapper
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/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
# 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
# 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}
# 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
if [ "$GAMEBINARY" == "Quake_x64_steam.exe" ]; then
if [ $PLAY_RERELEASE == 1 ]; then
$ENGINE -basedir "$GAMEDIR" $GAMEARGS
else
NEWPATH=$(dirname "$GAMEDIR")
$ENGINE -basedir "$NEWPATH" -quake $GAMEARGS
fi
elif [ "$GAMEBINARY" == "Winquake.exe" ]; then
$ENGINE -basedir "$GAMEDIR" $GAMEARGS
elif [ "$GAMEBINARY" == "qwcl.exe" ]; then
$ENGINE -basedir "$GAMEDIR" -game qw $GAMEARGS
elif [ "$GAMEBINARY" == "Glquake.exe" ]; then
$ENGINE -basedir "$GAMEDIR" -quake $GAMEARGS
elif [ "$GAMEBINARY" == "glqwcl.exe" ]; then
$ENGINE -basedir "$GAMEDIR" -quake -game qw $GAMEARGS
elif [ "$GAMEBINARY" == "quake3.exe" ]; then
$ENGINE -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
$ENGINE -basedir "$GAMEDIR" -quake2 $GAMEARGS
elif [ "$GAMEBINARY" == "glh2.exe" ]; then
$ENGINE -basedir "$GAMEDIR" -hexen2 $GAMEARGS
else
$ENGINE -basedir "$GAMEDIR" $GAMEARGS
fi
fi