Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 1 | pmbaty | 1 | /* | 
| 2 |  * src/scr_imain.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 <stdio.h>   /* sprintf */ | ||
| 15 | |||
| 16 | #include "system.h" | ||
| 17 | #include "game.h" | ||
| 18 | #include "screens.h" | ||
| 19 | |||
| 20 | #include "draw.h" | ||
| 21 | #include "pics.h" | ||
| 22 | #include "control.h" | ||
| 23 | |||
| 24 | |||
| 25 | /* | ||
| 26 |  * Main introduction | ||
| 27 |  * | ||
| 28 |  * return: SCREEN_RUNNING, SCREEN_DONE, SCREEN_EXIT | ||
| 29 |  */ | ||
| 30 | U8 screen_introMain (void) | ||
| 31 | { | ||
| 32 | static U8 seq = 0; | ||
| 33 | static U8 seen = 0; | ||
| 34 | static U8 period = 0; | ||
| 35 | static U32 tm = 0; | ||
| 36 | U8 i, s[32]; | ||
| 37 | |||
| 38 | if (seq == 0) | ||
| 39 |    { | ||
| 40 | draw_tilesBank = 0; | ||
| 41 | seq = 4; | ||
| 42 | period = game_period; | ||
| 43 | game_period = 50; | ||
| 44 | game_rects = &draw_SCREENRECT; | ||
| 45 | game_setmusic ("sounds/tune5.wav", -1); | ||
| 46 |    } | ||
| 47 | |||
| 48 | switch (seq) | ||
| 49 |    { | ||
| 50 | case 1: | ||
| 51 |       /* display Rick Dangerous title and Core Design copyright */ | ||
| 52 | sysvid_clear (); | ||
| 53 | tm = sys_gettime (); | ||
| 54 | |||
| 55 |       // Rick Dangerous title | ||
| 56 | draw_pic (50, 16, 216, 22, pic_splash); | ||
| 57 | |||
| 58 |       // Core Design copyright + press space to start | ||
| 59 | draw_tllst = (U8 *)screen_imaincdc; | ||
| 60 | draw_setfb (64, 80); | ||
| 61 | draw_tilesList (); | ||
| 62 | |||
| 63 | seq = 2; | ||
| 64 | break; | ||
| 65 | |||
| 66 | case 2: | ||
| 67 |        /* wait for key pressed or timeout */ | ||
| 68 | if (control_status & CONTROL_FIRE) | ||
| 69 | seq = 3; | ||
| 70 | else if (sys_gettime() - tm > SCREEN_TIMEOUT) | ||
| 71 |       { | ||
| 72 |          seen++; | ||
| 73 | seq = 4; | ||
| 74 |       } | ||
| 75 | break; | ||
| 76 | |||
| 77 | case 3: | ||
| 78 |       /* wait for key released */ | ||
| 79 | if (!(control_status & CONTROL_FIRE)) | ||
| 80 | seq = 7; | ||
| 81 | break; | ||
| 82 | |||
| 83 | case 4: | ||
| 84 |       /* dispay hall of fame */ | ||
| 85 | sysvid_clear (); | ||
| 86 | tm = sys_gettime (); | ||
| 87 | |||
| 88 |       /* hall of fame title */ | ||
| 89 | draw_pic (64, 4, 192, 22, pic_haf); | ||
| 90 | |||
| 91 |       /* hall of fame content */ | ||
| 92 | draw_setfb (56, 40); | ||
| 93 | for (i = 0; i < 8; i++) | ||
| 94 |       { | ||
| 95 | sprintf_s ((char *) s, sizeof (s), "%06d@@@....@@@%s", game_hscores[i].score, game_hscores[i].name); | ||
| 96 | s[26] = '\377'; s[27] = '\377'; s[28] = '\376'; | ||
| 97 | draw_tllst = s; | ||
| 98 | draw_tilesList (); | ||
| 99 |       } | ||
| 100 | |||
| 101 | seq = 5; | ||
| 102 | break; | ||
| 103 | |||
| 104 | case 5: | ||
| 105 |       /* wait for key pressed or timeout */ | ||
| 106 | if (control_status & CONTROL_FIRE) | ||
| 107 | seq = 6; | ||
| 108 | else if (sys_gettime() - tm > SCREEN_TIMEOUT) | ||
| 109 |       { | ||
| 110 |          seen++; | ||
| 111 | seq = 1; | ||
| 112 |       } | ||
| 113 | break; | ||
| 114 | |||
| 115 | case 6: | ||
| 116 |       /* wait for key released */ | ||
| 117 | if (!(control_status & CONTROL_FIRE)) | ||
| 118 | seq = 7; | ||
| 119 | break; | ||
| 120 |    } | ||
| 121 | |||
| 122 | if (control_status & CONTROL_EXIT) | ||
| 123 | return SCREEN_EXIT; // check for exit request | ||
| 124 | |||
| 125 | if (seq == 7) | ||
| 126 |    { | ||
| 127 |       /* we're done */ | ||
| 128 | sysvid_clear (); | ||
| 129 | seq = 0; | ||
| 130 | seen = 0; | ||
| 131 | game_period = period; | ||
| 132 | return SCREEN_DONE; | ||
| 133 |    } | ||
| 134 |    else | ||
| 135 | return SCREEN_RUNNING; | ||
| 136 | } |