aboutsummaryrefslogtreecommitdiffstats
path: root/games
diff options
context:
space:
mode:
authormiwi <miwi@FreeBSD.org>2006-09-11 16:36:08 +0800
committermiwi <miwi@FreeBSD.org>2006-09-11 16:36:08 +0800
commit7cf6b039b88f3a360244c52570901530b82ee6fa (patch)
tree40734aa7cb8fd71ddf48ccec98690f65714819a1 /games
parent263afacc9ad6c7f8d63145482fc9f3544092d447 (diff)
downloadfreebsd-ports-gnome-7cf6b039b88f3a360244c52570901530b82ee6fa.tar.gz
freebsd-ports-gnome-7cf6b039b88f3a360244c52570901530b82ee6fa.tar.zst
freebsd-ports-gnome-7cf6b039b88f3a360244c52570901530b82ee6fa.zip
Sturmbahnfahrer... for expert drivers only. If you want to master
it, try to have the laws of physics work with you, not against you. Sturmbahnfahrer is a game by Bram Stolk. WWW: http://www.sturmbahnfahrer.com/ PR: ports/102931 Submitted by: Dmitry Marakasov <amdmi3(at)mail.ru>
Diffstat (limited to 'games')
-rw-r--r--games/Makefile1
-rw-r--r--games/stormbaancoureur/Makefile45
-rw-r--r--games/stormbaancoureur/distinfo3
-rw-r--r--games/stormbaancoureur/files/patch-Makefile105
-rw-r--r--games/stormbaancoureur/files/patch-controllerpad.cxx193
-rw-r--r--games/stormbaancoureur/files/patch-main.cxx16
-rw-r--r--games/stormbaancoureur/files/patch-soundenginealsa.cxx147
-rw-r--r--games/stormbaancoureur/files/patch-soundenginealsa.h19
-rw-r--r--games/stormbaancoureur/pkg-descr6
-rw-r--r--games/stormbaancoureur/pkg-plist34
-rw-r--r--games/sturmbahnfahrer/Makefile45
-rw-r--r--games/sturmbahnfahrer/distinfo3
-rw-r--r--games/sturmbahnfahrer/files/patch-Makefile105
-rw-r--r--games/sturmbahnfahrer/files/patch-controllerpad.cxx193
-rw-r--r--games/sturmbahnfahrer/files/patch-main.cxx16
-rw-r--r--games/sturmbahnfahrer/files/patch-soundenginealsa.cxx147
-rw-r--r--games/sturmbahnfahrer/files/patch-soundenginealsa.h19
-rw-r--r--games/sturmbahnfahrer/pkg-descr6
-rw-r--r--games/sturmbahnfahrer/pkg-plist34
19 files changed, 1137 insertions, 0 deletions
diff --git a/games/Makefile b/games/Makefile
index 2285cf5392ec..7b330fe3c675 100644
--- a/games/Makefile
+++ b/games/Makefile
@@ -648,6 +648,7 @@
SUBDIR += starlanes
SUBDIR += stratagus
SUBDIR += stroq
+ SUBDIR += sturmbahnfahrer
SUBDIR += stvef-paks
SUBDIR += stvef-server
SUBDIR += sudoku
diff --git a/games/stormbaancoureur/Makefile b/games/stormbaancoureur/Makefile
new file mode 100644
index 000000000000..35f464dd779d
--- /dev/null
+++ b/games/stormbaancoureur/Makefile
@@ -0,0 +1,45 @@
+# New ports collection makefile for: sturmbahnfahrer
+# Date created: 07 Sep 2006
+# Whom: Dmitry Marakasov <amdmi3@mail.ru>
+#
+# $FreeBSD$
+#
+
+PORTNAME= sturmbahnfahrer
+PORTVERSION= 1.3
+CATEGORIES= games
+MASTER_SITES= http://www.stolk.org/sturmbahnfahrer/download/
+
+MAINTAINER= amdmi3@mail.ru
+COMMENT= Simulated obstacle course for automobiles
+
+LIB_DEPENDS= glut.4:${PORTSDIR}/graphics/libglut
+BUILD_DEPENDS= ${X11BASE}/lib/libplibsl.a:${PORTSDIR}/x11-toolkits/plib \
+ ${X11BASE}/lib/libode.a:${PORTSDIR}/devel/ode
+
+USE_GL= yes
+USE_GCC= 3.4+
+
+MAKE_ENV= DATADIR="${DATADIR}"
+
+PORTDOCS= README
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 500000
+BROKEN= does not compile on FreeBSD 4.x
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} -e 's|/usr/share/games/sturmbahnfahrer|${DATADIR}|' \
+ ${WRKSRC}/main.cxx
+
+.if !defined(NOPORTDOCS)
+post-install:
+ ${MKDIR} ${DOCSDIR}
+.for f in ${PORTDOCS}
+ ${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
+.endfor
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/games/stormbaancoureur/distinfo b/games/stormbaancoureur/distinfo
new file mode 100644
index 000000000000..5220c7011506
--- /dev/null
+++ b/games/stormbaancoureur/distinfo
@@ -0,0 +1,3 @@
+MD5 (sturmbahnfahrer-1.3.tar.gz) = fae14d9e3a503928b4423825a7268cfa
+SHA256 (sturmbahnfahrer-1.3.tar.gz) = 69ffdb02121657983393874480f2106775bd7713cc817f2cee6f4435af9255c6
+SIZE (sturmbahnfahrer-1.3.tar.gz) = 3100944
diff --git a/games/stormbaancoureur/files/patch-Makefile b/games/stormbaancoureur/files/patch-Makefile
new file mode 100644
index 000000000000..c4feba5a3a64
--- /dev/null
+++ b/games/stormbaancoureur/files/patch-Makefile
@@ -0,0 +1,105 @@
+--- Makefile.orig Wed Sep 6 05:32:09 2006
++++ Makefile Wed Sep 6 05:32:14 2006
+@@ -1,17 +1,17 @@
+ # EDIT THESE SETTINGS
+
+-PLIBPREFIX=/usr
+-ODEPREFIX=/usr
+-CXX=g++
++PLIBPREFIX=$(X11BASE)
++ODEPREFIX=$(X11BASE)
++CXX?=g++
+
+ # END OF CUSTOM SETTINGS
+
+-CXXFLAGS=-I$(ODEPREFIX)/include -I$(PLIBPREFIX)/include -O2 -g -Wall
+-LFLAGS=-L$(PLIBPREFIX)/lib -L/usr/X11R6/lib
++CXXFLAGS+=-I$(ODEPREFIX)/include -I$(PLIBPREFIX)/include -g -Wall
++LFLAGS+=-L$(PLIBPREFIX)/lib
+
+ OBJS=staticworldobject.o carobject.o controllerpad.o controllerkey.o main.o dynamicobject.o texture.o tga.o intro.o soundenginealsa.o vectortext.o postscore.o cartobject.o
+
+-LIBS= $(ODEPREFIX)/lib/libode.a -lplibssgaux -lplibssg -lplibsg -lplibpu -lplibfnt -lplibul -lglut -lGLU -lGL -lasound
++LIBS= $(ODEPREFIX)/lib/libode.a -lplibssgaux -lplibssg -lplibsg -lplibpu -lplibfnt -lplibul -lglut -lGLU -lGL
+
+
+ all: sturmbahnfahrer
+@@ -65,47 +65,46 @@
+ clean:
+ rm -f *.o sturmbahnfahrer
+
+-GAMEDIR=$(DESTDIR)/usr/share/games/sturmbahnfahrer
++GAMEDIR=$(DATADIR)
+ install: sturmbahnfahrer
+ # Directories
+- mkdir -p $(DESTDIR)/usr/games/
+ mkdir -p $(GAMEDIR)/images/
+ mkdir -p $(GAMEDIR)/sounds/
+ mkdir -p $(GAMEDIR)/models/
+ # Binary
+- install sturmbahnfahrer $(DESTDIR)/usr/games/sturmbahnfahrer
++ ${BSD_INSTALL_PROGRAM} sturmbahnfahrer $(PREFIX)/bin/
+ # Images
+- install -m 644 images/engine.tga $(GAMEDIR)/images/engine.tga
+- install -m 644 images/info_carpet_smooth.rgb $(GAMEDIR)/images/info_carpet_smooth.rgb
+- install -m 644 images/info_door_smooth.rgb $(GAMEDIR)/images/info_door_smooth.rgb
+- install -m 644 images/info_jump_smooth.rgb $(GAMEDIR)/images/info_jump_smooth.rgb
++ ${BSD_INSTALL_DATA} images/engine.tga $(GAMEDIR)/images/engine.tga
++ ${BSD_INSTALL_DATA} images/info_carpet_smooth.rgb $(GAMEDIR)/images/info_carpet_smooth.rgb
++ ${BSD_INSTALL_DATA} images/info_door_smooth.rgb $(GAMEDIR)/images/info_door_smooth.rgb
++ ${BSD_INSTALL_DATA} images/info_jump_smooth.rgb $(GAMEDIR)/images/info_jump_smooth.rgb
+ # Sounds
+- install -m 644 sounds/rpm_graph.txt $(GAMEDIR)/sounds/rpm_graph.txt
+- install -m 644 sounds/camaro_s16_le.wav $(GAMEDIR)/sounds/camaro_s16_le.wav
+- install -m 644 sounds/detonationnorm_s16_le.wav $(GAMEDIR)/sounds/detonationnorm_s16_le.wav
++ ${BSD_INSTALL_DATA} sounds/rpm_graph.txt $(GAMEDIR)/sounds/rpm_graph.txt
++ ${BSD_INSTALL_DATA} sounds/camaro_s16_le.wav $(GAMEDIR)/sounds/camaro_s16_le.wav
++ ${BSD_INSTALL_DATA} sounds/detonationnorm_s16_le.wav $(GAMEDIR)/sounds/detonationnorm_s16_le.wav
+ # Models
+- install -m 644 models/baseplate.3ds $(GAMEDIR)/models/baseplate.3ds
+- install -m 644 models/car.3ds $(GAMEDIR)/models/car.3ds
+- install -m 644 models/carpet.3ds $(GAMEDIR)/models/carpet.3ds
+- install -m 644 models/crate.3ds $(GAMEDIR)/models/crate.3ds
+- install -m 644 models/cratejump.3ds $(GAMEDIR)/models/cratejump.3ds
+- install -m 644 models/crate_low.3ds $(GAMEDIR)/models/crate_low.3ds
+- install -m 644 models/door.3ds $(GAMEDIR)/models/door.3ds
+- install -m 644 models/doorstand.3ds $(GAMEDIR)/models/doorstand.3ds
+- install -m 644 models/ferriswheelcart.3ds $(GAMEDIR)/models/ferriswheelcart.3ds
+- install -m 644 models/ferriswheelstand.3ds $(GAMEDIR)/models/ferriswheelstand.3ds
+- install -m 644 models/ferriswheelwheel.3ds $(GAMEDIR)/models/ferriswheelwheel.3ds
+- install -m 644 models/finishdoor.3ds $(GAMEDIR)/models/finishdoor.3ds
+- install -m 644 models/finishplank.3ds $(GAMEDIR)/models/finishplank.3ds
+- install -m 644 models/grid.3ds $(GAMEDIR)/models/grid.3ds
+- install -m 644 models/jumpboard.3ds $(GAMEDIR)/models/jumpboard.3ds
+- install -m 644 models/licplate.ac $(GAMEDIR)/models/licplate.ac
+- install -m 644 models/licplate.bmp $(GAMEDIR)/models/licplate.bmp
+- install -m 644 models/ramp.3ds $(GAMEDIR)/models/ramp.3ds
+- install -m 644 models/spikegate.3ds $(GAMEDIR)/models/spikegate.3ds
+- install -m 644 models/track.3ds $(GAMEDIR)/models/track.3ds
+- install -m 644 models/truck.3ds $(GAMEDIR)/models/truck.3ds
+- install -m 644 models/wheel.3ds $(GAMEDIR)/models/wheel.3ds
++ ${BSD_INSTALL_DATA} models/baseplate.3ds $(GAMEDIR)/models/baseplate.3ds
++ ${BSD_INSTALL_DATA} models/car.3ds $(GAMEDIR)/models/car.3ds
++ ${BSD_INSTALL_DATA} models/carpet.3ds $(GAMEDIR)/models/carpet.3ds
++ ${BSD_INSTALL_DATA} models/crate.3ds $(GAMEDIR)/models/crate.3ds
++ ${BSD_INSTALL_DATA} models/cratejump.3ds $(GAMEDIR)/models/cratejump.3ds
++ ${BSD_INSTALL_DATA} models/crate_low.3ds $(GAMEDIR)/models/crate_low.3ds
++ ${BSD_INSTALL_DATA} models/door.3ds $(GAMEDIR)/models/door.3ds
++ ${BSD_INSTALL_DATA} models/doorstand.3ds $(GAMEDIR)/models/doorstand.3ds
++ ${BSD_INSTALL_DATA} models/ferriswheelcart.3ds $(GAMEDIR)/models/ferriswheelcart.3ds
++ ${BSD_INSTALL_DATA} models/ferriswheelstand.3ds $(GAMEDIR)/models/ferriswheelstand.3ds
++ ${BSD_INSTALL_DATA} models/ferriswheelwheel.3ds $(GAMEDIR)/models/ferriswheelwheel.3ds
++ ${BSD_INSTALL_DATA} models/finishdoor.3ds $(GAMEDIR)/models/finishdoor.3ds
++ ${BSD_INSTALL_DATA} models/finishplank.3ds $(GAMEDIR)/models/finishplank.3ds
++ ${BSD_INSTALL_DATA} models/grid.3ds $(GAMEDIR)/models/grid.3ds
++ ${BSD_INSTALL_DATA} models/jumpboard.3ds $(GAMEDIR)/models/jumpboard.3ds
++ ${BSD_INSTALL_DATA} models/licplate.ac $(GAMEDIR)/models/licplate.ac
++ ${BSD_INSTALL_DATA} models/licplate.bmp $(GAMEDIR)/models/licplate.bmp
++ ${BSD_INSTALL_DATA} models/ramp.3ds $(GAMEDIR)/models/ramp.3ds
++ ${BSD_INSTALL_DATA} models/spikegate.3ds $(GAMEDIR)/models/spikegate.3ds
++ ${BSD_INSTALL_DATA} models/track.3ds $(GAMEDIR)/models/track.3ds
++ ${BSD_INSTALL_DATA} models/truck.3ds $(GAMEDIR)/models/truck.3ds
++ ${BSD_INSTALL_DATA} models/wheel.3ds $(GAMEDIR)/models/wheel.3ds
+
+
+ deb:
diff --git a/games/stormbaancoureur/files/patch-controllerpad.cxx b/games/stormbaancoureur/files/patch-controllerpad.cxx
new file mode 100644
index 000000000000..07c8069a2233
--- /dev/null
+++ b/games/stormbaancoureur/files/patch-controllerpad.cxx
@@ -0,0 +1,193 @@
+--- controllerpad.cxx.orig Mon Jul 17 00:26:08 2006
++++ controllerpad.cxx Mon Jul 17 00:28:23 2006
+@@ -14,7 +14,6 @@
+ #include <windows.h>
+ #include <mmsystem.h>
+ #else
+-#include <linux/joystick.h>
+ #include <sys/ioctl.h> // for ioctl()
+ #include <unistd.h> // for close()
+ #include <stdio.h> // for perror()
+@@ -81,100 +80,7 @@
+ accel_axis(-1),
+ accel_button(-1)
+ {
+-#ifdef WIN32
+- JOYINFOEX joyinfo;
+- JOYCAPS joycaps;
+- MMRESULT result;
+- int axisCounter;
+-
+- id = 0;
+-
+- joyinfo.dwSize = sizeof(joyinfo);
+- joyinfo.dwFlags = JOY_RETURNALL;
+-
+- result = joyGetPosEx(id, &joyinfo);
+- if(result != JOYERR_NOERROR) {
+- fprintf(stderr, "No input devices found\n");
+- return;
+- }
+- else {
+- result = joyGetDevCaps(id, &joycaps, sizeof(joycaps));
+- if(result != JOYERR_NOERROR) {
+- fprintf(stderr, "No input devices found\n");
+- return;
+- }
+- }
+-
+- opened = true;
+-
+- fprintf(stderr, "x min %d max %d\n", joycaps.wXmin, joycaps.wXmax);
+- buttoncount = joycaps.wNumButtons;
+- axiscount = joycaps.wNumAxes;
+-#else
+- fd = open(devfile.c_str(), O_RDONLY | O_NONBLOCK);
+- if (fd==-1)
+- {
+- if (errno != ENODEV)
+- perror("open() on joystick device failed");
+- return;
+- }
+- opened = true;
+-
+- int retval;
+-
+- int version;
+- retval = ioctl(fd, JSIOCGVERSION, &version);
+- if (retval == -1)
+- perror("ioctl JSIOCGVERSION failed");
+-
+- unsigned char lo = version;
+- unsigned char md = (version>>8);
+- unsigned char hi = (version>>16);
+-
+- retval = ioctl(fd, JSIOCGAXES, &axiscount);
+- if (retval == -1)
+- perror("ioctl JSIOCGAXES failed");
+-
+- retval = ioctl(fd, JSIOCGBUTTONS, &buttoncount);
+- if (retval == -1)
+- perror("ioctl JSIOCGBUTTONS failed");
+-
+- char n[128];
+- retval = ioctl(fd, JSIOCGNAME(128), n);
+- if (retval == -1)
+- perror("ioctl JSIOCGNAME failed");
+-
+- name = n;
+- fprintf(stderr,"joystick name: %s\n", name.c_str());
+- fprintf(stderr,"driver version: %d.%d.%d\n", hi,md,lo);
+- fprintf(stderr,"button count: %d, axiscount: %d\n", buttoncount, axiscount);
+-#endif
+-
+- // search db
+- assert(sizeof(joydb_names) == sizeof(joydb_descs));
+- int cnt = sizeof(joydb_names) / sizeof(void *) - 1;
+- for (int i=0; i<cnt && !joydb_entry; i++)
+- {
+- if (!strcmp(joydb_names[i], name.c_str()))
+- joydb_entry = joydb_descs[i];
+- }
+-
+- fprintf
+- (
+- stderr,
+- "Known in joystick description database: %s\n",
+- (joydb_entry)?"yes":"no"
+- );
+-
+- for (int i=0; i<axiscount; i++)
+- AxisValues.push_back(0);
+- for (int i=0; i<buttoncount; i++)
+- {
+- ButtonValues.push_back(false);
+- ButtonChanged.push_back(false);
+- }
+-
+- Introspect();
++ return;
+ }
+
+
+@@ -194,80 +100,6 @@
+
+ void ControllerPad::Sustain(float dt)
+ {
+-#ifdef WIN32
+- MMRESULT result;
+- DWORD flags[6 /*MAX_AXES*/] = { JOY_RETURNX, JOY_RETURNY, JOY_RETURNZ,
+- JOY_RETURNR, JOY_RETURNU, JOY_RETURNV };
+- DWORD pos[6 /*MAX_AXES*/];
+- JOYINFOEX joyinfo;
+-
+- joyinfo.dwSize = sizeof(joyinfo);
+- joyinfo.dwFlags = JOY_RETURNALL | JOY_RETURNPOVCTS;
+-
+-#if 0
+- if(!hats) {
+- joyinfo.dwFlags &= ~(JOY_RETURNPOV | JOY_RETURNPOVCTS);
+- }
+-#endif
+-
+- // get the actual data
+- result = joyGetPosEx(id, &joyinfo);
+-
+- if(result != JOYERR_NOERROR) {
+- SetMMerror("joyGetPosEx", result);
+- return;
+- }
+-
+- /* joystick motion events */
+- pos[0] = joyinfo.dwXpos;
+- pos[1] = joyinfo.dwYpos;
+- pos[2] = joyinfo.dwZpos;
+- pos[3] = joyinfo.dwRpos;
+- pos[4] = joyinfo.dwUpos;
+- pos[5] = joyinfo.dwVpos;
+-
+- for(int axisCounter = 0; axisCounter < axiscount; axisCounter++) {
+- if(joyinfo.dwFlags & flags[axisCounter]) {
+- AxisValues[axisCounter] = float(pos[axisCounter]);
+- }
+- }
+-#else
+- struct js_event ev;
+- int retval;
+- do
+- {
+- retval = read(fd, &ev, sizeof(ev));
+- if (retval == -1)
+- {
+- if (errno != EAGAIN)
+- {
+- perror("read() on joystick failed");
+- fprintf(stderr,"joystick read failure\n");
+- }
+- }
+- int type = ev.type;
+- switch(type)
+- {
+- case JS_EVENT_BUTTON:
+- if (ev.number < ButtonValues.size())
+- {
+- ButtonValues[ev.number] = ev.value;
+- ButtonChanged[ev.number] = true;
+- }
+- else
+- fprintf(stderr,"Illegal buttonnr %d\n", ev.number);
+- break;
+- case JS_EVENT_AXIS:
+- if (ev.number < AxisValues.size())
+- AxisValues[ev.number] = ev.value;
+- else
+- fprintf(stderr,"Illegal axisnr %d", ev.number);
+- break;
+- default:
+- break;
+- }
+- } while (retval>0);
+-#endif
+ }
+
+
diff --git a/games/stormbaancoureur/files/patch-main.cxx b/games/stormbaancoureur/files/patch-main.cxx
new file mode 100644
index 000000000000..04d93b7664db
--- /dev/null
+++ b/games/stormbaancoureur/files/patch-main.cxx
@@ -0,0 +1,16 @@
+--- main.cxx.orig Mon Sep 4 20:04:09 2006
++++ main.cxx Wed Sep 6 05:03:34 2006
+@@ -655,13 +655,7 @@
+ fprintf(stderr,"plib is (c) by Steve Baker\n");
+ fprintf(stderr,"OpenDE is (c) by Russel L. Smith\n");
+
+- char *bindirname = dirname(argv[0]);
+- if (!strcmp(bindirname,"."))
+ dirprefix="/usr/share/games/sturmbahnfahrer";
+- else
+- {
+- dirprefix = dirname(bindirname) + std::string("/share/games/sturmbahnfahrer");
+- }
+ if (getenv("PLODE_DATADIR"))
+ dirprefix = getenv("PLODE_DATADIR");
+ if (getenv("PLODE_DISPLAYMODE"))
diff --git a/games/stormbaancoureur/files/patch-soundenginealsa.cxx b/games/stormbaancoureur/files/patch-soundenginealsa.cxx
new file mode 100644
index 000000000000..e0891046e7ef
--- /dev/null
+++ b/games/stormbaancoureur/files/patch-soundenginealsa.cxx
@@ -0,0 +1,147 @@
+--- soundenginealsa.cxx.orig Mon Sep 4 19:47:37 2006
++++ soundenginealsa.cxx Wed Sep 6 04:43:37 2006
+@@ -38,85 +38,20 @@
+ complexfeed(0),
+ enginefeed(0),
+ activefeed(0),
+- handle(0),
+- periodsz(0),
+ batchsize(0),
+ framelag(lag),
+ lpfilter(0.0)
+ {
+- /* Open PCM device for playback. */
+- int rc = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, 0);
+- if (rc < 0)
+- {
+- fprintf(stderr, "unable to open pcm device: %s\n", snd_strerror(rc));
+- return;
+- }
+- snd_pcm_hw_params_t *params=0;
+-
+- /* Allocate a hardware parameters object. */
+- snd_pcm_hw_params_alloca(&params);
+- /* Fill it in with default values. */
+- snd_pcm_hw_params_any(handle, params);
+- /* Set the desired hardware parameters. */
+- /* Interleaved mode */
+- snd_pcm_hw_params_set_access(handle, params, SND_PCM_ACCESS_RW_INTERLEAVED);
+- /* Signed 16-bit little-endian format */
+- snd_pcm_hw_params_set_format(handle, params, SND_PCM_FORMAT_S16_LE);
+- /* Two channels (stereo) */
+- snd_pcm_hw_params_set_channels(handle, params, 2);
+- /* 44100 bits/second sampling rate (CD quality) */
+- const unsigned int cd_rate = 44100;
+- unsigned int playback_sampling_rate = cd_rate;
+- int dir=-1; // round down actual rate, please.
+- snd_pcm_hw_params_set_rate_near(handle, params, &playback_sampling_rate, &dir);
+- if (playback_sampling_rate != cd_rate)
+- {
+- fprintf
+- (
+- stderr,
+- "Asked for %dHz playback rate, but got %dHz\n",
+- cd_rate,
+- playback_sampling_rate
+- );
+- }
+-
+- snd_pcm_uframes_t frames = framelag;
+- snd_pcm_hw_params_set_period_size_near(handle, params, &frames, &dir);
+-
+- /* Write the parameters to the driver */
+- rc = snd_pcm_hw_params(handle, params);
+- if (rc < 0)
+- {
+- fprintf(stderr, "unable to set hw parameters: %s\n", snd_strerror(rc));
+- return;
+- }
+- snd_pcm_hw_params_get_period_size(params, &periodsz, &dir);
+- batchsize = (int) ceilf(framelag / (float) periodsz);
+- fprintf(stderr,"soundenginealsa.cxx: requested period %d, got period %d, use batchsize %d\n", framelag, (int) periodsz, batchsize);
+-
+- simplefeed = new SoundFeedSimple(periodsz);
+- complexfeed = new SoundFeedComplex(periodsz);
+- modulatedfeed = new SoundFeedModulated(periodsz);
+- enginefeed = new SoundFeedEngine(periodsz);
+- activefeed = simplefeed;
+- opened = true;
+ }
+
+
+ SoundEngineAlsa::~SoundEngineAlsa()
+ {
+- if (opened)
+- {
+- fprintf(stderr,"Closing down SoundEngineAlsa\n");
+- snd_pcm_drain(handle);
+- snd_pcm_close(handle);
+- }
+ }
+
+
+ void SoundEngineAlsa::Play(const std::string &fname, int delay)
+ {
+- activefeed->Paste(fname, delay);
+ }
+
+
+@@ -173,58 +108,7 @@
+
+ float SoundEngineAlsa::Sustain(void)
+ {
+- if (!activefeed)
+ return 0.0;
+- snd_pcm_sframes_t delay;
+- int avail = snd_pcm_avail_update(handle);
+- int rc = snd_pcm_delay(handle, &delay);
+- if (rc<0)
+- snd_strerror(rc);
+- if (rc==-EPIPE)
+- fprintf(stderr,"soundenginealsa.cxx: EPIPE\n");
+- else
+- assert(!rc);
+-
+- // We can only trust pcm_delay if the state is running.
+- snd_pcm_state_t pcm_state = snd_pcm_state(handle);
+- if (pcm_state != SND_PCM_STATE_RUNNING || delay<0)
+- {
+- delay=0;
+- if (pcm_state == SND_PCM_STATE_XRUN)
+- snd_pcm_prepare(handle);
+- }
+-
+-#if 0
+- if (delay<0)
+- fprintf(stderr,"delay=%d, avail=%d, periodsz=%d\n", delay, avail, periodsz);
+-#else
+- (void) avail;
+-#endif
+-
+- float fractiondone = activefeed->FractionDone(delay);
+-
+- if (delay < framelag)
+- {
+- int cnt = batchsize;
+- short *data = activefeed->Get(cnt);
+- if (cnt)
+- {
+- assert(data);
+- if (lpfilter>0.01)
+- low_pass_filter(data, cnt*periodsz, lpfilter);
+- rc = snd_pcm_writei(handle, data, cnt*periodsz);
+- assert(rc == -EPIPE || rc >= 0);
+- if (rc == -EPIPE)
+- {
+- snd_pcm_prepare(handle);
+- fprintf(stderr,"Underrrun!\n");
+- }
+- else
+- if (rc != (int) (cnt*periodsz))
+- fprintf(stderr, "short write, wrote %d frames instead of %d\n", rc, (int) periodsz);
+- }
+- }
+- return fractiondone;
+ }
+
+ clipmap_t SoundClip::clips;
diff --git a/games/stormbaancoureur/files/patch-soundenginealsa.h b/games/stormbaancoureur/files/patch-soundenginealsa.h
new file mode 100644
index 000000000000..c9b1967b194f
--- /dev/null
+++ b/games/stormbaancoureur/files/patch-soundenginealsa.h
@@ -0,0 +1,19 @@
+--- soundenginealsa.h.orig Mon Sep 4 19:47:37 2006
++++ soundenginealsa.h Wed Sep 6 04:38:00 2006
+@@ -2,7 +2,6 @@
+ #ifndef SOUNDENGINE_ALSA_H
+ #define SOUNDENGINE_ALSA_H
+
+-#include <alsa/asoundlib.h>
+
+ class SoundClip;
+ class SoundFeed;
+@@ -29,8 +28,6 @@
+ SoundFeedModulated *modulatedfeed;
+ SoundFeedEngine *enginefeed;
+ SoundFeed *activefeed;
+- snd_pcm_t *handle;
+- snd_pcm_uframes_t periodsz; // in frames
+ int batchsize; // in periods
+ int framelag; // in frames
+ float lpfilter;
diff --git a/games/stormbaancoureur/pkg-descr b/games/stormbaancoureur/pkg-descr
new file mode 100644
index 000000000000..304b2fb2bc33
--- /dev/null
+++ b/games/stormbaancoureur/pkg-descr
@@ -0,0 +1,6 @@
+Sturmbahnfahrer... for expert drivers only. If you want to master
+it, try to have the laws of physics work with you, not against you.
+
+Sturmbahnfahrer is a game by Bram Stolk.
+
+WWW: http://www.sturmbahnfahrer.com/
diff --git a/games/stormbaancoureur/pkg-plist b/games/stormbaancoureur/pkg-plist
new file mode 100644
index 000000000000..847c121c7b22
--- /dev/null
+++ b/games/stormbaancoureur/pkg-plist
@@ -0,0 +1,34 @@
+bin/sturmbahnfahrer
+%%DATADIR%%/images/engine.tga
+%%DATADIR%%/images/info_carpet_smooth.rgb
+%%DATADIR%%/images/info_door_smooth.rgb
+%%DATADIR%%/images/info_jump_smooth.rgb
+%%DATADIR%%/models/baseplate.3ds
+%%DATADIR%%/models/car.3ds
+%%DATADIR%%/models/carpet.3ds
+%%DATADIR%%/models/crate.3ds
+%%DATADIR%%/models/crate_low.3ds
+%%DATADIR%%/models/cratejump.3ds
+%%DATADIR%%/models/door.3ds
+%%DATADIR%%/models/doorstand.3ds
+%%DATADIR%%/models/ferriswheelcart.3ds
+%%DATADIR%%/models/ferriswheelstand.3ds
+%%DATADIR%%/models/ferriswheelwheel.3ds
+%%DATADIR%%/models/finishdoor.3ds
+%%DATADIR%%/models/finishplank.3ds
+%%DATADIR%%/models/grid.3ds
+%%DATADIR%%/models/jumpboard.3ds
+%%DATADIR%%/models/licplate.ac
+%%DATADIR%%/models/licplate.bmp
+%%DATADIR%%/models/ramp.3ds
+%%DATADIR%%/models/spikegate.3ds
+%%DATADIR%%/models/track.3ds
+%%DATADIR%%/models/truck.3ds
+%%DATADIR%%/models/wheel.3ds
+%%DATADIR%%/sounds/camaro_s16_le.wav
+%%DATADIR%%/sounds/detonationnorm_s16_le.wav
+%%DATADIR%%/sounds/rpm_graph.txt
+@dirrm %%DATADIR%%/sounds
+@dirrm %%DATADIR%%/models
+@dirrm %%DATADIR%%/images
+@dirrm %%DATADIR%%
diff --git a/games/sturmbahnfahrer/Makefile b/games/sturmbahnfahrer/Makefile
new file mode 100644
index 000000000000..35f464dd779d
--- /dev/null
+++ b/games/sturmbahnfahrer/Makefile
@@ -0,0 +1,45 @@
+# New ports collection makefile for: sturmbahnfahrer
+# Date created: 07 Sep 2006
+# Whom: Dmitry Marakasov <amdmi3@mail.ru>
+#
+# $FreeBSD$
+#
+
+PORTNAME= sturmbahnfahrer
+PORTVERSION= 1.3
+CATEGORIES= games
+MASTER_SITES= http://www.stolk.org/sturmbahnfahrer/download/
+
+MAINTAINER= amdmi3@mail.ru
+COMMENT= Simulated obstacle course for automobiles
+
+LIB_DEPENDS= glut.4:${PORTSDIR}/graphics/libglut
+BUILD_DEPENDS= ${X11BASE}/lib/libplibsl.a:${PORTSDIR}/x11-toolkits/plib \
+ ${X11BASE}/lib/libode.a:${PORTSDIR}/devel/ode
+
+USE_GL= yes
+USE_GCC= 3.4+
+
+MAKE_ENV= DATADIR="${DATADIR}"
+
+PORTDOCS= README
+
+.include <bsd.port.pre.mk>
+
+.if ${OSVERSION} < 500000
+BROKEN= does not compile on FreeBSD 4.x
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} -e 's|/usr/share/games/sturmbahnfahrer|${DATADIR}|' \
+ ${WRKSRC}/main.cxx
+
+.if !defined(NOPORTDOCS)
+post-install:
+ ${MKDIR} ${DOCSDIR}
+.for f in ${PORTDOCS}
+ ${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
+.endfor
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/games/sturmbahnfahrer/distinfo b/games/sturmbahnfahrer/distinfo
new file mode 100644
index 000000000000..5220c7011506
--- /dev/null
+++ b/games/sturmbahnfahrer/distinfo
@@ -0,0 +1,3 @@
+MD5 (sturmbahnfahrer-1.3.tar.gz) = fae14d9e3a503928b4423825a7268cfa
+SHA256 (sturmbahnfahrer-1.3.tar.gz) = 69ffdb02121657983393874480f2106775bd7713cc817f2cee6f4435af9255c6
+SIZE (sturmbahnfahrer-1.3.tar.gz) = 3100944
diff --git a/games/sturmbahnfahrer/files/patch-Makefile b/games/sturmbahnfahrer/files/patch-Makefile
new file mode 100644
index 000000000000..c4feba5a3a64
--- /dev/null
+++ b/games/sturmbahnfahrer/files/patch-Makefile
@@ -0,0 +1,105 @@
+--- Makefile.orig Wed Sep 6 05:32:09 2006
++++ Makefile Wed Sep 6 05:32:14 2006
+@@ -1,17 +1,17 @@
+ # EDIT THESE SETTINGS
+
+-PLIBPREFIX=/usr
+-ODEPREFIX=/usr
+-CXX=g++
++PLIBPREFIX=$(X11BASE)
++ODEPREFIX=$(X11BASE)
++CXX?=g++
+
+ # END OF CUSTOM SETTINGS
+
+-CXXFLAGS=-I$(ODEPREFIX)/include -I$(PLIBPREFIX)/include -O2 -g -Wall
+-LFLAGS=-L$(PLIBPREFIX)/lib -L/usr/X11R6/lib
++CXXFLAGS+=-I$(ODEPREFIX)/include -I$(PLIBPREFIX)/include -g -Wall
++LFLAGS+=-L$(PLIBPREFIX)/lib
+
+ OBJS=staticworldobject.o carobject.o controllerpad.o controllerkey.o main.o dynamicobject.o texture.o tga.o intro.o soundenginealsa.o vectortext.o postscore.o cartobject.o
+
+-LIBS= $(ODEPREFIX)/lib/libode.a -lplibssgaux -lplibssg -lplibsg -lplibpu -lplibfnt -lplibul -lglut -lGLU -lGL -lasound
++LIBS= $(ODEPREFIX)/lib/libode.a -lplibssgaux -lplibssg -lplibsg -lplibpu -lplibfnt -lplibul -lglut -lGLU -lGL
+
+
+ all: sturmbahnfahrer
+@@ -65,47 +65,46 @@
+ clean:
+ rm -f *.o sturmbahnfahrer
+
+-GAMEDIR=$(DESTDIR)/usr/share/games/sturmbahnfahrer
++GAMEDIR=$(DATADIR)
+ install: sturmbahnfahrer
+ # Directories
+- mkdir -p $(DESTDIR)/usr/games/
+ mkdir -p $(GAMEDIR)/images/
+ mkdir -p $(GAMEDIR)/sounds/
+ mkdir -p $(GAMEDIR)/models/
+ # Binary
+- install sturmbahnfahrer $(DESTDIR)/usr/games/sturmbahnfahrer
++ ${BSD_INSTALL_PROGRAM} sturmbahnfahrer $(PREFIX)/bin/
+ # Images
+- install -m 644 images/engine.tga $(GAMEDIR)/images/engine.tga
+- install -m 644 images/info_carpet_smooth.rgb $(GAMEDIR)/images/info_carpet_smooth.rgb
+- install -m 644 images/info_door_smooth.rgb $(GAMEDIR)/images/info_door_smooth.rgb
+- install -m 644 images/info_jump_smooth.rgb $(GAMEDIR)/images/info_jump_smooth.rgb
++ ${BSD_INSTALL_DATA} images/engine.tga $(GAMEDIR)/images/engine.tga
++ ${BSD_INSTALL_DATA} images/info_carpet_smooth.rgb $(GAMEDIR)/images/info_carpet_smooth.rgb
++ ${BSD_INSTALL_DATA} images/info_door_smooth.rgb $(GAMEDIR)/images/info_door_smooth.rgb
++ ${BSD_INSTALL_DATA} images/info_jump_smooth.rgb $(GAMEDIR)/images/info_jump_smooth.rgb
+ # Sounds
+- install -m 644 sounds/rpm_graph.txt $(GAMEDIR)/sounds/rpm_graph.txt
+- install -m 644 sounds/camaro_s16_le.wav $(GAMEDIR)/sounds/camaro_s16_le.wav
+- install -m 644 sounds/detonationnorm_s16_le.wav $(GAMEDIR)/sounds/detonationnorm_s16_le.wav
++ ${BSD_INSTALL_DATA} sounds/rpm_graph.txt $(GAMEDIR)/sounds/rpm_graph.txt
++ ${BSD_INSTALL_DATA} sounds/camaro_s16_le.wav $(GAMEDIR)/sounds/camaro_s16_le.wav
++ ${BSD_INSTALL_DATA} sounds/detonationnorm_s16_le.wav $(GAMEDIR)/sounds/detonationnorm_s16_le.wav
+ # Models
+- install -m 644 models/baseplate.3ds $(GAMEDIR)/models/baseplate.3ds
+- install -m 644 models/car.3ds $(GAMEDIR)/models/car.3ds
+- install -m 644 models/carpet.3ds $(GAMEDIR)/models/carpet.3ds
+- install -m 644 models/crate.3ds $(GAMEDIR)/models/crate.3ds
+- install -m 644 models/cratejump.3ds $(GAMEDIR)/models/cratejump.3ds
+- install -m 644 models/crate_low.3ds $(GAMEDIR)/models/crate_low.3ds
+- install -m 644 models/door.3ds $(GAMEDIR)/models/door.3ds
+- install -m 644 models/doorstand.3ds $(GAMEDIR)/models/doorstand.3ds
+- install -m 644 models/ferriswheelcart.3ds $(GAMEDIR)/models/ferriswheelcart.3ds
+- install -m 644 models/ferriswheelstand.3ds $(GAMEDIR)/models/ferriswheelstand.3ds
+- install -m 644 models/ferriswheelwheel.3ds $(GAMEDIR)/models/ferriswheelwheel.3ds
+- install -m 644 models/finishdoor.3ds $(GAMEDIR)/models/finishdoor.3ds
+- install -m 644 models/finishplank.3ds $(GAMEDIR)/models/finishplank.3ds
+- install -m 644 models/grid.3ds $(GAMEDIR)/models/grid.3ds
+- install -m 644 models/jumpboard.3ds $(GAMEDIR)/models/jumpboard.3ds
+- install -m 644 models/licplate.ac $(GAMEDIR)/models/licplate.ac
+- install -m 644 models/licplate.bmp $(GAMEDIR)/models/licplate.bmp
+- install -m 644 models/ramp.3ds $(GAMEDIR)/models/ramp.3ds
+- install -m 644 models/spikegate.3ds $(GAMEDIR)/models/spikegate.3ds
+- install -m 644 models/track.3ds $(GAMEDIR)/models/track.3ds
+- install -m 644 models/truck.3ds $(GAMEDIR)/models/truck.3ds
+- install -m 644 models/wheel.3ds $(GAMEDIR)/models/wheel.3ds
++ ${BSD_INSTALL_DATA} models/baseplate.3ds $(GAMEDIR)/models/baseplate.3ds
++ ${BSD_INSTALL_DATA} models/car.3ds $(GAMEDIR)/models/car.3ds
++ ${BSD_INSTALL_DATA} models/carpet.3ds $(GAMEDIR)/models/carpet.3ds
++ ${BSD_INSTALL_DATA} models/crate.3ds $(GAMEDIR)/models/crate.3ds
++ ${BSD_INSTALL_DATA} models/cratejump.3ds $(GAMEDIR)/models/cratejump.3ds
++ ${BSD_INSTALL_DATA} models/crate_low.3ds $(GAMEDIR)/models/crate_low.3ds
++ ${BSD_INSTALL_DATA} models/door.3ds $(GAMEDIR)/models/door.3ds
++ ${BSD_INSTALL_DATA} models/doorstand.3ds $(GAMEDIR)/models/doorstand.3ds
++ ${BSD_INSTALL_DATA} models/ferriswheelcart.3ds $(GAMEDIR)/models/ferriswheelcart.3ds
++ ${BSD_INSTALL_DATA} models/ferriswheelstand.3ds $(GAMEDIR)/models/ferriswheelstand.3ds
++ ${BSD_INSTALL_DATA} models/ferriswheelwheel.3ds $(GAMEDIR)/models/ferriswheelwheel.3ds
++ ${BSD_INSTALL_DATA} models/finishdoor.3ds $(GAMEDIR)/models/finishdoor.3ds
++ ${BSD_INSTALL_DATA} models/finishplank.3ds $(GAMEDIR)/models/finishplank.3ds
++ ${BSD_INSTALL_DATA} models/grid.3ds $(GAMEDIR)/models/grid.3ds
++ ${BSD_INSTALL_DATA} models/jumpboard.3ds $(GAMEDIR)/models/jumpboard.3ds
++ ${BSD_INSTALL_DATA} models/licplate.ac $(GAMEDIR)/models/licplate.ac
++ ${BSD_INSTALL_DATA} models/licplate.bmp $(GAMEDIR)/models/licplate.bmp
++ ${BSD_INSTALL_DATA} models/ramp.3ds $(GAMEDIR)/models/ramp.3ds
++ ${BSD_INSTALL_DATA} models/spikegate.3ds $(GAMEDIR)/models/spikegate.3ds
++ ${BSD_INSTALL_DATA} models/track.3ds $(GAMEDIR)/models/track.3ds
++ ${BSD_INSTALL_DATA} models/truck.3ds $(GAMEDIR)/models/truck.3ds
++ ${BSD_INSTALL_DATA} models/wheel.3ds $(GAMEDIR)/models/wheel.3ds
+
+
+ deb:
diff --git a/games/sturmbahnfahrer/files/patch-controllerpad.cxx b/games/sturmbahnfahrer/files/patch-controllerpad.cxx
new file mode 100644
index 000000000000..07c8069a2233
--- /dev/null
+++ b/games/sturmbahnfahrer/files/patch-controllerpad.cxx
@@ -0,0 +1,193 @@
+--- controllerpad.cxx.orig Mon Jul 17 00:26:08 2006
++++ controllerpad.cxx Mon Jul 17 00:28:23 2006
+@@ -14,7 +14,6 @@
+ #include <windows.h>
+ #include <mmsystem.h>
+ #else
+-#include <linux/joystick.h>
+ #include <sys/ioctl.h> // for ioctl()
+ #include <unistd.h> // for close()
+ #include <stdio.h> // for perror()
+@@ -81,100 +80,7 @@
+ accel_axis(-1),
+ accel_button(-1)
+ {
+-#ifdef WIN32
+- JOYINFOEX joyinfo;
+- JOYCAPS joycaps;
+- MMRESULT result;
+- int axisCounter;
+-
+- id = 0;
+-
+- joyinfo.dwSize = sizeof(joyinfo);
+- joyinfo.dwFlags = JOY_RETURNALL;
+-
+- result = joyGetPosEx(id, &joyinfo);
+- if(result != JOYERR_NOERROR) {
+- fprintf(stderr, "No input devices found\n");
+- return;
+- }
+- else {
+- result = joyGetDevCaps(id, &joycaps, sizeof(joycaps));
+- if(result != JOYERR_NOERROR) {
+- fprintf(stderr, "No input devices found\n");
+- return;
+- }
+- }
+-
+- opened = true;
+-
+- fprintf(stderr, "x min %d max %d\n", joycaps.wXmin, joycaps.wXmax);
+- buttoncount = joycaps.wNumButtons;
+- axiscount = joycaps.wNumAxes;
+-#else
+- fd = open(devfile.c_str(), O_RDONLY | O_NONBLOCK);
+- if (fd==-1)
+- {
+- if (errno != ENODEV)
+- perror("open() on joystick device failed");
+- return;
+- }
+- opened = true;
+-
+- int retval;
+-
+- int version;
+- retval = ioctl(fd, JSIOCGVERSION, &version);
+- if (retval == -1)
+- perror("ioctl JSIOCGVERSION failed");
+-
+- unsigned char lo = version;
+- unsigned char md = (version>>8);
+- unsigned char hi = (version>>16);
+-
+- retval = ioctl(fd, JSIOCGAXES, &axiscount);
+- if (retval == -1)
+- perror("ioctl JSIOCGAXES failed");
+-
+- retval = ioctl(fd, JSIOCGBUTTONS, &buttoncount);
+- if (retval == -1)
+- perror("ioctl JSIOCGBUTTONS failed");
+-
+- char n[128];
+- retval = ioctl(fd, JSIOCGNAME(128), n);
+- if (retval == -1)
+- perror("ioctl JSIOCGNAME failed");
+-
+- name = n;
+- fprintf(stderr,"joystick name: %s\n", name.c_str());
+- fprintf(stderr,"driver version: %d.%d.%d\n", hi,md,lo);
+- fprintf(stderr,"button count: %d, axiscount: %d\n", buttoncount, axiscount);
+-#endif
+-
+- // search db
+- assert(sizeof(joydb_names) == sizeof(joydb_descs));
+- int cnt = sizeof(joydb_names) / sizeof(void *) - 1;
+- for (int i=0; i<cnt && !joydb_entry; i++)
+- {
+- if (!strcmp(joydb_names[i], name.c_str()))
+- joydb_entry = joydb_descs[i];
+- }
+-
+- fprintf
+- (
+- stderr,
+- "Known in joystick description database: %s\n",
+- (joydb_entry)?"yes":"no"
+- );
+-
+- for (int i=0; i<axiscount; i++)
+- AxisValues.push_back(0);
+- for (int i=0; i<buttoncount; i++)
+- {
+- ButtonValues.push_back(false);
+- ButtonChanged.push_back(false);
+- }
+-
+- Introspect();
++ return;
+ }
+
+
+@@ -194,80 +100,6 @@
+
+ void ControllerPad::Sustain(float dt)
+ {
+-#ifdef WIN32
+- MMRESULT result;
+- DWORD flags[6 /*MAX_AXES*/] = { JOY_RETURNX, JOY_RETURNY, JOY_RETURNZ,
+- JOY_RETURNR, JOY_RETURNU, JOY_RETURNV };
+- DWORD pos[6 /*MAX_AXES*/];
+- JOYINFOEX joyinfo;
+-
+- joyinfo.dwSize = sizeof(joyinfo);
+- joyinfo.dwFlags = JOY_RETURNALL | JOY_RETURNPOVCTS;
+-
+-#if 0
+- if(!hats) {
+- joyinfo.dwFlags &= ~(JOY_RETURNPOV | JOY_RETURNPOVCTS);
+- }
+-#endif
+-
+- // get the actual data
+- result = joyGetPosEx(id, &joyinfo);
+-
+- if(result != JOYERR_NOERROR) {
+- SetMMerror("joyGetPosEx", result);
+- return;
+- }
+-
+- /* joystick motion events */
+- pos[0] = joyinfo.dwXpos;
+- pos[1] = joyinfo.dwYpos;
+- pos[2] = joyinfo.dwZpos;
+- pos[3] = joyinfo.dwRpos;
+- pos[4] = joyinfo.dwUpos;
+- pos[5] = joyinfo.dwVpos;
+-
+- for(int axisCounter = 0; axisCounter < axiscount; axisCounter++) {
+- if(joyinfo.dwFlags & flags[axisCounter]) {
+- AxisValues[axisCounter] = float(pos[axisCounter]);
+- }
+- }
+-#else
+- struct js_event ev;
+- int retval;
+- do
+- {
+- retval = read(fd, &ev, sizeof(ev));
+- if (retval == -1)
+- {
+- if (errno != EAGAIN)
+- {
+- perror("read() on joystick failed");
+- fprintf(stderr,"joystick read failure\n");
+- }
+- }
+- int type = ev.type;
+- switch(type)
+- {
+- case JS_EVENT_BUTTON:
+- if (ev.number < ButtonValues.size())
+- {
+- ButtonValues[ev.number] = ev.value;
+- ButtonChanged[ev.number] = true;
+- }
+- else
+- fprintf(stderr,"Illegal buttonnr %d\n", ev.number);
+- break;
+- case JS_EVENT_AXIS:
+- if (ev.number < AxisValues.size())
+- AxisValues[ev.number] = ev.value;
+- else
+- fprintf(stderr,"Illegal axisnr %d", ev.number);
+- break;
+- default:
+- break;
+- }
+- } while (retval>0);
+-#endif
+ }
+
+
diff --git a/games/sturmbahnfahrer/files/patch-main.cxx b/games/sturmbahnfahrer/files/patch-main.cxx
new file mode 100644
index 000000000000..04d93b7664db
--- /dev/null
+++ b/games/sturmbahnfahrer/files/patch-main.cxx
@@ -0,0 +1,16 @@
+--- main.cxx.orig Mon Sep 4 20:04:09 2006
++++ main.cxx Wed Sep 6 05:03:34 2006
+@@ -655,13 +655,7 @@
+ fprintf(stderr,"plib is (c) by Steve Baker\n");
+ fprintf(stderr,"OpenDE is (c) by Russel L. Smith\n");
+
+- char *bindirname = dirname(argv[0]);
+- if (!strcmp(bindirname,"."))
+ dirprefix="/usr/share/games/sturmbahnfahrer";
+- else
+- {
+- dirprefix = dirname(bindirname) + std::string("/share/games/sturmbahnfahrer");
+- }
+ if (getenv("PLODE_DATADIR"))
+ dirprefix = getenv("PLODE_DATADIR");
+ if (getenv("PLODE_DISPLAYMODE"))
diff --git a/games/sturmbahnfahrer/files/patch-soundenginealsa.cxx b/games/sturmbahnfahrer/files/patch-soundenginealsa.cxx
new file mode 100644
index 000000000000..e0891046e7ef
--- /dev/null
+++ b/games/sturmbahnfahrer/files/patch-soundenginealsa.cxx
@@ -0,0 +1,147 @@
+--- soundenginealsa.cxx.orig Mon Sep 4 19:47:37 2006
++++ soundenginealsa.cxx Wed Sep 6 04:43:37 2006
+@@ -38,85 +38,20 @@
+ complexfeed(0),
+ enginefeed(0),
+ activefeed(0),
+- handle(0),
+- periodsz(0),
+ batchsize(0),
+ framelag(lag),
+ lpfilter(0.0)
+ {
+- /* Open PCM device for playback. */
+- int rc = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, 0);
+- if (rc < 0)
+- {
+- fprintf(stderr, "unable to open pcm device: %s\n", snd_strerror(rc));
+- return;
+- }
+- snd_pcm_hw_params_t *params=0;
+-
+- /* Allocate a hardware parameters object. */
+- snd_pcm_hw_params_alloca(&params);
+- /* Fill it in with default values. */
+- snd_pcm_hw_params_any(handle, params);
+- /* Set the desired hardware parameters. */
+- /* Interleaved mode */
+- snd_pcm_hw_params_set_access(handle, params, SND_PCM_ACCESS_RW_INTERLEAVED);
+- /* Signed 16-bit little-endian format */
+- snd_pcm_hw_params_set_format(handle, params, SND_PCM_FORMAT_S16_LE);
+- /* Two channels (stereo) */
+- snd_pcm_hw_params_set_channels(handle, params, 2);
+- /* 44100 bits/second sampling rate (CD quality) */
+- const unsigned int cd_rate = 44100;
+- unsigned int playback_sampling_rate = cd_rate;
+- int dir=-1; // round down actual rate, please.
+- snd_pcm_hw_params_set_rate_near(handle, params, &playback_sampling_rate, &dir);
+- if (playback_sampling_rate != cd_rate)
+- {
+- fprintf
+- (
+- stderr,
+- "Asked for %dHz playback rate, but got %dHz\n",
+- cd_rate,
+- playback_sampling_rate
+- );
+- }
+-
+- snd_pcm_uframes_t frames = framelag;
+- snd_pcm_hw_params_set_period_size_near(handle, params, &frames, &dir);
+-
+- /* Write the parameters to the driver */
+- rc = snd_pcm_hw_params(handle, params);
+- if (rc < 0)
+- {
+- fprintf(stderr, "unable to set hw parameters: %s\n", snd_strerror(rc));
+- return;
+- }
+- snd_pcm_hw_params_get_period_size(params, &periodsz, &dir);
+- batchsize = (int) ceilf(framelag / (float) periodsz);
+- fprintf(stderr,"soundenginealsa.cxx: requested period %d, got period %d, use batchsize %d\n", framelag, (int) periodsz, batchsize);
+-
+- simplefeed = new SoundFeedSimple(periodsz);
+- complexfeed = new SoundFeedComplex(periodsz);
+- modulatedfeed = new SoundFeedModulated(periodsz);
+- enginefeed = new SoundFeedEngine(periodsz);
+- activefeed = simplefeed;
+- opened = true;
+ }
+
+
+ SoundEngineAlsa::~SoundEngineAlsa()
+ {
+- if (opened)
+- {
+- fprintf(stderr,"Closing down SoundEngineAlsa\n");
+- snd_pcm_drain(handle);
+- snd_pcm_close(handle);
+- }
+ }
+
+
+ void SoundEngineAlsa::Play(const std::string &fname, int delay)
+ {
+- activefeed->Paste(fname, delay);
+ }
+
+
+@@ -173,58 +108,7 @@
+
+ float SoundEngineAlsa::Sustain(void)
+ {
+- if (!activefeed)
+ return 0.0;
+- snd_pcm_sframes_t delay;
+- int avail = snd_pcm_avail_update(handle);
+- int rc = snd_pcm_delay(handle, &delay);
+- if (rc<0)
+- snd_strerror(rc);
+- if (rc==-EPIPE)
+- fprintf(stderr,"soundenginealsa.cxx: EPIPE\n");
+- else
+- assert(!rc);
+-
+- // We can only trust pcm_delay if the state is running.
+- snd_pcm_state_t pcm_state = snd_pcm_state(handle);
+- if (pcm_state != SND_PCM_STATE_RUNNING || delay<0)
+- {
+- delay=0;
+- if (pcm_state == SND_PCM_STATE_XRUN)
+- snd_pcm_prepare(handle);
+- }
+-
+-#if 0
+- if (delay<0)
+- fprintf(stderr,"delay=%d, avail=%d, periodsz=%d\n", delay, avail, periodsz);
+-#else
+- (void) avail;
+-#endif
+-
+- float fractiondone = activefeed->FractionDone(delay);
+-
+- if (delay < framelag)
+- {
+- int cnt = batchsize;
+- short *data = activefeed->Get(cnt);
+- if (cnt)
+- {
+- assert(data);
+- if (lpfilter>0.01)
+- low_pass_filter(data, cnt*periodsz, lpfilter);
+- rc = snd_pcm_writei(handle, data, cnt*periodsz);
+- assert(rc == -EPIPE || rc >= 0);
+- if (rc == -EPIPE)
+- {
+- snd_pcm_prepare(handle);
+- fprintf(stderr,"Underrrun!\n");
+- }
+- else
+- if (rc != (int) (cnt*periodsz))
+- fprintf(stderr, "short write, wrote %d frames instead of %d\n", rc, (int) periodsz);
+- }
+- }
+- return fractiondone;
+ }
+
+ clipmap_t SoundClip::clips;
diff --git a/games/sturmbahnfahrer/files/patch-soundenginealsa.h b/games/sturmbahnfahrer/files/patch-soundenginealsa.h
new file mode 100644
index 000000000000..c9b1967b194f
--- /dev/null
+++ b/games/sturmbahnfahrer/files/patch-soundenginealsa.h
@@ -0,0 +1,19 @@
+--- soundenginealsa.h.orig Mon Sep 4 19:47:37 2006
++++ soundenginealsa.h Wed Sep 6 04:38:00 2006
+@@ -2,7 +2,6 @@
+ #ifndef SOUNDENGINE_ALSA_H
+ #define SOUNDENGINE_ALSA_H
+
+-#include <alsa/asoundlib.h>
+
+ class SoundClip;
+ class SoundFeed;
+@@ -29,8 +28,6 @@
+ SoundFeedModulated *modulatedfeed;
+ SoundFeedEngine *enginefeed;
+ SoundFeed *activefeed;
+- snd_pcm_t *handle;
+- snd_pcm_uframes_t periodsz; // in frames
+ int batchsize; // in periods
+ int framelag; // in frames
+ float lpfilter;
diff --git a/games/sturmbahnfahrer/pkg-descr b/games/sturmbahnfahrer/pkg-descr
new file mode 100644
index 000000000000..304b2fb2bc33
--- /dev/null
+++ b/games/sturmbahnfahrer/pkg-descr
@@ -0,0 +1,6 @@
+Sturmbahnfahrer... for expert drivers only. If you want to master
+it, try to have the laws of physics work with you, not against you.
+
+Sturmbahnfahrer is a game by Bram Stolk.
+
+WWW: http://www.sturmbahnfahrer.com/
diff --git a/games/sturmbahnfahrer/pkg-plist b/games/sturmbahnfahrer/pkg-plist
new file mode 100644
index 000000000000..847c121c7b22
--- /dev/null
+++ b/games/sturmbahnfahrer/pkg-plist
@@ -0,0 +1,34 @@
+bin/sturmbahnfahrer
+%%DATADIR%%/images/engine.tga
+%%DATADIR%%/images/info_carpet_smooth.rgb
+%%DATADIR%%/images/info_door_smooth.rgb
+%%DATADIR%%/images/info_jump_smooth.rgb
+%%DATADIR%%/models/baseplate.3ds
+%%DATADIR%%/models/car.3ds
+%%DATADIR%%/models/carpet.3ds
+%%DATADIR%%/models/crate.3ds
+%%DATADIR%%/models/crate_low.3ds
+%%DATADIR%%/models/cratejump.3ds
+%%DATADIR%%/models/door.3ds
+%%DATADIR%%/models/doorstand.3ds
+%%DATADIR%%/models/ferriswheelcart.3ds
+%%DATADIR%%/models/ferriswheelstand.3ds
+%%DATADIR%%/models/ferriswheelwheel.3ds
+%%DATADIR%%/models/finishdoor.3ds
+%%DATADIR%%/models/finishplank.3ds
+%%DATADIR%%/models/grid.3ds
+%%DATADIR%%/models/jumpboard.3ds
+%%DATADIR%%/models/licplate.ac
+%%DATADIR%%/models/licplate.bmp
+%%DATADIR%%/models/ramp.3ds
+%%DATADIR%%/models/spikegate.3ds
+%%DATADIR%%/models/track.3ds
+%%DATADIR%%/models/truck.3ds
+%%DATADIR%%/models/wheel.3ds
+%%DATADIR%%/sounds/camaro_s16_le.wav
+%%DATADIR%%/sounds/detonationnorm_s16_le.wav
+%%DATADIR%%/sounds/rpm_graph.txt
+@dirrm %%DATADIR%%/sounds
+@dirrm %%DATADIR%%/models
+@dirrm %%DATADIR%%/images
+@dirrm %%DATADIR%%