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_Surface *screen, *temps, *levelbg, *head, *head5, *icecube;
extern SDL_Surface *head2,*head52;
extern SDL_Surface *grave;
extern SDL_Surface *healthbar[];
extern SDL_Surface *greenbox, *redbox;
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 *screen; // the actual video screen
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 *icecube; // overlaid on frozen monsters
SDL_Surface *greenbox; // for fly spray effect

101
rc.c
View File

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

View File

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