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

21
rc.c
View File

@ -4958,6 +4958,7 @@ void drawscore(void) {
// lives // lives
if (player->lives > 0) {
// show 1 less than lives // show 1 less than lives
numtoshow = player->lives-1; numtoshow = player->lives-1;
area.x = P1LIVESX; area.x = P1LIVESX;
@ -4976,6 +4977,14 @@ void drawscore(void) {
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);
}
// cards // cards
@ -5022,6 +5031,7 @@ void drawscore(void) {
// lives // lives
if (player2->lives > 0) {
// show 1 less than lives // show 1 less than lives
numtoshow = player2->lives-1; numtoshow = player2->lives-1;
area.x = 640 - P1LIVESX; area.x = 640 - P1LIVESX;
@ -5039,6 +5049,7 @@ void drawscore(void) {
area.x -= (head2->w + 3); area.x -= (head2->w + 3);
} }
// now start displaying // now start displaying
// show "x5" for lots of lives // show "x5" for lots of lives
@ -5052,6 +5063,14 @@ void drawscore(void) {
SDL_BlitSurface(head2, NULL, screen, &area); SDL_BlitSurface(head2, NULL, screen, &area);
area.x += (head2->w + 3); 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);
}
// cards // cards
@ -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);