1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Tomer Shalev 2009-12-12 07:24:34 +00:00
parent 82a6fb0649
commit c9a11d24eb

View file

@ -34,18 +34,6 @@ PLUGIN_HEADER
const struct button_mapping *plugin_contexts[] =
{generic_directions, generic_actions};
/* Mapping */
#define EXIT PLA_QUIT
#define VALIDATE PLA_FIRE
#define PREV_PIECE PLA_LEFT
#define PREV_PIECE_REPEAT PLA_LEFT_REPEAT
#define NEXT_PIECE PLA_RIGHT
#define NEXT_PIECE_REPEAT PLA_RIGHT_REPEAT
#define PREV_COLOR PLA_UP
#define PREV_COLOR_REPEAT PLA_UP_REPEAT
#define NEXT_COLOR PLA_DOWN
#define NEXT_COLOR_REPEAT PLA_DOWN_REPEAT
/*
* Screen structure:
* * (guesses_count) lines of guesses,
@ -433,35 +421,42 @@ enum plugin_status plugin_start(const void* parameter) {
while(!stop_game()) {
draw_board(guess, piece);
if ((button = get_button()) == VALIDATE) break;
button = get_button();
if (button == PLA_FIRE || button == PLA_START)
break;
switch (button) {
case EXIT:
/* Exit */
case PLA_QUIT:
case PLA_MENU:
resume = true;
main_menu();
break;
case NEXT_PIECE:
case NEXT_PIECE_REPEAT:
/* Next piece */
case PLA_RIGHT:
case PLA_RIGHT_REPEAT:
piece = (piece + 1) % pieces_count;
break;
case PREV_PIECE:
case PREV_PIECE_REPEAT:
/* Previous piece */
case PLA_LEFT:
case PLA_LEFT_REPEAT:
piece = (piece + pieces_count - 1) % pieces_count;
break;
case NEXT_COLOR:
case NEXT_COLOR_REPEAT:
/* Next color */
case PLA_DOWN:
case PLA_DOWN_REPEAT:
guesses[guess].pieces[piece] =
(guesses[guess].pieces[piece] + 1)
% colors_count;
break;
case PREV_COLOR:
case PREV_COLOR_REPEAT:
/* Previous color */
case PLA_UP:
case PLA_UP_REPEAT:
guesses[guess].pieces[piece] =
(guesses[guess].pieces[piece] + colors_count - 1)
% colors_count;