summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-12-20 22:57:04 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-12-20 22:57:04 +0000
commitca1a1ab141f745660ebceae9d70b827314ea29b8 (patch)
tree1cb9a03b7678c573d9faaf8a540204390b2c6d8b
parent735f8273f067869596ccef2e537c941c270ca950 (diff)
downloadrockbox-ca1a1ab141f745660ebceae9d70b827314ea29b8.tar.gz
rockbox-ca1a1ab141f745660ebceae9d70b827314ea29b8.zip
H300: Colors for solitaire by Ben Basha
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8267 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/solitaire.c727
-rw-r--r--docs/CREDITS1
2 files changed, 482 insertions, 246 deletions
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index ea56e2a693..306c0dcc8d 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -16,9 +16,10 @@
* KIND, either express or implied.
*
****************************************************************************/
-
+
/*****************************************************************************
Solitaire by dionoea
+Graphics & Fix Bugs by Ben Basha
use arrows to move the cursor
use ON to select cards, move cards, reveal hidden cards, ...
@@ -31,9 +32,11 @@ use F3 to put card on top of the remains' stack on one of the 4 final stacks
*****************************************************************************/
#include "plugin.h"
+#include "configfile.h"
#include "button.h"
#include "lcd.h"
+
#ifdef HAVE_LCD_BITMAP
/* here is a global api struct pointer. while not strictly necessary,
@@ -43,6 +46,7 @@ static struct plugin_api* rb;
#define min(a,b) (a<b?a:b)
+
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
#define SOL_QUIT BUTTON_OFF
@@ -100,23 +104,8 @@ static struct plugin_api* rb;
#define SOL_MENU_RUN BUTTON_SELECT
#define SOL_MENU_RUN2 BUTTON_RIGHT
#define SOL_MENU_INFO BUTTON_MODE
-#define SOL_MENU_INFO2 BUTTON_REC
-
-#elif (CONFIG_KEYPAD == IPOD_4G_PAD)
-
-#define SOL_QUIT (BUTTON_SELECT | BUTTON_MENU)
-#define SOL_UP BUTTON_MENU
-#define SOL_DOWN BUTTON_PLAY
-#define SOL_LEFT BUTTON_LEFT
-#define SOL_RIGHT BUTTON_RIGHT
-#define SOL_MOVE BUTTON_SELECT
-#define SOL_DRAW (BUTTON_SELECT | BUTTON_PLAY)
-#define SOL_REM2CUR (BUTTON_SELECT | BUTTON_LEFT)
-#define SOL_CUR2STACK (BUTTON_SELECT | BUTTON_RIGHT)
-#define SOL_REM2STACK (BUTTON_LEFT | BUTTON_RIGHT)
-#define SOL_MENU_RUN BUTTON_SELECT
-#define SOL_MENU_INFO (BUTTON_PLAY | BUTTON_MENU)
-
+#define SOL_OPT BUTTON_ON
+#define SOL_REM BUTTON_REC
#endif
/* common help definitions */
@@ -148,13 +137,6 @@ static struct plugin_api* rb;
#define HELP_SOL_CUR2STACK "SELECT..: Put the card under the cursor on one of the 4 final stacks."
#define HELP_SOL_REM2STACK "PLAY+RIGHT: Put the card on top of the remains' stack on one of the 4 final stacks."
-#elif (CONFIG_KEYPAD == IPOD_4G_PAD)
-#define HELP_SOL_MOVE "SELECT: Select cards, Move cards, reveal hidden cards ..."
-#define HELP_SOL_DRAW "SELECT+PLAY: Un-select a card if it was selected. Else, draw 3 new cards out of the remains' stack."
-#define HELP_SOL_REM2CUR "SELECT+LEFT: Put the card on top of the remains' stack on top of the cursor."
-#define HELP_SOL_CUR2STACK "SELECT+RIGHT..: Put the card under the cursor on one of the 4 final stacks."
-#define HELP_SOL_REM2STACK "LEFT+RIGHT: Put the card on top of the remains' stack on one of the 4 final stacks."
-
#endif
#if LCD_DEPTH>1
@@ -167,165 +149,162 @@ static const unsigned colors[4] = {
};
#endif
-static const unsigned char suits[4][8] = {
+#define BMPHEIGHT_c 10
+#define BMPWIDTH_c 8
+#define BMPHEIGHT_BACKSIDE 33
+#define BMPWIDTH_BACKSIDE 26
+
+static const unsigned short backside[33*26] = {
+0x9572, 0xdf3a, 0xdf3a, 0xdf39, 0xdf39, 0xdf39, 0xdf39, 0xdf39, 0xdf39, 0xdf39,
+0xdf3a, 0xdf3a, 0xdf39, 0xdf39, 0xdf39, 0xdf39, 0xdf39, 0xdf39, 0xdf39, 0xdf39,
+0xdf39, 0xdf39, 0xdf39, 0xdf3a, 0xdf3a, 0x9572,
+0xe77b, 0xfffc, 0xffbc, 0xfffd, 0xfffd, 0xfffc, 0xfffc, 0xfffd, 0xfffd, 0xfffc,
+0xfffc, 0xfffc, 0xfffd, 0xfffc, 0xfffc, 0xfffd, 0xfffc, 0xfffc, 0xfffc, 0xfffd,
+0xfffd, 0xfffd, 0xfffd, 0xffbc, 0xfffc, 0xe73a,
+0xdf3a, 0xfffb, 0xf7bc, 0xc639, 0xbdf9, 0xc63a, 0xc67a, 0xc67b, 0xc63a, 0xbe3a,
+0xc639, 0xbe39, 0xbe3a, 0xbe3a, 0xbe3a, 0xc63b, 0xbe3a, 0xc63a, 0xc63a, 0xb5fa,
+0xb5f9, 0xb5f9, 0xc63b, 0xf77c, 0xf7fc, 0xe6fa,
+0xdefa, 0xfffc, 0xc679, 0x6bd4, 0x5b54, 0x6394, 0x5b54, 0x6c34, 0x7433, 0x7435,
+0x7c34, 0x9536, 0x7c35, 0x7c35, 0x8cb5, 0x7434, 0x8474, 0x7c74, 0x8cf5, 0x7434,
+0x8475, 0x7c75, 0x6b93, 0xc63a, 0xfffc, 0xe6f9,
+0xdefa, 0xfffd, 0xc6ba, 0x6395, 0x42d3, 0x7c77, 0x7436, 0x73d5, 0x5b11, 0x8cb6,
+0xa578, 0x7c35, 0xadb9, 0xadb8, 0x6bd4, 0x9537, 0x84b6, 0x5312, 0x5b53, 0x7436,
+0x9538, 0x7436, 0x5b94, 0xc67b, 0xfffd, 0xdefa,
+0xdefa, 0xfffc, 0xce7a, 0x6bd5, 0x5311, 0x73d4, 0x94f7, 0xa5b8, 0x7435, 0x9538,
+0x84b6, 0x190d, 0x7c35, 0x94f7, 0x088d, 0x7c76, 0x84b7, 0x7c75, 0x8cb6, 0xadb9,
+0x7c35, 0x7436, 0x6bd3, 0xce7b, 0xfffd, 0xdefa,
+0xdf39, 0xfffd, 0xceba, 0x63d5, 0x6bd5, 0x31cf, 0x8476, 0xa577, 0x84b7, 0x5b54,
+0x7436, 0x6b94, 0x84b5, 0x9d38, 0x7394, 0x7c37, 0x84b7, 0x84b7, 0xa578, 0x9d77,
+0x31cf, 0x6bd5, 0x6bd4, 0xcebb, 0xfffc, 0xdefa,
+0xdf3a, 0xfffc, 0xce7a, 0x6c35, 0x7c76, 0x9537, 0xa5b9, 0x6b94, 0x5291, 0x4ad2,
+0x7c35, 0x9537, 0x6394, 0x5353, 0x9578, 0x8cb6, 0x5b13, 0x3a11, 0x5b13, 0x9538,
+0x9539, 0x7434, 0x7434, 0xce7a, 0xfffc, 0xe6fa,
+0xdf3a, 0xfffd, 0xc67a, 0x6394, 0x84b7, 0x7c75, 0xa578, 0x94f7, 0x8cb6, 0x94f6,
+0xa5b8, 0x5b12, 0x4b13, 0x4b13, 0x4291, 0xa5b9, 0x6bd4, 0x73d5, 0x7c34, 0xa578,
+0x6bd5, 0x7c75, 0x6b94, 0xc67a, 0xfffd, 0xdefa,
+0xdf3a, 0xfffd, 0xc67a, 0x63d4, 0x7c76, 0x320f, 0xc67b, 0xadf9, 0x5b52, 0xadba,
+0x5b53, 0x6bd4, 0x4b13, 0x6bd5, 0x6bd5, 0x52d2, 0xbe7b, 0x4a91, 0x94f7, 0xbe7b,
+0x320f, 0x7c35, 0x6b94, 0xc67a, 0xfffd, 0xdefa,
+0xdf3a, 0xfffd, 0xbe39, 0x6bd5, 0x84b7, 0x9537, 0xb5f9, 0x6352, 0xbe3b, 0x6393,
+0x4ad4, 0x73d5, 0x6395, 0x6bd5, 0x84b6, 0x52d3, 0x7c76, 0xbe3a, 0x5ad2, 0x8477,
+0x6bd5, 0x84b6, 0x73d5, 0xbe39, 0xfffd, 0xdefa,
+0xdf3a, 0xfffc, 0xc639, 0x7cb6, 0x8cf6, 0xa578, 0x4ad0, 0xc63a, 0x7c74, 0x7475,
+0x84b8, 0x3a51, 0x3210, 0x4292, 0x4250, 0x9d79, 0x7c77, 0x7435, 0xbe3a, 0x424f,
+0x84b8, 0x84b6, 0x84b6, 0xc63a, 0xfffd, 0xdefb,
+0xdf3a, 0xfffd, 0xc63a, 0x6bd5, 0x7c75, 0x4ad0, 0xb5fa, 0x9d38, 0x8cf6, 0x6353,
+0x5313, 0x6395, 0x7c77, 0x7c76, 0x7436, 0x6bd4, 0x5b52, 0xa5b9, 0xb5fa, 0xbdf9,
+0x4a91, 0x7435, 0x6c34, 0xc63a, 0xfffe, 0xdefb,
+0xdf3a, 0xfffd, 0xbe39, 0x7c76, 0x8cb6, 0xb639, 0x9d78, 0x7c35, 0x52d2, 0x2990,
+0x9538, 0xbe3b, 0x9d78, 0xadfa, 0xb63c, 0xadb9, 0x73d5, 0x5b13, 0x6353, 0x9d38,
+0xadf9, 0x8cb5, 0x7c75, 0xbe39, 0xfffd, 0xdefb,
+0xdf3b, 0xfffe, 0xbdf9, 0x5312, 0xadfa, 0x9d78, 0x3a51, 0x9d78, 0x4251, 0x84b8,
+0x7c75, 0x8d37, 0x7cb7, 0x7476, 0x84f7, 0x9d37, 0xcebc, 0x6bd4, 0x94f7, 0x5b53,
+0x94f6, 0xadf8, 0x5b13, 0xb5f9, 0xfffd, 0xdefa,
+0xdf3b, 0xffff, 0xb5f9, 0x63d5, 0x8cf8, 0x4ad2, 0x4ad4, 0x6c35, 0x4293, 0x9d78,
+0x7cb7, 0x6435, 0x5b55, 0x4b13, 0x63d4, 0x9537, 0x9d37, 0x84b7, 0x63d4, 0x84b7,
+0x4292, 0x8cb6, 0x6bd4, 0xb5f9, 0xfffd, 0xdefa,
+0xdf3b, 0xffff, 0xadf9, 0x5b54, 0x7c77, 0x6c35, 0x42d4, 0x218f, 0x4292, 0x9537,
+0x8d38, 0x5354, 0x7475, 0x9538, 0x5b94, 0x7c76, 0x9537, 0x84b8, 0x114e, 0x4b13,
+0x5315, 0x7c76, 0x6353, 0xb5b9, 0xfffd, 0xdefa,
+0xdf3b, 0xffff, 0xb5f9, 0x6395, 0x8cf8, 0x6bd4, 0x5313, 0x7cb6, 0x4ad3, 0xb63b,
+0x8cf7, 0x7436, 0x6c35, 0x6bd6, 0x7cb7, 0xadba, 0xadb8, 0x8477, 0x7435, 0x7435,
+0x4ad2, 0x7cb6, 0x6b95, 0xb5fa, 0xfffc, 0xdefa,
+0xdf3b, 0xffff, 0xadb8, 0x5b53, 0xadfa, 0xb63a, 0x42d2, 0x8cf7, 0x29cf, 0x7c77,
+0x8cb6, 0x7cb6, 0x7436, 0x7435, 0x9538, 0x84b6, 0xa5ba, 0x4a91, 0x84b7, 0x4b12,
+0x8cf7, 0xb63a, 0x5b53, 0xadb8, 0xfffd, 0xdefa,
+0xdf3b, 0xffff, 0xadf9, 0x5353, 0x7cb6, 0x9d36, 0xadfa, 0x6393, 0x5b53, 0x194f,
+0x6395, 0x8d38, 0x9538, 0x9537, 0xa5b9, 0x9539, 0x4a92, 0x4291, 0x6352, 0x8476,
+0xa578, 0x7435, 0x5b53, 0xadb9, 0xfffd, 0xdefa,
+0xdf3b, 0xffff, 0xb5f9, 0x6394, 0x8cf7, 0x4ad1, 0xadb9, 0xa5f9, 0x84b6, 0x6b94,
+0x4a92, 0x31d0, 0x5b55, 0x5314, 0x4252, 0x4a92, 0x52d2, 0x94f8, 0x9d78, 0xb5f9,
+0x5ad2, 0x8477, 0x6b95, 0xb5b9, 0xfffc, 0xdefa,
+0xdf3b, 0xffff, 0xadb9, 0x5354, 0x84f8, 0x7435, 0x4292, 0xadb8, 0x8475, 0x5b53,
+0x7c77, 0x3a93, 0x29d1, 0x4b13, 0x3a51, 0x6bd5, 0x6355, 0x5312, 0xa5b8, 0x4a91,
+0x84b7, 0x7cb6, 0x5b54, 0xadb9, 0xfffc, 0xdefa,
+0xdf3b, 0xffff, 0xadb8, 0x6394, 0x8cf8, 0x6393, 0xa57a, 0x6352, 0xbe7b, 0x7c75,
+0x2a10, 0x5b54, 0x4ad4, 0x5353, 0x5b54, 0x4292, 0x6354, 0xadb9, 0x5b12, 0xa5b9,
+0x6394, 0x7c76, 0x6394, 0xadb8, 0xfffd, 0xdefa,
+0xdf3b, 0xffff, 0xb5f9, 0x6c35, 0x8cf7, 0x31cf, 0x9578, 0x84b7, 0x4a91, 0xadf9,
+0x5b53, 0x5b94, 0x4293, 0x4b53, 0x5b55, 0x4291, 0xa5b8, 0x6352, 0x7c36, 0xc6bb,
+0x4a91, 0x6b95, 0x7436, 0xb5b9, 0xfffd, 0xdefa,
+0xdf3b, 0xffff, 0xb5f8, 0x5b53, 0x9539, 0x7435, 0x6bd5, 0x6bd5, 0x7c75, 0x6b94,
+0xadb9, 0x6bd4, 0x2a11, 0x2a11, 0x3a51, 0x84b6, 0x7434, 0x8476, 0x73d4, 0xa5b9,
+0x7435, 0x7476, 0x6394, 0xadb9, 0xfffd, 0xdefa,
+0xdf3b, 0xffff, 0xb5f9, 0x6bd4, 0x9539, 0x9d38, 0x6bd6, 0x5313, 0x4291, 0x4ad2,
+0x94f6, 0xd6fd, 0x5b52, 0x5353, 0x8cb7, 0x9538, 0x5b53, 0x4292, 0x5b52, 0x9537,
+0xb5fa, 0x7c36, 0x6c35, 0xb5f9, 0xfffd, 0xdefa,
+0xdf3b, 0xffff, 0xb5f8, 0x7434, 0x84b7, 0x298e, 0x8cf6, 0xadf9, 0x9538, 0xadf9,
+0x9d78, 0x5312, 0xadb9, 0xadf9, 0x6bd4, 0x6395, 0x8cf7, 0x7435, 0x9d77, 0xa578,
+0x3a10, 0x6394, 0x7c75, 0xb5f9, 0xfffd, 0xdefa,
+0xdf3b, 0xffff, 0xbe39, 0x63d5, 0x6394, 0x84b6, 0xa5b8, 0x84b7, 0x6353, 0xa5b8,
+0x8cf7, 0x008c, 0x6b93, 0xadb9, 0x190d, 0x7476, 0xadfa, 0x6c35, 0x8cf7, 0xbe3a,
+0x6393, 0x7c75, 0x63d5, 0xb63a, 0xfffd, 0xdefa,
+0xdf3b, 0xffff, 0xb5f9, 0x5354, 0x6354, 0x94f8, 0x5b54, 0x63d4, 0x5b93, 0x84b7,
+0xa578, 0x7434, 0xadb9, 0xb5f9, 0x8cb6, 0x9d78, 0x9537, 0x5b93, 0x6bd5, 0x84b6,
+0x8cf7, 0x84b6, 0x5353, 0xb639, 0xfffd, 0xdefa,
+0xdf3a, 0xfffe, 0xbdf8, 0x63d4, 0x5b53, 0x6394, 0x6354, 0x7434, 0x7433, 0x7435,
+0x7433, 0x9537, 0x7c35, 0x7c34, 0x84b4, 0x7433, 0x7c74, 0x7474, 0x84b5, 0x73d4,
+0x8476, 0x7c35, 0x6393, 0xbe38, 0xfffd, 0xdefa,
+0xdf3a, 0xffbc, 0xf7bc, 0xc67a, 0xbe3a, 0xc67a, 0xc67b, 0xce7a, 0xc67a, 0xc63a,
+0xc67a, 0xc67a, 0xc63a, 0xc63b, 0xc67a, 0xc67a, 0xc63a, 0xc67a, 0xc63a, 0xbdf9,
+0xbdf9, 0xb5f9, 0xc67a, 0xf7bc, 0xfffc, 0xdefa,
+0xdf7b, 0xfffc, 0xffbc, 0xfffc, 0xfffd, 0xfffc, 0xfffc, 0xfffc, 0xfffd, 0xfffd,
+0xfffd, 0xfffc, 0xfffc, 0xfffc, 0xfffc, 0xfffd, 0xfffc, 0xfffb, 0xfffd, 0xfffd,
+0xfffc, 0xfffc, 0xfffd, 0xfffc, 0xfffc, 0xdefa,
+0x9572, 0xe73b, 0xdefa, 0xdefa, 0xdefa, 0xdefa, 0xdefa, 0xdefa, 0xdefa, 0xdefa,
+0xdefa, 0xdefa, 0xe6fa, 0xe6fa, 0xdefa, 0xdefa, 0xdefa, 0xdefa, 0xdefa, 0xdefa,
+0xdefa, 0xdefa, 0xdefa, 0xdefa, 0xe73a, 0xd6b9};
+
+static const unsigned char suitsi[4][30] = {
+ {0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x07, 0x0f, 0x1f, 0x1f, 0x0f, 0x7f, 0x7f, 0x7f, 0x0f, 0x1f, 0x1f, 0x0f, 0x07, 0x00},
+ {0x00, 0xf0, 0xf8, 0xfc, 0xfe, 0xfc, 0xf8, 0xf0, 0xf8, 0xfc, 0xfe, 0xfc, 0xf8, 0xf0, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x7f, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x00, 0x00},
+ {0x00, 0xc0, 0xe0, 0xe0, 0xfc, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfc, 0xe0, 0xe0, 0xc0, 0x00, 0x00, 0x03, 0x07, 0x07, 0x0f, 0x0f, 0x7f, 0x7f, 0x7f, 0x0f, 0x0f, 0x07, 0x07, 0x03, 0x00},
+ {0x00, 0x00, 0x00, 0x00, 0x80, 0xe0, 0xf8, 0xfe, 0xfe, 0xf8, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x1f, 0x7f, 0x7f, 0x1f, 0x07, 0x01, 0x00, 0x00, 0x00},
+};
+static const unsigned char suits[4][16] = {
/* Spades */
- {0x00, /* ........ */
- 0x18, /* ...O.... */
- 0x1c, /* ..OOO... */
- 0x3e, /* .OOOOO.. */
- 0x1c, /* .OOOOO.. */
- 0x18, /* ...O.... */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0x78, 0x3c, 0xfe, 0xfe, 0x3c, 0x78, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00},/* ........ */
/* Hearts */
- {0x00, /* ........ */
- 0x0c, /* ..O.O... */
- 0x1e, /* .OOOOO.. */
- 0x3c, /* .OOOOO.. */
- 0x1e, /* ..OOO... */
- 0x0c, /* ...O.... */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0x3c, 0x7e, 0xfc, 0xf8, 0xfc, 0x7e, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00},/* ........ */
/* Clubs */
- {0x00, /* ........ */
- 0x18, /* ..OOO... */
- 0x0a, /* ...O.... */
- 0x3e, /* .OOOOO.. */
- 0x0a, /* .O.O.O.. */
- 0x18, /* ...O.... */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0x70, 0x34, 0xfe, 0xfe, 0x34, 0x70, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00},/* ........ */
/* Diamonds */
- {0x00, /* ........ */
- 0x08, /* ...O.... */
- 0x1c, /* ..OOO... */
- 0x3e, /* .OOOOO.. */
- 0x1c, /* ..OOO... */
- 0x08, /* ...O.... */
- 0x00, /* ........ */
- 0x00} /* ........ */
+ {0x00, 0x70, 0xfc, 0xfe, 0xfe, 0xfc, 0x70, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00} /* ........ */
};
-static unsigned char numbers[13][8] = {
+static unsigned char numbers[13][16] = {
/* Ace */
- {0x00, /* ........ */
- 0x38, /* ...O.... */
- 0x14, /* ..O.O... */
- 0x12, /* .O...O.. */
- 0x14, /* .OOOOO.. */
- 0x38, /* .O...O.. */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0xf0, 0xfc, 0x7e, 0x36, 0x7e, 0xfc, 0xf0, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01},
/* 2 */
- {0x00, /* ........ */
- 0x24, /* ..OOO... */
- 0x32, /* .O...O.. */
- 0x32, /* ....O... */
- 0x2a, /* ..OO.... */
- 0x24, /* .OOOOO.. */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0x8c, 0xce, 0xe6, 0xf6, 0xbe, 0x9c, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00}, /* ........ */
/* 3 */
- {0x00, /* ........ */
- 0x22, /* .OOOO... */
- 0x2a, /* .....O.. */
- 0x2a, /* ..OOO... */
- 0x2a, /* .....O.. */
- 0x14, /* .OOOO... */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0xcc, 0x86, 0xb6, 0xb6, 0xfe, 0xdc, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00}, /* ........ */
/* 4 */
- {0x00, /* ........ */
- 0x10, /* ....O... */
- 0x18, /* ...O.... */
- 0x34, /* ..O..... */
- 0x12, /* .OOOOO.. */
- 0x10, /* ...O.... */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0x3e, 0x3e, 0x30, 0xfe, 0xfe, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00}, /* ........ */
/* 5 */
- {0x00, /* ........ */
- 0x2e, /* .OOOOO.. */
- 0x2a, /* .O...... */
- 0x2a, /* .OOOO... */
- 0x2a, /* .....O.. */
- 0x12, /* .OOOO... */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0xbe, 0xbe, 0xb6, 0xb6, 0xf6, 0xe6, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00}, /* ........ */
/* 6 */
- {0x00, /* ........ */
- 0x1c, /* ..OOO... */
- 0x2a, /* .O...... */
- 0x2a, /* .OOOO... */
- 0x2a, /* .O...O.. */
- 0x10, /* ..OOO... */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0xfc, 0xfe, 0xb6, 0xb6, 0xf6, 0xe4, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00}, /* ........ */
/* 7 */
- {0x00, /* ........ */
- 0x22, /* .OOOOO.. */
- 0x12, /* ....O... */
- 0x0a, /* ...O.... */
- 0x06, /* ..O..... */
- 0x02, /* .O...... */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0x86, 0xc6, 0x66, 0x36, 0x1e, 0x0e, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00}, /* ........ */
/* 8 */
- {0x00, /* ........ */
- 0x14, /* ..OOO... */
- 0x2a, /* .O...O.. */
- 0x2a, /* ..OOO... */
- 0x2a, /* .O...O.. */
- 0x14, /* ..OOO... */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0xdc, 0xfe, 0xb6, 0xb6, 0xfe, 0xdc, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00}, /* ........ */
/* 9 */
- {0x00, /* ........ */
- 0x04, /* ..OOO... */
- 0x2a, /* .O...O.. */
- 0x2a, /* ..OOOO.. */
- 0x2a, /* .....O.. */
- 0x1c, /* ..OOO... */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0x9c, 0xbe, 0xb6, 0xb6, 0xfe, 0xfc, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00}, /* ........ */
/* 10 */
- {0x00, /* ........ */
- 0x3e, /* .O..O... */
- 0x00, /* .O.O.O.. */
- 0x1c, /* .O.O.O.. */
- 0x22, /* .O.O.O.. */
- 0x1c, /* .O..O... */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0x18, 0x0c, 0xfe, 0x00, 0xfc, 0x86, 0xfc, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00}, /* ........ */
/* Jack */
- {0x00, /* ........ */
- 0x12, /* .OOOOO.. */
- 0x22, /* ...O.... */
- 0x1e, /* ...O.... */
- 0x02, /* .O.O.... */
- 0x02, /* ..O..... */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0xe6, 0xc6, 0x86, 0xfe, 0xfe, 0x06, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00}, /* ........ */
/* Queen */
- {0x00, /* ........ */
- 0x1c, /* ..OOO... */
- 0x22, /* .O...O.. */
- 0x32, /* .O...O.. */
- 0x22, /* .O.O.O.. */
- 0x1c, /* ..OOO... */
- 0x00, /* ........ */
- 0x00},/* ........ */
+ {0x00, 0x7c, 0xfe, 0xc6, 0xe6, 0xfe, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00}, /* ........ */
/* King */
- {0x00, /* ........ */
- 0x3e, /* .O...O.. */
- 0x08, /* .O..O... */
- 0x08, /* .OOO.... */
- 0x14, /* .O..O... */
- 0x22, /* .O...O.. */
- 0x00, /* ........ */
- 0x00} /* ........ */
+ {0x00, 0xfe, 0xfe, 0x38, 0x7c, 0xee, 0xc6, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00} /* ........ */
};
+
+#define FILENAME "sol.cfg"
+
+
#define NOT_A_CARD 255
/* number of cards per suit */
@@ -345,12 +324,29 @@ static unsigned char numbers[13][8] = {
#define NOT_A_COL 255
-/* number of cards that are drawn on the remains' stack (by pressing F2) */
-#define CARDS_PER_DRAW 3
/* size of a card on the screen */
-#define CARD_WIDTH 14
-#define CARD_HEIGHT 10
+#if (CONFIG_KEYPAD == IRIVER_H300_PAD)
+#define CARD_WIDTH 26
+#define CARD_HEIGHT 34
+#else
+#define CARD_WIDTH 18
+#define CARD_HEIGHT 24
+#endif
+
+/* where the cards start */
+#define CARD_START CARD_HEIGHT +4
+
+#if (CONFIG_KEYPAD == IRIVER_H300_PAD)
+#define KNOWN_CARD 23
+#define NOT_KNOWN_CARD 30
+#else
+#define KNOWN_CARD 13
+#define NOT_KNOWN_CARD 20
+#endif
+
+/* background color */
+#define background_color LCD_RGBPACK(0,157,0)
typedef struct card {
unsigned char suit : 2;
@@ -503,51 +499,74 @@ int solitaire_help(void){
lastbutton = button;
}
}
+#define CFGFILE_VERSION 0
+int draw_type;
+
+
+unsigned char change_draw(unsigned char draw){
+ if (draw == 0)
+ return 1;
+ else
+ return 0;
+}
+static struct configdata config[] = {
+ { TYPE_INT, 0, 1, &draw_type, "draw_type", NULL, NULL }
+};
/* menu return codes */
#define MENU_RESUME 0
#define MENU_RESTART 1
-#define MENU_HELP 2
-#define MENU_QUIT 3
-#define MENU_USB 4
+#define MENU_HELP 3
+#define MENU_QUIT 4
+#define MENU_USB 5
+#define MENU_OPT 2
/* menu item number */
-#define MENU_LENGTH 4
+#define MENU_LENGTH 5
/* different menu behaviors */
-#define MENU_BEFOREGAME 0
-#define MENU_DURINGGAME 1
+#define MENU_BEFOREGAME 0
+#define MENU_BEFOREGAMEOP 1
+#define MENU_DURINGGAME 2
+unsigned char when;
/* the menu */
/* text displayed changes depending on the 'when' parameter */
-int solitaire_menu(unsigned char when)
+int solitaire_menu(unsigned char when_n)
{
- static char menu[2][MENU_LENGTH][13] =
+ static char menu[3][MENU_LENGTH][17] =
{ { "Start Game",
"",
+ "Draw Three Cards",
+ "Help",
+ "Quit" },
+ { "Start Game",
+ "",
+ "Draw One Card",
"Help",
"Quit" },
{ "Resume Game",
"Restart Game",
+ "",
"Help",
- "Quit"}
+ "Quit"},
};
+
int i;
int cursor=0;
int button;
int fh;
-
+ when=when_n;
rb->lcd_getstringsize("A", NULL, &fh);
fh++;
- if(when!=MENU_BEFOREGAME && when!=MENU_DURINGGAME)
+ if(when != MENU_BEFOREGAMEOP && when!=MENU_BEFOREGAME && when!=MENU_DURINGGAME)
when = MENU_DURINGGAME;
while(1){
rb->lcd_clear_display();
-
rb->lcd_putsxy(20, 1, "Solitaire");
for(i = 0; i<MENU_LENGTH; i++){
@@ -563,11 +582,11 @@ int solitaire_menu(unsigned char when)
button = rb->button_get(true);
switch(button){
- case SOL_UP:
+ case BUTTON_UP:
cursor = (cursor + MENU_LENGTH - 1)%MENU_LENGTH;
break;
- case SOL_DOWN:
+ case BUTTON_DOWN:
cursor = (cursor + 1)%MENU_LENGTH;
break;
@@ -581,6 +600,7 @@ int solitaire_menu(unsigned char when)
switch(cursor){
case MENU_RESUME:
case MENU_RESTART:
+ case MENU_OPT:
case MENU_QUIT:
return cursor;
@@ -598,10 +618,11 @@ int solitaire_menu(unsigned char when)
#endif
rb->splash(HZ, true, "Solitaire for Rockbox by dionoea");
break;
-
- case SOL_QUIT:
+ case BUTTON_ON:
+ return MENU_OPT;
+ case BUTTON_OFF:
return MENU_QUIT;
-
+
default:
if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
return MENU_USB;
@@ -624,18 +645,32 @@ card deck[SUITS * CARDS_PER_SUIT];
/* the remaining cards */
unsigned char rem;
unsigned char cur_rem;
+unsigned char coun_rem;
/* the 7 game columns */
unsigned char cols[COL_NUM];
+int CARDS_PER_DRAW;
/* the 4 final stacks */
unsigned char stacks[SUITS];
/* initialize the game */
void solitaire_init(void){
+
unsigned char c;
int i,j;
-
+#if LCD_DEPTH>1
+ rb->lcd_set_foreground(LCD_BLACK);
+#ifdef HAVE_LCD_COLOR
+ rb->lcd_set_background(background_color);
+#endif
+#endif
+/* number of cards that are drawn on the remains' stack (by pressing F2) */
+ if(draw_type == 0) {
+ CARDS_PER_DRAW =3;
+ } else {
+ CARDS_PER_DRAW=1;
+ }
/* init deck */
for(i=0;i<SUITS;i++){
for(j=0;j<CARDS_PER_SUIT;j++){
@@ -688,6 +723,8 @@ void solitaire_init(void){
/* init the remainder */
cur_rem = NOT_A_CARD;
+
+ coun_rem=0;
}
/* find the column number in which 'card' can be found */
@@ -835,6 +872,7 @@ unsigned char move_card(unsigned char dest_col, unsigned char src_card){
/* if src card is the first card from the stack */
if(src_card_prev == NOT_A_CARD){
rem = deck[src_card].next;
+ coun_rem = coun_rem-1;
}
/* if src card is not the first card from the stack */
else {
@@ -842,6 +880,7 @@ unsigned char move_card(unsigned char dest_col, unsigned char src_card){
}
cur_rem = src_card_prev;
deck[src_card].next = NOT_A_CARD;
+ coun_rem = coun_rem-1;
}
/* if the src card is from somewhere else, just take everything */
else {
@@ -855,11 +894,13 @@ unsigned char move_card(unsigned char dest_col, unsigned char src_card){
deck[src_card_prev].next = NOT_A_CARD;
}
}
-
+ sel_card = NOT_A_CARD;
/* tada ! */
return MOVE_OK;
}
+
+
#define SOLITAIRE_WIN 0
#define SOLITAIRE_QUIT 1
#define SOLITAIRE_USB 2
@@ -874,21 +915,35 @@ unsigned char move_card(unsigned char dest_col, unsigned char src_card){
/* the game */
int solitaire(void){
- int i,j;
+ int i,j,x;
int button, lastbutton = 0;
- unsigned char c;
+ unsigned char c,h,prevcard;
int biggest_col_length;
-
+
+ configfile_init(rb);
+ configfile_load(FILENAME, config, 1, 0);
+
rb->srand( *rb->current_tick );
-
- switch(solitaire_menu(MENU_BEFOREGAME)) {
- case MENU_QUIT:
+ switch(solitaire_menu(draw_type==0?MENU_BEFOREGAME:MENU_BEFOREGAMEOP)) {
+ case MENU_QUIT:
return SOLITAIRE_QUIT;
case MENU_USB:
return SOLITAIRE_USB;
+ case MENU_OPT:
+ draw_type=change_draw(draw_type);
+ configfile_save(FILENAME, config, 1, 0);
+ when=draw_type==0?MENU_BEFOREGAME:MENU_BEFOREGAMEOP;
+ return NULL;
}
-
+#if LCD_DEPTH>1
+ rb->lcd_set_foreground(LCD_BLACK);
+#ifdef HAVE_LCD_COLOR
+ rb->lcd_set_background(background_color);
+#else
+ rb->lcd_set_background(LCD_DEFAULT_BG);
+#endif
+#endif
solitaire_init();
while(true){
@@ -918,63 +973,100 @@ int solitaire(void){
/* draw the columns */
for(i=0;i<COL_NUM;i++){
c = cols[i];
- j = 0;
+ j = CARD_START;
while(true){
if(c==NOT_A_CARD) {
/* draw the cursor on empty columns */
if(cur_col == i){
rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
- rb->lcd_fillrect(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+2, 2, CARD_WIDTH-3, CARD_HEIGHT-1);
+ rb->lcd_fillrect(1+i*(LCD_WIDTH-2)/COL_NUM+1, j+1, CARD_WIDTH-1, CARD_HEIGHT-1);
}
break;
}
/* clear the card's spot */
+
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- rb->lcd_fillrect(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM, j+1, CARD_WIDTH, CARD_HEIGHT-1);
+ rb->lcd_fillrect(1+i*(LCD_WIDTH - 2)/COL_NUM, j+1, CARD_WIDTH, CARD_HEIGHT-1);
rb->lcd_set_drawmode(DRMODE_SOLID);
/* known card */
- if(deck[c].known){
+ if(deck[c].known == 1){
+#if LCD_DEPTH>1
+ #ifdef HAVE_LCD_COLOR
+ rb->lcd_set_foreground(LCD_WHITE);
+ rb->lcd_set_background(LCD_WHITE);
+ #else
+ rb->lcd_set_foreground(LCD_DEFAULT_BG);
+ rb->lcd_set_background(LCD_DEFAULT_BG);
+ #endif
+#endif
+ rb->lcd_fillrect(1+i*(LCD_WIDTH - 2)/COL_NUM+1, j+1, CARD_WIDTH-1, CARD_HEIGHT-1);
#if LCD_DEPTH>1
rb->lcd_set_foreground(colors[deck[c].suit]);
#endif
- rb->lcd_mono_bitmap(numbers[deck[c].num], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1, j, 8, 8);
- rb->lcd_mono_bitmap(suits[deck[c].suit], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+7, j, 8, 8);
+ rb->lcd_mono_bitmap(numbers[deck[c].num], 1+i*(LCD_WIDTH - 2)/COL_NUM+1, j+1, BMPWIDTH_c, BMPHEIGHT_c);
+ rb->lcd_mono_bitmap(suits[deck[c].suit], 1+i*(LCD_WIDTH - 2)/COL_NUM+ BMPWIDTH_c +2, j+1, BMPWIDTH_c, BMPHEIGHT_c);
#if LCD_DEPTH>1
rb->lcd_set_foreground(LCD_BLACK);
+#ifdef HAVE_LCD_COLOR
+ rb->lcd_set_background(background_color);
+#endif
+#endif
+ } else {
+#ifdef HAVE_LCD_COLOR
+ rb->lcd_bitmap(backside, 1+i*(LCD_WIDTH - 2)/COL_NUM+1, j+1, BMPWIDTH_BACKSIDE, BMPHEIGHT_BACKSIDE);
#endif
}
/* draw top line of the card */
- rb->lcd_drawline(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1,j,i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+CARD_WIDTH-1,j);
+ rb->lcd_drawline(1+i*(LCD_WIDTH - 2)/COL_NUM+1,j,1+i*(LCD_WIDTH - 2)/COL_NUM+CARD_WIDTH-1,j);
/* selected card */
if(c == sel_card && sel_card != NOT_A_CARD){
- rb->lcd_drawrect(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1, j+1, CARD_WIDTH-1, CARD_HEIGHT-1);
+ rb->lcd_drawrect(1+i*(LCD_WIDTH - 2)/COL_NUM+1, j+1, CARD_WIDTH-1, CARD_HEIGHT-1);
}
/* cursor (or not) */
if(c == cur_card){
rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
- rb->lcd_fillrect(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1, j+1, CARD_WIDTH-1, CARD_HEIGHT-1);
+ rb->lcd_fillrect(1+i*(LCD_WIDTH - 2)/COL_NUM+1, j+1, CARD_WIDTH-1, CARD_HEIGHT-1);
rb->lcd_set_drawmode(DRMODE_SOLID);
/* go to the next card */
c = deck[c].next;
if(c == NOT_A_CARD) break;
- j += CARD_HEIGHT - 2;
+ else {
+ if(deck[c].known == 0) {
+ j += CARD_HEIGHT - NOT_KNOWN_CARD;
+ } else {
+ j += CARD_HEIGHT - KNOWN_CARD;
+ }
+ }
} else {
/* go to the next card */
- c = deck[c].next;
+ h = c;
+ c = deck[c].next;
if(c == NOT_A_CARD) break;
- j += min(CARD_HEIGHT - 2, (LCD_HEIGHT - CARD_HEIGHT)/biggest_col_length);
+ if(c!=NOT_A_CARD) {
+ if(deck[h].known == 0) {
+ /*changeeee*/ j += CARD_HEIGHT - NOT_KNOWN_CARD;
+ } else {
+ j += min(CARD_HEIGHT - KNOWN_CARD, (LCD_HEIGHT - CARD_START - CARD_HEIGHT)/biggest_col_length);
+ }
+ }
}
}
if(cols[i]!=NOT_A_CARD){
/* draw line to the left of the column */
- rb->lcd_drawline(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM,1,i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM,j+CARD_HEIGHT-1);
+ rb->lcd_drawline(1+i*(LCD_WIDTH - 2)/COL_NUM,CARD_START,1+i*(LCD_WIDTH - 2)/COL_NUM,j+CARD_HEIGHT-1);
/* draw line to the right of the column */
- rb->lcd_drawline(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+CARD_WIDTH,1,i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+CARD_WIDTH,j+CARD_HEIGHT-1);
+ rb->lcd_drawline(1+i*(LCD_WIDTH - 2)/COL_NUM+CARD_WIDTH,CARD_START,1+i*(LCD_WIDTH - 2)/COL_NUM+CARD_WIDTH,j+CARD_HEIGHT-1);
/* draw bottom of the last card */
- rb->lcd_drawline(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1,j+CARD_HEIGHT,i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+CARD_WIDTH-1,j+CARD_HEIGHT);
+ rb->lcd_drawline(1+i*(LCD_WIDTH - 2)/COL_NUM+1,j+CARD_HEIGHT,1+i*(LCD_WIDTH - 2)/COL_NUM+CARD_WIDTH-1,j+CARD_HEIGHT);
}
}
-
+#if LCD_DEPTH>1
+ rb->lcd_set_foreground(LCD_BLACK);
+#ifdef HAVE_LCD_COLOR
+ rb->lcd_set_background(background_color);
+#endif
+#endif
+ rb->lcd_set_drawmode(DRMODE_SOLID);
/* draw the stacks */
for(i=0; i<SUITS; i++){
c = stacks[i];
@@ -983,67 +1075,177 @@ int solitaire(void){
c = deck[c].next;
}
}
+
+ if(c != NOT_A_CARD) {
+#if LCD_DEPTH>1
+ #ifdef HAVE_LCD_COLOR
+ rb->lcd_set_foreground(LCD_WHITE);
+ rb->lcd_set_background(LCD_WHITE);
+ #else
+ rb->lcd_set_foreground(LCD_DEFAULT_BG);
+ rb->lcd_set_background(LCD_DEFAULT_BG);
+ #endif
+#endif
+ rb->lcd_fillrect(LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+1, 2, CARD_WIDTH-1, CARD_HEIGHT-1);
+#if LCD_DEPTH>1
+ rb->lcd_set_foreground(colors[i]);
+#endif
+ rb->lcd_mono_bitmap(numbers[deck[c].num], LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+1, 2, BMPWIDTH_c, BMPHEIGHT_c);
+ rb->lcd_mono_bitmap(suits[deck[c].suit], LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+10, 2, BMPWIDTH_c, BMPHEIGHT_c);
+ } else {
+#if LCD_DEPTH>1
+ #ifdef HAVE_LCD_COLOR
+ rb->lcd_set_foreground(LCD_WHITE);
+ rb->lcd_set_background(LCD_WHITE);
+ #else
+ rb->lcd_set_foreground(LCD_DEFAULT_BG);
+ rb->lcd_set_background(LCD_DEFAULT_BG);
+ #endif
+#endif
+ rb->lcd_fillrect(LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+1, 2, CARD_WIDTH-1, CARD_HEIGHT-1);
#if LCD_DEPTH>1
rb->lcd_set_foreground(colors[i]);
+#endif
+#ifdef HAVE_LCD_COLOR
+ rb->lcd_mono_bitmap(suitsi[i], LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+(CARD_WIDTH/2-7), CARD_HEIGHT/2-7, 15, 16);
#endif
- if(c != NOT_A_CARD) {
- rb->lcd_mono_bitmap(numbers[deck[c].num], LCD_WIDTH2 - CARD_WIDTH+1, i*CARD_HEIGHT, 8, 8);
}
- rb->lcd_mono_bitmap(suits[i], LCD_WIDTH2 - CARD_WIDTH+7, i*CARD_HEIGHT, 8, 8);
#if LCD_DEPTH>1
- rb->lcd_set_foreground(colors[deck[c].suit]);
+ rb->lcd_set_foreground(LCD_BLACK);
+#ifdef HAVE_LCD_COLOR
+ rb->lcd_set_background(background_color);
+#endif
#endif
/* draw a selected card */
if(c != NOT_A_CARD) {
if(sel_card == c){
- rb->lcd_drawrect(LCD_WIDTH2 - CARD_WIDTH+1, i*CARD_HEIGHT + 1, CARD_WIDTH-1, CARD_HEIGHT-1);
+ rb->lcd_drawrect(LCD_WIDTH2 -(CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+1, 2, CARD_WIDTH-1, CARD_HEIGHT-1);
}
- }
- rb->lcd_drawline(LCD_WIDTH2 - CARD_WIDTH+1, i*CARD_HEIGHT,LCD_WIDTH2 - 1,i*CARD_HEIGHT);
- rb->lcd_drawline(LCD_WIDTH2 - CARD_WIDTH,i*CARD_HEIGHT+1,LCD_WIDTH2 - CARD_WIDTH,(i+1)*CARD_HEIGHT-1);
- rb->lcd_drawline(LCD_WIDTH2 - CARD_WIDTH+1,(i+1)*CARD_HEIGHT,LCD_WIDTH2 - 1,(i+1)*CARD_HEIGHT);
+ }
+ rb->lcd_drawline(LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+1, 1,LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+CARD_WIDTH,1);
+ rb->lcd_drawline(LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2 ,2,LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2,CARD_HEIGHT);
+ rb->lcd_drawline(LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+1,CARD_HEIGHT+1,LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+CARD_WIDTH - 1,CARD_HEIGHT+1);
#if BIG_SCREEN
- rb->lcd_drawline(LCD_WIDTH2,i*CARD_HEIGHT+1,LCD_WIDTH2,(i+1)*CARD_HEIGHT-1);
+ rb->lcd_drawline(LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+CARD_WIDTH,2,LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+CARD_WIDTH,CARD_HEIGHT);
#endif
/* draw the cursor on one of the stacks */
if(cur_col == STACKS_COL + i){
rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
- rb->lcd_fillrect(LCD_WIDTH2 - CARD_WIDTH+1, i*CARD_HEIGHT + 1, CARD_WIDTH-1, CARD_HEIGHT-1);
+ rb->lcd_fillrect(LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+1, 2, CARD_WIDTH-1, CARD_HEIGHT-1);
rb->lcd_set_drawmode(DRMODE_SOLID);
}
}
/* draw the remains */
- if(rem != NOT_A_CARD) {
- rb->lcd_drawline(LCD_WIDTH2 - CARD_WIDTH+1,LCD_HEIGHT-CARD_HEIGHT-1,LCD_WIDTH2 - 1,LCD_HEIGHT-CARD_HEIGHT-1);
- rb->lcd_drawline(LCD_WIDTH2 - CARD_WIDTH,LCD_HEIGHT-CARD_HEIGHT,LCD_WIDTH2 - CARD_WIDTH,LCD_HEIGHT-2);
- rb->lcd_drawline(LCD_WIDTH2 - CARD_WIDTH+1,LCD_HEIGHT-1,LCD_WIDTH2 - 1,LCD_HEIGHT-1);
-#if BIG_SCREEN
- rb->lcd_drawline(LCD_WIDTH2,LCD_HEIGHT-CARD_HEIGHT,LCD_WIDTH2,LCD_HEIGHT-2);
+
+
+ if(rem != NOT_A_CARD) {
+ coun_rem = coun_rem>2?coun_rem=2:coun_rem;
+ if(cur_rem != NOT_A_CARD && find_prev_card(cur_rem) != NOT_A_CARD && CARDS_PER_DRAW != 1) {
+ j = (coun_rem)*(BMPWIDTH_c+2);
+ for(i=0;i<=coun_rem;i++) {
+ if (i>0 && i<3){
+#if LCD_DEPTH>1
+ #ifdef HAVE_LCD_COLOR
+ rb->lcd_set_foreground(LCD_WHITE);
+ rb->lcd_set_background(LCD_WHITE);
+ #else
+ rb->lcd_set_foreground(LCD_DEFAULT_BG);
+ rb->lcd_set_background(LCD_DEFAULT_BG);
+ #endif
#endif
- if(cur_rem != NOT_A_CARD){
+ rb->lcd_fillrect(CARD_WIDTH+4+j+1, 2, BMPWIDTH_c+1, CARD_HEIGHT-1);
+ #if LCD_DEPTH>1
+ rb->lcd_set_foreground(LCD_BLACK);
+ #endif
+ rb->lcd_drawline(CARD_WIDTH+4+j+1,1,CARD_WIDTH+4+j+BMPWIDTH_c+2,1); /* top line */
+ rb->lcd_drawline(CARD_WIDTH+4+j+1,CARD_HEIGHT+1,CARD_WIDTH+4+j+BMPWIDTH_c+2,CARD_HEIGHT+1); /* bottom line */
+ rb->lcd_drawline(CARD_WIDTH+4+j,2,CARD_WIDTH+4+j,CARD_HEIGHT); /* right line */
+
+
+ prevcard = cur_rem;
+ for(x=0;i>x;x++)
+ prevcard = find_prev_card(prevcard);
+ #if LCD_DEPTH>1
+ rb->lcd_set_foreground(colors[deck[prevcard].suit]);
+ #ifdef HAVE_LCD_COLOR
+ rb->lcd_set_background(LCD_WHITE);
+ #endif
+ #endif
+ rb->lcd_mono_bitmap(numbers[deck[prevcard].num], CARD_WIDTH+4+j+1, 3, BMPWIDTH_c, BMPHEIGHT_c);
+ rb->lcd_mono_bitmap(suits[deck[prevcard].suit], CARD_WIDTH+4+j+1, 4+BMPHEIGHT_c, BMPWIDTH_c, BMPHEIGHT_c);
+
+
+ }
+ j -= BMPWIDTH_c+2;
+ }
+ }
#if LCD_DEPTH>1
- rb->lcd_set_foreground(colors[deck[cur_rem].suit]);
+ rb->lcd_set_foreground(LCD_BLACK);
#endif
- rb->lcd_mono_bitmap(numbers[deck[cur_rem].num], LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT, 8, 8);
- rb->lcd_mono_bitmap(suits[deck[cur_rem].suit], LCD_WIDTH2 - CARD_WIDTH+7, LCD_HEIGHT-CARD_HEIGHT, 8, 8);
- /* draw a selected card */
+ if(CARDS_PER_DRAW==1 || cur_rem==NOT_A_CARD)
+ j=0;
+ else
+ j=(coun_rem)*(BMPWIDTH_c+2);
+ if(cur_rem != NOT_A_CARD){
+ rb->lcd_drawline(CARD_WIDTH+4+j+1,1,CARD_WIDTH+4+j+CARD_WIDTH-1,1); /* top line */
+ rb->lcd_drawline(CARD_WIDTH+4+j,2,CARD_WIDTH+4+j,CARD_HEIGHT); /* left line */
+ rb->lcd_drawline(CARD_WIDTH+4+j+1,CARD_HEIGHT+1,CARD_WIDTH+4+j+CARD_WIDTH - 1,CARD_HEIGHT+1); /* bottom line */
+ rb->lcd_drawline(CARD_WIDTH+4+j+CARD_WIDTH,2,CARD_WIDTH+4+j+CARD_WIDTH,CARD_HEIGHT); /* right line */
+ }
+
+ rb->lcd_drawline(2,1,CARD_WIDTH+1,1); /* top line */
+ rb->lcd_drawline(1,2,1,CARD_HEIGHT); /* left line */
+ rb->lcd_drawline(2,CARD_HEIGHT+1,CARD_WIDTH + 1,CARD_HEIGHT+1); /* bottom line */
+ rb->lcd_drawline(CARD_WIDTH+2,2,CARD_WIDTH+2,CARD_HEIGHT); /* right line */
+
+ if(cur_rem != NOT_A_CARD){
#if LCD_DEPTH>1
- rb->lcd_set_foreground(LCD_BLACK);
+ #ifdef HAVE_LCD_COLOR
+ rb->lcd_set_foreground(LCD_WHITE);
+ rb->lcd_set_background(LCD_WHITE);
+ #else
+ rb->lcd_set_foreground(LCD_DEFAULT_BG);
+ rb->lcd_set_background(LCD_DEFAULT_BG);
+ #endif
#endif
- if(sel_card == cur_rem){
- rb->lcd_drawrect(LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT,CARD_WIDTH-1, CARD_HEIGHT-1);
+ rb->lcd_fillrect(CARD_WIDTH+4+j+1, 2, CARD_WIDTH-1, CARD_HEIGHT-1);
+ #if LCD_DEPTH>1
+ rb->lcd_set_foreground(colors[deck[cur_rem].suit]);
+ #endif
+ rb->lcd_mono_bitmap(numbers[deck[cur_rem].num], CARD_WIDTH+4+j+1, 3, BMPWIDTH_c, BMPHEIGHT_c);
+ rb->lcd_mono_bitmap(suits[deck[cur_rem].suit], CARD_WIDTH+4+j+10, 3, BMPWIDTH_c, BMPHEIGHT_c);
+ /* draw a selected card */
+ #if LCD_DEPTH>1
+ rb->lcd_set_foreground(LCD_BLACK);
+ #ifdef HAVE_LCD_COLOR
+ rb->lcd_set_background(background_color);
+ #endif
+ #endif
+ if(sel_card == cur_rem){
+ rb->lcd_drawrect(CARD_WIDTH+4+j+1, 2,CARD_WIDTH-1, CARD_HEIGHT-1);
+ }
}
+ if(rem != NOT_A_CARD){
+#ifdef HAVE_LCD_COLOR
+ rb->lcd_bitmap(backside, 2, 2, BMPWIDTH_BACKSIDE, BMPHEIGHT_BACKSIDE);
+#endif
+ }
}
- }
+
+
/* draw the cursor */
- if(cur_col == REM_COL){
+ if(cur_col == REM_COL && rem != NOT_A_CARD){
+ rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
+ rb->lcd_fillrect(CARD_WIDTH+4+j+1, 2,CARD_WIDTH-1, CARD_HEIGHT-1);
+ rb->lcd_set_drawmode(DRMODE_SOLID);
+ } else if(cur_col == REM_COL && rem == NOT_A_CARD) {
rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
- rb->lcd_fillrect(LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT,CARD_WIDTH-1, CARD_HEIGHT-1);
+ rb->lcd_fillrect(CARD_WIDTH+4+1, 2,CARD_WIDTH-1, CARD_HEIGHT-1);
rb->lcd_set_drawmode(DRMODE_SOLID);
}
-
-
+
+
rb->lcd_update();
/* what to do when a key is pressed ... */
@@ -1104,7 +1306,8 @@ int solitaire(void){
cur_col = (cur_col - COL_NUM + 1)%(SUITS + 1) + COL_NUM;
if(cur_col == REM_COL){
cur_card = cur_rem;
- } else {
+ }
+ else {
cur_card = find_last_card(cur_col);
}
break;
@@ -1154,6 +1357,7 @@ int solitaire(void){
#endif
if(cur_card != NOT_A_CARD){
move_card(deck[cur_card].suit + STACKS_COL, cur_card);
+ sel_card = NOT_A_CARD;
}
break;
@@ -1163,11 +1367,14 @@ int solitaire(void){
if(lastbutton != SOL_MOVE_PRE)
break;
#endif
+
if(sel_card == NOT_A_CARD) {
- if(cur_card != NOT_A_CARD){
+ if(cur_card != NOT_A_CARD) {
/* reveal a hidden card */
if(deck[cur_card].next == NOT_A_CARD && deck[cur_card].known==0){
deck[cur_card].known = 1;
+ } else if(cur_col == REM_COL && cur_rem == NOT_A_CARD) {
+ break;
/* select a card */
} else {
sel_card = cur_card;
@@ -1192,7 +1399,9 @@ int solitaire(void){
if(lastbutton != SOL_REM2CUR_PRE)
break;
#endif
+ coun_rem = coun_rem-1;
move_card(cur_col, cur_rem);
+ sel_card = NOT_A_CARD;
break;
/* If the card on top of the remains can be put on one */
@@ -1204,9 +1413,26 @@ int solitaire(void){
#endif
if(cur_rem != NOT_A_CARD){
move_card(deck[cur_rem].suit + COL_NUM, cur_rem);
+ sel_card = NOT_A_CARD;
+ coun_rem = coun_rem-1;
}
break;
+
+#ifdef SOL_REM
+ case SOL_REM:
+ if(sel_card != NOT_A_CARD){
+ /* unselect selected card */
+ sel_card = NOT_A_CARD;
+ break;
+ }
+ if(rem != NOT_A_CARD && cur_rem != NOT_A_CARD) {
+ sel_card=cur_rem;
+ break;
+ }
+ break;
+#endif
+
/* unselect selected card or ... */
/* draw new cards from the remains of the deck */
case SOL_DRAW:
@@ -1221,38 +1447,47 @@ int solitaire(void){
}
if(rem != NOT_A_CARD) {
int cur_rem_old = cur_rem;
+ coun_rem = 0;
/* draw new cards form the remains of the deck */
- if(cur_rem == NOT_A_CARD){
+ if(cur_rem == NOT_A_CARD){ /*if the cursor card is null*/
cur_rem = rem;
i = CARDS_PER_DRAW - 1;
} else {
i = CARDS_PER_DRAW;
}
+
while(i>0 && deck[cur_rem].next != NOT_A_CARD){
cur_rem = deck[cur_rem].next;
i--;
+ coun_rem = coun_rem +1;
}
/* test if any cards are really left on */
/* the remains' stack */
if(i == CARDS_PER_DRAW){
cur_rem = NOT_A_CARD;
+ coun_rem = 0;
}
/* if cursor was on remains' stack when new cards were
* drawn, put cursor on top of remains' stack */
- if(cur_col == REM_COL && cur_card == cur_rem_old)
+ if(cur_col == REM_COL && cur_card == cur_rem_old) {
cur_card = cur_rem;
+ sel_card = NOT_A_CARD;
+ }
}
break;
/* Show the menu */
case SOL_QUIT:
+#if LCD_DEPTH>1
+ rb->lcd_set_background(LCD_DEFAULT_BG);
+#endif
switch(solitaire_menu(MENU_DURINGGAME)){
case MENU_QUIT:
return SOLITAIRE_QUIT;
case MENU_USB:
return SOLITAIRE_USB;
-
+
case MENU_RESTART:
solitaire_init();
break;
@@ -1285,9 +1520,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
(void)parameter;
rb = api;
/* end of plugin init */
-
/* Welcome to Solitaire ! */
- rb->splash(HZ*2, true, "Welcome to Solitaire !");
+
+ rb->splash(HZ, true, "Welcome to Solitaire !");
/* play the game :) */
/* Keep playing if a game was won (that means display the menu after */
diff --git a/docs/CREDITS b/docs/CREDITS
index 52fead8dff..2bd8b2616b 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -150,3 +150,4 @@ David J. Song
Jeong Taek In
Anders Kagerin
Peter D'Hoye
+Ben Basha