summaryrefslogtreecommitdiff
path: root/games/jetpack/patches/patch-erase.c
blob: b0dd90085a1d8fbbfc28d448d9f16cf3c3976267 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
$NetBSD: patch-erase.c,v 1.1 2013/01/15 15:19:05 joerg Exp $

--- erase.c.orig	1992-03-29 19:41:20.000000000 +0000
+++ erase.c
@@ -8,9 +8,12 @@
 /*	Note: the functions and variables in this file are not used in the
 	blitting version.
 */
+static void draw_recur(int i);
+static void erase_recur(int i);
 
 #ifndef BLIT
 
+#define MAXTOUCH 10
 #define MAXOBJECTS 6+MAXLINES+MAXFIREBALLS+MAXSWEEPERS+MAXFUELPODS+MAXGUARDS+MAXHIGHSCORES/5
 
 /*	Structure for eraseable zones that minimize flicker
@@ -19,7 +22,7 @@ struct zone {
 	int	type, num;
 	int	x, y, w, h;
 	int	numtouch;
-	int	touch[MAXOBJECTS];
+	int	touch[MAXTOUCH];
 	int	erased, drawn;
 };
 
@@ -57,6 +60,10 @@ int	x, y, w, h, type, num;
 		if(zone_intersect(numzones,j)) {
 			zones[j].touch[zones[j].numtouch] = numzones;
 			zones[j].numtouch++;
+			if (zones[j].numtouch == MAXTOUCH) {
+				zones[j].numtouch = -1;
+				printf("Reached maxtouch for zone %d\n", numzones);
+			}
 			break;
 		}
 	}
@@ -115,8 +122,7 @@ erase_draw_zones()
 
 /*	erase_recur erases zone i and all the zones that touch it.
 */
-erase_recur(i)
-int	i;
+static void erase_recur(int i)
 {
 	register int	j;
 
@@ -137,8 +143,7 @@ int	i;
 /*	draw_recur draws the object associated with zone i and the objects
 	associated with all the zones that touch it.
 */
-draw_recur(i)
-int	i;
+static void draw_recur(int i)
 {
 	register int	j, tmp;