summaryrefslogtreecommitdiff
path: root/apps/plugins/xrick/scr_gameover.c
diff options
context:
space:
mode:
authorSebastian Leonhardt <sebastian.leonhardt@web.de>2016-01-08 01:05:36 +0100
committerSolomon Peachy <pizza@shaftnet.org>2024-06-30 17:24:16 -0400
commit102c3742487dba76ec72d5f56a2c3041344b2d68 (patch)
tree4931ad34d2cc0bac56d9984b9ead355d012ad63a /apps/plugins/xrick/scr_gameover.c
parent6f1e67e5e318ba2fd0f5ec1892c7b6633ec6521c (diff)
downloadrockbox-102c3742487dba76ec72d5f56a2c3041344b2d68.tar.gz
rockbox-102c3742487dba76ec72d5f56a2c3041344b2d68.zip
added xrick game
original xrick code by 'BigOrno' at: http://www.bigorno.net/xrick/ Rockbox port, plus bugfixes at: https://github.com/pierluigi-vicinanza/xrick Further changes: * Additonal fixes from g#3026 * Port to modern plugin API * Add Pluginlib keymap fallback * Support all >1bpp screens * Fix build warnings in miniz * Better error message when resources are missing Change-Id: Id83928bc2539901b0221692f65cbca41389c58e7
Diffstat (limited to 'apps/plugins/xrick/scr_gameover.c')
-rw-r--r--apps/plugins/xrick/scr_gameover.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/apps/plugins/xrick/scr_gameover.c b/apps/plugins/xrick/scr_gameover.c
new file mode 100644
index 0000000000..7467ce3cbe
--- /dev/null
+++ b/apps/plugins/xrick/scr_gameover.c
@@ -0,0 +1,92 @@
1/*
2 * xrick/scr_gameover.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#include "xrick/system/system.h"
22
23/*
24 * Display the game over screen
25 *
26 * return: SCREEN_RUNNING, SCREEN_DONE, SCREEN_EXIT
27 */
28U8
29screen_gameover(void)
30{
31 static U8 seq = 0;
32 static U8 period = 0;
33#ifdef GFXST
34 static U32 tm = 0;
35#endif
36 if (seq == 0) {
37 draw_tilesBank = 0;
38 seq = 1;
39 period = game_period; /* save period, */
40 game_period = 50; /* and use our own */
41#ifdef ENABLE_SOUND
42 game_setmusic(soundGameover, 1);
43#endif
44 }
45
46 switch (seq) {
47 case 1: /* display banner */
48#ifdef GFXST
49 sysvid_clear();
50 tm = sys_gettime();
51#endif
52 draw_tllst = screen_gameovertxt;
53 draw_setfb(120, 80);
54#ifdef GFXPC
55 draw_filter = 0xAAAA;
56#endif
57 draw_tilesList();
58 draw_drawStatus();
59
60 game_rects = &draw_SCREENRECT;
61 seq = 2;
62 break;
63
64 case 2: /* wait for key pressed */
65 if (control_test(Control_FIRE))
66 seq = 3;
67#ifdef GFXST
68 else if (sys_gettime() - tm > SCREEN_TIMEOUT)
69 seq = 4;
70#endif
71 break;
72
73 case 3: /* wait for key released */
74 if (!(control_test(Control_FIRE)))
75 seq = 4;
76 break;
77 }
78
79 if (control_test(Control_EXIT)) /* check for exit request */
80 return SCREEN_EXIT;
81
82 if (seq == 4) { /* we're done */
83 sysvid_clear();
84 seq = 0;
85 game_period = period;
86 return SCREEN_DONE;
87 }
88
89 return SCREEN_RUNNING;
90}
91
92/* eof */