summaryrefslogtreecommitdiff
path: root/apps/plugins/xrick/scr_imain.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/xrick/scr_imain.c')
-rw-r--r--apps/plugins/xrick/scr_imain.c170
1 files changed, 170 insertions, 0 deletions
diff --git a/apps/plugins/xrick/scr_imain.c b/apps/plugins/xrick/scr_imain.c
new file mode 100644
index 0000000000..6851cd0cca
--- /dev/null
+++ b/apps/plugins/xrick/scr_imain.c
@@ -0,0 +1,170 @@
1/*
2 * xrick/scr_imain.c
3 *
4 * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net).
5 * Copyright (C) 2008-2014 Pierluigi Vicinanza.
6 * All rights reserved.
7 *
8 * The use and distribution terms for this software are contained in the file
9 * named README, which can be found in the root of this distribution. By
10 * using this software in any fashion, you are agreeing to be bound by the
11 * terms of this license.
12 *
13 * You must not remove this notice, or any other, from this software.
14 */
15
16#include "xrick/screens.h"
17
18#include "xrick/game.h"
19#include "xrick/draw.h"
20#include "xrick/control.h"
21#ifdef GFXST
22#include "xrick/data/pics.h"
23#endif
24#include "xrick/system/system.h"
25
26/*
27 * Main introduction
28 *
29 * return: SCREEN_RUNNING, SCREEN_DONE, SCREEN_EXIT
30 */
31U8
32screen_introMain(void)
33{
34 static U8 seq = 0;
35 static U8 seen = 0;
36 static bool first = true;
37 static U8 period = 0;
38 static U32 tm = 0;
39
40 if (seq == 0) {
41 draw_tilesBank = 0;
42 if (first)
43 seq = 1;
44 else
45 seq = 4;
46 period = game_period;
47 game_period = 50;
48 game_rects = &draw_SCREENRECT;
49#ifdef ENABLE_SOUND
50 game_setmusic(soundTune5, -1);
51#endif
52 }
53
54 switch (seq)
55 {
56 case 1: /* display Rick Dangerous title and Core Design copyright */
57 {
58 sysvid_clear();
59 tm = sys_gettime();
60#ifdef GFXPC
61 /* Rick Dangerous title */
62 draw_tllst = (U8 *)screen_imainrdt;
63 draw_setfb(32, 16);
64 draw_filter = 0xaaaa;
65 draw_tilesList();
66
67 /* Core Design copyright + press space to start */
68 draw_tllst = (U8 *)screen_imaincdc;
69 draw_setfb(64, 80);
70 draw_filter = 0x5555;
71 draw_tilesList();
72#endif
73#ifdef GFXST
74 draw_pic(pic_splash);
75#endif
76 seq = 2;
77 break;
78 }
79 case 2: /* wait for key pressed or timeout */
80 {
81 if (control_test(Control_FIRE))
82 seq = 3;
83 else if (sys_gettime() - tm > SCREEN_TIMEOUT) {
84 seen++;
85 seq = 4;
86 }
87 break;
88 }
89 case 3: /* wait for key released */
90 {
91 if (!(control_test(Control_FIRE))) {
92 if (seen++ == 0)
93 seq = 4;
94 else
95 seq = 7;
96 }
97 break;
98 }
99 case 4: /* dispay hall of fame */
100 {
101 U8 s[32];
102 size_t i;
103
104 sysvid_clear();
105 tm = sys_gettime();
106 /* hall of fame title */
107#ifdef GFXPC
108 draw_tllst = (U8 *)screen_imainhoft;
109 draw_setfb(32, 0);
110 draw_filter = 0xaaaa;
111 draw_tilesList();
112#endif
113#ifdef GFXST
114 draw_pic(pic_haf);
115#endif
116 /* hall of fame content */
117 draw_setfb(56, 48);
118#ifdef GFXPC
119 draw_filter = 0x5555;
120#endif
121 for (i = 0; i < screen_nbr_hiscores; i++) {
122 sys_snprintf((char *)s, sizeof(s), "%06d@@@====@@@%s",
123 screen_highScores[i].score, screen_highScores[i].name);
124 s[26] = (U8)'\377';
125 s[27] = (U8)'\377';
126 s[28] = (U8)'\376';
127 draw_tllst = s;
128 draw_tilesList();
129 }
130 seq = 5;
131 break;
132 }
133 case 5: /* wait for key pressed or timeout */
134 {
135 if (control_test(Control_FIRE))
136 seq = 6;
137 else if (sys_gettime() - tm > SCREEN_TIMEOUT) {
138 seen++;
139 seq = 1;
140 }
141 break;
142 }
143 case 6: /* wait for key released */
144 {
145 if (!(control_test(Control_FIRE))) {
146 if (seen++ == 0)
147 seq = 1;
148 else
149 seq = 7;
150 }
151 break;
152 }
153 }
154
155 if (control_test(Control_EXIT)) /* check for exit request */
156 return SCREEN_EXIT;
157
158 if (seq == 7) { /* we're done */
159 sysvid_clear();
160 seq = 0;
161 seen = 0;
162 first = false;
163 game_period = period;
164 return SCREEN_DONE;
165 }
166 else
167 return SCREEN_RUNNING;
168}
169
170/* eof */