X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=rocks.c;h=ed98cac172b5781bd55f2a13ef705a8285eecfcd;hp=89efb6ec5172b3733a4387a46b8b2abcba066709;hb=148882a3cc520f34616a1175ed157fe258d68dcc;hpb=5c8f059629c2127848ce4051296d2f5897bf5c0f diff --git a/rocks.c b/rocks.c index 89efb6e..ed98cac 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; @@ -206,7 +210,7 @@ blast_rocks(float x, float y, float radius) float dx, dy, n; for(i=0; ix <= 0) continue;