Added UrbanTerror, as requested by admiral0.

This commit is contained in:
Adrian Chaves Fernandez (Gallaecio) 2011-06-11 08:57:46 +00:00
parent 094b680b50
commit 3b10b7563f
13 changed files with 328 additions and 0 deletions

36
urbanterror-data/PKGBUILD Normal file
View File

@ -0,0 +1,36 @@
#
# Games Packages for Chakra, part of chakra-project.org
#
# Maintainer: Adrián Chaves Fernández (Gallaecio) <adriyetichaves gmail.com>
# include global config
source ../_buildscripts/${current_repo}-${_arch}-cfg.conf
pkgname=urbanterror-data
_pkgname=urbanterror
_pkgname2=UrbanTerror
pkgver=4.1.1
_pkgver=411
pkgrel=1
pkgdesc="A team-based tactical shooter based on the Quake 3 Engine (data files)."
arch=('any')
url="http://www.urbanterror.net"
license=('custom:freeware')
source=("http://www.iourt.com/files/${_pkgname2}${_pkgver}.zip")
md5sums=('722c1fea9936593c9ef039bb068cc33b')
package() {
install -d $pkgdir/usr/share/$_pkgname/q3ut4/demos
cd $pkgdir/usr/share/$_pkgname
for i in $srcdir/$_pkgname2/q3ut4/*.{cfg,pk3,txt}
do
mv "$i" q3ut4/
chmod 644 "q3ut4/$(basename "$i")"
done
install -m644 $srcdir/$_pkgname2/q3ut4/demos/tutorial.dm_68 q3ut4/demos/tutorial.dm_68
install -Dm644 $pkgdir/usr/share/$_pkgname/q3ut4/readme41.txt $pkgdir/usr/share/licenses/$pkgname/LICENSE
}

81
urbanterror/PKGBUILD Normal file
View File

@ -0,0 +1,81 @@
#
# Games Packages for Chakra, part of chakra-project.org
#
# Maintainer: Adrián Chaves Fernández (Gallaecio) <adriyetichaves gmail.com>
# include global config
source ../_buildscripts/${current_repo}-${_arch}-cfg.conf
pkgname=urbanterror
_pkgname=iourbanterror
_pkgname2=ioUrbanTerror
pkgver=4.1
pkgrel=1
pkgdesc="A team-based tactical shooter based on the Quake 3 Engine."
arch=('i686' 'x86_64')
url="http://www.urbanterror.net"
license=('GPL2')
depends=('sdl' 'openal' 'curl' 'urbanterror-data')
makedepends=('mesa')
source=("http://ftp.snt.utwente.nl/pub/games/$pkgname/$_pkgname/source/complete/${_pkgname2}Source_2007_12_20.zip" \
"${pkgname}_home.patch" "default-curl_lib.patch" \
"cmd.c.patch" "g_cmds.c.patch" "qcommon.h.patch" "sv_client.c.patch" "sv_main.c.patch" \
"${pkgname}.sh" "${pkgname}-server.sh" "${pkgname}.desktop" "${pkgname}.png")
md5sums=('4dbe5a03a10f23138f42b5e0dc39598b'
'a1d992453aa64108c0b7b8304484c21f'
'e917e9fe1210598885665e13a40c11d8'
'0e5cc83478b8d37f59740620e5eccd21'
'1120e5f2a3a5944f219a432e5eb9bcaa'
'a12059253d555fdb169d2717899b47e6'
'57241e730301a78d1b13de5b9cc9f68a'
'8b24a2aa5446e9c6ccbc04e844b189ab'
'1871dee6da522731cf86748cabed9706'
'57e013a7999a3b0fb7277e8276e28410'
'08a99f4d7ad63024bc886e118ddcbc0f'
'f9a57d898df73f43c6a85c8d8cc455ba')
build() {
# Patch home.
cd $srcdir
patch -Np0 -i ${pkgname}_home.patch
# Patch master servers.
sed -i 's/master.urbanterror.net/master.urbanterror.info/g' \
$srcdir/ioUrbanTerrorServerSource/code/qcommon/qcommon.h \
$srcdir/ioUrbanTerrorClientSource/code/qcommon/qcommon.h
sed -i 's/master2.urbanterror.net/master2.urbanterror.info/g' \
$srcdir/ioUrbanTerrorServerSource/code/qcommon/qcommon.h \
$srcdir/ioUrbanTerrorClientSource/code/qcommon/qcommon.h
# Patch and compile client.
cd $srcdir/ioUrbanTerrorClientSource
patch -Np0 -i $srcdir/default-curl_lib.patch
make
# Patch and compile server.
cd $srcdir/ioUrbanTerrorServerSource
patch -Np1 -i $srcdir/cmd.c.patch
patch -Np1 -i $srcdir/g_cmds.c.patch
patch -Np1 -i $srcdir/qcommon.h.patch
patch -Np1 -i $srcdir/sv_client.c.patch
patch -Np1 -i $srcdir/sv_main.c.patch
make
}
package() {
install -d $pkgdir/usr/share/urbanterror
cd $pkgdir/usr/share/urbanterror
# Copy binaries.
install -m755 $srcdir/ioUrbanTerrorClientSource/build/release-linux-*/ioUrbanTerror.* ioUrbanTerror
install -m755 $srcdir/ioUrbanTerrorServerSource/build/release-linux-*/ioUrTded.* ioUrTded
# Copy desktop launcher.
install -Dm644 $srcdir/urbanterror.desktop $pkgdir/usr/share/applications/urbanterror.desktop
install -Dm644 $srcdir/urbanterror.png $pkgdir/usr/share/pixmaps/urbanterror.png
# Copy launch scripts.
install -Dm755 $srcdir/urbanterror.sh $pkgdir/usr/bin/urbanterror
install -Dm755 $srcdir/urbanterror-server.sh $pkgdir/usr/bin/urbanterror-server
}

25
urbanterror/cmd.c.patch Normal file
View File

@ -0,0 +1,25 @@
--- trunk/code/qcommon/cmd.c 2009/01/13 07:57:03 1492
+++ trunk/code/qcommon/cmd.c 2009/01/17 23:09:58 1493
@@ -434,6 +434,22 @@
}
/*
+ Replace command separators with space to prevent interpretation
+ This is a hack to protect buggy qvms
+ https://bugzilla.icculus.org/show_bug.cgi?id=3593
+*/
+void Cmd_Args_Sanitize( void ) {
+ int i;
+ for ( i = 1 ; i < cmd_argc ; i++ ) {
+ char* c = cmd_argv[i];
+ while ((c = strpbrk(c, "\n\r;"))) {
+ *c = ' ';
+ ++c;
+ }
+ }
+}
+
+/*
============
Cmd_TokenizeString

View File

@ -0,0 +1,28 @@
--- code/client/cl_curl.h.orig 2008-07-01 11:27:47.000000000 +0300
+++ code/client/cl_curl.h 2008-07-01 11:28:16.000000000 +0300
@@ -34,7 +34,7 @@
#elif defined(MACOS_X)
#define DEFAULT_CURL_LIB "libcurl.dylib"
#else
-#define DEFAULT_CURL_LIB "libcurl.so.3"
+#define DEFAULT_CURL_LIB "libcurl.so"
#endif
#if USE_LOCAL_HEADERS
--- Makefile.orig 2008-07-01 14:40:01.000000000 +0300
+++ Makefile 2008-07-01 14:53:54.000000000 +0300
@@ -1129,12 +1129,12 @@
$(B)/ioUrbanTerror.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN)
$(echo_cmd) "LD $@"
$(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ) $(CLIENT_LDFLAGS) \
- $(LDFLAGS) $(LIBSDLMAIN)
+ $(LDFLAGS) $(LIBSDLMAIN) -lcurl
$(B)/ioUrbanTerror-smp.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN)
$(echo_cmd) "LD $@"
$(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ_SMP) $(CLIENT_LDFLAGS) \
- $(THREAD_LDFLAGS) $(LDFLAGS) $(LIBSDLMAIN)
+ $(THREAD_LDFLAGS) $(LDFLAGS) $(LIBSDLMAIN) -lcurl
ifneq ($(strip $(LIBSDLMAIN)),)
ifneq ($(strip $(LIBSDLMAINSRC)),)

View File

@ -0,0 +1,30 @@
--- trunk/code/game/g_cmds.c 2009/01/13 07:57:03 1492
+++ trunk/code/game/g_cmds.c 2009/01/17 23:09:58 1493
@@ -1213,6 +1213,7 @@
==================
*/
void Cmd_CallVote_f( gentity_t *ent ) {
+ char* c;
int i;
char arg1[MAX_STRING_TOKENS];
char arg2[MAX_STRING_TOKENS];
@@ -1239,9 +1240,16 @@
trap_Argv( 1, arg1, sizeof( arg1 ) );
trap_Argv( 2, arg2, sizeof( arg2 ) );
- if( strchr( arg1, ';' ) || strchr( arg2, ';' ) ) {
- trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" );
- return;
+ // check for command separators in arg2
+ for( c = arg2; *c; ++c) {
+ switch(*c) {
+ case '\n':
+ case '\r':
+ case ';':
+ trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" );
+ return;
+ break;
+ }
}
if ( !Q_stricmp( arg1, "map_restart" ) ) {

View File

@ -0,0 +1,10 @@
--- trunk/code/qcommon/qcommon.h 2009/01/13 07:57:03 1492
+++ trunk/code/qcommon/qcommon.h 2009/01/17 23:09:58 1493
@@ -434,6 +434,7 @@
char *Cmd_ArgsFrom( int arg );
void Cmd_ArgsBuffer( char *buffer, int bufferLength );
char *Cmd_Cmd (void);
+void Cmd_Args_Sanitize( void );
// The functions that execute commands get their parameters with these
// functions. Cmd_Argv () will return an empty string, not a NULL
// if arg > argc, so string operations are allways safe.

View File

@ -0,0 +1,10 @@
--- trunk/code/server/sv_client.c 2009/01/13 07:57:03 1492
+++ trunk/code/server/sv_client.c 2009/01/17 23:09:58 1493
@@ -1500,6 +1500,7 @@
if (clientOK) {
// pass unknown strings to the game
if (!u->name && sv.state == SS_GAME) {
+ Cmd_Args_Sanitize();
VM_Call( gvm, GAME_CLIENT_COMMAND, cl - svs.clients );
}
}

View File

@ -0,0 +1,42 @@
Index: trunk/code/server/sv_main.c
===================================================================
--- trunk/code/server/sv_main.c (revision 1525)
+++ trunk/code/server/sv_main.c (working copy)
@@ -466,20 +466,24 @@
// TTimo - https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=534
time = Com_Milliseconds();
- if ( (unsigned)( time - lasttime ) < 500u ) {
- return;
- }
- lasttime = time;
+ if ( !strlen( sv_rconPassword->string ) ||
+ strcmp (Cmd_Argv(1), sv_rconPassword->string) ) {
+ // MaJ - If the rconpassword is bad and one just happned recently, don't spam the log file, just die.
+ if ( (unsigned)( time - lasttime ) < 500u ) {
+ return;
+ }
+ valid = qfalse;
+ Com_Printf ("Bad rcon from %s:\n%s\n", NET_AdrToString (from), Cmd_Argv(2) );
+ } else {
+ // MaJ - If the rconpassword is good, allow it much sooner than a bad one.
+ if ( (unsigned)( time - lasttime ) < 100u ) {
+ return;
+ }
+ valid = qtrue;
+ Com_Printf ("Rcon from %s:\n%s\n", NET_AdrToString (from), Cmd_Argv(2) );
+ }
+ lasttime = time;
- if ( !strlen( sv_rconPassword->string ) ||
- strcmp (Cmd_Argv(1), sv_rconPassword->string) ) {
- valid = qfalse;
- Com_Printf ("Bad rcon from %s:\n%s\n", NET_AdrToString (from), Cmd_Argv(2) );
- } else {
- valid = qtrue;
- Com_Printf ("Rcon from %s:\n%s\n", NET_AdrToString (from), Cmd_Argv(2) );
- }
-
// start redirecting all print outputs to the packet
svs.redirectAddress = from;
Com_BeginRedirect (sv_outputbuf, SV_OUTPUTBUF_LENGTH, SV_FlushRedirect);

View File

@ -0,0 +1,4 @@
#!/bin/sh
cd /usr/share/urbanterror/
exec ./ioUrTded "$@"

View File

@ -0,0 +1,7 @@
[Desktop Entry]
Name=Urban Terror
Type=Application
Categories=Game;
Terminal=false
Exec=urbanterror
Icon=urbanterror

BIN
urbanterror/urbanterror.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -0,0 +1,4 @@
#!/bin/sh
cd /usr/share/urbanterror/
exec ./ioUrbanTerror "$@"

View File

@ -0,0 +1,51 @@
diff -Naur ioUrbanTerrorClientSource.orig/code/q3_ui/ui_mods.c ioUrbanTerrorClientSource/code/q3_ui/ui_mods.c
--- ioUrbanTerrorClientSource.orig/code/q3_ui/ui_mods.c 2007-10-09 02:47:14.000000000 +0300
+++ ioUrbanTerrorClientSource/code/q3_ui/ui_mods.c 2007-12-21 14:44:17.000000000 +0200
@@ -161,7 +161,7 @@
// always start off with baseq3
s_mods.list.numitems = 1;
- s_mods.list.itemnames[0] = s_mods.descriptionList[0] = "Quake III Arena";
+ s_mods.list.itemnames[0] = s_mods.descriptionList[0] = "Urban Terror";
s_mods.fs_gameList[0] = "";
numdirs = trap_FS_GetFileList( "$modlist", "", dirlist, sizeof(dirlist) );
diff -Naur ioUrbanTerrorClientSource.orig/code/unix/unix_shared.c ioUrbanTerrorClientSource/code/unix/unix_shared.c
--- ioUrbanTerrorClientSource.orig/code/unix/unix_shared.c 2007-10-09 02:47:16.000000000 +0300
+++ ioUrbanTerrorClientSource/code/unix/unix_shared.c 2007-12-21 14:44:17.000000000 +0200
@@ -409,7 +409,7 @@
#ifdef MACOS_X
Q_strcat(homePath, sizeof(homePath), "/Library/Application Support/Quake3");
#else
- Q_strcat(homePath, sizeof(homePath), "/.q3a");
+ Q_strcat(homePath, sizeof(homePath), "/.urbanterror");
#endif
if (mkdir(homePath, 0777)) {
if (errno != EEXIST)
diff -Naur ioUrbanTerrorServerSource.orig/code/q3_ui/ui_mods.c ioUrbanTerrorServerSource/code/q3_ui/ui_mods.c
--- ioUrbanTerrorServerSource.orig/code/q3_ui/ui_mods.c 2007-11-18 19:53:48.000000000 +0200
+++ ioUrbanTerrorServerSource/code/q3_ui/ui_mods.c 2007-12-21 14:46:30.000000000 +0200
@@ -125,7 +125,7 @@
// always start off with baseq3
s_mods.list.numitems = 1;
- s_mods.list.itemnames[0] = s_mods.descriptionList[0] = "Quake III Arena";
+ s_mods.list.itemnames[0] = s_mods.descriptionList[0] = "Urban Terror";
s_mods.fs_gameList[0] = "";
numdirs = trap_FS_GetFileList( "$modlist", "", dirlist, sizeof(dirlist) );
diff -Naur ioUrbanTerrorServerSource.orig/code/sys/sys_unix.c ioUrbanTerrorServerSource/code/sys/sys_unix.c
--- ioUrbanTerrorServerSource.orig/code/sys/sys_unix.c 2007-12-03 02:37:34.000000000 +0200
+++ ioUrbanTerrorServerSource/code/sys/sys_unix.c 2007-12-21 14:47:47.000000000 +0200
@@ -55,7 +55,7 @@
#ifdef MACOS_X
Q_strcat( homePath, sizeof( homePath ), "/Library/Application Support/Quake3" );
#else
- Q_strcat( homePath, sizeof( homePath ), "/.q3a" );
+ Q_strcat( homePath, sizeof( homePath ), "/.urbanterror" );
#endif
if( mkdir( homePath, 0777 ) )
{