Fixed boxing glove bug - wasn't ever finishing level
This commit is contained in:
parent
f6d5d4285e
commit
579526c983
48
rc.c
48
rc.c
|
@ -200,6 +200,8 @@ int main (int argc, char **argv) {
|
||||||
s->invuln = INVULNTIME;
|
s->invuln = INVULNTIME;
|
||||||
} else {
|
} else {
|
||||||
killsprite(s);
|
killsprite(s);
|
||||||
|
// check for level completion
|
||||||
|
countmonsters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,6 +249,13 @@ int main (int argc, char **argv) {
|
||||||
toggletimer = 50;
|
toggletimer = 50;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// dump sprites
|
||||||
|
if (keys[SDLK_d]) {
|
||||||
|
if (toggletimer == 0) {
|
||||||
|
dumpsprites();
|
||||||
|
toggletimer = 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (keys[SDLK_RETURN]) {
|
if (keys[SDLK_RETURN]) {
|
||||||
if (toggletimer == 0) {
|
if (toggletimer == 0) {
|
||||||
SDL_WM_ToggleFullScreen(screen);
|
SDL_WM_ToggleFullScreen(screen);
|
||||||
|
@ -525,8 +534,6 @@ void nextlevel(void) {
|
||||||
// remove the player
|
// remove the player
|
||||||
removesprite(player);
|
removesprite(player);
|
||||||
|
|
||||||
// don't want the player flashing
|
|
||||||
player->invuln = 0;
|
|
||||||
|
|
||||||
/* in case we skipped the level due to a powerup etc */
|
/* in case we skipped the level due to a powerup etc */
|
||||||
levelcomplete = LV_NEXTLEV;
|
levelcomplete = LV_NEXTLEV;
|
||||||
|
@ -537,10 +544,15 @@ void nextlevel(void) {
|
||||||
playmusic(normalmusic);
|
playmusic(normalmusic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// don't want the player flashing while scrolling
|
||||||
|
player->invuln = 0;
|
||||||
|
|
||||||
// these two handle the scroll effect to the next level
|
// these two handle the scroll effect to the next level
|
||||||
loadlevel(curworld,curlevelnum);
|
loadlevel(curworld,curlevelnum);
|
||||||
drawlevel();
|
drawlevel();
|
||||||
|
|
||||||
|
// now the player gets invincibility
|
||||||
|
player->invuln = INVULNTIME;
|
||||||
|
|
||||||
/* reset game stats */
|
/* reset game stats */
|
||||||
levelcomplete = LV_INIT;
|
levelcomplete = LV_INIT;
|
||||||
|
@ -583,7 +595,6 @@ void jump(sprite_t *s, int dir) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void die(sprite_t *s) {
|
void die(sprite_t *s) {
|
||||||
int mcount = 0;
|
|
||||||
sprite_t *s2;
|
sprite_t *s2;
|
||||||
/* clouds can't die like this */
|
/* clouds can't die like this */
|
||||||
if (s->id == P_CLOUD) return;
|
if (s->id == P_CLOUD) return;
|
||||||
|
@ -617,6 +628,16 @@ void die(sprite_t *s) {
|
||||||
s->netting = 0;
|
s->netting = 0;
|
||||||
s->slamming = 0;
|
s->slamming = 0;
|
||||||
|
|
||||||
|
// check for level clear
|
||||||
|
countmonsters();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// check whether the level has been won
|
||||||
|
void countmonsters(void) {
|
||||||
|
sprite_t *s2;
|
||||||
|
int mcount;
|
||||||
|
mcount = 0;
|
||||||
/* any monsters left? */
|
/* any monsters left? */
|
||||||
if (!levelcomplete) {
|
if (!levelcomplete) {
|
||||||
for (s2 = sprite->next ; s2 ; s2 = s2->next) {
|
for (s2 = sprite->next ; s2 ; s2 = s2->next) {
|
||||||
|
@ -2729,6 +2750,8 @@ int randompowerup(void) {
|
||||||
num = rand() % 4;
|
num = rand() % 4;
|
||||||
|
|
||||||
|
|
||||||
|
return P_BOXING;
|
||||||
|
|
||||||
switch (num) {
|
switch (num) {
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
|
@ -2741,3 +2764,22 @@ int randompowerup(void) {
|
||||||
return P_BOXING;
|
return P_BOXING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dumpsprites(void) {
|
||||||
|
sprite_t *s;
|
||||||
|
int i = 0;
|
||||||
|
int mcount = 0;
|
||||||
|
for (s = sprite; s ; s = s->next) {
|
||||||
|
printf("Sprite #%d: %s at %1.0f,%1.0f id=%d (",i,s->name,s->x,s->y, s->id);
|
||||||
|
if (ismonster(s->id)) { printf("MONSTER, "); mcount++; }
|
||||||
|
if (isfruit(s->id)) printf("FRUIT, ");
|
||||||
|
if (isflower(s->id)) printf("FLOWER, ");
|
||||||
|
if (isbullet(s->id)) printf("BULLET, ");
|
||||||
|
if (iseffect(s->id)) printf("EFFECT, ");
|
||||||
|
printf(")\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("--------\n");
|
||||||
|
printf("Total monsters: %d\n",mcount);
|
||||||
|
printf("\n\n");
|
||||||
|
}
|
||||||
|
|
2
rc.h
2
rc.h
|
@ -41,3 +41,5 @@ void channeldone(int channel);
|
||||||
void movetostart(sprite_t *p, int dstx, int dsty, int speed);
|
void movetostart(sprite_t *p, int dstx, int dsty, int speed);
|
||||||
SDL_Surface *grabbehind(sprite_t *s, SDL_Surface *surf);
|
SDL_Surface *grabbehind(sprite_t *s, SDL_Surface *surf);
|
||||||
int randompowerup(void);
|
int randompowerup(void);
|
||||||
|
void dumpsprites(void);
|
||||||
|
void countmonsters(void);
|
||||||
|
|
Loading…
Reference in New Issue