quake2: well known first person shooter

Requires the original version of Quake2 data files in order to function.
With SDL graphics it is fast enough on my X40 to kill some boring hours.

With help and OK jasper@
This commit is contained in:
claudio 2007-03-16 18:26:01 +00:00
parent e64a9942cb
commit 462c12e2ae
9 changed files with 278 additions and 0 deletions

41
games/quake2/Makefile Normal file
View File

@ -0,0 +1,41 @@
# $OpenBSD: Makefile,v 1.1.1.1 2007/03/16 18:26:01 claudio Exp $
ONLY_FOR_ARCHS= i386
COMMENT= "first person shooter"
DISTNAME= quake2-0.3
CATEGORIES= games
HOMEPAGE= http://www.quakeforge.net/
MAINTAINER= Claudio Jeker <claudio@openbsd.org>
# GPL
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
WANTLIB= ICE SM X11 Xext Xxf86dga Xxf86vm c m ossaudio pthread \
usbhid
MASTER_SITES= http://www.quakeforge.net/files/quake2forge/
EXTRACT_SUFX= .tar.gz
LIB_DEPENDS= SDL::devel/sdl
SEPARATE_BUILD= concurrent
USE_X11= Yes
CONFIGURE_STYLE= gnu
NO_REGRESS= Yes
CFLAGS+= -pthread -g
PLUGINS= ref_softsdl.so ref_softx.so snd_oss.so snd_sdl.so \
snd_solaris.so baseq2/game.so ctf/game.so
post-install:
(cd ${PREFIX}/lib/quake2; for i in ${PLUGINS}; do \
mv $${i}.0.0 $${i}; \
done)
.include <bsd.port.mk>

4
games/quake2/distinfo Normal file
View File

@ -0,0 +1,4 @@
MD5 (quake2-0.3.tar.gz) = 2c167ff7edce20f0240316b98a1e4515
RMD160 (quake2-0.3.tar.gz) = 81b6abdf83782d1bd227df9e4511aa25c673b5bb
SHA1 (quake2-0.3.tar.gz) = 9daf646b02799de01aa77824f648ef6c5f66b3ec
SIZE (quake2-0.3.tar.gz) = 1757285

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_q_sh_c,v 1.1.1.1 2007/03/16 18:26:01 claudio Exp $
--- src/q_sh.c.orig Sat Jan 21 23:29:07 2006
+++ src/q_sh.c Sat Jan 21 23:29:17 2006
@@ -54,7 +54,7 @@ void *Hunk_Begin (int maxsize)
/* FIXME: clean all this up into configure tests for mmap, MAP_ANONYMOUS and malloc */
#if defined(__linux__)
membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-#elif defined(__FreeBSD__) || defined(__bsd__) || defined(__NetBSD__)
+#elif defined(__FreeBSD__) || defined(__bsd__) || defined(__NetBSD__) || defined(__OpenBSD__)
membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);
#elif defined(__sun__) || defined(__sgi)
membase = malloc(maxhunksize);

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_snd_oss_c,v 1.1.1.1 2007/03/16 18:26:01 claudio Exp $
--- src/snd_oss.c.orig Sun Jan 22 00:12:42 2006
+++ src/snd_oss.c Sun Jan 22 00:14:14 2006
@@ -358,7 +358,7 @@ qboolean SNDDMA_Init(struct sndinfo * s)
if (!si->dma->buffer) {
si->dma->buffer = (unsigned char *) mmap(NULL, info.fragstotal * info.fragsize,
-#if defined(__FreeBSD__) && (__FreeBSD_version < 500000)
+#if defined(__FreeBSD__) && (__FreeBSD_version < 500000) || defined (__OpenBSD__)
PROT_READ|PROT_WRITE,
#else
PROT_WRITE,

View File

@ -0,0 +1,173 @@
$OpenBSD: patch-src_snd_solaris_c,v 1.1.1.1 2007/03/16 18:26:01 claudio Exp $
--- src/snd_solaris.c.orig Mon Mar 15 13:50:17 2004
+++ src/snd_solaris.c Sun Jan 22 00:04:45 2006
@@ -27,12 +27,12 @@ Foundation, Inc., 59 Temple Place - Suit
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
-#include <stropts.h>
#include <sys/types.h>
+# include <sys/ioctl.h>
#include <sys/audioio.h>
-#include "../client/client.h"
-#include "../client/snd_loc.h"
+#include "client.h"
+#include "snd_loc.h"
#define SND_DEBUG 0
@@ -77,7 +77,7 @@ qboolean SNDDMA_Init(struct sndinfo * s)
if (audio_fd < 0) {
- audio_fd = open(si->device->string, O_WRONLY);
+ audio_fd = open(si->device->string, O_RDWR);
if (audio_fd < 0) {
Com_Printf("Could not open %s: %s\n", si->device->string, strerror(errno));
@@ -96,7 +96,7 @@ qboolean SNDDMA_Init(struct sndinfo * s)
? AUDIO_ENCODING_LINEAR8
: AUDIO_ENCODING_LINEAR );
au_info.play.sample_rate = (int)si->speed->value;
- au_info.play.channels = (int)sndchannels->value;
+ au_info.play.channels = (int)si->channels->value;
if (ioctl(audio_fd, AUDIO_SETINFO, &au_info) == -1) {
Com_Printf("AUDIO_SETINFO failed: %s\n", strerror(errno));
@@ -112,7 +112,7 @@ qboolean SNDDMA_Init(struct sndinfo * s)
? AUDIO_ENCODING_LINEAR8
: AUDIO_ENCODING_LINEAR );
au_info.play.sample_rate = tryrates[i];
- au_info.play.channels = (int)sndchannels->value;
+ au_info.play.channels = (int)si->channels->value;
if (ioctl(audio_fd, AUDIO_SETINFO, &au_info) == 0)
break;
@@ -122,25 +122,25 @@ qboolean SNDDMA_Init(struct sndinfo * s)
if (i >= sizeof(tryrates)/sizeof(tryrates[0]))
return 0;
}
- dma.samplebits = au_info.play.precision;
- dma.channels = au_info.play.channels;
- dma.speed = au_info.play.sample_rate;
+ si->dma->samplebits = au_info.play.precision;
+ si->dma->channels = au_info.play.channels;
+ si->dma->speed = au_info.play.sample_rate;
/*
* submit some sound data every ~ 0.1 seconds, and try to buffer 2*0.1
* seconds in sound driver
*/
- samples = dma.channels * dma.speed / 10;
+ samples = si->dma->channels * si->dma->speed / 10;
for (i = 0; (1 << i) < samples; i++)
;
- dma.submission_chunk = 1 << (i-1);
+ si->dma->submission_chunk = 1 << (i-1);
DPRINTF("channels %d, speed %d, log2(samples) %d, submission chunk %d\n",
- dma.channels, dma.speed, i-1,
- dma.submission_chunk);
+ si->dma->channels, si->dma->speed, i-1,
+ si->dma->submission_chunk);
- dma.samples = QSND_NUM_CHUNKS * dma.submission_chunk;
- dma.buffer = calloc(dma.samples, dma.samplebits/8);
- if (dma.buffer == NULL) {
+ si->dma->samples = QSND_NUM_CHUNKS * si->dma->submission_chunk;
+ si->dma->buffer = calloc(si->dma->samples, si->dma->samplebits/8);
+ if (si->dma->buffer == NULL) {
Com_Printf("Could not alloc sound buffer\n");
return 0;
}
@@ -150,7 +150,7 @@ qboolean SNDDMA_Init(struct sndinfo * s)
au_info.play.samples = 0;
ioctl(audio_fd, AUDIO_SETINFO, &au_info);
- dma.samplepos = 0;
+ si->dma->samplepos = 0;
snd_inited = 1;
@@ -179,8 +179,8 @@ int SNDDMA_GetDMAPos(void)
return 0;
}
- s_pos = au_info.play.samples * dma.channels;
- return s_pos & (dma.samples - 1);
+ s_pos = au_info.play.samples * si->dma->channels;
+ return s_pos & (si->dma->samples - 1);
}
/*
@@ -194,7 +194,6 @@ void SNDDMA_Shutdown(void)
{
if (snd_inited) {
if (audio_fd >= 0) {
- ioctl(audio_fd, I_FLUSH, FLUSHW);
close(audio_fd);
audio_fd = -1;
}
@@ -211,7 +210,7 @@ Send sound to device if buffer isn't rea
*/
void SNDDMA_Submit(void)
{
- int samplebytes = dma.samplebits/8;
+ int samplebytes = si->dma->samplebits/8;
audio_info_t au_info;
int s_pos;
int chunk_idx;
@@ -221,10 +220,10 @@ void SNDDMA_Submit(void)
return;
if (last_chunk_idx == -1) {
- if (write(audio_fd, dma.buffer, dma.samples * samplebytes) != dma.samples * samplebytes)
+ if (write(audio_fd, si->dma->buffer, si->dma->samples * samplebytes) != si->dma->samples * samplebytes)
Com_Printf("initial write on audio device failed\n");
last_chunk_idx = 0;
- dma.samplepos = 0;
+ si->dma->samplepos = 0;
return;
}
@@ -247,30 +246,30 @@ void SNDDMA_Submit(void)
au_info.play.samples = 0;
ioctl(audio_fd, AUDIO_SETINFO, &au_info);
- if (write(audio_fd, dma.buffer, dma.samples * samplebytes) != dma.samples * samplebytes)
+ if (write(audio_fd, si->dma->buffer, si->dma->samples * samplebytes) != si->dma->samples * samplebytes)
Com_Printf("refill sound driver after underflow failed\n");
last_chunk_idx = 0;
- dma.samplepos = 0;
+ si->dma->samplepos = 0;
return;
}
- s_pos = au_info.play.samples * dma.channels;
- chunk_idx = (s_pos % dma.samples) / dma.submission_chunk;
+ s_pos = au_info.play.samples * si->dma->channels;
+ chunk_idx = (s_pos % si->dma->samples) / si->dma->submission_chunk;
- DPRINTF("HW DMA Pos=%u (%u), dma.samplepos=%u, play in=%d, last=%d\n",
- au_info.play.samples, s_pos, dma.samplepos,
+ DPRINTF("HW DMA Pos=%u (%u), si->dma->samplepos=%u, play in=%d, last=%d\n",
+ au_info.play.samples, s_pos, si->dma->samplepos,
chunk_idx, last_chunk_idx);
while (chunk_idx != last_chunk_idx) {
if (write(audio_fd,
- dma.buffer + dma.samplepos * samplebytes,
- dma.submission_chunk * samplebytes) != dma.submission_chunk * samplebytes) {
+ si->dma->buffer + si->dma->samplepos * samplebytes,
+ si->dma->submission_chunk * samplebytes) != si->dma->submission_chunk * samplebytes) {
Com_Printf("write error on audio device\n");
}
- if ((dma.samplepos += dma.submission_chunk) >= dma.samples)
- dma.samplepos = 0;
+ if ((si->dma->samplepos += si->dma->submission_chunk) >= si->dma->samples)
+ si->dma->samplepos = 0;
if (++last_chunk_idx >= QSND_NUM_CHUNKS)
last_chunk_idx = 0;

2
games/quake2/pkg/DESCR Normal file
View File

@ -0,0 +1,2 @@
Quake2 is a 3D action game, which can be played both single-user as
multi-user.

3
games/quake2/pkg/MESSAGE Normal file
View File

@ -0,0 +1,3 @@
Quake2 requires the original version of Quake2 data files in order
to function. Data files and music files should be placed in
${PREFIX}/share/quake2/base2q/

View File

@ -0,0 +1,8 @@
@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2007/03/16 18:26:01 claudio Exp $
lib/quake2/baseq2/game.so
lib/quake2/ctf/game.so
lib/quake2/ref_softsdl.so
lib/quake2/ref_softx.so
lib/quake2/snd_oss.so
lib/quake2/snd_sdl.so
lib/quake2/snd_solaris.so

23
games/quake2/pkg/PLIST Normal file
View File

@ -0,0 +1,23 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2007/03/16 18:26:01 claudio Exp $
%%SHARED%%
bin/quake2
lib/quake2/
lib/quake2/baseq2/
lib/quake2/baseq2/game.a
lib/quake2/baseq2/game.la
lib/quake2/ctf/
lib/quake2/ctf/game.a
lib/quake2/ctf/game.la
lib/quake2/ref_softsdl.a
lib/quake2/ref_softsdl.la
lib/quake2/ref_softx.a
lib/quake2/ref_softx.la
lib/quake2/snd_oss.a
lib/quake2/snd_oss.la
lib/quake2/snd_sdl.a
lib/quake2/snd_sdl.la
lib/quake2/snd_solaris.a
lib/quake2/snd_solaris.la
share/quake2/
share/quake2/baseq2/
share/quake2/baseq2/config.cfg