Modified gunner powerup to exit as soon as you kill the last un-caught
monster
This commit is contained in:
parent
6094920eab
commit
3c3d6b3b89
28
rc.c
28
rc.c
|
@ -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) {
|
if (levelcomplete != LV_DOPOKER) {
|
||||||
SDL_BlitSurface(redbox,NULL,screen,NULL);
|
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
|
// never reach hurryup time
|
||||||
resethurryup(curlevel);
|
resethurryup(curlevel);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// decrement counter
|
// decrement counter
|
||||||
guntime--;
|
guntime--;
|
||||||
if (guntime < 0) {
|
if (guntime < 0) {
|
||||||
// finished!
|
// finished!
|
||||||
losepowerup(player);
|
losepowerup(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1443,6 +1450,23 @@ int countmonsters(int montype) {
|
||||||
return mcount;
|
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) {
|
void cleanup(void) {
|
||||||
int i;
|
int i;
|
||||||
printf("commencing cleanup routine....\n");
|
printf("commencing cleanup routine....\n");
|
||||||
|
|
Loading…
Reference in New Issue