Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Aug 2003 22:39:36 +0700 (NOVST)
From:      Alexey Dokuchaev <danfe@regency.nsu.ru>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/56085: games/fuhquake port updated
Message-ID:  <200308281539.h7SFdaIu080712@regency.nsu.ru>
Resent-Message-ID: <200308281540.h7SFeOdi063446@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         56085
>Category:       ports
>Synopsis:       games/fuhquake port updated
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 28 08:40:23 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Alexey Dokuchaev
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
CNIT NSU
>Environment:
System: FreeBSD regency.nsu.ru 4.8-STABLE FreeBSD 4.8-STABLE #0: Fri Aug 8 20:27:14 NOVST 2003 root@regency.nsu.ru:/usr/obj/usr/src/sys/REGENCY i386
>Description:
This update of games/fuhquake does the following (`-' means bug fixed, `+'
means feature/knob added):

	+ Allows fuhquake to be run from any directory per kris' suggestion;

	+ Adds WITH_SHAREWARE_DATA knob.  Coupled with provious `+', this
	  makes fuhquake playable right after install, yet allows it to be
	  distributed on CDROM (since shareware data cannot be included,
	  one must explicitly define this knob);

	- Properly utilizes EXTRACT_ONLY in Makefile;

	- Removes EXTRACT_BEFORE_ARGS from Makefile since it's no longer
	  needed (kris made a commit regarding this to bsd.port.mk four
	  weeks ago);

	+ Tells user about WITHOUT_XMMS knob, when XMMS bits are found;

	- Fixes palette problems on 24-bit depth with x11-renderer;

	- Fixes DGA mouse behavior on higher mouse rates when GLX-rendered.
>How-To-Repeat:
N/A
>Fix:
Two new patch files (patch-common.c and patch-vid_x11.c):

=== start of patch-common.c ===
--- common.c.orig	Thu Aug 28 18:15:40 2003
+++ common.c	Thu Aug 28 18:16:04 2003
@@ -1512,7 +1512,7 @@
 	if ((i = COM_CheckParm ("-basedir")) && i < com_argc - 1)
 		Q_strncpyz (com_basedir, com_argv[i + 1], sizeof(com_basedir));
 	else
-		strcpy (com_basedir, ".");
+		strcpy (com_basedir, "%%%%BASEDIR%%%%");
 
 	for (i = 0; i < strlen(com_basedir); i++)
 		if (com_basedir[i] == '\\')
==== end of patch-common.c ====

		* * *

=== start of patch-common.c ===
--- vid_x11.c.orig	Mon Aug 25 21:01:40 2003
+++ vid_x11.c	Mon Aug 25 21:10:09 2003
@@ -21,7 +21,8 @@
 
 #define _BSD
 
-typedef unsigned short PIXEL;
+typedef unsigned short PIXEL16;
+typedef unsigned PIXEL24;
 
 #include <ctype.h>
 #include <sys/time.h>
@@ -111,7 +112,8 @@
 void (*vid_menukeyfn)(int key);
 void VID_MenuKey (int key);
 
-static PIXEL st2d_8to16table[256];
+static PIXEL16 st2d_8to16table[256];
+static PIXEL24 st2d_8to24table[256];
 static int shiftmask_fl=0;
 static long r_shift,g_shift,b_shift;
 static unsigned long r_mask,g_mask,b_mask;
@@ -132,8 +134,42 @@
     shiftmask_fl = 1;
 }
 
-PIXEL xlib_rgb(int r,int g,int b) {
-    PIXEL p;
+PIXEL16 xlib_rgb16(int r,int g,int b) {
+    PIXEL16 p;
+
+    if (shiftmask_fl == 0) 
+		shiftmask_init();
+    p = 0;
+
+    if (r_shift > 0) {
+        p = (r << (r_shift)) &r_mask;
+    } else if(r_shift<0) {
+        p = (r >> (-r_shift)) &r_mask;
+	} else {
+		p |= (r & r_mask);
+	}
+
+    if(g_shift>0) {
+        p |= (g << (g_shift)) &g_mask;
+    } else if(g_shift<0) {
+        p |= (g >> (-g_shift)) &g_mask;
+	} else {
+		p|=(g & g_mask);
+	}
+
+    if(b_shift > 0) {
+        p |= (b << (b_shift)) &b_mask;
+    } else if (b_shift < 0) {
+        p |= (b >> (-b_shift)) &b_mask;
+	} else {
+		p|=(b & b_mask);
+	}
+
+    return p;
+}
+
+PIXEL24 xlib_rgb24(int r,int g,int b) {
+    PIXEL24 p;
 
     if (shiftmask_fl == 0) 
 		shiftmask_init();
@@ -169,20 +205,37 @@
 void st2_fixup( XImage *framebuf, int x, int y, int width, int height) {
 	int xi,yi;
 	unsigned char *src;
-	PIXEL *dest;
+	PIXEL16 *dest;
 
 	if(x < 0 || y < 0)
 		return;
 
 	for (yi = y; yi < y + height; yi++) {
 		src = &framebuf->data [yi * framebuf->bytes_per_line];
-		dest = (PIXEL*)src;
+		dest = (PIXEL16 *)src;
 		for(xi = (x + width - 1); xi >= x; xi--) {
 			dest[xi] = st2d_8to16table[src[xi]];
 		}
 	}
 }
 
+void st3_fixup( XImage *framebuf, int x, int y, int width, int height) {
+	int xi,yi;
+	unsigned char *src;
+	PIXEL24 *dest;
+
+	if(x < 0 || y < 0)
+		return;
+
+	for (yi = y; yi < y + height; yi++) {
+		src = &framebuf->data [yi * framebuf->bytes_per_line];
+		dest = (PIXEL24 *)src;
+		for(xi = (x + width - 1); xi >= x; xi--) {
+			dest[xi] = st2d_8to24table[src[xi]];
+		}
+	}
+}
+
 // ========================================================================
 // Tragic death handler
 // ========================================================================
@@ -564,8 +617,10 @@
 	int i;
 	XColor colors[256];
 
-	for (i = 0; i < 256; i++)
-		st2d_8to16table[i]= xlib_rgb(palette[i * 3], palette[i * 3 + 1], palette[i * 3 + 2]);
+	for (i = 0; i < 256; i++) {
+		st2d_8to24table[i]= xlib_rgb24(palette[i * 3], palette[i * 3 + 1], palette[i * 3 + 2]);
+		st2d_8to16table[i]= xlib_rgb16(palette[i * 3], palette[i * 3 + 1], palette[i * 3 + 2]);
+	}
 
 	if (x_visinfo->class == PseudoColor && x_visinfo->depth == 8) {
 		if (palette != current_palette)
@@ -821,7 +876,9 @@
 
 	if (doShm) {
 		while (rects){
-			if (x_visinfo->depth != 8)
+			if (x_visinfo->depth == 24)
+				st3_fixup( x_framebuffer[current_framebuffer], rects->x, rects->y, rects->width, rects->height);
+			else if (x_visinfo->depth == 16)
 				st2_fixup( x_framebuffer[current_framebuffer], rects->x, rects->y, rects->width, rects->height);
 			if (!XShmPutImage(x_disp, x_win, x_gc,
 				x_framebuffer[current_framebuffer], rects->x, rects->y, rects->x, rects->y, rects->width, rects->height, True))
==== end of patch-common.c ====

		* * *

And this is the main diff:

%%%
diff -ur fuhquake.orig/Makefile fuhquake/Makefile
--- fuhquake.orig/Makefile	Thu Aug 28 22:33:38 2003
+++ fuhquake/Makefile	Thu Aug 28 21:59:10 2003
@@ -7,6 +7,7 @@
 
 PORTNAME=	fuhquake
 PORTVERSION=	0.28
+PORTREVISION=	1
 CATEGORIES=	games
 MASTER_SITES=	http://www.fuhquake.net/files/source/:src \
 		http://www.fuhquake.net/files/releases/:dat \
@@ -14,7 +15,16 @@
 DISTNAME=	${PORTNAME}-source-v${PORTVERSION}
 DISTFILES=	${DISTNAME}${EXTRACT_SUFX}:src \
 		${PORTNAME}-linux-v${PORTVERSION}${EXTRACT_SUFX}:dat \
-		pak0.pak${EXTRACT_SUFX}:pak
+		pak0.pak:pak
+.if defined(WITH_SHAREWARE_DATA)
+DISTFILES+=	q1-shareware-pak0.pak:pak
+PLIST_SUB+=	SHAREWARE=""
+.else
+PLIST_SUB+=	SHAREWARE="@comment "
+.endif
+
+EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX} \
+		${PORTNAME}-linux-v${PORTVERSION}${EXTRACT_SUFX}
 
 MAINTAINER=	danfe@regency.nsu.ru
 COMMENT=	An excellent QuakeWorld client
@@ -72,6 +82,12 @@
 .if !defined(WITHOUT_GLX)
 	@${ECHO_MSG} "Define WITHOUT_GLX to disable building of GLX client"
 .endif
+.if defined(WITH_SHAREWARE_DATA)
+	@${ECHO_MSG} "Define WITH_SHAREWARE_DATA to install demo version game data"
+.endif
+.if !defined(WITHOUT_XMMS) && exists(${X11BASE}/lib/libxmms.so.3)
+	@${ECHO_MSG} "Define WITHOUT_XMMS to build without \`\`MP3 Player'' feature"
+.endif
 .if !defined(WITH_OPTIMIZED_CFLAGS)
 	@${ECHO_MSG} "Define WITH_OPTIMIZED_CFLAGS to enable extra optimization options"
 .endif
@@ -80,14 +96,17 @@
 .endif
 
 MAKEFILE=	${FILESDIR}/Makefile
+USE_REINPLACE=	yes
 USE_ZIP=	yes
-EXTRACT_BEFORE_ARGS+=	-qo
 WRKSRC=		${WRKDIR}/source
 
 post-extract:
 	@${FIND} -E ${WRKDIR} -type f -iregex ".*\.(c|h|s|txt)" -exec ${FILESDIR}/fix^m.sh '{}' \;
 	@${CP} ${FILESDIR}/*.c ${WRKSRC}
 
+post-patch:
+	@${REINPLACE_CMD} -e 's|%%%%BASEDIR%%%%|${DATADIR}|' ${WRKSRC}/common.c
+
 do-build:
 .if !defined(WITHOUT_X11)
 	@(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} clean x11)
@@ -105,11 +124,15 @@
 .for tgt in ${END_TARGETS}
 	${INSTALL_PROGRAM} ${WRKSRC}/${tgt} ${PREFIX}/bin
 .endfor
-	@${MKDIR} ${DATADIR}/qw
-	@${MKDIR} ${DATADIR}/${PORTNAME}
+	@${MKDIR} ${DATADIR}/qw ${DATADIR}/${PORTNAME}
 	${INSTALL_DATA} ${WRKDIR}/qw/qwprogs.dat ${DATADIR}/qw
 	${INSTALL_DATA} ${WRKDIR}/qw/spprogs.dat ${DATADIR}/qw
-	${INSTALL_DATA} ${WRKDIR}/pak0.pak ${DATADIR}/${PORTNAME}
+	${INSTALL_DATA} ${DISTDIR}/pak0.pak ${DATADIR}/${PORTNAME}
+.if defined(WITH_SHAREWARE_DATA)
+	@${MKDIR} ${DATADIR}/id1
+	${INSTALL_DATA} ${DISTDIR}/q1-shareware-pak0.pak \
+		${DATADIR}/id1/pak0.pak
+.endif
 .if !defined(NOPORTDOCS)
 	@${MKDIR} ${DOCSDIR}
 . for txt in benchmark config_manager crosshairs linux logitech mp3 \
@@ -120,6 +143,6 @@
 .endif
 
 post-install:
-	@${SED} -e 's#$${PREFIX}#${PREFIX}#g' ${PKGMESSAGE}
+	@${SED} -e 's|$${PREFIX}|${PREFIX}|g' ${PKGMESSAGE}
 
 .include <bsd.port.mk>
diff -ur fuhquake.orig/distinfo fuhquake/distinfo
--- fuhquake.orig/distinfo	Thu Aug 28 22:33:38 2003
+++ fuhquake/distinfo	Thu Aug 28 22:29:42 2003
@@ -1,3 +1,4 @@
 MD5 (fuhquake-source-v0.28.zip) = 7e77a97a1e1524b289ffa6978ce5377e
 MD5 (fuhquake-linux-v0.28.zip) = 72e99f8df1baab11e0492b7cee93fdd3
-MD5 (pak0.pak.zip) = eaedb54f2f0fabb1b621afb831185748
+MD5 (pak0.pak) = 2fa37c49cb1d3902d97cb82a1c96115a
+MD5 (q1-shareware-pak0.pak) = 5906e5998fc3d896ddaf5e6a62e03abb
diff -ur fuhquake.orig/files/patch-vid_glx.c fuhquake/files/patch-vid_glx.c
--- fuhquake.orig/files/patch-vid_glx.c	Thu Aug 28 22:33:38 2003
+++ fuhquake/files/patch-vid_glx.c	Thu Aug 28 18:09:00 2003
@@ -1,5 +1,5 @@
---- vid_glx.c.orig	Wed May 21 17:18:37 2003
-+++ vid_glx.c	Mon Jun  2 20:04:34 2003
+--- vid_glx.c.orig	Thu Aug 28 18:08:22 2003
++++ vid_glx.c	Thu Aug 28 18:08:03 2003
 @@ -20,7 +20,9 @@
  #include <termios.h>
  #include <sys/ioctl.h>
@@ -10,6 +10,17 @@
  #include <stdarg.h>
  #include <stdio.h>
  #include <signal.h>
+@@ -284,8 +286,8 @@
+ 	case MotionNotify:
+ #ifdef WITH_DGA
+ 		if (dgamouse && _windowed_mouse.value) {
+-			mouse_x = event.xmotion.x_root;
+-			mouse_y = event.xmotion.y_root;
++			mouse_x += event.xmotion.x_root;
++			mouse_y += event.xmotion.y_root;
+ 		} else
+ #endif
+ 		{
 @@ -601,8 +603,9 @@
  #ifdef WITH_VMODE
  	// fullscreen
diff -ur fuhquake.orig/pkg-message fuhquake/pkg-message
--- fuhquake.orig/pkg-message	Thu Aug 28 22:33:38 2003
+++ fuhquake/pkg-message	Mon Aug 25 16:16:42 2003
@@ -1,6 +1,15 @@
 ================================================
 
     Install models, skins, maps, and mods in
-    ${PREFIX}/share/fuhquake/
+    ${DATADIR}/ directory.
+
+    You must also have registered version of
+    Quake per to be able to legally copy the
+    PAK files (pak*.pak) from id1/ directory
+    to ${DATADIR}/id1/ from CDROM or Windows
+    installation.  In case it is not an opt-
+    ion, you can rebuild the port with "make
+    -DWITH_SHAREWARE_DATA", and thus install
+    demo version (shareware) data files.
 
 ================================================
diff -ur fuhquake.orig/pkg-plist fuhquake/pkg-plist
--- fuhquake.orig/pkg-plist	Thu Aug 28 22:33:38 2003
+++ fuhquake/pkg-plist	Thu Aug 28 21:41:29 2003
@@ -14,8 +14,10 @@
 %%PORTDOCS%%share/doc/fuhquake/track.txt
 %%PORTDOCS%%@dirrm share/doc/fuhquake
 share/fuhquake/fuhquake/pak0.pak
+%%SHAREWARE%%share/fuhquake/id1/pak0.pak
 share/fuhquake/qw/qwprogs.dat
 share/fuhquake/qw/spprogs.dat
 @dirrm share/fuhquake/qw
+%%SHAREWARE%%@dirrm share/fuhquake/id1
 @dirrm share/fuhquake/fuhquake
 @dirrm share/fuhquake

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200308281539.h7SFdaIu080712>