summaryrefslogtreecommitdiff
blob: 19da515feff9ab241948d7c8a661c2816644fe22 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
Subject: [PATCH] Fix variable type mismatch in hyperspace
From: Alexander Miller <alex.miller@gmx.de>
Date: Sun, 31 Mar 2024 2024-03-31 03:08:04 +0200

Some source files of hyperspace (flare.cpp, goo.cpp, starBurst.cpp)
were referring to a variable "extern float frameTime" which doesn't
exist in hyperspace (it's only a parameter of hack_draw() nowadays).

It got mixed up with the driver.c variable "int frameTime".

Remove the mismatched declaration from the 3 files and pass the value
from hack_draw() to the functions using it by adding a new parameter.
Also make frameTime (and most other variables) in driver.c static.

Bug: https://bugs.gentoo.org/928251
Signed-off-by: Alexander Miller <alex.miller@gmx.de>
--- a/src/driver.c
+++ b/src/driver.c
@@ -49,24 +49,24 @@
 
 #include "vroot.h"
 
-xstuff_t *XStuff;
+static xstuff_t *XStuff;
 
 extern const char *hack_name;
 
 /*
  * display parameters
  */
-int rootWindow = False;
+static int rootWindow = False;
 int glewInitialized = False;
 #ifdef HAVE_GLEW
-int frameTime = 10000;
-int vsync = 1;
+static int frameTime = 10000;
+static int vsync = 1;
 #else
-int frameTime = 33333;
-int vsync = 0;
+static int frameTime = 33333;
+static int vsync = 0;
 #endif
-int idleOnDPMS = 1;
-int signalled = 0;
+static int idleOnDPMS = 1;
+static volatile int signalled = 0;
 
 void createWindow (int argc, char **argv)
 {
--- a/src/flare.cpp
+++ b/src/flare.cpp
@@ -45,7 +45,6 @@ extern double modelMat[16];
 extern double projMat[16];
 extern int viewport[4];
 // Calculated in main draw routine each frame
-extern float frameTime;
 extern float camPos[3];
 
 
@@ -182,7 +181,7 @@ void initFlares(){
 // Draw a flare at a specified (x,y) location on the screen
 // Screen corners are at (0,0) and (1,1)
 // alpha = 0.0 for lowest intensity; alpha = 1.0 for highest intensity
-void flare(double *pos, float red, float green, float blue, float alpha){
+void flare(double *pos, float red, float green, float blue, float alpha, float frameTime){
 	double winx, winy, winz;  // in screen coordinates
 	float x, y, dx, dy;
 	float fadewidth, temp;
--- a/src/flare.h
+++ b/src/flare.h
@@ -36,7 +36,7 @@ void initFlares();
 // Draw a flare at a specified (x,y) location on the screen
 // Screen corners are at (0,0) and (1,1)
 // alpha = 0.0 for lowest intensity; alpha = 1.0 for highest intensity
-void flare(double *pos, float red, float green, float blue, float alpha);
+void flare(double *pos, float red, float green, float blue, float alpha, float frameTime);
 
 
 #endif  // FLARE_H
--- a/src/goo.cpp
+++ b/src/goo.cpp
@@ -25,9 +25,7 @@
 #include "goo.h"
 
 
-extern float frameTime, simulationTime;
 extern float shiftx, shiftz;
-extern float dFov;
 
 
 goo::goo(int res, float rad, float (*func)(float* position)){
--- a/src/hyperspace.cpp
+++ b/src/hyperspace.cpp
@@ -340,10 +340,10 @@ void hack_draw (xstuff_t * XStuff, doubl
 	}
 #ifdef HAVE_GLEW
 	if (dShaders)
-		theStarBurst->draw(lerp);
+		theStarBurst->draw(frameTime, lerp);
 	else
 #endif
-		theStarBurst->draw();
+		theStarBurst->draw(frameTime);
 
 	// draw tunnel
 	theTunnel->make(frameTime);
@@ -379,7 +379,7 @@ void hack_draw (xstuff_t * XStuff, doubl
 	float diff[3] = {(float)flarepos[0] - camPos[0], (float)flarepos[1] - camPos[1], (float)flarepos[2] - camPos[2]};
 	float alpha = 0.5f - 0.005f * sqrtf(diff[0] * diff[0] + diff[1] * diff[1] + diff[2] * diff[2]);
 	if(alpha > 0.0f)
-		flare(flarepos, 1.0f, 1.0f, 1.0f, alpha);
+		flare(flarepos, 1.0f, 1.0f, 1.0f, alpha, frameTime);
 	glEnable(GL_FOG);
 }
 
--- a/src/starBurst.cpp
+++ b/src/starBurst.cpp
@@ -38,7 +38,6 @@
 
 extern int xsize, ysize;
 extern float aspectRatio;
-extern float frameTime;
 extern float camPos[3];
 extern int numAnimTexFrames;
 extern wavyNormalCubeMaps* theWNCM;
@@ -136,7 +135,7 @@ void starBurst::restart(float* position)
 }
 
 
-void starBurst::drawStars(){
+void starBurst::drawStars(float frameTime){
 	int i;
 	float distance;
 
@@ -158,8 +157,8 @@ void starBurst::drawStars(){
 }
 
 
-void starBurst::draw(){
-	drawStars();
+void starBurst::draw(float frameTime){
+	drawStars(frameTime);
 	
 	size += frameTime * 0.5f;
 	if(size >= 3.0f)
@@ -172,7 +171,7 @@ void starBurst::draw(float frameTime){
 		p[0] = pos[0];
 		p[1] = pos[1];
 		p[2] = pos[2];
-		flare(p, 1.0f, 1.0f, 1.0f, brightness);
+		flare(p, 1.0f, 1.0f, 1.0f, brightness, frameTime);
 	}
 
 	glMatrixMode(GL_MODELVIEW);
@@ -201,8 +200,8 @@ void starBurst::draw(){
 
 
 #ifdef HAVE_GLEW
-void starBurst::draw(float lerp){
-	drawStars();
+void starBurst::draw(float frameTime, float lerp){
+	drawStars(frameTime);
 	
 	size += frameTime * 0.5f;
 	if(size >= 3.0f)
@@ -215,7 +214,7 @@ void starBurst::draw(float frameTime, fl
 		p[0] = pos[0];
 		p[1] = pos[1];
 		p[2] = pos[2];
-		flare(p, 1.0f, 1.0f, 1.0f, brightness);
+		flare(p, 1.0f, 1.0f, 1.0f, brightness, frameTime);
 	}
 
 	glMatrixMode(GL_MODELVIEW);
--- a/src/starBurst.h
+++ b/src/starBurst.h
@@ -43,10 +43,10 @@ public:
 	starBurst();
 	~starBurst();
 	void restart(float* position);
-	void drawStars();
-	void draw();  // draw regular
+	void drawStars(float frameTime);
+	void draw(float frameTime);  // draw regular
 #ifdef HAVE_GLEW
-	void draw(float lerp);  // draw with shaders
+	void draw(float frameTime, float lerp);  // draw with shaders
 #endif
 };