Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | pmbaty | 1 | /* |
| 2 | * src/scr_gameover.c |
||
| 3 | * |
||
| 4 | * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved. |
||
| 5 | * |
||
| 6 | * The use and distribution terms for this software are contained in the file |
||
| 7 | * named README, which can be found in the root of this distribution. By |
||
| 8 | * using this software in any fashion, you are agreeing to be bound by the |
||
| 9 | * terms of this license. |
||
| 10 | * |
||
| 11 | * You must not remove this notice, or any other, from this software. |
||
| 12 | */ |
||
| 13 | |||
| 14 | #include "stddef.h" /* NULL */ |
||
| 15 | |||
| 16 | #include "system.h" |
||
| 17 | #include "game.h" |
||
| 18 | #include "screens.h" |
||
| 19 | |||
| 20 | #include "draw.h" |
||
| 21 | #include "control.h" |
||
| 22 | |||
| 23 | /* |
||
| 24 | * Display the game over screen |
||
| 25 | * |
||
| 26 | * return: SCREEN_RUNNING, SCREEN_DONE, SCREEN_EXIT |
||
| 27 | */ |
||
| 28 | U8 screen_gameover (void) |
||
| 29 | { |
||
| 30 | static U8 seq = 0; |
||
| 31 | static U8 period = 0; |
||
| 32 | static U32 tm = 0; |
||
| 33 | static sound_t *snd; |
||
| 34 | static U8 chan; |
||
| 35 | |||
| 36 | if (seq == 0) |
||
| 37 | { |
||
| 38 | draw_tilesBank = 0; |
||
| 39 | seq = 1; |
||
| 40 | period = game_period; /* save period, */ |
||
| 41 | game_period = 50; /* and use our own */ |
||
| 42 | game_setmusic ("sounds/gameover.wav", 1); |
||
| 43 | } |
||
| 44 | |||
| 45 | switch (seq) |
||
| 46 | { |
||
| 47 | case 1: /* display banner */ |
||
| 48 | tm = sys_gettime (); |
||
| 49 | draw_tllst = screen_gameovertxt; |
||
| 50 | draw_setfb (120, 80); |
||
| 51 | draw_tilesList (); |
||
| 52 | |||
| 53 | game_rects = &draw_SCREENRECT; |
||
| 54 | seq = 2; |
||
| 55 | break; |
||
| 56 | |||
| 57 | case 2: |
||
| 58 | /* wait for key pressed */ |
||
| 59 | if (control_status & CONTROL_FIRE) |
||
| 60 | seq = 3; |
||
| 61 | else if (sys_gettime () - tm > SCREEN_TIMEOUT) |
||
| 62 | seq = 4; |
||
| 63 | else |
||
| 64 | sys_sleep (50); |
||
| 65 | break; |
||
| 66 | |||
| 67 | case 3: |
||
| 68 | /* wait for key released */ |
||
| 69 | if (!(control_status & CONTROL_FIRE)) |
||
| 70 | seq = 4; |
||
| 71 | else |
||
| 72 | sys_sleep (50); |
||
| 73 | break; |
||
| 74 | } |
||
| 75 | |||
| 76 | if (control_status & CONTROL_EXIT) /* check for exit request */ |
||
| 77 | return SCREEN_EXIT; |
||
| 78 | |||
| 79 | if (seq == 4) |
||
| 80 | { |
||
| 81 | /* we're done */ |
||
| 82 | sysvid_clear (); |
||
| 83 | seq = 0; |
||
| 84 | game_period = period; |
||
| 85 | return SCREEN_DONE; |
||
| 86 | } |
||
| 87 | |||
| 88 | return SCREEN_RUNNING; |
||
| 89 | } |