From e6809268b57efea32dfb2936ee683291ff984a62 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Wed, 12 Nov 2008 07:23:10 +0000 Subject: [PATCH] Now displaying a tombstone when you lose all your lives --- data/sprites/gravestone.png | Bin 0 -> 1298 bytes defs.h | 1 + globals.h | 1 + rc.c | 101 +++++++++++++++++++++--------------- shared.c | 2 + 5 files changed, 64 insertions(+), 41 deletions(-) create mode 100644 data/sprites/gravestone.png diff --git a/data/sprites/gravestone.png b/data/sprites/gravestone.png new file mode 100644 index 0000000000000000000000000000000000000000..d6b0c83dbaca96577bcbfc8d0c257c997f090d86 GIT binary patch literal 1298 zcmV+t1?~EYP)WFU8GbZ8({Xk{QrNlj4iWF>9@00eePL_t(I%XO7as9jeT z$A5e6ea^Y(o_pWBFT7kxs9z)DK^v-+Vmr|$)f!1-F<{ZwiQqsKDHN)MptNEY36&0< zX{&i87CUfYg7`6Wpn^yc9}a4WgHokx-pjl1-1D*bS`N<3SCj79-mLxG|GoZeuk8S~ zwk~n&*w{G2(N8~_y?1`#k+xYr&@2~kXfgfOFE)R?eYaS*wRH*S9A*Z7=g6`QRdo@;g`6|r zIZXg?{Vq+@lC4Y)pz9MN?p+~(#pRy!S(71}0NL0$!XN+eC!79KnbaqPbPZbII_evtX<8g*SefL~v{z{w{*Ly*A0icVKUK7>0N`OCl>`{LA+uv~FGkwx90>vyvHyBNE-Lu z@eK1}L+X3#-5siNmBjlyA!bHh*Y4D*Q-~9e9y^9Z`NZ*05>+|z_~XQ6Wce61_19nh z4agg-tJKpe)woJmx3}r~4mG3gx}nrD9I#jKaBX)RaY8+v-h^0yBOiHyu)Tv};=F)! z^sz_PDDs??5^9Dshr>`)!uAdi{ou?k*Xfi8Uw(jq~+p5uL>$a0(r2>9SoGnUIGDDS8fgT?>qXP3MGwfSt!JqKsZ z4^)(eV^kQkN#FyACmfzFnXTk~Tfe>a&2OE4^g6@={Nw%)^K{AYmre7q_d=fKLsv^i z$O2gqVl)gR#;9go1OD>oOMiXD#eF58&1zBW*HLA4wn8}`6S9nAl!Hr{C7g>CIZP*B zikw;I?fwtl`@vNJcjB>oO%a+VvN99APjt@kPU#w@EHbhbNTw_s$MskVj`_?nt&A`! z9mx`c&^1ESC=!JE%(K2?Ty5>Pe`kF)Fglp?pS^}ULc37@4?9XQRQ`~{-~a#s07*qo IM6N<$f?DcuMgRZ+ literal 0 HcmV?d00001 diff --git a/defs.h b/defs.h index ad1eba9..5844d60 100644 --- a/defs.h +++ b/defs.h @@ -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; diff --git a/globals.h b/globals.h index b648c08..d545b5d 100644 --- a/globals.h +++ b/globals.h @@ -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 diff --git a/rc.c b/rc.c index 70b0444..6a8baad 100644 --- a/rc.c +++ b/rc.c @@ -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; diff --git a/shared.c b/shared.c index 9c14e32..f0908be 100644 --- a/shared.c +++ b/shared.c @@ -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);