summaryrefslogtreecommitdiff
path: root/apps/plugins/jewels.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-10-08 09:47:40 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-10-11 16:37:17 -0400
commit2a471e288c16b91a7186a60b3fb84dd55a494c7a (patch)
tree3e746212c5fa69b59f61d19b6e29d11aa8a5e31b /apps/plugins/jewels.c
parent5efaa9ef8073bb216e3dcdbb4476f2fa7c672b76 (diff)
New port: AIGO EROS Q / EROS K
The Q and K have a slightly different case, but the hardware under the shell is completely identical. These models are rebadged versions: * Hifiwalker H2 (== Q) * AGPTek H3 (== K) * Surfans F20 (== K) Other notes: * Significant improvements in the shared Hiby-platform launcher/loader * SD card can theoretically be hot-swapped now * Support external USB mass storage! * Some consolidation of Hiby-platform targets * Some consolidation of plugin keymaps Todo/known issues: * Keymaps need to be gone over properly * Convert to HAVE_SCROLLWHEEL? Change-Id: I5a8a4f22c38a5b69392ca7c0a8ad8c4e07d9523c
Diffstat (limited to 'apps/plugins/jewels.c')
-rw-r--r--apps/plugins/jewels.c71
1 files changed, 26 insertions, 45 deletions
diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c
index 64a15ff4fc..b58c47dd12 100644
--- a/apps/plugins/jewels.c
+++ b/apps/plugins/jewels.c
@@ -347,27 +347,7 @@ CONFIG_KEYPAD == MROBE500_PAD
#define JEWELS_CANCEL BUTTON_POWER
#define HK_CANCEL "Power"
-#elif CONFIG_KEYPAD == XDUOO_X3_PAD
-#define JEWELS_UP BUTTON_HOME
-#define JEWELS_DOWN BUTTON_OPTION
-#define JEWELS_LEFT BUTTON_PREV
-#define JEWELS_RIGHT BUTTON_NEXT
-#define JEWELS_SELECT BUTTON_PLAY
-#define JEWELS_CANCEL BUTTON_POWER
-#define HK_SELECT "PLAY"
-#define HK_CANCEL "POWER"
-
-#elif CONFIG_KEYPAD == XDUOO_X3II_PAD
-#define JEWELS_UP BUTTON_HOME
-#define JEWELS_DOWN BUTTON_OPTION
-#define JEWELS_LEFT BUTTON_PREV
-#define JEWELS_RIGHT BUTTON_NEXT
-#define JEWELS_SELECT BUTTON_PLAY
-#define JEWELS_CANCEL BUTTON_POWER
-#define HK_SELECT "PLAY"
-#define HK_CANCEL "POWER"
-
-#elif CONFIG_KEYPAD == XDUOO_X20_PAD
+#elif CONFIG_KEYPAD == XDUOO_X3_PAD || CONFIG_KEYPAD == XDUOO_X3II_PAD || CONFIG_KEYPAD == XDUOO_X20_PAD
#define JEWELS_UP BUTTON_HOME
#define JEWELS_DOWN BUTTON_OPTION
#define JEWELS_LEFT BUTTON_PREV
@@ -387,7 +367,7 @@ CONFIG_KEYPAD == MROBE500_PAD
#define HK_SELECT "PLAY"
#define HK_CANCEL "POWER"
-#elif CONFIG_KEYPAD == IHIFI_770_PAD
+#elif CONFIG_KEYPAD == IHIFI_770_PAD || CONFIG_KEYPAD == IHIFI_800_PAD
#define JEWELS_UP BUTTON_PREV
#define JEWELS_DOWN BUTTON_NEXT
#define JEWELS_LEFT BUTTON_HOME
@@ -397,15 +377,16 @@ CONFIG_KEYPAD == MROBE500_PAD
#define HK_SELECT "PLAY"
#define HK_CANCEL "POWER"
-#elif CONFIG_KEYPAD == IHIFI_800_PAD
+#elif CONFIG_KEYPAD == EROSQ_PAD
#define JEWELS_UP BUTTON_PREV
#define JEWELS_DOWN BUTTON_NEXT
-#define JEWELS_LEFT BUTTON_HOME
-#define JEWELS_RIGHT BUTTON_VOL_DOWN
+#define JEWELS_LEFT BUTTON_SCROLL_BACK
+#define JEWELS_RIGHT BUTTON_SCROLL_FWD
#define JEWELS_SELECT BUTTON_PLAY
-#define JEWELS_CANCEL BUTTON_POWER
+#define JEWELS_CANCEL BUTTON_BACK
#define HK_SELECT "PLAY"
-#define HK_CANCEL "POWER"
+#define HK_CANCEL "BACK"
+
#else
#error No keymap defined!
@@ -662,14 +643,14 @@ static void jewels_drawboard(struct game_context* bj) {
TILE_WIDTH, TILE_HEIGHT);
rb->lcd_bitmap_transparent_part(jewels,
0, TILE_HEIGHT*(bj->playboard[i+1][j].type),
- STRIDE( SCREEN_MAIN,
- BMPWIDTH_jewels, BMPHEIGHT_jewels),
+ STRIDE( SCREEN_MAIN,
+ BMPWIDTH_jewels, BMPHEIGHT_jewels),
j*TILE_WIDTH, i*TILE_HEIGHT+YOFS,
TILE_WIDTH, TILE_HEIGHT);
#else
rb->lcd_bitmap_part(jewels,
0, TILE_HEIGHT*(bj->playboard[i+1][j].type),
- STRIDE( SCREEN_MAIN,
+ STRIDE( SCREEN_MAIN,
BMPWIDTH_jewels, BMPHEIGHT_jewels),
j*TILE_WIDTH, i*TILE_HEIGHT+YOFS,
TILE_WIDTH, TILE_HEIGHT);
@@ -685,7 +666,7 @@ static void jewels_drawboard(struct game_context* bj) {
rb->lcd_hline(BJ_WIDTH*TILE_WIDTH, LCD_WIDTH-1, 18);
rb->lcd_hline(BJ_WIDTH*TILE_WIDTH, LCD_WIDTH-1, LCD_HEIGHT-10);
-
+
/* draw progress bar */
#ifdef HAVE_LCD_COLOR
rb->lcd_set_foreground(LCD_RGBPACK(104, 63, 63));
@@ -708,7 +689,7 @@ static void jewels_drawboard(struct game_context* bj) {
(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2,
((LCD_HEIGHT-10)-18)*tempscore/size+1);
#endif
-
+
/* print text */
rb->lcd_getstringsize(title, &w, &h);
rb->lcd_putsxy(LCD_WIDTH-(LCD_WIDTH-BJ_WIDTH*TILE_WIDTH)/2-w/2, 1, title);
@@ -730,7 +711,7 @@ static void jewels_drawboard(struct game_context* bj) {
rb->lcd_hline(0, LCD_WIDTH-1, 8*TILE_HEIGHT+YOFS);
rb->lcd_hline(0, LCD_WIDTH-1, LCD_HEIGHT-14);
rb->lcd_vline(LCD_WIDTH/2, LCD_HEIGHT-14, LCD_HEIGHT-1);
-
+
/* draw progress bar */
#ifdef HAVE_LCD_COLOR
rb->lcd_set_foreground(LCD_RGBPACK(104, 63, 63));
@@ -751,10 +732,10 @@ static void jewels_drawboard(struct game_context* bj) {
LCD_WIDTH*tempscore/size+1,
(LCD_HEIGHT-14-(8*TILE_HEIGHT+YOFS))/2);
#endif
-
+
/* print text */
rb->lcd_putsxyf(1, LCD_HEIGHT-10, "%s %d", title, bj->level);
-
+
if (bj->type == GAME_TYPE_NORMAL) {
rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score);
rb->lcd_getstringsize(str, &w, &h);
@@ -796,7 +777,7 @@ static void jewels_drawboard(struct game_context* bj) {
/* print text */
rb->lcd_putsxyf(1, LCD_HEIGHT-(LCD_HEIGHT-(8*TILE_HEIGHT+YOFS))/2-3,"%s %d",
title, bj->level);
-
+
if (bj->type == GAME_TYPE_NORMAL) {
rb->snprintf(str, 6, "%d", (bj->level-1)*LEVEL_PTS+bj->score);
rb->lcd_getstringsize(str, &w, &h);
@@ -881,8 +862,8 @@ static void jewels_putjewels(struct game_context* bj){
#ifdef HAVE_LCD_COLOR
rb->lcd_bitmap_transparent_part(jewels, 0,
TILE_HEIGHT*(bj->playboard[i][j].type),
- STRIDE( SCREEN_MAIN,
- BMPWIDTH_jewels,
+ STRIDE( SCREEN_MAIN,
+ BMPWIDTH_jewels,
BMPHEIGHT_jewels),
j*TILE_WIDTH,
(i-1)*TILE_HEIGHT+YOFS+
@@ -891,8 +872,8 @@ static void jewels_putjewels(struct game_context* bj){
#else
rb->lcd_bitmap_part(jewels, 0,
TILE_HEIGHT*(bj->playboard[i][j].type),
- STRIDE( SCREEN_MAIN,
- BMPWIDTH_jewels,
+ STRIDE( SCREEN_MAIN,
+ BMPWIDTH_jewels,
BMPHEIGHT_jewels),
j*TILE_WIDTH,
(i-1)*TILE_HEIGHT+YOFS+
@@ -1113,7 +1094,7 @@ static unsigned int jewels_swapjewels(struct game_context* bj,
rb->lcd_bitmap_transparent_part(jewels,
0, TILE_HEIGHT*(bj->playboard
[y+1+vertmod][x+horzmod].type),
- STRIDE( SCREEN_MAIN,
+ STRIDE( SCREEN_MAIN,
BMPWIDTH_jewels, BMPHEIGHT_jewels),
(x+horzmod)*TILE_WIDTH-horzmod*
((((movelen<<10)*k)/8)>>10),
@@ -1122,7 +1103,7 @@ static unsigned int jewels_swapjewels(struct game_context* bj,
TILE_WIDTH, TILE_HEIGHT);
rb->lcd_bitmap_transparent_part(jewels,
0, TILE_HEIGHT*(bj->playboard[y+1][x].type),
- STRIDE( SCREEN_MAIN,
+ STRIDE( SCREEN_MAIN,
BMPWIDTH_jewels, BMPHEIGHT_jewels),
x*TILE_WIDTH+horzmod*
((((movelen<<10)*k)/8)>>10),
@@ -1133,7 +1114,7 @@ static unsigned int jewels_swapjewels(struct game_context* bj,
rb->lcd_bitmap_part(jewels,
0, TILE_HEIGHT*(bj->playboard
[y+1+vertmod][x+horzmod].type),
- STRIDE( SCREEN_MAIN,
+ STRIDE( SCREEN_MAIN,
BMPWIDTH_jewels, BMPHEIGHT_jewels),
(x+horzmod)*TILE_WIDTH-horzmod*
((((movelen<<10)*k)/8)>>10),
@@ -1143,7 +1124,7 @@ static unsigned int jewels_swapjewels(struct game_context* bj,
rb->lcd_set_drawmode(DRMODE_FG);
rb->lcd_bitmap_part(jewels,
0, TILE_HEIGHT*(bj->playboard[y+1][x].type),
- STRIDE( SCREEN_MAIN,
+ STRIDE( SCREEN_MAIN,
BMPWIDTH_jewels, BMPHEIGHT_jewels),
x*TILE_WIDTH+horzmod*
((((movelen<<10)*k)/8)>>10),
@@ -1430,7 +1411,7 @@ static bool jewels_help(void)
{
static char *help_text[] = {
"Jewels", "", "Aim", "",
- "Swap", "pairs", "of", "jewels", "to", "form", "connected",
+ "Swap", "pairs", "of", "jewels", "to", "form", "connected",
"segments", "of", "three", "or", "more", "of", "the", "same",
"type.", "",
"The", "goal", "of", "the", "game", "is", "to", "score", "as", "many",