R1Q2 is an enhanced client/server for Quake II. Based on the id Software 3.21

source, rather than concentrate on fancy graphics, embedded MP3 players and
other "gimmick" features, R1Q2 is focused on providing stability, security and
speed whilst remaining fully compatible with existing mods and other clients.

WWW: http://www.r1ch.net/stuff/r1q2/

Approved by:	garga (mentor)
This commit is contained in:
Alejandro Pulver 2006-05-21 21:35:18 +00:00
parent 3128f146cd
commit 333f37c2c7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=162997
23 changed files with 939 additions and 0 deletions

View File

@ -546,6 +546,7 @@
SUBDIR += quetoo
SUBDIR += quit
SUBDIR += qwdtools
SUBDIR += r1q2
SUBDIR += race
SUBDIR += reminiscence
SUBDIR += rfksay

110
games/r1q2/Makefile Normal file
View File

@ -0,0 +1,110 @@
# New ports collection makefile for: r1q2
# Date created: 16 May 2006
# Whom: alepulver
#
# $FreeBSD$
#
PORTNAME= r1q2
PORTVERSION= 6557
CATEGORIES= games
MASTER_SITES= http://www.r1ch.net/stuff/r1q2/src/
DISTNAME= ${PORTNAME}-b${PORTVERSION}-src
PATCH_SITES= http://qudos.quakedev.com/linux/quake2/engines/R1Q2/
PATCHFILES= r1q2_diff.gz
PATCH_DIST_STRIP= -p1
MAINTAINER= alepulver@FreeBSD.org
COMMENT= Enhaced Quake II client/server focusing on stability
LIB_DEPENDS= execinfo.1:${PORTSDIR}/devel/libexecinfo \
jpeg.9:${PORTSDIR}/graphics/jpeg \
png.5:${PORTSDIR}/graphics/png
USE_ZIP= yes
USE_GCC= 3.2+
USE_GMAKE= yes
USE_GL= yes
NO_WRKSUBDIR= yes
OPTIONS= DEDICATED "Build dedicated server" on \
HTTP "Enable HTTP download support" on \
OPENAL "Ebable OpenAL support" on \
OPTIMIZED_CFLAGS "Enable compilation optimizations" on \
SDL "Build SDL client" on \
SDLGL "Build SDL OpenGL renderer" on
ALL_TARGET= release
MAKE_ENV= LIBDIR="${LIBDIR}"
PLIST_SUB= LIBDIR="${LIBDIR:S/${PREFIX}\///}"
LIBDIR= ${PREFIX}/lib/${PORTNAME}
.include "${.CURDIR}/../quake2-data/Makefile.include"
.include <bsd.port.pre.mk>
.if !defined(WITHOUT_DEDICATED)
MAKE_ENV+= BUILD_DEDICATED=YES
PLIST_SUB+= DEDICATED=""
.else
PLIST_SUB+= DEDICATED="@comment "
.endif
.if !defined(WITHOUT_HTTP)
LIB_DEPENDS+= curl.3:${PORTSDIR}/ftp/curl
MAKE_ENV+= WITH_HTTP_DOWNLOAD_SUPPORT=YES
.endif
.if !defined(WITHOUT_OPENAL)
LIB_DEPENDS+= openal.0:${PORTSDIR}/audio/openal
MAKE_ENV+= WITH_OPENAL_SUPPORT=YES
.endif
.if !defined(WITHOUT_OPTIMIZED_CFLAGS)
MAKE_ENV+= OPTIMIZED_CFLAGS=YES
.endif
.if !defined(WITHOUT_SDL) && !defined(WITHOUT_SDLGL)
USE_SDL= sdl
.endif
.if !defined(WITHOUT_SDL)
MAKE_ENV+= BUILD_SDL=YES
PLIST_SUB+= SDL=""
.else
PLIST_SUB+= SDL="@comment "
.endif
.if !defined(WITHOUT_SDLGL)
MAKE_ENV+= BUILD_SDLGL=YES
PLIST_SUB+= SDLGL=""
.else
PLIST_SUB+= SDLGL="@comment "
.endif
.if ${OSVERSION} < 500000
post-patch:
@${REINPLACE_CMD} -e 's|<stdint\.h>|<inttypes.h>|' \
${WRKSRC}/game/q_shared.h
.endif
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/quake2/${PORTNAME} ${PREFIX}/bin
.if !defined(WITHOUT_SDL)
${INSTALL_PROGRAM} ${WRKSRC}/quake2/${PORTNAME}-sdl ${PREFIX}/bin
.endif
${MKDIR} ${LIBDIR}/baseq2
${INSTALL_PROGRAM} ${WRKSRC}/quake2/ref_r1gl.so ${LIBDIR}
.if !defined(WITHOUT_SDLGL)
${INSTALL_PROGRAM} ${WRKSRC}/quake2/ref_r1sdl.so ${LIBDIR}
.endif
${INSTALL_PROGRAM} ${WRKSRC}/quake2/baseq2/game.so ${LIBDIR}/baseq2
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/readme.txt ${WRKSRC}/r1q2.txt ${DOCSDIR}
.endif
.include <bsd.port.post.mk>

6
games/r1q2/distinfo Normal file
View File

@ -0,0 +1,6 @@
MD5 (r1q2-b6557-src.zip) = 6a77951783bf1fdfa074fd98533eb25a
SHA256 (r1q2-b6557-src.zip) = f0be6e8b9748ea4505bfe033c4f316319390b444fadc7239ebb65fe611944dd7
SIZE (r1q2-b6557-src.zip) = 1094217
MD5 (r1q2_diff.gz) = 3a75c1c00060fee1733fda1a893ee341
SHA256 (r1q2_diff.gz) = 5e958cec37cfc9bf5f6b4b3c17ddd99c8e80a94b7e3c1f7e7671833bb89cde24
SIZE (r1q2_diff.gz) = 73430

View File

@ -0,0 +1,101 @@
--- ./Makefile.orig Wed May 17 22:21:33 2006
+++ ./Makefile Wed May 17 22:47:04 2006
@@ -21,25 +21,25 @@
#===============================#
# Quake 2 dedicated server only #
#===============================#
-BUILD_DEDICATED=YES
+#BUILD_DEDICATED=YES
#===============================#
# Quake 2 SDL Options #
# Uses SDL for cdrom and sound #
# SDL OpenGL ref library #
#===============================#
-BUILD_SDL=YES
-BUILD_SDLGL=YES
+#BUILD_SDL=YES
+#BUILD_SDLGL=YES
#===============================#
# HTTP download stuff #
#===============================#
-WITH_HTTP_DOWNLOAD_SUPPORT=YES
+#WITH_HTTP_DOWNLOAD_SUPPORT=YES
#===============================#
# OpenAL stuff #
#===============================#
-WITH_OPENAL_SUPPORT=YES
+#WITH_OPENAL_SUPPORT=YES
#===============================#
# CD Audio #
@@ -61,18 +61,21 @@
REF_GL_DIR=$(MOUNT_DIR)/ref_gl
SERVER_DIR=$(MOUNT_DIR)/server
-CC=gcc
+CC?=gcc
-BASE_CFLAGS= -DLINUX -ffloat-store
-RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O2 -ffast-math -funroll-loops -fno-strict-aliasing
+BASE_CFLAGS=$(CFLAGS) -DDATADIR='\"$(Q2DIR)\"' -DLIBDIR='\"$(LIBDIR)\"' -I$(LOCALBASE)/include -I$(X11BASE)/include -DLINUX -ffloat-store
+RELEASE_CFLAGS=$(BASE_CFLAGS)
-ifeq ($(ARCH),i386)
- RELEASE_CFLAGS+=-falign-loops=2 -falign-jumps=2 -falign-functions=2
+ifdef OPTIMIZED_CFLAGS
+RELEASE_CFLAGS+=-DNDEBUG -O2 -ffast-math -funroll-loops -fno-strict-aliasing
+ ifeq ($(ARCH),i386)
+RELEASE_CFLAGS+=-falign-loops=2 -falign-jumps=2 -falign-functions=2
+ endif
endif
DEBUG_CFLAGS=$(BASE_CFLAGS) -g -ggdb -Wall -pipe
-LDFLAGS+=-lm -lz
+LDFLAGS+=-L$(LOCALBASE)/lib -L$(X11BASE)/lib -lm -lz
ifeq ($(OSTYPE),Linux)
LDFLAGS+=-ldl
@@ -91,16 +94,16 @@
endif
ifeq ($(strip $(WITH_HTTP_DOWNLOAD_SUPPORT)),YES)
-#LDFLAGS+= -lcurl
-LDFLAGS+= /usr/local/lib/libcurl.a # Statically linked, note the path, if curl is not installed in your system,
+LDFLAGS+= -lcurl
+#LDFLAGS+= /usr/local/lib/libcurl.a # Statically linked, note the path, if curl is not installed in your system,
# set to NO in the build options
BASE_CFLAGS+= -DUSE_CURL
endif
-GLXLDFLAGS=-L/usr/X11R6/lib -L/usr/local/lib -lX11 -lXext -lXxf86dga -lXxf86vm -lGL -lpng -ljpeg
+GLXLDFLAGS=-L$(LOCALBASE)/lib -L$(X11BASE)/lib -lX11 -lXext -lXxf86dga -lXxf86vm -lGL -lpng -ljpeg
-SDLCFLAGS=$(shell sdl-config --cflags)
-SDLLDFLAGS=$(shell sdl-config --libs)
+SDLCFLAGS=$(shell $(SDL_CONFIG) --cflags)
+SDLLDFLAGS=$(shell $(SDL_CONFIG) --libs)
SDLGLCFLAGS=$(SDLCFLAGS) -DOPENGL
SDLGLLDFLAGS=$(SDLLDFLAGS)
@@ -122,7 +125,7 @@
$(BINDIR)/ref_r1gl.$(SHLIBEXT)
ifeq ($(strip $(BUILD_GAME)),YES)
- TARGETS+=$(BINDIR)/baseq2/game$(ARCH).$(SHLIBEXT)
+ TARGETS+=$(BINDIR)/baseq2/game.$(SHLIBEXT)
endif
ifeq ($(strip $(BUILD_DEDICATED)),YES)
@@ -618,7 +621,7 @@
$(BUILDDIR)/objects/game/p_weapon.o \
$(BUILDDIR)/objects/game/m_flash.o
-$(BINDIR)/baseq2/game$(ARCH).$(SHLIBEXT) : $(GAME_OBJS)
+$(BINDIR)/baseq2/game.$(SHLIBEXT) : $(GAME_OBJS)
$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS)
$(BUILDDIR)/objects/game/g_ai.o : $(GAME_DIR)/g_ai.c

View File

@ -0,0 +1,29 @@
--- ./client/cl_main.c.orig Wed May 17 22:21:33 2006
+++ ./client/cl_main.c Wed May 17 22:27:30 2006
@@ -3629,7 +3629,7 @@
//jec - updates all input events
void CL_RefreshCmd (void);
-#if (defined JOYSTICK) || (defined LINUX)
+#if (defined JOYSTICK) || (defined __unix__)
extern void IN_Commands (void);
#endif
void CL_RefreshInputs (void)
@@ -3637,7 +3637,7 @@
// process new key events
Sys_SendKeyEvents ();
-#if (defined JOYSTICK) || (defined LINUX)
+#if (defined JOYSTICK) || (defined __unix__)
// process mice & joystick events
IN_Commands ();
#endif
@@ -4032,7 +4032,7 @@
Cbuf_Execute ();
Con_Init ();
-#if defined __linux__ || defined __sgi || defined __FreeBSD__
+#if defined __unix__ || defined __sgi
S_Init (true);
VID_Init ();

View File

@ -0,0 +1,10 @@
--- client/menu.c.orig Wed Jan 4 05:16:38 2006
+++ client/menu.c Sat May 20 13:45:54 2006
@@ -587,6 +587,7 @@
{
{"+attack", "attack"},
{"weapnext", "next weapon"},
+{"weapprev", "previous weapon"},
{"+forward", "walk forward"},
{"+back", "backpedal"},
{"+left", "turn left"},

View File

@ -0,0 +1,13 @@
--- client/qal.h.orig Sat Jun 26 15:20:12 2004
+++ client/qal.h Thu May 18 20:40:19 2006
@@ -22,6 +22,10 @@
#ifndef __QAL_H__
#define __QAL_H__
+#undef ALCAPI
+#define ALCAPI
+#undef ALAPI
+#define ALAPI
qboolean QAL_Init (const char *driver);
void QAL_Shutdown (void);

View File

@ -0,0 +1,28 @@
--- client/snd_openal.h.orig Mon Dec 5 21:03:34 2005
+++ client/snd_openal.h Thu May 18 20:09:05 2006
@@ -3,7 +3,6 @@
#ifdef USE_OPENAL
#include <AL/al.h>
#include <AL/alc.h>
-#include <AL/altypes.h>
#include "client.h"
@@ -14,7 +13,7 @@
#ifdef _WIN32
#include "../win32/alw_win.h"
#endif
-#ifdef __linux__
+#ifdef __unix__
#include "../linux/al_linux.h"
#endif
#endif
@@ -158,7 +157,7 @@
#define ALimp_Shutdown ALW_Shutdown
#else
-#ifdef __linux__
+#ifdef __unix__
#define AL_DRIVER_OPENAL "/usr/lib/libopenal.so"

View File

@ -0,0 +1,11 @@
--- ./game/q_shared.c.orig Wed May 17 22:21:33 2006
+++ ./game/q_shared.c Wed May 17 22:28:01 2006
@@ -421,7 +421,7 @@
Returns 1, 2, or 1 + 2
==================
*/
-#if !id386 || defined __linux__ || defined __FreeBSD__
+#if !id386 || defined __unix__
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p)
{
float dist1, dist2;

View File

@ -0,0 +1,11 @@
--- ./game/q_shared.h.orig Wed May 17 22:21:33 2006
+++ ./game/q_shared.h Wed May 17 22:28:23 2006
@@ -315,7 +315,7 @@
//float Q_fabs (float f);
//#define fabs(f) Q_fabs(f)
//extern int sse2_enabled;
-#if !defined C_ONLY && !defined __linux__ && !defined __sgi && !defined SSE2 && !defined __FreeBSD__
+#if !defined C_ONLY && !defined __unix__ && !defined __sgi && !defined SSE2
//extern void __cdecl Q_sseinit (void);
void __cdecl Q_ftol2( float f, int *out );
int __cdecl Q_ftol( float f );

View File

@ -0,0 +1,11 @@
--- ./linux/al_linux.h.orig Sat Sep 24 16:18:00 2005
+++ ./linux/al_linux.h Wed May 17 22:28:37 2006
@@ -23,7 +23,7 @@
#define __AL_LINUX_H__
-#ifndef __linux__
+#ifndef __unix__
#error "You should not be including this file on this platform"
#endif

View File

@ -0,0 +1,319 @@
--- ./linux/cd_linux.c.orig Wed May 17 22:21:33 2006
+++ ./linux/cd_linux.c Wed May 17 22:42:46 2006
@@ -13,7 +13,12 @@
#include <time.h>
#include <errno.h>
+#ifdef __FreeBSD__
+#include <sys/cdio.h>
+#define CDROM_DATA_TRACK 4
+#else
#include <linux/cdrom.h>
+#endif
#include "../client/client.h"
@@ -43,8 +48,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
}
@@ -53,30 +63,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 = false;
+#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 = true;
+#ifdef __FreeBSD__
+ maxTrack = tochdr.ending_track;
+#else
maxTrack = tochdr.cdth_trk1;
+#endif
return 0;
}
@@ -84,8 +117,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;
@@ -105,6 +144,20 @@
return;
}
+#ifdef __FreeBSD__
+ 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;
@@ -114,6 +167,7 @@
return;
}
if (entry.cdte_ctrl == CDROM_DATA_TRACK)
+#endif
{
Com_Printf("CDAudio: track %i is not audio\n", LOG_CLIENT, track);
return;
@@ -126,19 +180,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;
@@ -153,8 +225,14 @@
int track, i = 0, free_tracks = 0, remap_track;
float f;
byte *track_bools;
+#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;
@@ -167,13 +245,25 @@
// create array of available audio tracknumbers
for (; i < maxTrack; i++) {
+#ifdef __FreeBSD__
+ 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 = remap[i];
+ entry.address_format = CD_LBA_FORMAT;
+ if (ioctl(cdfile, CDIOREADTOCENTRYS, &entry) == -1)
+ track_bools[i] = 0;
+ else
+ track_bools[i] = (toc_buffer.control != CDROM_DATA_TRACK);
+#else
entry.cdte_track = remap[i];
entry.cdte_format = CDROM_LBA;
if (ioctl(cdfile, CDROMREADTOCENTRY, &entry) == -1) {
track_bools[i] = 0;
} else
track_bools[i] = (entry.cdte_ctrl != CDROM_DATA_TRACK);
-
+#endif
free_tracks += track_bools[i];
}
@@ -197,12 +287,23 @@
}
CDAudio_Stop();
}
+#ifdef __FreeBSD__
+ ti.start_track = remap_track;
+ ti.end_track = remap_track;
+ ti.start_index = 0;
+ ti.end_index = 0;
+#else
ti.cdti_trk0 = remap_track;
ti.cdti_trk1 = remap_track;
ti.cdti_ind0 = 0;
ti.cdti_ind1 = 0;
+#endif
+#ifdef __FreeBSD__
+ if (ioctl(cdfile, CDIOCPLAYTRACKS, &ti) == -1) {
+#else
if (ioctl(cdfile, CDROMPLAYTRKIND, &ti) == -1) {
+#endif
track_bools[track] = 0;
free_tracks--;
} else {
@@ -227,8 +328,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 = false;
playing = false;
@@ -242,8 +348,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 = false;
@@ -261,8 +372,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 = true;
}
@@ -391,7 +507,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)
@@ -415,6 +536,24 @@
if (playing && lastchk < time(NULL)) {
lastchk = time(NULL) + 2; //two seconds between chks
+#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 = false;
+ return;
+ }
+ if (subchnl.data->header.audio_status != CD_AS_PLAY_IN_PROGRESS &&
+ subchnl.data->header.audio_status != CD_AS_PLAY_PAUSED) {
+ playing = false;
+ if (playLooping)
+ CDAudio_Play(playTrack, true);
+ }
+#else
subchnl.cdsc_format = CDROM_MSF;
if (ioctl(cdfile, CDROMSUBCHNL, &subchnl) == -1 ) {
Com_DPrintf("ioctl cdromsubchnl failed\n");
@@ -427,6 +566,7 @@
if (playLooping)
CDAudio_Play(playTrack, true);
}
+#endif
}
}

View File

@ -0,0 +1,65 @@
--- linux/q_shlinux.c.orig Sat Feb 19 22:17:58 2005
+++ linux/q_shlinux.c Fri May 19 20:26:48 2006
@@ -12,25 +12,23 @@
#include "../qcommon/qcommon.h"
+#ifndef __linux__
+#include <machine/param.h>
+#endif
+
//===============================================================================
byte *membase;
int maxhunksize;
int curhunksize;
-#ifdef __FreeBSD__
-#define MMAP_ANON MAP_ANON
-#else
-#define MMAP_ANON MAP_ANONYMOUS
-#endif
-
void *Hunk_Begin (int maxsize)
{
// reserve a huge chunk of memory, but don't commit any yet
maxhunksize = maxsize + sizeof(int);
curhunksize = 0;
membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE,
- MAP_PRIVATE|MMAP_ANON, -1, 0);
+ MAP_PRIVATE|MAP_ANON, -1, 0);
if (membase == NULL || membase == (byte *)-1)
Sys_Error("unable to virtual allocate %d bytes", maxsize);
@@ -54,14 +52,29 @@
int Hunk_End (void)
{
-#ifndef __FreeBSD__
byte *n;
+#ifndef __linux__
+ size_t old_size = maxhunksize;
+ size_t new_size = curhunksize + 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)(membase + new_size);
+ unmap_len = old_size - new_size;
+ n = munmap(unmap_base, unmap_len) + membase;
+ }
+#else
n = mremap(membase, maxhunksize, curhunksize + sizeof(int), 0);
+#endif
if (n != membase)
Sys_Error("Hunk_End: Could not remap virtual block (%d)", errno);
*((int *)membase) = curhunksize + sizeof(int);
-#endif
return curhunksize;
}

View File

@ -0,0 +1,12 @@
--- ./linux/snd_linux.c.orig Wed May 17 22:21:33 2006
+++ ./linux/snd_linux.c Wed May 17 22:28:57 2006
@@ -8,8 +8,7 @@
#include <sys/wait.h>
#if defined (__linux__)
#include <linux/soundcard.h>
-#endif
-#if defined (__FreeBSD__)
+#else
#include <sys/soundcard.h>
#endif
#include <stdio.h>

View File

@ -0,0 +1,52 @@
--- linux/sys_linux.c.orig Fri May 19 18:31:30 2006
+++ linux/sys_linux.c Fri May 19 18:32:04 2006
@@ -230,7 +230,7 @@
size = backtrace (array, sizeof(array)/sizeof(void*));
-#ifndef __x86_64__
+#if !defined(__x86_64__) && !defined(__FreeBSD__)
array[1] = (void *) uc->uc_mcontext.gregs[REG_EIP];
#endif
@@ -414,29 +414,17 @@
void *(*GetGameAPI) (void *);
char name[MAX_OSPATH];
- char curpath[MAX_OSPATH];
char *path;
-#ifdef __i386__
- const char *gamename = "gamei386.so";
-#elif defined __alpha__
- const char *gamename = "gameaxp.so";
-#elif defined __x86_64__
- const char *gamename = "gamex86_64.so";
-#else
-#error "Don't know what kind of dynamic objects to use for this architecture."
-#endif
+ const char *gamename = "game.so";
if (game_library)
Com_Error (ERR_FATAL, "Sys_GetGameAPI without Sys_UnloadingGame");
- getcwd(curpath, sizeof(curpath)-1);
- curpath[sizeof(curpath)-1] = 0;
-
Com_Printf("------- Loading %s -------\n", LOG_SERVER|LOG_NOTICE, gamename);
if (baseq2)
{
- Com_sprintf (name, sizeof(name), "%s/%s/%s", curpath, BASEDIRNAME, gamename);
+ Com_sprintf (name, sizeof(name), "%s/%s", BASEDIRNAME, gamename);
game_library = dlopen (name, RTLD_NOW );
}
else
@@ -448,7 +436,7 @@
path = FS_NextPath (path);
if (!path)
return NULL; // couldn't find one anywhere
- Com_sprintf (name, sizeof(name), "%s/%s/%s", curpath, path, gamename);
+ Com_sprintf (name, sizeof(name), "%s/%s", path, gamename);
game_library = dlopen (name, RTLD_NOW );
if (game_library)
{

View File

@ -0,0 +1,29 @@
--- ./linux/vid_so.c.orig Fri May 19 17:48:09 2006
+++ ./linux/vid_so.c Fri May 19 17:49:23 2006
@@ -196,7 +196,6 @@
char fn[MAX_OSPATH];
struct stat st;
- char *path;
if ( reflib_active )
{
@@ -212,17 +211,12 @@
Com_Printf( "------- Loading %s -------\n", LOG_CLIENT, name);
- path = Cvar_Get ("basedir", ".", CVAR_NOSET)->string;
- snprintf (fn, MAX_OSPATH, "%s/%s", path, name );
+ snprintf (fn, MAX_OSPATH, "%s/%s", LIBDIR, name );
if (stat(fn, &st) == -1) {
Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", LOG_CLIENT, name, strerror(errno));
return false;
}
-
- strcpy (fn, ".");
- strcat(fn, "/");
- strcat(fn, name);
if ( ( reflib_library = dlopen( fn, RTLD_NOW ) ) == 0 )
{

View File

@ -0,0 +1,20 @@
--- ./qcommon/common.c.orig Wed May 17 22:21:33 2006
+++ ./qcommon/common.c Wed May 17 22:29:35 2006
@@ -1986,7 +1986,7 @@
#if defined _WIN32
z->allocationLocation = _ReturnAddress ();
-#elif defined LINUX
+#elif defined __unix__
z->allocationLocation = __builtin_return_address (0);
#else
//FIXME: other OSes/CCs
@@ -2046,7 +2046,7 @@
#if defined _WIN32
retAddr = _ReturnAddress ();
-#elif defined LINUX
+#elif defined __unix__
retAddr = __builtin_return_address (0);
#else
//FIXME: other OSes/CCs

View File

@ -0,0 +1,63 @@
--- qcommon/files.c.orig Sat May 20 09:53:45 2006
+++ qcommon/files.c Sat May 20 09:59:37 2006
@@ -1232,11 +1232,6 @@
Q_strncpy (fs_gamedir, dir, sizeof(fs_gamedir)-1);
-#if defined (__unix__)
- // Create directory if it does not exist
- Sys_Mkdir(fs_gamedir);
-#endif
-
Com_DPrintf ("FS_AddGameDirectory: Added '%s'\n", dir);
//
@@ -1391,6 +1386,17 @@
FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
}
+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/.r1q2/%s", homedir, dir);
+ FS_AddGameDirectory(gdir);
+ }
+}
+
/*
================
FS_SetGamedir
@@ -1449,7 +1455,10 @@
{
Com_sprintf (fs_gamedir, sizeof(fs_gamedir), "%s/%s", fs_basedir->string, dir);
Cvar_FullSet ("gamedir", dir, CVAR_SERVERINFO|CVAR_NOSET);
+ FS_AddGameDirectory (va("%s/%s", DATADIR, dir) );
+ FS_AddGameDirectory (va("%s/%s", LIBDIR, dir) );
FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
+ FS_AddHomeAsGameDirectory(dir);
}
}
@@ -1707,7 +1716,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);
// any set gamedirs will be freed up to here
fs_base_searchpaths = fs_searchpaths;
@@ -1716,4 +1728,8 @@
fs_gamedirvar = Cvar_Get ("game", "", CVAR_LATCH|CVAR_SERVERINFO);
if (fs_gamedirvar->string[0])
FS_SetGamedir (fs_gamedirvar->string);
+
+ FS_CreatePath(fs_gamedir);
+ Sys_Mkdir(fs_gamedir);
+ Com_Printf("Using '%s' for writing.\n", LOG_GENERAL, fs_gamedir);
}

View File

@ -0,0 +1,10 @@
--- ./qcommon/qcommon.h.orig Wed Mar 15 17:18:50 2006
+++ ./qcommon/qcommon.h Wed May 17 22:31:34 2006
@@ -88,6 +88,7 @@
#define BUILDSTRING "FreeBSD"
+ #define __cdecl
#ifdef __i386__
#define CPUSTRING "i386"
#elif defined __x86_64__

View File

@ -0,0 +1,11 @@
--- ./ref_gl/gl_local.h.orig Mon Apr 24 14:23:20 2006
+++ ./ref_gl/gl_local.h Wed May 17 22:29:52 2006
@@ -28,7 +28,7 @@
#include <GL/glu.h>
#include <math.h>
-#ifndef __linux__
+#ifndef __unix__
#ifndef GL_COLOR_INDEX8_EXT
#define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX
#endif

View File

@ -0,0 +1,11 @@
--- ./ref_gl/qgl.h.orig Wed May 17 22:21:33 2006
+++ ./ref_gl/qgl.h Wed May 17 22:29:57 2006
@@ -436,7 +436,7 @@
#endif
-#ifdef __linux__
+#ifdef __unix__
// local function in dll
extern void *qwglGetProcAddress(char *symbol);

6
games/r1q2/pkg-descr Normal file
View File

@ -0,0 +1,6 @@
R1Q2 is an enhanced client/server for Quake II. Based on the id Software 3.21
source, rather than concentrate on fancy graphics, embedded MP3 players and
other "gimmick" features, R1Q2 is focused on providing stability, security and
speed whilst remaining fully compatible with existing mods and other clients.
WWW: http://www.r1ch.net/stuff/r1q2/

10
games/r1q2/pkg-plist Normal file
View File

@ -0,0 +1,10 @@
bin/r1q2
%%SDL%%bin/r1q2-sdl
%%LIBDIR%%/baseq2/game.so
%%LIBDIR%%/ref_r1gl.so
%%SDLGL%%%%LIBDIR%%/ref_r1sdl.so
%%PORTDOCS%%%%DOCSDIR%%/r1q2.txt
%%PORTDOCS%%%%DOCSDIR%%/readme.txt
%%PORTDOCS%%@dirrm %%DOCSDIR%%
@dirrm %%LIBDIR%%/baseq2
@dirrm %%LIBDIR%%