pkgsrc/games/xdoom/patches/patch-ai
2002-08-22 05:08:30 +00:00

129 lines
3.7 KiB
Text

$NetBSD: patch-ai,v 1.3 2002/08/22 05:08:31 mycroft Exp $
--- linuxdoom-1.10/i_video.c.orig Mon Dec 22 20:39:01 1997
+++ linuxdoom-1.10/i_video.c Thu Aug 22 04:42:18 2002
@@ -36,7 +36,7 @@
#include <X11/extensions/XShm.h>
// Had to dig up XShm.c for this one.
// It is in the libXext, but not in the XFree86 headers.
-#ifdef LINUX
+#if defined(LINUX) || defined (__NetBSD__)
int XShmGetEventBase( Display* dpy ); // problems with g++?
#endif
@@ -46,13 +46,14 @@
#include <sys/socket.h>
#include <netinet/in.h>
-#include <errnos.h>
+#include <errno.h>
#include <signal.h>
#include "doomstat.h"
#include "i_system.h"
#include "v_video.h"
#include "m_argv.h"
+#include "m_swap.h" /* For BYTE_ORDER == BIG_ENDIAN */
#include "d_main.h"
#include "doomdef.h"
@@ -164,15 +165,20 @@
void I_ShutdownGraphics(void)
{
// Detach from X server
- if (!XShmDetach(X_display, &X_shminfo))
+ if (X_shminfo.shmid)
+ {
+ if (!XShmDetach(X_display, &X_shminfo))
I_Error("XShmDetach() failed in I_ShutdownGraphics()");
- // Release shared memory.
- shmdt(X_shminfo.shmaddr);
- shmctl(X_shminfo.shmid, IPC_RMID, 0);
+ // Release shared memory.
+ shmdt(X_shminfo.shmaddr);
+ shmctl(X_shminfo.shmid, IPC_RMID, 0);
+ X_shminfo.shmid = 0;
+ }
// Paranoia.
- image->data = NULL;
+ if (image)
+ image->data = NULL;
}
@@ -685,8 +691,7 @@
// attach to the shared memory segment
image->data = X_shminfo.shmaddr = shmat(id, 0, 0);
- fprintf(stderr, "shared memory id=%d, addr=0x%x\n", id,
- (int) (image->data));
+ fprintf(stderr, "shared memory id=%d, addr=%p\n", id, image->data);
}
void I_InitGraphics(void)
@@ -986,13 +991,13 @@
{
fourpixels = lineptr[0];
- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
+ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff0000)>>13) );
xline[0] = dpixel;
xline[160] = dpixel;
xline[320] = dpixel;
xline[480] = dpixel;
- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
+ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff)<<3 ) );
xline[1] = dpixel;
xline[161] = dpixel;
xline[321] = dpixel;
@@ -1000,13 +1005,13 @@
fourpixels = lineptr[1];
- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
+ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff0000)>>13) );
xline[2] = dpixel;
xline[162] = dpixel;
xline[322] = dpixel;
xline[482] = dpixel;
- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
+ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff)<<3 ) );
xline[3] = dpixel;
xline[163] = dpixel;
xline[323] = dpixel;
@@ -1014,13 +1019,13 @@
fourpixels = lineptr[2];
- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
+ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff0000)>>13) );
xline[4] = dpixel;
xline[164] = dpixel;
xline[324] = dpixel;
xline[484] = dpixel;
- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
+ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff)<<3 ) );
xline[5] = dpixel;
xline[165] = dpixel;
xline[325] = dpixel;
@@ -1028,13 +1033,13 @@
fourpixels = lineptr[3];
- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
+ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff0000)>>13) );
xline[6] = dpixel;
xline[166] = dpixel;
xline[326] = dpixel;
xline[486] = dpixel;
- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
+ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff)<<3 ) );
xline[7] = dpixel;
xline[167] = dpixel;
xline[327] = dpixel;