View | Details | Raw Unified | Return to bug 55243
Collapse All | Expand All

(-)games/digger-vgl/Makefile (-19 / +12 lines)
Lines 6-13 Link Here
6
#
6
#
7
7
8
PORTNAME=	digger
8
PORTNAME=	digger
9
PORTVERSION=	1.0
9
PORTVERSION=	20020314
10
PORTREVISION=	1
11
CATEGORIES=	games
10
CATEGORIES=	games
12
MASTER_SITES=	http://www.digger.org/
11
MASTER_SITES=	http://www.digger.org/
13
DISTNAME=	${PORTNAME}-${DIGREL}
12
DISTNAME=	${PORTNAME}-${DIGREL}
Lines 15-50 Link Here
15
MAINTAINER=	ports@FreeBSD.org
14
MAINTAINER=	ports@FreeBSD.org
16
COMMENT=	FreeBSD graphics console (VGL) version of the famous Digger game
15
COMMENT=	FreeBSD graphics console (VGL) version of the famous Digger game
17
16
18
.if defined(WITH_SOUND)
19
SDL_CONFIG?=	${LOCALBASE}/bin/sdl11-config
20
LIB_DEPENDS=	SDL-1.1.5:${PORTSDIR}/devel/sdl12
21
MAKE_ENV=	SOUND=yes \
22
		SDL_CONFIG=${SDL_CONFIG}
23
.endif
24
25
ONLY_FOR_ARCHS=	i386	# Alphas don't have libvgl yet...
17
ONLY_FOR_ARCHS=	i386	# Alphas don't have libvgl yet...
26
18
27
DIGREL=		20000407
28
WRKSRC=		${WRKDIR}/${PORTNAME}-${DIGREL}
29
MAKEFILE=	Makefile.fbsd
19
MAKEFILE=	Makefile.fbsd
30
20
21
.if defined(WITH_SOUND)
22
USE_SDL=	yes
23
MAKE_ENV=	SOUND=yes
24
.endif
25
26
pre-everything::
31
.if !defined(WITH_SOUND)
27
.if !defined(WITH_SOUND)
32
post-extract:
28
	@${ECHO_MSG} ""
33
	@${ECHO_MSG}
34
	@${ECHO_MSG} "Please use \"make -DWITH_SOUND\" if you want to build the game with sound support."
29
	@${ECHO_MSG} "Please use \"make -DWITH_SOUND\" if you want to build the game with sound support."
35
	@${ECHO_MSG}
30
	@${ECHO_MSG} ""
36
.endif
31
.endif
37
32
38
do-install:
33
do-install:
39
	@${INSTALL_PROGRAM} ${WRKSRC}/digger ${PREFIX}/bin
34
	${INSTALL_PROGRAM} ${WRKSRC}/digger ${PREFIX}/bin
40
	@${MKDIR} /var/games/digger
35
	@${MKDIR} /var/games/digger
41
.if !defined(NOPORTDOCS)
36
.if !defined(NOPORTDOCS)
42
	@${MKDIR} ${PREFIX}/share/doc/digger
37
	@${MKDIR} ${DOCSDIR}
43
	@${INSTALL_MAN} ${WRKSRC}/digger.txt ${PREFIX}/share/doc/digger
38
	${INSTALL_MAN} ${WRKSRC}/digger.txt ${DOCSDIR}
44
.endif
39
.endif
45
46
.if defined(WITH_SOUND)
40
.if defined(WITH_SOUND)
47
post-install:
48
	@${ECHO_MSG}
41
	@${ECHO_MSG}
49
	@${ECHO_MSG} "Use \"digger /A\" command to run Digger with sound enabled."
42
	@${ECHO_MSG} "Use \"digger /A\" command to run Digger with sound enabled."
50
	@${ECHO_MSG}
43
	@${ECHO_MSG}
(-)games/digger-vgl/distinfo (-1 / +1 lines)
Line 1 Link Here
1
MD5 (digger-20000407.tar.gz) = 6b91314193ebdefcc22337b46458e950
1
MD5 (digger-20020314.tar.gz) = 76c1e8ae3c4566dad65e91adbfe29570
(-)games/digger-vgl/files/patch-aa (-39 lines)
Lines 1-39 Link Here
1
2
$FreeBSD: ports/games/digger-vgl/files/patch-aa,v 1.2 2001/09/22 20:35:22 sobomax Exp $
3
4
--- Makefile.fbsd.orig	Mon Apr  3 23:42:48 2000
5
+++ Makefile.fbsd	Sat Sep 22 23:07:01 2001
6
@@ -4,24 +4,28 @@
7
 		newsnd.c ini.c input.c monster.c bags.c alpha.c vgagrafx.c \
8
 		title_gz.c
9
 
10
-CFLAGS=		-g -O -Wall -pedantic -DFREEBSD
11
+CFLAGS+=	-DFREEBSD
12
 
13
 LDADD+=		-lz
14
 
15
+SDL_CONFIG?=	sdl-config
16
+
17
 .if !defined(SDL)
18
 CFLAGS+=	-D_VGL
19
 LDADD+=		-lvgl 
20
 SRCS+=		fbsd_sup.c fbsd_vid.c fbsd_kbd.c fbsd_timer.c
21
 .if defined(SOUND)
22
 SRCS+=		sdl_snd.c
23
-CFLAGS+=	-D_SDL_SOUND `sdl-config --cflags`
24
-LDADD+=		`sdl-config --libs`
25
+SDL_CFLAGS!=	${SDL_CONFIG} --cflags
26
+SDL_LDFLAGS!=	${SDL_CONFIG} --libs
27
+CFLAGS+=	-D_SDL_SOUND ${SDL_CFLAGS}
28
+LDADD+=		${SDL_LDFLAGS}
29
 .else	# NO SOUND
30
 SRCS+=		fbsd_snd.c
31
 .endif	# SOUND
32
 .else	# SDL
33
-CFLAGS+=	-D_SDL `sdl-config --cflags`
34
-LDADD+=		`sdl-config --libs`
35
+CFLAGS+=	-D_SDL `${SDL_CONFIG} --cflags`
36
+LDADD+=		`${SDL_CONFIG} --libs`
37
 SRCS+=		fbsd_sup.c sdl_vid.c sdl_timer.c sdl_kbd.c sdl_snd.c icon.c
38
 .endif
39
 
(-)games/digger-vgl/files/patch-ab (-34 lines)
Lines 1-34 Link Here
1
2
$FreeBSD: ports/games/digger-vgl/files/patch-ab,v 1.2 2001/09/22 20:35:22 sobomax Exp $
3
4
--- fbsd_vid.c.orig	Mon Apr  3 23:42:44 2000
5
+++ fbsd_vid.c	Sat Sep 22 22:18:25 2001
6
@@ -1,4 +1,18 @@
7
-#include <machine/console.h>
8
+/*
9
+ * ---------------------------------------------------------------------------
10
+ * "THE BEER-WARE LICENSE" (Revision 42, (c) Poul-Henning Kamp): Maxim
11
+ * Sobolev <sobomax@altavista.net> wrote this file. As long as you retain
12
+ * this  notice you can  do whatever you  want with this stuff. If we meet
13
+ * some day, and you think this stuff is worth it, you can buy me a beer in
14
+ * return.
15
+ *
16
+ * Maxim Sobolev
17
+ * ---------------------------------------------------------------------------
18
+ */
19
+
20
+#include <sys/fbio.h>
21
+#include <sys/kbio.h>
22
+#include <sys/consio.h>
23
 #include <vgl.h>
24
 #include <signal.h>
25
 #include <osreldate.h>
26
@@ -272,6 +286,8 @@
27
     Sint4           w = 3, h = 12, size;
28
     Sint4           i;
29
 
30
+    if(((ch - 32) >= 0x5f) || (ch < 32))
31
+	return;
32
     tmp = ch2bmap(alphas[ch - 32], w, h);
33
     size = tmp->Xsize * tmp->Ysize;
34
     copy = malloc(size);
(-)games/digger-vgl/files/patch-ac (-13 lines)
Lines 1-13 Link Here
1
2
$FreeBSD: ports/games/digger-vgl/files/patch-ac,v 1.2 2001/09/22 20:35:22 sobomax Exp $
3
4
--- fbsd_kbd.c.orig	Mon Apr  3 23:42:46 2000
5
+++ fbsd_kbd.c	Sat Sep 22 22:19:37 2001
6
@@ -1,4 +1,6 @@
7
-#include <machine/console.h>
8
+#include <sys/fbio.h>
9
+#include <sys/kbio.h>
10
+#include <sys/consio.h>
11
 #include <vgl.h>
12
 
13
 #include "def.h"
(-)games/digger-vgl/files/patch-ad (-15 lines)
Lines 1-15 Link Here
1
2
$FreeBSD: ports/games/digger-vgl/files/patch-ad,v 1.2 2001/09/22 20:35:22 sobomax Exp $
3
4
--- fbsd_timer.c.orig	Mon Apr  3 23:42:44 2000
5
+++ fbsd_timer.c	Sat Sep 22 22:20:03 2001
6
@@ -2,7 +2,8 @@
7
 #include <stdlib.h>
8
 #include <time.h>
9
 #include <sys/time.h>
10
-#include <machine/console.h>
11
+#include <sys/fbio.h>
12
+#include <sys/consio.h>
13
 #include <vgl.h>
14
 
15
 #include "def.h"
(-)games/digger-vgl/files/patch-sdl_kbd.c (-43 lines)
Lines 1-43 Link Here
1
2
$FreeBSD: ports/games/digger-vgl/files/patch-sdl_kbd.c,v 1.2 2001/09/22 20:35:22 sobomax Exp $
3
4
--- sdl_kbd.c	2001/09/12 21:53:57	1.1
5
+++ sdl_kbd.c	2001/09/12 21:54:03
6
@@ -1,3 +1,15 @@
7
+/*
8
+ * ---------------------------------------------------------------------------
9
+ * "THE BEER-WARE LICENSE" (Revision 42, (c) Poul-Henning Kamp): Maxim
10
+ * Sobolev <sobomax@altavista.net> wrote this file. As long as you retain
11
+ * this  notice you can  do whatever you  want with this stuff. If we meet
12
+ * some day, and you think this stuff is worth it, you can buy me a beer in
13
+ * return.
14
+ * 
15
+ * Maxim Sobolev
16
+ * --------------------------------------------------------------------------- 
17
+ */
18
+
19
 #include <SDL.h>
20
 
21
 #include "def.h"
22
@@ -14,8 +26,12 @@
23
 		if(klen == KBLEN) /* Buffer is full, drop some pieces */
24
 			memcpy(kbuffer, kbuffer + 1, --klen);
25
 		kbuffer[klen++] = event->key.keysym.sym;
26
-	}
27
 
28
+		/* ALT + Enter handling (fullscreen/windowed operation) */
29
+		if((event->key.keysym.sym == SDLK_RETURN || event->key.keysym.sym == SDLK_KP_ENTER) &&
30
+		    ((event->key.keysym.mod & KMOD_ALT) != 0))
31
+			switchmode();
32
+	}
33
 	if(event->type == SDL_QUIT)
34
 		exit(0);
35
 
36
@@ -28,7 +44,6 @@
37
 	
38
 	SDL_PumpEvents();
39
 	keys = SDL_GetKeyState(NULL);
40
-	
41
 	if (keys[key] == SDL_PRESSED )
42
 		return(TRUE);
43
 	else
(-)games/digger-vgl/files/patch-sdl_snd.c (-13 lines)
Lines 1-13 Link Here
1
2
$FreeBSD: ports/games/digger-vgl/files/patch-sdl_snd.c,v 1.1 2001/09/22 20:35:22 sobomax Exp $
3
4
--- sdl_snd.c	2001/09/22 19:20:28	1.1
5
+++ sdl_snd.c	2001/09/22 19:20:38
6
@@ -15,7 +15,6 @@
7
 
8
 bool initsounddevice(void)
9
 {
10
-//	SDL_PauseAudio(0);
11
 	return(TRUE);
12
 }
13
 
(-)games/digger-vgl/files/patch-sdl_vid.c (-157 lines)
Lines 1-157 Link Here
1
2
$FreeBSD: ports/games/digger-vgl/files/patch-sdl_vid.c,v 1.2 2001/09/22 20:35:22 sobomax Exp $
3
4
--- sdl_vid.c.orig	Mon Apr  3 23:42:42 2000
5
+++ sdl_vid.c	Thu Sep 13 01:24:35 2001
6
@@ -1,5 +1,18 @@
7
-#include <stdlib.h>
8
+/*
9
+ * ---------------------------------------------------------------------------
10
+ * "THE BEER-WARE LICENSE" (Revision 42, (c) Poul-Henning Kamp): Maxim
11
+ * Sobolev <sobomax@altavista.net> wrote this file. As long as you retain
12
+ * this  notice you can  do whatever you  want with this stuff. If we meet
13
+ * some day, and you think this stuff is worth it, you can buy me a beer in
14
+ * return.
15
+ * 
16
+ * Maxim Sobolev
17
+ * --------------------------------------------------------------------------- 
18
+ */
19
 
20
+/* malloc() and friends */
21
+#include <stdlib.h>
22
+/* Lovely SDL */
23
 #include <SDL.h>
24
 
25
 #include "def.h"
26
@@ -48,8 +61,11 @@
27
 SDL_Color *ipalettes[] = {vga16_pal1i, vga16_pal2i};
28
 Sint4	currpal=0;
29
 
30
+Uint32	addflag=0;
31
+
32
 SDL_Surface *screen = NULL;
33
 
34
+/* Data structure holding pending updates */
35
 struct PendNode {
36
 	void *prevnode;
37
 	void *nextnode;
38
@@ -77,6 +93,46 @@
39
 {
40
 }
41
 
42
+bool setmode(void)
43
+{
44
+	if((screen = SDL_SetVideoMode(640, 400, 8, \
45
+	    SDL_HWSURFACE | SDL_HWPALETTE | addflag)) == NULL)
46
+		return(FALSE);
47
+	else
48
+		return(TRUE);
49
+}
50
+
51
+void switchmode(void)
52
+{
53
+	Uint32 saved;
54
+	SDL_Surface *tmp = NULL;
55
+	SDL_Surface *oldscreen;
56
+	
57
+	vgageti(0, 0, (Uint3 *)&tmp, 80, 200);
58
+	oldscreen = screen;
59
+	saved = addflag;
60
+
61
+	if(addflag == 0)
62
+		addflag = SDL_FULLSCREEN;
63
+	else
64
+		addflag = 0;
65
+	if(setmode() == FALSE) {
66
+		addflag = saved;
67
+		if(setmode() == FALSE) {
68
+			fprintf(stderr, "Fatal: failed to change videomode and"\
69
+				"fallback mode failed as well. Exitting.\n");
70
+			exit(1);
71
+		}
72
+	}
73
+
74
+	SDL_SetColors(screen, tmp->format->palette->colors, 0, \
75
+		tmp->format->palette->ncolors);
76
+	vgaputi(0, 0, (Uint3 *)&tmp, 80, 200);
77
+	SDL_FreeSurface(tmp);
78
+	SDL_FreeSurface(oldscreen);
79
+}
80
+
81
+
82
 void vgainit(void)
83
 {
84
 	SDL_Surface *tmp = NULL;
85
@@ -92,7 +148,7 @@
86
 	}
87
 	SDL_WM_SetCaption("D I G G E R", NULL);
88
 	SDL_WM_SetIcon(tmp, NULL);
89
-	if ((screen = SDL_SetVideoMode(640, 400, 8, SDL_HWSURFACE | SDL_HWPALETTE)) == NULL) {
90
+	if(setmode() == FALSE) {
91
 		fprintf(stderr, "Couldn't set 640x480x8 video mode: %s\n", SDL_GetError());
92
 		exit(1);
93
         }
94
@@ -131,7 +187,6 @@
95
 {
96
 	struct PendNode *p;
97
 
98
-	SDL_UnlockSurface(screen);				
99
 	for(p=First;p!=NULL;)
100
 	{
101
 		SDL_UpdateRect(screen,p->rect.x,p->rect.y,p->rect.w,p->rect.h);
102
@@ -139,7 +194,6 @@
103
 		free(p);
104
 		p = First;
105
 	}
106
-	SDL_LockSurface(screen);
107
 	pendnum = 0;
108
 }
109
 
110
@@ -161,12 +215,26 @@
111
 	tmp->format->palette = screen->format->palette;
112
 	SDL_BlitSurface(tmp, NULL, screen, &new->rect);
113
 	tmp->format->palette = reserv;
114
+/* 
115
+ * Following piece of code comparing already pending updates with current with
116
+ * main goal to prevent redrawing overlapping rectangles several times.
117
+ */ 
118
 	
119
 	for(ptr=First;ptr!=NULL;ptr=ptr->nextnode) {
120
 		if((new->rect.x >= ptr->rect.x) &&
121
 		   (new->rect.y >= ptr->rect.y) &&
122
-		   ((new->rect.x+new->rect.w)<=(ptr->rect.x+ptr->rect.w)) &&
123
-		   ((new->rect.y+new->rect.h)<=(ptr->rect.y+ptr->rect.h))) {
124
+		   ((new->rect.x+new->rect.w) <= (ptr->rect.x+ptr->rect.w)) &&
125
+		   ((new->rect.y+new->rect.h) <= (ptr->rect.y+ptr->rect.h))) {
126
+			free(new);
127
+			return;
128
+		} else if((new->rect.x <= ptr->rect.x) &&
129
+		   (new->rect.y <= ptr->rect.y) &&
130
+		   ((new->rect.x+new->rect.w) >= (ptr->rect.x+ptr->rect.w)) &&
131
+		   ((new->rect.y+new->rect.h) >= (ptr->rect.y+ptr->rect.h))) {
132
+			ptr->rect.x = new->rect.x;
133
+			ptr->rect.y = new->rect.y;
134
+			ptr->rect.w = new->rect.w;
135
+			ptr->rect.h = new->rect.h;
136
 			free(new);
137
 			return;
138
 		}
139
@@ -211,6 +279,9 @@
140
 	Sint4 rval = 0;
141
 	Uint8 *pixels;
142
 
143
+	if ((x > 319) || (y > 199))
144
+	       return (0xff);
145
+
146
 	vgageti(x, y, (Uint3 *)&tmp, 1, 1);
147
 	pixels = (Uint8 *)tmp->pixels;
148
 	for (yi=0;yi<tmp->h;yi++)
149
@@ -260,6 +331,8 @@
150
 	Sint4 w=3, h=12, size;
151
 	Sint4 i;
152
 
153
+	if(((ch - 32) >= 0x5f) || (ch < 32))
154
+		return;
155
 	tmp = ch2bmap(alphas[ch-32], w, h);
156
 	size = tmp->w*tmp->h;
157
 	copy = malloc(size);
(-)games/digger-vgl/files/patch-sdl_vid.h (-10 lines)
Lines 1-10 Link Here
1
2
$FreeBSD: ports/games/digger-vgl/files/patch-sdl_vid.h,v 1.2 2001/09/22 20:35:22 sobomax Exp $
3
4
--- sdl_vid.h	2001/09/12 21:54:45	1.1
5
+++ sdl_vid.h	2001/09/12 21:54:59
6
@@ -1,2 +1,3 @@
7
-void doscreenupdate();
8
+void doscreenupdate(void);
9
+void switchmode(void);
10
 
(-)games/digger-vgl/files/patch-sound.c (-15 lines)
Lines 1-15 Link Here
1
2
$FreeBSD: ports/games/digger-vgl/files/patch-sound.c,v 1.1 2001/09/22 20:35:22 sobomax Exp $
3
4
--- sound.c.orig	Mon Apr  3 23:42:42 2000
5
+++ sound.c	Sat Sep 22 22:18:55 2001
6
@@ -172,6 +172,9 @@
7
 	if (!wave_device_available)
8
 		soundlevdoneflag=FALSE;
9
 #endif
10
+#if defined _SDL || defined _SDL_SOUND
11
+    SDL_Delay(10);	/* Let some CPU time go away */
12
+#endif
13
 #ifdef ARM
14
     gretrace();
15
     soundint();
(-)games/digger-vgl/pkg-plist (-2 / +4 lines)
Lines 1-3 Link Here
1
bin/digger
1
bin/digger
2
share/doc/digger/digger.txt
2
%%PORTDOCS%%%%DOCSDIR%%/digger.txt
3
@dirrm share/doc/digger
3
%%PORTDOCS%%@dirrm %%DOCSDIR%%
4
@unexec rmdir /var/games/digger 2>/dev/null || true
5
@exec mkdir -p /var/games/digger

Return to bug 55243