diff options
-rw-r--r-- | apps/plugins/mazezam.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c index ad5e5437af..1eab90e9db 100644 --- a/apps/plugins/mazezam.c +++ b/apps/plugins/mazezam.c | |||
@@ -34,6 +34,10 @@ PLUGIN_HEADER | |||
34 | # define MAZEZAM_LEFT BUTTON_LEFT | 34 | # define MAZEZAM_LEFT BUTTON_LEFT |
35 | # define MAZEZAM_UP BUTTON_MENU | 35 | # define MAZEZAM_UP BUTTON_MENU |
36 | # define MAZEZAM_DOWN BUTTON_PLAY | 36 | # define MAZEZAM_DOWN BUTTON_PLAY |
37 | # define MAZEZAM_RIGHT_REPEAT (BUTTON_RIGHT|BUTTON_REPEAT) | ||
38 | # define MAZEZAM_LEFT_REPEAT (BUTTON_LEFT|BUTTON_REPEAT) | ||
39 | # define MAZEZAM_UP_REPEAT (BUTTON_MENU|BUTTON_REPEAT) | ||
40 | # define MAZEZAM_DOWN_REPEAT (BUTTON_PLAY|BUTTON_REPEAT) | ||
37 | 41 | ||
38 | #elif (CONFIG_KEYPAD == IPOD_3G_PAD) | 42 | #elif (CONFIG_KEYPAD == IPOD_3G_PAD) |
39 | # define MAZEZAM_MENU BUTTON_MENU | 43 | # define MAZEZAM_MENU BUTTON_MENU |
@@ -41,6 +45,10 @@ PLUGIN_HEADER | |||
41 | # define MAZEZAM_LEFT BUTTON_LEFT | 45 | # define MAZEZAM_LEFT BUTTON_LEFT |
42 | # define MAZEZAM_UP BUTTON_SCROLL_BACK | 46 | # define MAZEZAM_UP BUTTON_SCROLL_BACK |
43 | # define MAZEZAM_DOWN BUTTON_SCROLL_FWD | 47 | # define MAZEZAM_DOWN BUTTON_SCROLL_FWD |
48 | # define MAZEZAM_RIGHT_REPEAT (BUTTON_RIGHT|BUTTON_REPEAT) | ||
49 | # define MAZEZAM_LEFT_REPEAT (BUTTON_LEFT|BUTTON_REPEAT) | ||
50 | # define MAZEZAM_UP_REPEAT (BUTTON_SCROLL_BACK|BUTTON_REPEAT) | ||
51 | # define MAZEZAM_DOWN_REPEAT (BUTTON_SCROLL_FWD|BUTTON_REPEAT) | ||
44 | 52 | ||
45 | #elif (CONFIG_KEYPAD == SANSA_FUZE_PAD) | 53 | #elif (CONFIG_KEYPAD == SANSA_FUZE_PAD) |
46 | # define MAZEZAM_MENU (BUTTON_HOME | BUTTON_REPEAT) | 54 | # define MAZEZAM_MENU (BUTTON_HOME | BUTTON_REPEAT) |
@@ -48,6 +56,10 @@ PLUGIN_HEADER | |||
48 | # define MAZEZAM_LEFT BUTTON_LEFT | 56 | # define MAZEZAM_LEFT BUTTON_LEFT |
49 | # define MAZEZAM_UP BUTTON_UP | 57 | # define MAZEZAM_UP BUTTON_UP |
50 | # define MAZEZAM_DOWN BUTTON_DOWN | 58 | # define MAZEZAM_DOWN BUTTON_DOWN |
59 | # define MAZEZAM_RIGHT_REPEAT (BUTTON_RIGHT|BUTTON_REPEAT) | ||
60 | # define MAZEZAM_LEFT_REPEAT (BUTTON_LEFT|BUTTON_REPEAT) | ||
61 | # define MAZEZAM_UP_REPEAT (BUTTON_UP|BUTTON_REPEAT) | ||
62 | # define MAZEZAM_DOWN_REPEAT (BUTTON_DOWN|BUTTON_REPEAT) | ||
51 | 63 | ||
52 | #elif (CONFIG_KEYPAD == SANSA_E200_PAD) | 64 | #elif (CONFIG_KEYPAD == SANSA_E200_PAD) |
53 | # define MAZEZAM_MENU BUTTON_POWER | 65 | # define MAZEZAM_MENU BUTTON_POWER |
@@ -56,6 +68,10 @@ PLUGIN_HEADER | |||
56 | # define MAZEZAM_LEFT BUTTON_LEFT | 68 | # define MAZEZAM_LEFT BUTTON_LEFT |
57 | # define MAZEZAM_UP BUTTON_UP | 69 | # define MAZEZAM_UP BUTTON_UP |
58 | # define MAZEZAM_DOWN BUTTON_DOWN | 70 | # define MAZEZAM_DOWN BUTTON_DOWN |
71 | # define MAZEZAM_RIGHT_REPEAT (BUTTON_RIGHT|BUTTON_REPEAT) | ||
72 | # define MAZEZAM_LEFT_REPEAT (BUTTON_LEFT|BUTTON_REPEAT) | ||
73 | # define MAZEZAM_UP_REPEAT (BUTTON_UP|BUTTON_REPEAT) | ||
74 | # define MAZEZAM_DOWN_REPEAT (BUTTON_DOWN|BUTTON_REPEAT) | ||
59 | 75 | ||
60 | #else | 76 | #else |
61 | # include "lib/pluginlib_actions.h" | 77 | # include "lib/pluginlib_actions.h" |
@@ -64,6 +80,10 @@ PLUGIN_HEADER | |||
64 | # define MAZEZAM_LEFT PLA_LEFT | 80 | # define MAZEZAM_LEFT PLA_LEFT |
65 | # define MAZEZAM_UP PLA_UP | 81 | # define MAZEZAM_UP PLA_UP |
66 | # define MAZEZAM_DOWN PLA_DOWN | 82 | # define MAZEZAM_DOWN PLA_DOWN |
83 | # define MAZEZAM_RIGHT_REPEAT PLA_RIGHT_REPEAT | ||
84 | # define MAZEZAM_LEFT_REPEAT PLA_LEFT_REPEAT | ||
85 | # define MAZEZAM_UP_REPEAT PLA_UP_REPEAT | ||
86 | # define MAZEZAM_DOWN_REPEAT PLA_DOWN_REPEAT | ||
67 | const struct button_mapping *plugin_contexts[] | 87 | const struct button_mapping *plugin_contexts[] |
68 | = {generic_directions, generic_actions}; | 88 | = {generic_directions, generic_actions}; |
69 | #endif | 89 | #endif |
@@ -221,7 +241,7 @@ static enum { | |||
221 | 241 | ||
222 | STATE_COMPLETED /* A level has been completed */ | 242 | STATE_COMPLETED /* A level has been completed */ |
223 | = STATE_IN_GAME, | 243 | = STATE_IN_GAME, |
224 | 244 | ||
225 | STATE_FAILED, /* The player wants to retry the level */ | 245 | STATE_FAILED, /* The player wants to retry the level */ |
226 | STATE_GAME_MENU, /* The player wan't to access the in-game menu */ | 246 | STATE_GAME_MENU, /* The player wan't to access the in-game menu */ |
227 | 247 | ||
@@ -574,7 +594,7 @@ static void level_loop(struct level_info* li, short* shift, short *x, short *y) | |||
574 | 594 | ||
575 | switch (button) { | 595 | switch (button) { |
576 | case MAZEZAM_UP: | 596 | case MAZEZAM_UP: |
577 | case (MAZEZAM_UP|BUTTON_REPEAT): | 597 | case MAZEZAM_UP_REPEAT: |
578 | if ((*y > 0) && (*x >= 0) && (*x < li->width)) { | 598 | if ((*y > 0) && (*x >= 0) && (*x < li->width)) { |
579 | for (i = 0; i < li->cd.l_num[*y-1]; i++) | 599 | for (i = 0; i < li->cd.l_num[*y-1]; i++) |
580 | blocked = blocked || | 600 | blocked = blocked || |
@@ -585,10 +605,8 @@ static void level_loop(struct level_info* li, short* shift, short *x, short *y) | |||
585 | } | 605 | } |
586 | break; | 606 | break; |
587 | 607 | ||
588 | |||
589 | |||
590 | case MAZEZAM_DOWN: | 608 | case MAZEZAM_DOWN: |
591 | case (MAZEZAM_DOWN|BUTTON_REPEAT): | 609 | case MAZEZAM_DOWN_REPEAT: |
592 | if ((*y < li->height-1) && (*x >= 0) && (*x < li->width)) { | 610 | if ((*y < li->height-1) && (*x >= 0) && (*x < li->width)) { |
593 | for (i = 0; i < li->cd.l_num[*y+1]; i++) | 611 | for (i = 0; i < li->cd.l_num[*y+1]; i++) |
594 | blocked = blocked || | 612 | blocked = blocked || |
@@ -600,7 +618,7 @@ static void level_loop(struct level_info* li, short* shift, short *x, short *y) | |||
600 | break; | 618 | break; |
601 | 619 | ||
602 | case MAZEZAM_LEFT: | 620 | case MAZEZAM_LEFT: |
603 | case (MAZEZAM_LEFT|BUTTON_REPEAT): | 621 | case MAZEZAM_LEFT_REPEAT: |
604 | if (*x > 0) { | 622 | if (*x > 0) { |
605 | for (i = 0; i < li->cd.l_num[*y]; i++) | 623 | for (i = 0; i < li->cd.l_num[*y]; i++) |
606 | blocked = blocked || | 624 | blocked = blocked || |
@@ -615,7 +633,7 @@ static void level_loop(struct level_info* li, short* shift, short *x, short *y) | |||
615 | break; | 633 | break; |
616 | 634 | ||
617 | case MAZEZAM_RIGHT: | 635 | case MAZEZAM_RIGHT: |
618 | case (MAZEZAM_RIGHT|BUTTON_REPEAT): | 636 | case MAZEZAM_RIGHT_REPEAT: |
619 | if (*x < li->width-1) { | 637 | if (*x < li->width-1) { |
620 | for (i = 0; i < li->cd.l_num[*y]; i++) | 638 | for (i = 0; i < li->cd.l_num[*y]; i++) |
621 | blocked = blocked || | 639 | blocked = blocked || |
@@ -817,6 +835,7 @@ static void game_loop(struct resume_data *r) | |||
817 | break; | 835 | break; |
818 | 836 | ||
819 | case STATE_WELLDONE: | 837 | case STATE_WELLDONE: |
838 | r->level = 0; | ||
820 | welldone_screen(); | 839 | welldone_screen(); |
821 | break; | 840 | break; |
822 | 841 | ||