projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ftp://ftp.krokus.ru/pub/OpenBSD/distfiles/xscreensaver-4.22.tar.gz
[xscreensaver]
/
hacks
/
speedmine.c
diff --git
a/hacks/speedmine.c
b/hacks/speedmine.c
index 64f8578a5ae27e9119e3d6206ead53e56cd5dc85..aac2d18bcc98f46b3e676ce087e92613285a5f9c 100644
(file)
--- a/
hacks/speedmine.c
+++ b/
hacks/speedmine.c
@@
-116,6
+116,11
@@
static double step=0.0;
#define BACKWARDS -1
static int direction = FORWARDS;
#define BACKWARDS -1
static int direction = FORWARDS;
+/* Apparently AIX's math.h bogusly defines `nearest' as a function,
+ in violation of the ANSI C spec. */
+#undef nearest
+#define nearest n3arest
+
static int pindex=0, nearest=0;
static int flipped_at=0;
static int xoffset=0, yoffset=0;
static int pindex=0, nearest=0;
static int flipped_at=0;
static int xoffset=0, yoffset=0;
@@
-272,12
+277,17
@@
perspective (void)
zfactor = (double)depth* (12.0 - TERRAIN_LENGTH/8.0) * zf;
for (j=0; j < TERRAIN_BREADTH; j++) {
jj = direction * j; MODULO(jj, TERRAIN_BREADTH);
zfactor = (double)depth* (12.0 - TERRAIN_LENGTH/8.0) * zf;
for (j=0; j < TERRAIN_BREADTH; j++) {
jj = direction * j; MODULO(jj, TERRAIN_BREADTH);
- xx = (worldx[i][jj]-(vertigo*xcc))/zfactor;
- yy = (worldy[i][j]-(vertigo*ycc))/zfactor;
-
+ /* jwz: not totally sure if this is right, but it avoids div0 */
+ if (zfactor != 0) {
+ xx = (worldx[i][jj]-(vertigo*xcc))/zfactor;
+ yy = (worldy[i][j]-(vertigo*ycc))/zfactor;
+ } else {
+ xx = 0;
+ yy = 0;
+ }
r = rotation_bias + (int)(vertigo*zcc); MODULO(r, ROTS);
r = rotation_bias + (int)(vertigo*zcc); MODULO(r, ROTS);
- xvals[t][j] = xoffset +
width/2
+
+ xvals[t][j] = xoffset +
(width>>1)
+
(int)(xx * costab[r] - yy * sintab[r]);
maxx[t] = MAX(maxx[t], xvals[t][j]);
minx[t] = MIN(minx[t], xvals[t][j]);
(int)(xx * costab[r] - yy * sintab[r]);
maxx[t] = MAX(maxx[t], xvals[t][j]);
minx[t] = MIN(minx[t], xvals[t][j]);