X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fspeedmine.c;h=d7051c1ea12e558e77f2c56c85639f0cb34a1d6f;hp=64f8578a5ae27e9119e3d6206ead53e56cd5dc85;hb=a1d41b2aa6e18bf9a49b914a99dda8232c5d7762;hpb=3c58fb6311db49c46f1670922933b27c6ea0c065 diff --git a/hacks/speedmine.c b/hacks/speedmine.c index 64f8578a..d7051c1e 100644 --- a/hacks/speedmine.c +++ b/hacks/speedmine.c @@ -272,9 +272,14 @@ 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); - 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); xvals[t][j] = xoffset + width/2 +