summaryrefslogtreecommitdiff
path: root/x11/xscreensaver/patches/patch-ai
blob: c078273486580097c1a88732ff6c640cf5fce97b (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
58
59
60
$NetBSD: patch-ai,v 1.1 2005/07/17 17:39:57 kristerw Exp $

--- hacks/glx/antmaze.c.orig	Sun Jul 17 19:21:59 2005
+++ hacks/glx/antmaze.c	Sun Jul 17 19:28:25 2005
@@ -975,6 +975,7 @@
 
   /* fade out */
   if(fadeoutspeed < -0.00001) {
+    GLfloat df[4];
 
     if(fadeout <= 0.0) {
       /* switch boards: rebuild old board, increment current */
@@ -985,20 +986,27 @@
     
     fadeout += fadeoutspeed;
 
-    GLfloat df[4] = {0.8*fadeout, 0.8*fadeout, 0.8*fadeout, 1.0};
+    df[0] = 0.8*fadeout;
+    df[1] = 0.8*fadeout;
+    df[2] = 0.8*fadeout;
+    df[3] = 1.0;
     glLightfv(GL_LIGHT0, GL_DIFFUSE, df);
     glLightfv(GL_LIGHT1, GL_DIFFUSE, df);
   }
 
   /* fade in */
   if(fadeoutspeed > 0.0001) {
+    GLfloat df[4];
     fadeout += fadeoutspeed;
     if(fadeout >= 1.0) {
       fadeout = 1.0;
       fadeoutspeed = 0.0;
       entroducing = 12;
     }
-    GLfloat df[4] = {0.8*fadeout, 0.8*fadeout, 0.8*fadeout, 1.0};
+    df[0] = 0.8*fadeout;
+    df[1] = 0.8*fadeout; 
+    df[2] = 0.8*fadeout; 
+    df[3] = 1.0;
     glLightfv(GL_LIGHT0, GL_DIFFUSE, df);
     glLightfv(GL_LIGHT1, GL_DIFFUSE, df);    
   }
@@ -1159,7 +1167,7 @@
       /* difference */
       double dx = antpath[i][part[i]][0] - antposition[i][0];
       double dz = - antpath[i][part[i]][1] + antposition[i][1];
-      double theta, ideal;
+      double theta, ideal, dt;
 
       if(dz > EPSILON)
 	theta = atan(dz/dx);
@@ -1171,7 +1179,7 @@
 	ideal += Pi;
 
       /* compute correction */
-      double dt = sign(ideal) * min(fabs(ideal), PI/90.0);
+      dt = sign(ideal) * min(fabs(ideal), PI/90.0);
       antdirection[i] += dt;
       if(antdirection[i] > 2.0*PI)
 	antdirection[i] = 0.0;