X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=rocks.c;h=5f637e038c678d3736a5e72e1f3c7e73eda2db37;hp=89efb6ec5172b3733a4387a46b8b2abcba066709;hb=0224eb908d4084f52a22c8d64404a0efb4acfa35;hpb=5c8f059629c2127848ce4051296d2f5897bf5c0f diff --git a/rocks.c b/rocks.c index 89efb6e..5f637e0 100644 --- a/rocks.c +++ b/rocks.c @@ -17,9 +17,11 @@ static struct rock prototypes[NROCKS]; // timers for rock generation. static float rtimers[4]; -uint32_t nrocks = I_ROCKS; +uint32_t nrocks = NORMAL_I_ROCKS; +uint32_t initial_rocks = NORMAL_I_ROCKS; +uint32_t final_rocks = NORMAL_F_ROCKS; float nrocks_timer = 0; -float nrocks_inc_ticks = 2*60*20/(F_ROCKS-I_ROCKS); +float nrocks_inc_ticks = 2*60*20/(NORMAL_F_ROCKS-NORMAL_I_ROCKS); // constants for rock generation. #define KH (32*20) // 32 s for a speed=1 rock to cross the screen horizontally. @@ -30,7 +32,8 @@ float nrocks_inc_ticks = 2*60*20/(F_ROCKS-I_ROCKS); void reset_rocks(void) { - nrocks = I_ROCKS; + nrocks = initial_rocks; + nrocks_inc_ticks = 2*60*20/(final_rocks-initial_rocks); nrocks_timer = 0; } @@ -45,13 +48,14 @@ load_rocks(void) for(i=0; i= nrocks_inc_ticks) { nrocks_timer -= nrocks_inc_ticks; @@ -150,8 +154,8 @@ new_rocks(void) for(i=0; i<4; i++) { while(rtimers[i] >= 1) { rtimers[i] -= 1; - if(!free_sprites[ROCK_SPRITE]) return; // sorry, we ran out of rocks! - r = (struct rock *) remove_sprite(&free_sprites[ROCK_SPRITE]); + if(!free_sprites[ROCK]) return; // sorry, we ran out of rocks! + r = (struct rock *) remove_sprite(&free_sprites[ROCK]); type = urnd() % NROCKS; *r = prototypes[type]; r->type = type; @@ -197,27 +201,3 @@ draw_rocks(void) int i; for(i=0; ix <= 0) continue; - - dx = r->x - x; - dy = r->y - y; - - n = sqrt(dx*dx + dy*dy); - if(n < radius) { - n *= 15; - r->dx += 54.0*dx/n; - r->dy += 54.0*dy/n; - } - } -}