// timers for rock generation.
float rtimers[4];
-int nrocks;
+
+uint32_t nrocks;
+uint32_t nrocks_timer;
+uint32_t nrocks_inc_ticks = 2*60*1000/(F_ROCKS-I_ROCKS);
// constants for rock generation.
#define KH 32.0 // 32 s for a speed=1 rock to cross the screen horizontally.
NULLERROR(surf_rock[i] = SDL_DisplayFormat(temp));
get_shape(surf_rock[i], &rock_shapes[i]);
}
- nrocks = 41;
return 0;
}
int i;
for(i = 0; i<MAXROCKS; i++) rock[i].active = 0;
+ nrocks = I_ROCKS;
+ nrocks_timer = 0;
}
enum { LEFT, RIGHT, TOP, BOTTOM };
{
int i,j;
float ti[4];
- float x, y;
+
+ if(nrocks < F_ROCKS) {
+ nrocks_timer += ticks_since_last;
+ if(nrocks_timer >= nrocks_inc_ticks) {
+ nrocks_timer -= nrocks_inc_ticks;
+ nrocks++;
+ }
+ }
rock_timer_increments(ti);
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) fprintf(stderr, "had to try %d times.\n", j);
+ rockptr->dx = RDX*crnd();
+ rockptr->dy = RDY*crnd();
rockptr->active = 1;
}
int i;
float dx, dy, n;
+ if(onlyslow) return;
+
for(i = 0; i<MAXROCKS; i++ ) {
if(rock[i].x <= 0) continue;
n = sqrt(dx*dx + dy*dy);
if(n < radius) {
- n *= 20;
- rock[i].dx += 54.0*(dx+30)/n;
+ n *= 15;
+ rock[i].dx += 54.0*dx/n;
rock[i].dy += 54.0*dy/n;
}
}