summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2009-12-12 07:24:34 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2009-12-12 07:24:34 +0000
commitc9a11d24eba931017094908a0cf23c8a5b2d9473 (patch)
tree9b44cccaf958609249d9f66dc06348ddc778c516 /apps/plugins
parent82a6fb064927f065988bfddb2e3d16c768fe46a6 (diff)
downloadrockbox-c9a11d24eba931017094908a0cf23c8a5b2d9473.tar.gz
rockbox-c9a11d24eba931017094908a0cf23c8a5b2d9473.zip
CodeBuster: Replace mapping defines with direct use of PLA_* macros.
Add PLA_MENU as a way to exit to menu Add PLA_START as a way to validate a combination git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23938 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/codebuster.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/apps/plugins/codebuster.c b/apps/plugins/codebuster.c
index 2de1ce3b4d..2abf5ec81b 100644
--- a/apps/plugins/codebuster.c
+++ b/apps/plugins/codebuster.c
@@ -34,18 +34,6 @@ PLUGIN_HEADER
34const struct button_mapping *plugin_contexts[] = 34const struct button_mapping *plugin_contexts[] =
35 {generic_directions, generic_actions}; 35 {generic_directions, generic_actions};
36 36
37/* Mapping */
38#define EXIT PLA_QUIT
39#define VALIDATE PLA_FIRE
40#define PREV_PIECE PLA_LEFT
41#define PREV_PIECE_REPEAT PLA_LEFT_REPEAT
42#define NEXT_PIECE PLA_RIGHT
43#define NEXT_PIECE_REPEAT PLA_RIGHT_REPEAT
44#define PREV_COLOR PLA_UP
45#define PREV_COLOR_REPEAT PLA_UP_REPEAT
46#define NEXT_COLOR PLA_DOWN
47#define NEXT_COLOR_REPEAT PLA_DOWN_REPEAT
48
49/* 37/*
50 * Screen structure: 38 * Screen structure:
51 * * (guesses_count) lines of guesses, 39 * * (guesses_count) lines of guesses,
@@ -433,35 +421,42 @@ enum plugin_status plugin_start(const void* parameter) {
433 while(!stop_game()) { 421 while(!stop_game()) {
434 draw_board(guess, piece); 422 draw_board(guess, piece);
435 423
436 if ((button = get_button()) == VALIDATE) break; 424 button = get_button();
425 if (button == PLA_FIRE || button == PLA_START)
426 break;
437 427
438 switch (button) { 428 switch (button) {
439 429
440 case EXIT: 430 /* Exit */
431 case PLA_QUIT:
432 case PLA_MENU:
441 resume = true; 433 resume = true;
442 main_menu(); 434 main_menu();
443 break; 435 break;
444 436
445 case NEXT_PIECE: 437 /* Next piece */
446 case NEXT_PIECE_REPEAT: 438 case PLA_RIGHT:
439 case PLA_RIGHT_REPEAT:
447 piece = (piece + 1) % pieces_count; 440 piece = (piece + 1) % pieces_count;
448 break; 441 break;
449 442
450 case PREV_PIECE: 443 /* Previous piece */
451 case PREV_PIECE_REPEAT: 444 case PLA_LEFT:
445 case PLA_LEFT_REPEAT:
452 piece = (piece + pieces_count - 1) % pieces_count; 446 piece = (piece + pieces_count - 1) % pieces_count;
453 break; 447 break;
454 448
455 449 /* Next color */
456 case NEXT_COLOR: 450 case PLA_DOWN:
457 case NEXT_COLOR_REPEAT: 451 case PLA_DOWN_REPEAT:
458 guesses[guess].pieces[piece] = 452 guesses[guess].pieces[piece] =
459 (guesses[guess].pieces[piece] + 1) 453 (guesses[guess].pieces[piece] + 1)
460 % colors_count; 454 % colors_count;
461 break; 455 break;
462 456
463 case PREV_COLOR: 457 /* Previous color */
464 case PREV_COLOR_REPEAT: 458 case PLA_UP:
459 case PLA_UP_REPEAT:
465 guesses[guess].pieces[piece] = 460 guesses[guess].pieces[piece] =
466 (guesses[guess].pieces[piece] + colors_count - 1) 461 (guesses[guess].pieces[piece] + colors_count - 1)
467 % colors_count; 462 % colors_count;