diff options
author | alepulver <alepulver@FreeBSD.org> | 2006-12-26 12:36:35 +0800 |
---|---|---|
committer | alepulver <alepulver@FreeBSD.org> | 2006-12-26 12:36:35 +0800 |
commit | 1e59061bd5ce8fcc063ebe2174f5cebe0ab426f9 (patch) | |
tree | 3941e3907277e04acfee43b665bd167c71614df9 /games | |
parent | 811e4be12d16d188a55aa7dd502212e580668f91 (diff) | |
download | freebsd-ports-gnome-1e59061bd5ce8fcc063ebe2174f5cebe0ab426f9.tar.gz freebsd-ports-gnome-1e59061bd5ce8fcc063ebe2174f5cebe0ab426f9.tar.zst freebsd-ports-gnome-1e59061bd5ce8fcc063ebe2174f5cebe0ab426f9.zip |
Q2PRO is a Quake2 engine modification. Client and server sides are both
compatible with original Quake2 v3.20 network architecture, as well as with
modern R1Q2 network architecture. Q2PRO is designed to be secure, fast and
doesn't provide any graphical enhancements that are contrary to the classic
Quake2 look and feel. It provides some features yet unique to Quake2, notably
server side Multi View Demos. Q2PRO has it's own software and OpenGL refresh
libraries and runs under Win32 and GNU/Linux natively.
Q2PRO supports the following network protocols:
- 34, original Quake2 protocol.
- 35, enhanced R1Q2 protocol.
- 36, enhanced Q2PRO protocol, extension of R1Q2 protocol.
- 37, special broadband MVD protocol.
WWW: http://q2pro.sourceforge.net/
Diffstat (limited to 'games')
21 files changed, 789 insertions, 0 deletions
diff --git a/games/Makefile b/games/Makefile index 9d720d295bff..bc0073b8798a 100644 --- a/games/Makefile +++ b/games/Makefile @@ -569,6 +569,7 @@ SUBDIR += pysycache-themes SUBDIR += pythonchess SUBDIR += q15 + SUBDIR += q2pro SUBDIR += q3base SUBDIR += q3cellshading SUBDIR += linux-quake3 diff --git a/games/q2pro/Makefile b/games/q2pro/Makefile new file mode 100644 index 000000000000..8515d49bc906 --- /dev/null +++ b/games/q2pro/Makefile @@ -0,0 +1,119 @@ +# New ports collection makefile for: q2pro +# Date created: 2006-12-25 +# Whom: alepulver +# +# $FreeBSD$ +# + +PORTNAME= q2pro +PORTVERSION= ${SVN_REV} +CATEGORIES= games +MASTER_SITES= ${MASTER_SITE_LOCAL} +MASTER_SITE_SUBDIR= alepulver + +MAINTAINER= alepulver@FreeBSD.org +COMMENT= Quake II engine modification compatible with R1Q2 + +USE_BZIP2= yes +USE_DOS2UNIX= yes +USE_GMAKE= yes +WRKSRC= ${WRKDIR}/${PORTNAME} +ALL_TARGET= # + +OPTIONS= CLIENT "Build client" on \ + DEDICATED "Build dedicated server" on \ + GAME "Build a main game .so file" off \ + GL "Build OpenGL render" on \ + SOFT "Build software render" on \ + UI "Build user interface (for CLIENT menus)" on + +MAKE_ENV= LIBDIR="${LIBDIR}" +PLIST_SUB= LIBDIR="${LIBDIR:S/${PREFIX}\///}" + +SVN_REV= 131 +LIBDIR= ${PREFIX}/lib/${PORTNAME} + +.include "${.CURDIR}/../quake2-data/Makefile.include" + +.include <bsd.port.pre.mk> + +.if defined(WITHOUT_CLIENT) && defined(WITHOUT_DEDICATED) +IGNORE= needs at least one executable (CLIENT and DEDICATED) +.endif + +.if !defined(WITHOUT_CLIENT) +ALL_TARGET+= client +PLIST_SUB+= CLIENT="" +.else +PLIST_SUB+= CLIENT="@comment " +.endif + +.if !defined(WITHOUT_DEDICATED) +ALL_TARGET+= server +PLIST_SUB+= DEDICATED="" +.else +PLIST_SUB+= DEDICATED="@comment " +.endif + +.if defined(WITH_GAME) +ALL_TARGET+= game +PLIST_SUB+= GAME="" +.else +PLIST_SUB+= GAME="@comment " +.endif + +.if !defined(WITHOUT_GL) +USE_GL= yes +LIB_DEPENDS+= png.5:${PORTSDIR}/graphics/png +ALL_TARGET+= ref_newgl +PLIST_SUB+= GL="" +.else +PLIST_SUB+= GL="@comment " +.endif + +.if !defined(WITHOUT_SOFT) +ALL_TARGET+= ref_soft +PLIST_SUB+= SOFT="" +.else +PLIST_SUB+= SOFT="@comment " +.endif + +.if !defined(WITHOUT_UI) +ALL_TARGET+= ui +PLIST_SUB+= UI="" +.else +PLIST_SUB+= UI="@comment " +.endif + +do-install: + ${MKDIR} ${LIBDIR}/baseq2 +.if !defined(WITHOUT_CLIENT) + ${INSTALL_PROGRAM} ${WRKSRC}/build/release/q2pro ${PREFIX}/bin +.endif +.if !defined(WITHOUT_DEDICATED) + ${INSTALL_PROGRAM} ${WRKSRC}/build/release/q2proded ${PREFIX}/bin +.endif +.if defined(WITH_GAME) + ${INSTALL_PROGRAM} ${WRKSRC}/build/release/game.so ${LIBDIR}/baseq2 +.endif +.if !defined(WITHOUT_GL) + ${INSTALL_PROGRAM} ${WRKSRC}/build/release/ref_newgl.so ${LIBDIR} +.endif +.if !defined(WITHOUT_SOFT) + ${INSTALL_PROGRAM} ${WRKSRC}/build/release/ref_soft.so ${LIBDIR} +.endif +.if !defined(WITHOUT_UI) + ${INSTALL_PROGRAM} ${WRKSRC}/build/release/ui.so ${LIBDIR} +.endif + +maint-gen-distfile: + @if [ -f ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX} ]; then \ + ${ECHO_CMD} "ERROR: the distfile already exists."; \ + ${FALSE}; \ + fi + svn export -r${SVN_REV} \ + https://svn.sourceforge.net/svnroot/q2pro/q2pro q2pro + ${TAR} jcf ${DISTDIR}/${DISTNAME}${EXTRACT_SUFX} q2pro + ${RM} -rf q2pro + +.include <bsd.port.post.mk> diff --git a/games/q2pro/distinfo b/games/q2pro/distinfo new file mode 100644 index 000000000000..8dd37d890b25 --- /dev/null +++ b/games/q2pro/distinfo @@ -0,0 +1,3 @@ +MD5 (q2pro-131.tar.bz2) = 8defcd63e025f4cbade4a93c63d98448 +SHA256 (q2pro-131.tar.bz2) = 8aa747f533c05ac9286db84c71b8219d88486890095d20581450a30dba8a1bea +SIZE (q2pro-131.tar.bz2) = 1536784 diff --git a/games/q2pro/files/patch-build__client.mk b/games/q2pro/files/patch-build__client.mk new file mode 100644 index 000000000000..38567ff80f91 --- /dev/null +++ b/games/q2pro/files/patch-build__client.mk @@ -0,0 +1,11 @@ +--- ./build/client.mk.orig Mon Dec 25 17:07:02 2006 ++++ ./build/client.mk Mon Dec 25 17:07:02 2006 +@@ -42,7 +42,7 @@ + # + SRCFILES_LINUX = sys_unix.c snd_linux.c cd_linux.c vid_sdl.c in_linux.c + ASMFILES_LINUX = snd_mixa.s +-LDFLAGS_LINUX += -lz -ldl -lSDL ++LDFLAGS_LINUX += -lz `sdl-config --libs` + + include ../../post.mk + diff --git a/games/q2pro/files/patch-build__detect.mk b/games/q2pro/files/patch-build__detect.mk new file mode 100644 index 000000000000..bcb2a442c9fe --- /dev/null +++ b/games/q2pro/files/patch-build__detect.mk @@ -0,0 +1,11 @@ +--- ./build/detect.mk.orig Mon Dec 25 17:07:02 2006 ++++ ./build/detect.mk Mon Dec 25 17:07:02 2006 +@@ -21,7 +21,7 @@ + ifeq (linux,$(TARGETOS)) + EXEEXT = #blank + SHLIBEXT = .so +-OUTDIRSUFFIX = i386 ++OUTDIRSUFFIX = #blank + else + $(error Unknown target OS) + endif diff --git a/games/q2pro/files/patch-build__pre.mk b/games/q2pro/files/patch-build__pre.mk new file mode 100644 index 000000000000..fecf8a95745e --- /dev/null +++ b/games/q2pro/files/patch-build__pre.mk @@ -0,0 +1,49 @@ +--- ./build/pre.mk.orig Mon Dec 25 17:07:02 2006 ++++ ./build/pre.mk Mon Dec 25 17:07:02 2006 +@@ -5,29 +5,28 @@ + include ../../detect.mk + + ifdef build-prefix +-CC = $(build-prefix)-gcc ++CC ?= $(build-prefix)-gcc + WINDRES = $(build-prefix)-windres + else +-CC = gcc ++CC ?= gcc + WINDRES = windres + endif + + INSTALLDIR = $(CURDIR)/../../.. + OUTPUTDIR = $(CURDIR)/.. + INCLUDEDIR = $(INSTALLDIR)/include +-LIBDIR = #blank + + VPATH = $(INSTALLDIR)/asm \ + $(INSTALLDIR)/shared \ + $(INSTALLDIR)/source + + ifdef debug +-CFLAGS = -g +-LDFLAGS = -g ++CFLAGS += -g ++LDFLAGS += -g + else +-#CFLAGS = -march=i686 -msse2 -mfpmath=sse -O2 -fno-strict-aliasing -DNDEBUG +-CFLAGS = -march=i386 -ffloat-store -O2 -fno-strict-aliasing -DNDEBUG +-LDFLAGS = -s ++#CFLAGS += -march=i686 -msse2 -mfpmath=sse -O2 -fno-strict-aliasing -DNDEBUG ++CFLAGS += -ffloat-store -O2 -fno-strict-aliasing -DNDEBUG ++LDFLAGS += -s + endif + + CFLAGS += -I$(INCLUDEDIR) \ +@@ -61,7 +60,7 @@ + SRCFILES_WINCE = #blank + ASMFILES_WINCE = #blank + +-CFLAGS_LINUX = #blank +-LDFLAGS_LINUX = #blank ++CFLAGS_LINUX = -I$(LOCALBASE)/include -I$(X11BASE)/include -DDATADIR='"$(Q2DIR)"' -DLIBDIR='"$(LIBDIR)"' ++LDFLAGS_LINUX = -L$(LOCALBASE)/lib -L$(X11BASE)/lib + SRCFILES_LINUX = #blank + ASMFILES_LINUX = #blank diff --git a/games/q2pro/files/patch-build__server.mk b/games/q2pro/files/patch-build__server.mk new file mode 100644 index 000000000000..5699e2037a3c --- /dev/null +++ b/games/q2pro/files/patch-build__server.mk @@ -0,0 +1,11 @@ +--- ./build/server.mk.orig Mon Dec 25 17:07:02 2006 ++++ ./build/server.mk Mon Dec 25 17:07:02 2006 +@@ -22,7 +22,7 @@ + LDFLAGS_WIN32 += -mconsole -lws2_32 -lwinmm -ladvapi32 + + SRCFILES_LINUX += sys_unix.c +-LDFLAGS_LINUX += -ldl ++LDFLAGS_LINUX += # + + include ../../post.mk + diff --git a/games/q2pro/files/patch-include__net.h b/games/q2pro/files/patch-include__net.h new file mode 100644 index 000000000000..7bdd52846bc1 --- /dev/null +++ b/games/q2pro/files/patch-include__net.h @@ -0,0 +1,11 @@ +--- ./include/net.h.orig Mon Dec 25 17:07:02 2006 ++++ ./include/net.h Mon Dec 25 17:07:02 2006 +@@ -24,7 +24,7 @@ + #include <windows.h> + #endif + #include <winsock2.h> +-#elif defined( __linux__ ) ++#elif defined( __unix__ ) + #include <unistd.h> + #include <sys/socket.h> + #include <sys/time.h> diff --git a/games/q2pro/files/patch-include__q_shared.h b/games/q2pro/files/patch-include__q_shared.h new file mode 100644 index 000000000000..6a5f1b1a2860 --- /dev/null +++ b/games/q2pro/files/patch-include__q_shared.h @@ -0,0 +1,23 @@ +--- ./include/q_shared.h.orig Mon Dec 25 17:07:02 2006 ++++ ./include/q_shared.h Mon Dec 25 17:07:02 2006 +@@ -87,7 +87,19 @@ + #define CPUSTRING "Unknown" + #endif + +-#elif( defined __sun__ ) /* __linux__ */ ++#elif( defined __FreeBSD__ ) /* __linux__ */ ++ ++#define BUILDSTRING "FreeBSD" ++ ++#ifdef __i386__ ++#define CPUSTRING "i386" ++#elif defined __alpha__ ++#define CPUSTRING "axp" ++#else ++#define CPUSTRING "Unknown" ++#endif ++ ++#elif( defined __sun__ ) /* __FreeBSD__ */ + + #define BUILDSTRING "Solaris" + diff --git a/games/q2pro/files/patch-include__qgl_api.h b/games/q2pro/files/patch-include__qgl_api.h new file mode 100644 index 000000000000..ac63e362c1c0 --- /dev/null +++ b/games/q2pro/files/patch-include__qgl_api.h @@ -0,0 +1,11 @@ +--- ./include/qgl_api.h.orig Mon Dec 25 17:07:02 2006 ++++ ./include/qgl_api.h Mon Dec 25 17:07:02 2006 +@@ -392,7 +392,7 @@ + typedef BOOL ( WINAPI * PFNWGLSWAPINTERWALEXTPROC )( int ); + extern PROC ( WINAPI * qwglGetProcAddress )( LPCSTR ); + extern BOOL ( WINAPI * qwglSwapIntervalEXT )( int interval ); +-#elif ( defined __linux__ ) ++#elif ( defined __FreeBSD__ ) + // local function in dll + extern void *qwglGetProcAddress( const char *symbol ); + extern void (*qgl3DfxSetPaletteEXT)(GLuint *); diff --git a/games/q2pro/files/patch-include__qgl_local.h b/games/q2pro/files/patch-include__qgl_local.h new file mode 100644 index 000000000000..f811a348da65 --- /dev/null +++ b/games/q2pro/files/patch-include__qgl_local.h @@ -0,0 +1,11 @@ +--- ./include/qgl_local.h.orig Mon Dec 25 17:07:02 2006 ++++ ./include/qgl_local.h Mon Dec 25 17:07:02 2006 +@@ -3,7 +3,7 @@ + #include <windows.h> + #include <GL/gl.h> + #include <GL/glext.h> +-#elif (defined __linux__) ++#elif (defined __unix__) + #include <GL/gl.h> + #else + #error Unknown Target OS diff --git a/games/q2pro/files/patch-ref_shared__qgl.c b/games/q2pro/files/patch-ref_shared__qgl.c new file mode 100644 index 000000000000..e28138446141 --- /dev/null +++ b/games/q2pro/files/patch-ref_shared__qgl.c @@ -0,0 +1,11 @@ +--- ./ref_shared/qgl.c.orig Mon Dec 25 17:07:02 2006 ++++ ./ref_shared/qgl.c Mon Dec 25 17:07:03 2006 +@@ -392,7 +392,7 @@ + BOOL ( WINAPI * qwglSwapIntervalEXT )( int interval ); + #endif + +-#ifdef __linux ++#ifdef __unix__ + void *qwglGetProcAddress( const char *symbol ) { return video.GetProcAddr( symbol ); } + void (*qgl3DfxSetPaletteEXT)(GLuint *); + #endif diff --git a/games/q2pro/files/patch-source__cd_linux.c b/games/q2pro/files/patch-source__cd_linux.c new file mode 100644 index 000000000000..ce7f633ecad5 --- /dev/null +++ b/games/q2pro/files/patch-source__cd_linux.c @@ -0,0 +1,253 @@ +--- ./source/cd_linux.c.orig Mon Dec 25 17:07:02 2006 ++++ ./source/cd_linux.c Mon Dec 25 17:07:03 2006 +@@ -31,7 +31,11 @@ + #include <time.h> + #include <errno.h> + ++#ifdef __FreeBSD__ ++#include <sys/cdio.h> ++#else + #include <linux/cdrom.h> ++#endif + + #include "client.h" + +@@ -61,8 +65,13 @@ + if (cdfile == -1 || !enabled) + return; // no cd init'd + ++#ifdef __FreeBSD__ ++ if (ioctl(cdfile, CDIOCEJECT) == -1) ++ Com_DPrintf ("ioctl cdioceject failed\n"); ++#else + if ( ioctl(cdfile, CDROMEJECT) == -1 ) + Com_DPrintf("ioctl cdromeject failed\n"); ++#endif + } + + +@@ -71,30 +80,53 @@ + if (cdfile == -1 || !enabled) + return; // no cd init'd + ++#ifdef __FreeBSD__ ++ if (ioctl(cdfile, CDIOCCLOSE) == -1) ++ Com_DPrintf ("ioctl cdiocclose failed\n"); ++#else + if ( ioctl(cdfile, CDROMCLOSETRAY) == -1 ) + Com_DPrintf("ioctl cdromclosetray failed\n"); ++#endif + } + + static int CDAudio_GetAudioDiskInfo(void) + { ++#ifdef __FreeBSD__ ++ struct ioc_toc_header tochdr; ++#else + struct cdrom_tochdr tochdr; ++#endif + + cdValid = qfalse; + ++#ifdef __FreeBSD__ ++ if (ioctl(cdfile, CDIOREADTOCHEADER, &tochdr) == -1) ++ { ++ Com_DPrintf ("ioctl cdioreadtocheader failed\n"); ++#else + if ( ioctl(cdfile, CDROMREADTOCHDR, &tochdr) == -1 ) + { + Com_DPrintf("ioctl cdromreadtochdr failed\n"); ++#endif + return -1; + } + ++#ifdef __FreeBSD__ ++ if (tochdr.starting_track < 1) ++#else + if (tochdr.cdth_trk0 < 1) ++#endif + { + Com_DPrintf("CDAudio: no music tracks\n"); + return -1; + } + + cdValid = qtrue; ++#ifdef __FreeBSD__ ++ maxTrack = tochdr.ending_track; ++#else + maxTrack = tochdr.cdth_trk1; ++#endif + + return 0; + } +@@ -102,8 +134,14 @@ + + void CDAudio_Play(int track, qboolean looping) + { ++#ifdef __FreeBSD__ ++ struct ioc_read_toc_entry entry; ++ struct cd_toc_entry toc_buffer; ++ struct ioc_play_track ti; ++#else + struct cdrom_tocentry entry; + struct cdrom_ti ti; ++#endif + + if (cdfile == -1 || !enabled) + return; +@@ -123,6 +161,21 @@ + return; + } + ++#ifdef __FreeBSD__ ++ #define CDROM_DATA_TRACK 4 ++ bzero((char *)&toc_buffer, sizeof(toc_buffer)); ++ entry.data_len = sizeof(toc_buffer); ++ entry.data = &toc_buffer; ++ // don't try to play a non-audio track ++ entry.starting_track = track; ++ entry.address_format = CD_MSF_FORMAT; ++ if ( ioctl(cdfile, CDIOREADTOCENTRYS, &entry) == -1 ) ++ { ++ Com_DPrintf("ioctl cdromreadtocentry failed\n"); ++ return; ++ } ++ if (toc_buffer.control == CDROM_DATA_TRACK) ++#else + // don't try to play a non-audio track + entry.cdte_track = track; + entry.cdte_format = CDROM_MSF; +@@ -132,6 +185,7 @@ + return; + } + if (entry.cdte_ctrl == CDROM_DATA_TRACK) ++#endif + { + Com_Printf("CDAudio: track %i is not audio\n", track); + return; +@@ -144,19 +198,37 @@ + CDAudio_Stop(); + } + ++#ifdef __FreeBSD__ ++ ti.start_track = track; ++ ti.end_track = track; ++ ti.start_index = 1; ++ ti.end_index = 99; ++#else + ti.cdti_trk0 = track; + ti.cdti_trk1 = track; + ti.cdti_ind0 = 1; + ti.cdti_ind1 = 99; ++#endif + ++#ifdef __FreeBSD__ ++ if (ioctl(cdfile, CDIOCPLAYTRACKS, &ti) == -1) ++ { ++ Com_DPrintf ("ioctl cdiocplaytracks failed\n"); ++#else + if ( ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1 ) + { + Com_DPrintf("ioctl cdromplaytrkind failed\n"); ++#endif + return; + } + ++#ifdef __FreeBSD__ ++ if (ioctl(cdfile, CDIOCRESUME) == -1) ++ Com_DPrintf ("ioctl cdiocresume failed\n"); ++#else + if ( ioctl(cdfile, CDROMRESUME) == -1 ) + Com_DPrintf("ioctl cdromresume failed\n"); ++#endif + + playLooping = looping; + playTrack = track; +@@ -175,8 +247,13 @@ + if (!playing) + return; + ++#ifdef __FreeBSD__ ++ if (ioctl(cdfile, CDIOCSTOP) == -1) ++ Com_DPrintf ("ioctl cdiocstop failed (%d)\n", errno); ++#else + if ( ioctl(cdfile, CDROMSTOP) == -1 ) + Com_DPrintf("ioctl cdromstop failed (%d)\n", errno); ++#endif + + wasPlaying = qfalse; + playing = qfalse; +@@ -190,8 +267,13 @@ + if (!playing) + return; + ++#ifdef __FreeBSD__ ++ if (ioctl(cdfile, CDIOCPAUSE) == -1) ++ Com_DPrintf ("ioctl cdiocpause failed\n"); ++#else + if ( ioctl(cdfile, CDROMPAUSE) == -1 ) + Com_DPrintf("ioctl cdrompause failed\n"); ++#endif + + wasPlaying = playing; + playing = qfalse; +@@ -209,8 +291,13 @@ + if (!wasPlaying) + return; + ++#ifdef __FreeBSD__ ++ if (ioctl(cdfile, CDIOCRESUME) == -1) ++ Com_DPrintf ("ioctl cdiocresume failed\n"); ++#else + if ( ioctl(cdfile, CDROMRESUME) == -1 ) + Com_DPrintf("ioctl cdromresume failed\n"); ++#endif + playing = qtrue; + } + +@@ -334,7 +421,12 @@ + + void CDAudio_Update(void) + { ++#ifdef __FreeBSD__ ++ struct ioc_read_subchannel subchnl; ++ struct cd_sub_channel_info data; ++#else + struct cdrom_subchnl subchnl; ++#endif + static time_t lastchk; + + if (cdfile == -1 || !enabled) +@@ -357,6 +449,24 @@ + } + + if (playing && lastchk < time(NULL)) { ++#if defined(__FreeBSD__) ++ subchnl.address_format = CD_MSF_FORMAT; ++ subchnl.data_format = CD_CURRENT_POSITION; ++ subchnl.data_len = sizeof(data); ++ subchnl.track = playTrack; ++ subchnl.data = &data; ++ if (ioctl(cdfile, CDIOCREADSUBCHANNEL, &subchnl) == -1 ) { ++ Com_DPrintf("ioctl cdiocreadsubchannel failed\n"); ++ playing = qfalse; ++ return; ++ } ++ if (subchnl.data->header.audio_status != CD_AS_PLAY_IN_PROGRESS && ++ subchnl.data->header.audio_status != CD_AS_PLAY_PAUSED) { ++ playing = qfalse; ++ if (playLooping) ++ CDAudio_Play(playTrack, qtrue); ++ } ++#else + lastchk = time(NULL) + 2; //two seconds between chks + subchnl.cdsc_format = CDROM_MSF; + if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1 ) { +@@ -370,6 +480,7 @@ + if (playLooping) + CDAudio_Play(playTrack, qtrue); + } ++#endif + } + } + diff --git a/games/q2pro/files/patch-source__cl_main.c b/games/q2pro/files/patch-source__cl_main.c new file mode 100644 index 000000000000..cff10c9d1a2c --- /dev/null +++ b/games/q2pro/files/patch-source__cl_main.c @@ -0,0 +1,11 @@ +--- ./source/cl_main.c.orig Mon Dec 25 17:07:02 2006 ++++ ./source/cl_main.c Mon Dec 25 17:07:03 2006 +@@ -2637,7 +2637,7 @@ + + // all archived variables will now be loaded + +-#if defined __linux__ || defined __sgi ++#if defined __unix__ || defined __sgi + S_Init(); + CL_InitRefresh(); + #else diff --git a/games/q2pro/files/patch-source__files.c b/games/q2pro/files/patch-source__files.c new file mode 100644 index 000000000000..06ede9193136 --- /dev/null +++ b/games/q2pro/files/patch-source__files.c @@ -0,0 +1,96 @@ +--- ./source/files.c.orig Mon Dec 25 17:07:02 2006 ++++ ./source/files.c Mon Dec 25 17:09:49 2006 +@@ -413,6 +413,7 @@ + char *ext; + + switch( file->mode & FS_PATH_MASK ) { ++ /* + case FS_PATH_INIT: + Com_sprintf( file->fullpath, sizeof( file->fullpath ), + "%s/" INITDIRNAME "/%s", fs_basedir->string, file->name ); +@@ -421,6 +422,7 @@ + Com_sprintf( file->fullpath, sizeof( file->fullpath ), + "%s/" BASEDIRNAME "/%s", fs_basedir->string, file->name ); + break; ++ */ + default: + Com_sprintf( file->fullpath, sizeof( file->fullpath ), + "%s/%s", fs_gamedir, file->name ); +@@ -1495,7 +1497,7 @@ + #ifdef _WIN32 + Com_sprintf( path, sizeof( path ), "%s/%s/gamex86.dll", fs_basedir->string, dirlist[i] ); + #else +- Com_sprintf( path, sizeof( path ), "%s/%s/gamex86.so", fs_basedir->string, dirlist[i] ); ++ Com_sprintf( path, sizeof( path ), "%s/%s/game.so", fs_basedir->string, dirlist[i] ); + #endif + Com_ReplaceSeparators( path, PATH_SEP_CHAR ); + +@@ -2153,15 +2155,35 @@ + ================ + */ + static void FS_DefaultGamedir( void ) { ++ /* + Com_sprintf( fs_gamedir, sizeof( fs_gamedir ), "%s/"BASEDIRNAME, fs_basedir->string ); + + Cvar_Set( "game", "" ); + Cvar_Set( "gamedir", "" ); ++ */ + } + + + /* + ================ ++FS_AddHomeAsGameDirectory ++ ++Adds ~/.q2pro/<dir> as a game directory. ++================ ++*/ ++void FS_AddHomeAsGameDirectory(char *dir) ++{ ++ char gdir[MAX_OSPATH]; /* Game directory. */ ++ char *homedir; /* Home directory. */ ++ ++ if ((homedir = getenv("HOME")) != NULL) { ++ Com_sprintf(gdir, sizeof(gdir), "%s/.q2pro/%s", homedir, dir); ++ FS_AddGameDirectory(gdir); ++ } ++} ++ ++/* ++================ + FS_SetupGamedir + + Sets the gamedir and path to a different directory. +@@ -2196,7 +2218,10 @@ + if( fs_cddir->string[0] ) + FS_AddGameDirectory( va( "%s/%s", fs_cddir->string, fs_game->string ) ); + ++ FS_AddGameDirectory(va("%s/%s", DATADIR, fs_game->string)); ++ FS_AddGameDirectory(va("%s/%s", LIBDIR, fs_game->string)); + FS_AddGameDirectory( va( "%s/%s", fs_basedir->string, fs_game->string ) ); ++ FS_AddHomeAsGameDirectory(fs_game->string); + + } + +@@ -2339,7 +2364,10 @@ + // + // start up with baseq2pro by default + // ++ FS_AddGameDirectory(va("%s/"INITDIRNAME, DATADIR)); ++ FS_AddGameDirectory(va("%s/"INITDIRNAME, LIBDIR)); + FS_AddGameDirectory( va( "%s/"INITDIRNAME, fs_basedir->string ) ); ++ FS_AddHomeAsGameDirectory(INITDIRNAME); + + + fs_init_searchpaths = fs_searchpaths; +@@ -2363,7 +2391,10 @@ + // + // start up with baseq2 by default + // ++ FS_AddGameDirectory(va("%s/"BASEDIRNAME, DATADIR)); ++ FS_AddGameDirectory(va("%s/"BASEDIRNAME, LIBDIR)); + FS_AddGameDirectory( va( "%s/"BASEDIRNAME, fs_basedir->string ) ); ++ FS_AddHomeAsGameDirectory(BASEDIRNAME); + + fs_base_searchpaths = fs_searchpaths; + diff --git a/games/q2pro/files/patch-source__in_linux.c b/games/q2pro/files/patch-source__in_linux.c new file mode 100644 index 000000000000..3bfe7c5e3818 --- /dev/null +++ b/games/q2pro/files/patch-source__in_linux.c @@ -0,0 +1,32 @@ +--- ./source/in_linux.c.orig Mon Dec 25 17:07:02 2006 ++++ ./source/in_linux.c Mon Dec 25 17:07:03 2006 +@@ -27,10 +27,14 @@ + #include <sys/ioctl.h> + #include <unistd.h> + #include <fcntl.h> ++#ifdef __linux__ + #include <linux/input.h> ++#endif + #include <errno.h> + ++#ifdef __linux__ + #include "SDL/SDL.h" ++#endif + + static cvar_t *in_device; + +@@ -38,6 +42,7 @@ + static qboolean mouseactive; + static int evdev_fd; + ++#ifdef __linux__ + #define MAX_EVENTS 64 + #define EVENT_SIZE sizeof( struct input_event ) + +@@ -223,5 +228,4 @@ + api->Frame = Evdev_SendMouseMoveEvents; + api->ClearStates = Evdev_ClearMouseStates; + } +- +- ++#endif diff --git a/games/q2pro/files/patch-source__snd_dma.c b/games/q2pro/files/patch-source__snd_dma.c new file mode 100644 index 000000000000..76c097bf95a6 --- /dev/null +++ b/games/q2pro/files/patch-source__snd_dma.c @@ -0,0 +1,20 @@ +--- ./source/snd_dma.c.orig Mon Dec 25 17:07:02 2006 ++++ ./source/snd_dma.c Mon Dec 25 17:07:03 2006 +@@ -110,7 +110,7 @@ + #if (defined _WIN32) + void WAVE_FillAPI( snddmaAPI_t *api ); + void DS_FillAPI( snddmaAPI_t *api ); +-#elif (defined __linux__) ++#elif (defined __unix__) + void OSS_FillAPI( snddmaAPI_t *api ); + #endif + +@@ -129,7 +129,7 @@ + /* fallback driver should be present on all systems */ + #if (defined _WIN32) + { "wave", WAVE_FillAPI }, +-#elif (defined __linux__) ++#elif (defined __unix__) + { "oss", OSS_FillAPI }, + #endif + diff --git a/games/q2pro/files/patch-source__snd_linux.c b/games/q2pro/files/patch-source__snd_linux.c new file mode 100644 index 000000000000..78b27e0467b8 --- /dev/null +++ b/games/q2pro/files/patch-source__snd_linux.c @@ -0,0 +1,11 @@ +--- ./source/snd_linux.c.orig Mon Dec 25 17:07:02 2006 ++++ ./source/snd_linux.c Mon Dec 25 17:07:03 2006 +@@ -27,6 +27,8 @@ + #include <sys/wait.h> + #ifdef __linux__ + #include <linux/soundcard.h> ++#else ++#include <sys/soundcard.h> + #endif + #include <stdio.h> + #include <errno.h> diff --git a/games/q2pro/files/patch-source__sys_unix.c b/games/q2pro/files/patch-source__sys_unix.c new file mode 100644 index 000000000000..6dae184ee783 --- /dev/null +++ b/games/q2pro/files/patch-source__sys_unix.c @@ -0,0 +1,70 @@ +--- ./source/sys_unix.c.orig Mon Dec 25 17:07:02 2006 ++++ ./source/sys_unix.c Mon Dec 25 17:07:03 2006 +@@ -36,10 +36,15 @@ + #include <sys/wait.h> + #include <sys/mman.h> + #include <errno.h> ++#ifdef __linux__ + #include <mntent.h> ++#endif + #include <dirent.h> + #include <dlfcn.h> + #include <termios.h> ++#ifndef __linux__ ++#include <machine/param.h> ++#endif + + #include "qcommon.h" + #include "q_list.h" +@@ -376,7 +381,7 @@ + pool->maxsize = ( maxsize + 4095 ) & ~4095; + pool->cursize = 0; + buf = mmap( NULL, pool->maxsize, PROT_READ|PROT_WRITE, +- MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 ); ++ MAP_PRIVATE|MAP_ANON, -1, 0 ); + if( buf == NULL || buf == ( byte * )-1 ) { + Com_Error( ERR_FATAL, "Hunk_Begin: unable to virtual allocate %d bytes", + pool->maxsize ); +@@ -403,7 +408,24 @@ + void Hunk_End( mempool_t *pool ) { + byte *n; + ++#ifndef __linux__ ++ size_t old_size = pool->maxsize; ++ size_t new_size = pool->cursize + sizeof(int); ++ void * unmap_base; ++ size_t unmap_len; ++ ++ new_size = round_page(new_size); ++ old_size = round_page(old_size); ++ if (new_size > old_size) ++ n = 0; /* error */ ++ else if (new_size < old_size) { ++ unmap_base = (caddr_t)(pool->base + new_size); ++ unmap_len = old_size - new_size; ++ n = munmap(unmap_base, unmap_len) + pool->base; ++ } ++#else + n = mremap( pool->base, pool->maxsize, pool->cursize, 0 ); ++#endif + if( n != pool->base ) { + Com_Error( ERR_FATAL, "Hunk_End: could not remap virtual block: %s", + strerror( errno ) ); +@@ -750,7 +772,7 @@ + if( sys_debugdir->string[0] ) { + base = sys_debugdir->string; + } else { +- base = Sys_GetCurrentDirectory(); ++ base = LIBDIR; + } + + // check the current debug directory first for development purposes +@@ -829,7 +851,7 @@ + //======================================================================= + static void *gameLibrary; + +-#define GAMELIB "gamei386.so" ++#define GAMELIB "game.so" + + /* + ================= diff --git a/games/q2pro/pkg-descr b/games/q2pro/pkg-descr new file mode 100644 index 000000000000..55f4734bd8ee --- /dev/null +++ b/games/q2pro/pkg-descr @@ -0,0 +1,15 @@ +Q2PRO is a Quake2 engine modification. Client and server sides are both +compatible with original Quake2 v3.20 network architecture, as well as with +modern R1Q2 network architecture. Q2PRO is designed to be secure, fast and +doesn't provide any graphical enhancements that are contrary to the classic +Quake2 look and feel. It provides some features yet unique to Quake2, notably +server side Multi View Demos. Q2PRO has it's own software and OpenGL refresh +libraries and runs under Win32 and GNU/Linux natively. + +Q2PRO supports the following network protocols: +- 34, original Quake2 protocol. +- 35, enhanced R1Q2 protocol. +- 36, enhanced Q2PRO protocol, extension of R1Q2 protocol. +- 37, special broadband MVD protocol. + +WWW: http://q2pro.sourceforge.net/ diff --git a/games/q2pro/pkg-plist b/games/q2pro/pkg-plist new file mode 100644 index 000000000000..914e85bcdf9e --- /dev/null +++ b/games/q2pro/pkg-plist @@ -0,0 +1,9 @@ +@exec mkdir -p %D/%%LIBDIR%%/baseq2 +%%CLIENT%%bin/q2pro +%%DEDICATED%%bin/q2proded +%%GAME%%%%LIBDIR%%/baseq2/game.so +%%GL%%%%LIBDIR%%/ref_newgl.so +%%SOFT%%%%LIBDIR%%/ref_soft.so +%%UI%%%%LIBDIR%%/ui.so +@dirrm %%LIBDIR%%/baseq2 +@dirrm %%LIBDIR%% |