Now displaying a tombstone when you lose all your lives

This commit is contained in:
Rob Pearce 2008-11-12 07:23:10 +00:00
parent 39556cf003
commit e6809268b5
5 changed files with 64 additions and 41 deletions

BIN
data/sprites/gravestone.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

1
defs.h
View File

@ -886,6 +886,7 @@ extern char progname[];
extern SDL_Color black; extern SDL_Color black;
extern SDL_Surface *screen, *temps, *levelbg, *head, *head5, *icecube; extern SDL_Surface *screen, *temps, *levelbg, *head, *head5, *icecube;
extern SDL_Surface *head2,*head52; extern SDL_Surface *head2,*head52;
extern SDL_Surface *grave;
extern SDL_Surface *healthbar[]; extern SDL_Surface *healthbar[];
extern SDL_Surface *greenbox, *redbox; extern SDL_Surface *greenbox, *redbox;
extern sprite_t *sprite, *lastsprite, *player, *player2, *boss; extern sprite_t *sprite, *lastsprite, *player, *player2, *boss;

View File

@ -31,6 +31,7 @@ SDL_Surface *levelbg; // level background image
SDL_Surface *temps; // temporary surface SDL_Surface *temps; // temporary surface
SDL_Surface *screen; // the actual video screen SDL_Surface *screen; // the actual video screen
SDL_Surface *head,*head5; // imgs in corner showing number of lives SDL_Surface *head,*head5; // imgs in corner showing number of lives
SDL_Surface *grave;
SDL_Surface *head2,*head52; // imgs in corner showing number of lives SDL_Surface *head2,*head52; // imgs in corner showing number of lives
SDL_Surface *icecube; // overlaid on frozen monsters SDL_Surface *icecube; // overlaid on frozen monsters
SDL_Surface *greenbox; // for fly spray effect SDL_Surface *greenbox; // for fly spray effect

101
rc.c
View File

@ -4958,23 +4958,32 @@ void drawscore(void) {
// lives // lives
// show 1 less than lives if (player->lives > 0) {
numtoshow = player->lives-1; // show 1 less than lives
area.x = P1LIVESX; numtoshow = player->lives-1;
area.y = LIVESY; area.x = P1LIVESX;
area.w = 0; area.y = LIVESY;
area.h = 0; area.w = 0;
area.h = 0;
// show "x5" for lots of lives // show "x5" for lots of lives
while (numtoshow >= 5) { while (numtoshow >= 5) {
SDL_BlitSurface(head5, NULL, screen, &area); SDL_BlitSurface(head5, NULL, screen, &area);
area.x += (head->w + 3); area.x += (head->w + 3);
numtoshow -= 5; numtoshow -= 5;
} }
for (i = 0; i < numtoshow; i++) { for (i = 0; i < numtoshow; i++) {
SDL_BlitSurface(head, NULL, screen, &area); SDL_BlitSurface(head, NULL, screen, &area);
area.x += (head->w + 3); area.x += (head->w + 3);
}
} else {
area.x = P1LIVESX;
area.y = LIVESY;
area.w = 0;
area.h = 0;
SDL_BlitSurface(grave, NULL, screen, &area);
} }
@ -5022,35 +5031,45 @@ void drawscore(void) {
// lives // lives
// show 1 less than lives if (player2->lives > 0) {
numtoshow = player2->lives-1; // show 1 less than lives
area.x = 640 - P1LIVESX; numtoshow = player2->lives-1;
area.y = LIVESY; area.x = 640 - P1LIVESX;
area.w = 0; area.y = LIVESY;
area.h = 0; area.w = 0;
area.h = 0;
// go left correct amount // go left correct amount
numtoshow2 = numtoshow; numtoshow2 = numtoshow;
while (numtoshow2 >= 5) { while (numtoshow2 >= 5) {
area.x -= (head2->w + 3); area.x -= (head2->w + 3);
numtoshow2 -= 5; numtoshow2 -= 5;
} }
for (i = 0; i < numtoshow2; i++) { for (i = 0; i < numtoshow2; i++) {
area.x -= (head2->w + 3); area.x -= (head2->w + 3);
} }
// now start displaying
// show "x5" for lots of lives // now start displaying
while (numtoshow >= 5) {
SDL_BlitSurface(head52, NULL, screen, &area);
area.x += (head2->w + 3);
numtoshow -= 5;
}
for (i = 0; i < numtoshow; i++) { // show "x5" for lots of lives
SDL_BlitSurface(head2, NULL, screen, &area); while (numtoshow >= 5) {
area.x += (head2->w + 3); SDL_BlitSurface(head52, NULL, screen, &area);
area.x += (head2->w + 3);
numtoshow -= 5;
}
for (i = 0; i < numtoshow; i++) {
SDL_BlitSurface(head2, NULL, screen, &area);
area.x += (head2->w + 3);
}
} else {
area.x = 640 - P1LIVESX - (head2->w);
area.y = LIVESY;
area.w = 0;
area.h = 0;
SDL_BlitSurface(grave, NULL, screen, &area);
} }
@ -9545,7 +9564,7 @@ void startgame(void) {
player2->armour = B_FALSE; player2->armour = B_FALSE;
player2->id = P_PLAYER2; player2->id = P_PLAYER2;
} }
player2->lives = 1; player2->lives = 3;
} }
forcegoodcard = B_FALSE; forcegoodcard = B_FALSE;

View File

@ -1103,6 +1103,8 @@ int loadimagesets(void) {
SDL_Surface *reds; SDL_Surface *reds;
char tempfile[BUFLEN]; char tempfile[BUFLEN];
sprintf(tempfile, "%s/sprites/gravestone.png",datadir);
grave = IMG_Load(tempfile);
sprintf(tempfile, "%s/sprites/dwarfhead.png",datadir); sprintf(tempfile, "%s/sprites/dwarfhead.png",datadir);
head = IMG_Load(tempfile); head = IMG_Load(tempfile);