Subversion Repositories Games.Rick Dangerous

Rev

Rev 1 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  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 U8 chan;
  34.  
  35.    if (seq == 0)
  36.    {
  37.       draw_tilesBank = 0;
  38.       seq = 1;
  39.       period = game_period; /* save period, */
  40.       game_period = 50;       /* and use our own */
  41.       game_setmusic ("sounds/gameover.wav", 1);
  42.    }
  43.  
  44.    switch (seq)
  45.    {
  46.    case 1:   /* display banner */
  47.       tm = sys_gettime ();
  48.       draw_tllst = screen_gameovertxt;
  49.       draw_setfb (120, 80);
  50.       draw_tilesList ();
  51.  
  52.       game_rects = &draw_SCREENRECT;
  53.       seq = 2;
  54.       break;
  55.  
  56.    case 2:
  57.       /* wait for key pressed */
  58.       if (control_status & CONTROL_FIRE)
  59.          seq = 3;
  60.       else if (sys_gettime () - tm > SCREEN_TIMEOUT)
  61.          seq = 4;
  62.       else
  63.          sys_sleep (50);
  64.       break;
  65.  
  66.    case 3:
  67.       /* wait for key released */
  68.       if (!(control_status & CONTROL_FIRE))
  69.          seq = 4;
  70.       else
  71.          sys_sleep (50);
  72.       break;
  73.    }
  74.  
  75.    if (control_status & CONTROL_EXIT)   /* check for exit request */
  76.       return SCREEN_EXIT;
  77.  
  78.    if (seq == 4)
  79.    {
  80.       /* we're done */
  81.       sysvid_clear ();
  82.       seq = 0;
  83.       game_period = period;
  84.       return SCREEN_DONE;
  85.    }
  86.  
  87.    return SCREEN_RUNNING;
  88. }
  89.