JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added constant MAX_DUST_DEPTHS.
[vor.git] / rocks.c
diff --git a/rocks.c b/rocks.c
index 7de0c2f..5c23b81 100644 (file)
--- a/rocks.c
+++ b/rocks.c
@@ -68,9 +68,11 @@ void
 rock_timer_increments(float *ti)
 {
        float dx0,dx1, dy0,dy1;
+       float hfactor, vfactor;
        int i;
 
        for(i=0; i<4; i++) ti[i] = 0;
+       hfactor = nrocks/KH; vfactor = nrocks/KV;
 
        dx0 = -RDX - screendx; dx1 = RDX - screendx;
        dy0 = -RDY - screendy; dy1 = RDY - screendy;
@@ -84,6 +86,8 @@ rock_timer_increments(float *ti)
                        }
                } else ti[LEFT] = (dx0+dx1)/2;
        }
+       ti[LEFT] *= hfactor;
+       ti[RIGHT] *= hfactor;
 
        if(dy0 != 0) {
                if(dy0 < 0) {
@@ -94,6 +98,8 @@ rock_timer_increments(float *ti)
                        }
                } else ti[TOP] = (dy0+dy1)/2;
        }
+       ti[TOP] *= vfactor;
+       ti[BOTTOM] *= vfactor;
 }
 
 void
@@ -101,7 +107,6 @@ new_rocks(void)
 {
        int i,j;
        float ti[4];
-       float x, y;
 
        rock_timer_increments(ti);
 
@@ -137,16 +142,8 @@ new_rocks(void)
                                                break;
                                }
 
-                               j=0;
-                               do {
-                                       rockptr->dx = RDX*crnd();
-                                       rockptr->dy = RDY*crnd();
-                                       x = (rockptr->dx-screendx)*gamerate;
-                                       y = (rockptr->dy-screendy)*gamerate;
-                                       j++;
-                               } while(x < -rockptr->image->w || x >= XSIZE
-                                               || y < -rockptr->image->h || y >= YSIZE);
-                               if(j > 1) printf("had to try %d times.\n", j);
+                               rockptr->dx = RDX*crnd();
+                               rockptr->dy = RDY*crnd();
 
                                rockptr->active = 1;
                        }
@@ -232,7 +229,7 @@ blast_rocks(float x, float y, float radius, int onlyslow)
                n = sqrt(dx*dx + dy*dy);
                if(n < radius) {
                        n *= 20;
-                       rock[i].dx += 54.0*(dx+30)/n;
+                       rock[i].dx += 54.0*dx/n;
                        rock[i].dy += 54.0*dy/n;
                }
        }