Modified gunner powerup to exit as soon as you kill the last un-caught

monster
This commit is contained in:
Rob Pearce 2008-11-04 20:03:05 +00:00
parent 6094920eab
commit 3c3d6b3b89
2 changed files with 27 additions and 2 deletions

28
rc.c
View File

@ -460,10 +460,15 @@ int main (int argc, char **argv) {
}
}
}
if (player->powerup == PW_GUNNER) { // red overlay for machine gunner
// gunner effect - red overlay
if (player->powerup == PW_GUNNER) {
if (levelcomplete != LV_DOPOKER) {
SDL_BlitSurface(redbox,NULL,screen,NULL);
}
if (uncaughtmonsters() <= 0) {
// finish if no monsters are left alive & uncaught
losepowerup(player);
}
}
/**********************************************
@ -885,12 +890,14 @@ void tick(void) {
// never reach hurryup time
resethurryup(curlevel);
// decrement counter
guntime--;
if (guntime < 0) {
// finished!
losepowerup(player);
}
}
}
}
@ -1443,6 +1450,23 @@ int countmonsters(int montype) {
return mcount;
}
// count of monsters left alive and uncaught
int uncaughtmonsters(void) {
sprite_t *s2;
int mcount;
mcount = 0;
/* any monsters left? */
for (s2 = sprite->next ; s2 ; s2 = s2->next) {
if (ismonster(s2->id) && !s2->dead && !s2->caughtby) {
if (s2->id != P_BLACKCLOUD) {
mcount++;
}
}
}
return mcount;
}
void cleanup(void) {
int i;
printf("commencing cleanup routine....\n");

1
rc.h
View File

@ -104,3 +104,4 @@ void keeponscreen(sprite_t *s);
void stopteleporting(sprite_t *s);
void losepowerup(sprite_t *s);
int easymode(void);
int uncaughtmonsters(void);