From 13f67bd0888b8b4ccec1a1fb5516074423d0ec32 Mon Sep 17 00:00:00 2001 From: Joshua Grams Date: Fri, 29 Apr 2005 22:50:40 +0000 Subject: [PATCH] number of rocks on screen now starts at 25, gradually increasing to a max of 45 at 2:00 minutes into the game. See config.h: I_ROCKS/F_ROCKS. --- config.h | 2 ++ main.c | 3 +-- rocks.c | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/config.h b/config.h index 62b9fda..6b346c5 100644 --- a/config.h +++ b/config.h @@ -19,6 +19,8 @@ #define NROCKS 50 // image file containing font for score stuff. #define BIG_FONT_FILE "fonts/score.png" +#define I_ROCKS 25 // initial/final counts for rocks-on-screen. +#define F_ROCKS 45 #define MAXROCKS 120 // MAX Rocks #define MAXROCKHEIGHT 100 diff --git a/main.c b/main.c index 112d6d7..61b2caa 100644 --- a/main.c +++ b/main.c @@ -76,7 +76,7 @@ float gamerate; // this controls the speed of everything that moves. float bangx, bangy, bangdx, bangdy; -int nships,score,initticks,ticks_since_last, last_ticks; +int nships,score,ticks_since_last, last_ticks; int gameover; int maneuver = 0; int sound_flag, music_flag; @@ -897,7 +897,6 @@ main(int argc, char **argv) { } reset_rocks(); - initticks = SDL_GetTicks(); gameloop(); return 0; diff --git a/rocks.c b/rocks.c index ca921cf..19918ed 100644 --- a/rocks.c +++ b/rocks.c @@ -24,7 +24,10 @@ struct shape rock_shapes[NROCKS]; // 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. @@ -50,7 +53,6 @@ init_rocks(void) NULLERROR(surf_rock[i] = SDL_DisplayFormat(temp)); get_shape(surf_rock[i], &rock_shapes[i]); } - nrocks = 41; return 0; } @@ -60,6 +62,8 @@ reset_rocks(void) int i; for(i = 0; i= nrocks_inc_ticks) { + nrocks_timer -= nrocks_inc_ticks; + nrocks++; + } + } + rock_timer_increments(ti); for(i=0; i<4; i++) { -- 1.7.10.4