- if(state == GAMEPLAY || state == DEAD_PAUSE || state == GAME_OVER)
- for(i = 0; i<nships-1; i++) {
- dest.x = (i + 1)*(surf_life->w + 10);
- dest.y = 20;
- SDL_BlitSurface(surf_life, NULL, surf_screen, &dest);
- }
-
- if(state == GAMEPLAY) {
- // Update speeds.
- cur_speed = shipdx;
- if(shipdx < 0) cur_speed = 0;
- if(shipdx > 20) cur_speed = 20;
- game_dist += cur_speed*ticks_since_last;
- game_ticks += ticks_since_last;
- if(game_ticks < 2*1000) avg_speed = cur_speed;
- else avg_speed = game_dist/game_ticks;
- //printf("avg=%.2f, cur=%.2f. shipdx=%.2f\n", avg_speed, cur_speed, shipdx);
- avg_speed_w = 2 + 64*avg_speed/20;
- cur_speed_w = 2 + 64*cur_speed/20;
- }
-
- if(state == GAMEPLAY || state == DEAD_PAUSE) {
- // Draw the speed indicators.
- src.x = 0; src.y = 0;
- src.h = surf_speed->h;
- dest.x = 240;
- src.w = avg_speed_w; dest.y = 10;
- SDL_BlitSurface(surf_speed, &src, surf_screen, &dest);
- src.w = cur_speed_w; dest.y = 20;
- SDL_BlitSurface(surf_speed, &src, surf_screen, &dest);
+ if(state == GAMEPLAY || state == DEAD_PAUSE || state == GAME_OVER) {
+ for(i = 0; i<ship.lives-1; i++) {
+ dest.x = (i + 1)*(surf_life->w + 10);
+ dest.y = 20;
+ SDL_BlitSurface(surf_life, NULL, surf_screen, &dest);
+ }