summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Cellerier <dionoea@videolan.org>2006-07-11 21:38:27 +0000
committerAntoine Cellerier <dionoea@videolan.org>2006-07-11 21:38:27 +0000
commit7ee850e432a1575d9b974d4c88e630e0559a1010 (patch)
tree6def35ccaa18353c901839a51409400ebc467b81
parent18e6529d5d6c988f74a815085a56a39294f97301 (diff)
downloadrockbox-7ee850e432a1575d9b974d4c88e630e0559a1010.tar.gz
rockbox-7ee850e432a1575d9b974d4c88e630e0559a1010.zip
* fix bug (when double clicking on a card on the remains' stack to
automatically move it to the corresponding final stack, if the move worked, the cursor wasn't able to select a new card afterwards. - yeah, this sounds a bit complicated) * remove trailing spaces/tabs TODO: Fix/clean/rewrite the plugin. This whole code is a mess. It's impossible to read and maintain. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10196 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/solitaire.c148
1 files changed, 76 insertions, 72 deletions
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index 56990beeb3..a9a0d5c762 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2004-2005 dionoea (Antoine Cellerier) 10 * Copyright (C) 2004-2006 dionoea (Antoine Cellerier)
11 * 11 *
12 * All files in this archive are subject to the GNU General Public License. 12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement. 13 * See the file COPYING in the source tree root for full license agreement.
@@ -16,7 +16,7 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20/***************************************************************************** 20/*****************************************************************************
21Solitaire by dionoea 21Solitaire by dionoea
22Graphics & Fix Bugs by Ben Basha 22Graphics & Fix Bugs by Ben Basha
@@ -187,26 +187,26 @@ static struct plugin_api* rb;
187#define HELP_SOL_REM2STACK "PLAY+RIGHT: Put the card on top of the remains' stack on one of the 4 final stacks." 187#define HELP_SOL_REM2STACK "PLAY+RIGHT: Put the card on top of the remains' stack on one of the 4 final stacks."
188 188
189#elif (CONFIG_KEYPAD == IPOD_4G_PAD) ||(CONFIG_KEYPAD == IPOD_3G_PAD) 189#elif (CONFIG_KEYPAD == IPOD_4G_PAD) ||(CONFIG_KEYPAD == IPOD_3G_PAD)
190#define HELP_SOL_MOVE "SELECT: Select cards, Move cards, reveal hidden cards ..." 190#define HELP_SOL_MOVE "SELECT: Select cards, Move cards, reveal hidden cards ..."
191#define HELP_SOL_DRAW "SELECT+PLAY: Un-select a card if it was selected. Else, draw 3 new cards out of the remains' stack." 191#define HELP_SOL_DRAW "SELECT+PLAY: Un-select a card if it was selected. Else, draw 3 new cards out of the remains' stack."
192#define HELP_SOL_REM2CUR "SELECT+LEFT: Put the card on top of the remains' stack on top of the cursor." 192#define HELP_SOL_REM2CUR "SELECT+LEFT: Put the card on top of the remains' stack on top of the cursor."
193#define HELP_SOL_CUR2STACK "SELECT+RIGHT..: Put the card under the cursor on one of the 4 final stacks." 193#define HELP_SOL_CUR2STACK "SELECT+RIGHT..: Put the card under the cursor on one of the 4 final stacks."
194#define HELP_SOL_REM2STACK "LEFT+RIGHT: Put the card on top of the remains' stack on one of the 4 final stacks." 194#define HELP_SOL_REM2STACK "LEFT+RIGHT: Put the card on top of the remains' stack on one of the 4 final stacks."
195 195
196#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD) 196#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD)
197#define HELP_SOL_MOVE "MENU: Select cards, Move cards, reveal hidden cards ..." 197#define HELP_SOL_MOVE "MENU: Select cards, Move cards, reveal hidden cards ..."
198#define HELP_SOL_DRAW "PLAY: Un-select a card if it was selected. Else, draw 3 new cards out of the remains' stack." 198#define HELP_SOL_DRAW "PLAY: Un-select a card if it was selected. Else, draw 3 new cards out of the remains' stack."
199#define HELP_SOL_REM2CUR "REC+LEFT: Put the card on top of the remains' stack on top of the cursor." 199#define HELP_SOL_REM2CUR "REC+LEFT: Put the card on top of the remains' stack on top of the cursor."
200#define HELP_SOL_CUR2STACK "REC+UP..: Put the card under the cursor on one of the 4 final stacks." 200#define HELP_SOL_CUR2STACK "REC+UP..: Put the card under the cursor on one of the 4 final stacks."
201#define HELP_SOL_REM2STACK "REC+DOWN: Put the card on top of the remains' stack on one of the 4 final stacks." 201#define HELP_SOL_REM2STACK "REC+DOWN: Put the card on top of the remains' stack on one of the 4 final stacks."
202 202
203#elif (CONFIG_KEYPAD == GIGABEAT_PAD) 203#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
204#define HELP_SOL_MOVE "SELECT: Select cards, Move cards, reveal hidden cards ..." 204#define HELP_SOL_MOVE "SELECT: Select cards, Move cards, reveal hidden cards ..."
205#define HELP_SOL_DRAW "MENU: Un-select a card if it was selected. Else, draw 3 new cards out of the remains' stack." 205#define HELP_SOL_DRAW "MENU: Un-select a card if it was selected. Else, draw 3 new cards out of the remains' stack."
206#define HELP_SOL_REM2CUR "POWER+LEFT: Put the card on top of the remains' stack on top of the cursor." 206#define HELP_SOL_REM2CUR "POWER+LEFT: Put the card on top of the remains' stack on top of the cursor."
207#define HELP_SOL_CUR2STACK "SELECT..: Put the card under the cursor on one of the 4 final stacks." 207#define HELP_SOL_CUR2STACK "SELECT..: Put the card under the cursor on one of the 4 final stacks."
208#define HELP_SOL_REM2STACK "POWER+RIGHT: Put the card on top of the remains' stack on one of the 4 final stacks." 208#define HELP_SOL_REM2STACK "POWER+RIGHT: Put the card on top of the remains' stack on one of the 4 final stacks."
209 209
210#endif 210#endif
211 211
212#if LCD_DEPTH>1 212#if LCD_DEPTH>1
@@ -581,7 +581,7 @@ int solitaire_menu(unsigned char when_n)
581 switch(cursor){ 581 switch(cursor){
582 case MENU_RESUME: 582 case MENU_RESUME:
583 case MENU_RESTART: 583 case MENU_RESTART:
584 case MENU_OPT: 584 case MENU_OPT:
585 case MENU_QUIT: 585 case MENU_QUIT:
586 return cursor; 586 return cursor;
587 587
@@ -610,7 +610,7 @@ int solitaire_menu(unsigned char when_n)
610#endif 610#endif
611 case SOL_QUIT: 611 case SOL_QUIT:
612 return MENU_QUIT; 612 return MENU_QUIT;
613 613
614 default: 614 default:
615 if(rb->default_event_handler(button) == SYS_USB_CONNECTED) 615 if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
616 return MENU_USB; 616 return MENU_USB;
@@ -711,7 +711,7 @@ void solitaire_init(void){
711 711
712 /* init the remainder */ 712 /* init the remainder */
713 cur_rem = NOT_A_CARD; 713 cur_rem = NOT_A_CARD;
714 714
715 coun_rem=0; 715 coun_rem=0;
716} 716}
717 717
@@ -866,8 +866,8 @@ unsigned char move_card(unsigned char dest_col, unsigned char src_card){
866 else { 866 else {
867 deck[src_card_prev].next = deck[src_card].next; 867 deck[src_card_prev].next = deck[src_card].next;
868 } 868 }
869 cur_rem = src_card_prev;
870 deck[src_card].next = NOT_A_CARD; 869 deck[src_card].next = NOT_A_CARD;
870 cur_rem = src_card_prev;
871 coun_rem = coun_rem-1; 871 coun_rem = coun_rem-1;
872 } 872 }
873 /* if the src card is from somewhere else, just take everything */ 873 /* if the src card is from somewhere else, just take everything */
@@ -907,10 +907,10 @@ int solitaire(void){
907 int button, lastbutton = 0; 907 int button, lastbutton = 0;
908 unsigned char c,h,prevcard; 908 unsigned char c,h,prevcard;
909 int biggest_col_length; 909 int biggest_col_length;
910 910
911 configfile_init(rb); 911 configfile_init(rb);
912 configfile_load(FILENAME, config, 1, 0); 912 configfile_load(FILENAME, config, 1, 0);
913 913
914 rb->srand( *rb->current_tick ); 914 rb->srand( *rb->current_tick );
915 switch(solitaire_menu(draw_type==0?MENU_BEFOREGAME:MENU_BEFOREGAMEOP)) { 915 switch(solitaire_menu(draw_type==0?MENU_BEFOREGAME:MENU_BEFOREGAMEOP)) {
916 case MENU_QUIT: 916 case MENU_QUIT:
@@ -920,9 +920,9 @@ int solitaire(void){
920 return SOLITAIRE_USB; 920 return SOLITAIRE_USB;
921 case MENU_OPT: 921 case MENU_OPT:
922 draw_type=change_draw(draw_type); 922 draw_type=change_draw(draw_type);
923 configfile_save(FILENAME, config, 1, 0); 923 configfile_save(FILENAME, config, 1, 0);
924 when=draw_type==0?MENU_BEFOREGAME:MENU_BEFOREGAMEOP; 924 when=draw_type==0?MENU_BEFOREGAME:MENU_BEFOREGAMEOP;
925 return 0; 925 return 0;
926 } 926 }
927#if LCD_DEPTH>1 927#if LCD_DEPTH>1
928 rb->lcd_set_foreground(LCD_BLACK); 928 rb->lcd_set_foreground(LCD_BLACK);
@@ -980,11 +980,11 @@ int solitaire(void){
980 if(deck[c].known == 1){ 980 if(deck[c].known == 1){
981#if LCD_DEPTH>1 981#if LCD_DEPTH>1
982 #ifdef HAVE_LCD_COLOR 982 #ifdef HAVE_LCD_COLOR
983 rb->lcd_set_foreground(LCD_WHITE); 983 rb->lcd_set_foreground(LCD_WHITE);
984 rb->lcd_set_background(LCD_WHITE); 984 rb->lcd_set_background(LCD_WHITE);
985 #else 985 #else
986 rb->lcd_set_foreground(LCD_DEFAULT_BG); 986 rb->lcd_set_foreground(LCD_DEFAULT_BG);
987 rb->lcd_set_background(LCD_DEFAULT_BG); 987 rb->lcd_set_background(LCD_DEFAULT_BG);
988 #endif 988 #endif
989#endif 989#endif
990 rb->lcd_fillrect(1+i*(LCD_WIDTH - 2)/COL_NUM+1, j+1, CARD_WIDTH-1, CARD_HEIGHT-1); 990 rb->lcd_fillrect(1+i*(LCD_WIDTH - 2)/COL_NUM+1, j+1, CARD_WIDTH-1, CARD_HEIGHT-1);
@@ -1001,8 +1001,8 @@ int solitaire(void){
1001#endif 1001#endif
1002 } else { 1002 } else {
1003#ifdef HAVE_LCD_COLOR 1003#ifdef HAVE_LCD_COLOR
1004 rb->lcd_bitmap(solitaire_cardback, 1004 rb->lcd_bitmap(solitaire_cardback,
1005 1+i*(LCD_WIDTH - 2)/COL_NUM+1, j+1, 1005 1+i*(LCD_WIDTH - 2)/COL_NUM+1, j+1,
1006 BMPWIDTH_CARDBACK, BMPHEIGHT_CARDBACK); 1006 BMPWIDTH_CARDBACK, BMPHEIGHT_CARDBACK);
1007#endif 1007#endif
1008 } 1008 }
@@ -1024,13 +1024,13 @@ int solitaire(void){
1024 if(deck[c].known == 0) { 1024 if(deck[c].known == 0) {
1025 j += CARD_HEIGHT - NOT_KNOWN_CARD; 1025 j += CARD_HEIGHT - NOT_KNOWN_CARD;
1026 } else { 1026 } else {
1027 j += CARD_HEIGHT - KNOWN_CARD; 1027 j += CARD_HEIGHT - KNOWN_CARD;
1028 } 1028 }
1029 } 1029 }
1030 } else { 1030 } else {
1031 /* go to the next card */ 1031 /* go to the next card */
1032 h = c; 1032 h = c;
1033 c = deck[c].next; 1033 c = deck[c].next;
1034 if(c == NOT_A_CARD) break; 1034 if(c == NOT_A_CARD) break;
1035 if(c!=NOT_A_CARD) { 1035 if(c!=NOT_A_CARD) {
1036 if(deck[h].known == 0) { 1036 if(deck[h].known == 0) {
@@ -1069,33 +1069,33 @@ int solitaire(void){
1069 if(c != NOT_A_CARD) { 1069 if(c != NOT_A_CARD) {
1070#if LCD_DEPTH>1 1070#if LCD_DEPTH>1
1071 #ifdef HAVE_LCD_COLOR 1071 #ifdef HAVE_LCD_COLOR
1072 rb->lcd_set_foreground(LCD_WHITE); 1072 rb->lcd_set_foreground(LCD_WHITE);
1073 rb->lcd_set_background(LCD_WHITE); 1073 rb->lcd_set_background(LCD_WHITE);
1074 #else 1074 #else
1075 rb->lcd_set_foreground(LCD_DEFAULT_BG); 1075 rb->lcd_set_foreground(LCD_DEFAULT_BG);
1076 rb->lcd_set_background(LCD_DEFAULT_BG); 1076 rb->lcd_set_background(LCD_DEFAULT_BG);
1077 #endif 1077 #endif
1078#endif 1078#endif
1079 rb->lcd_fillrect(LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+1, 2, CARD_WIDTH-1, CARD_HEIGHT-1); 1079 rb->lcd_fillrect(LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+1, 2, CARD_WIDTH-1, CARD_HEIGHT-1);
1080#if LCD_DEPTH>1 1080#if LCD_DEPTH>1
1081 rb->lcd_set_foreground(colors[i]); 1081 rb->lcd_set_foreground(colors[i]);
1082#endif 1082#endif
1083 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); 1083 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);
1084 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); 1084 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);
1085 } else { 1085 } else {
1086#if LCD_DEPTH>1 1086#if LCD_DEPTH>1
1087 #ifdef HAVE_LCD_COLOR 1087 #ifdef HAVE_LCD_COLOR
1088 rb->lcd_set_foreground(LCD_WHITE); 1088 rb->lcd_set_foreground(LCD_WHITE);
1089 rb->lcd_set_background(LCD_WHITE); 1089 rb->lcd_set_background(LCD_WHITE);
1090 #else 1090 #else
1091 rb->lcd_set_foreground(LCD_DEFAULT_BG); 1091 rb->lcd_set_foreground(LCD_DEFAULT_BG);
1092 rb->lcd_set_background(LCD_DEFAULT_BG); 1092 rb->lcd_set_background(LCD_DEFAULT_BG);
1093 #endif 1093 #endif
1094#endif 1094#endif
1095 rb->lcd_fillrect(LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+1, 2, CARD_WIDTH-1, CARD_HEIGHT-1); 1095 rb->lcd_fillrect(LCD_WIDTH2 - (CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+1, 2, CARD_WIDTH-1, CARD_HEIGHT-1);
1096#if LCD_DEPTH>1 1096#if LCD_DEPTH>1
1097 rb->lcd_set_foreground(colors[i]); 1097 rb->lcd_set_foreground(colors[i]);
1098#endif 1098#endif
1099#ifdef HAVE_LCD_COLOR 1099#ifdef HAVE_LCD_COLOR
1100 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); 1100 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);
1101#endif 1101#endif
@@ -1111,7 +1111,7 @@ int solitaire(void){
1111 if(sel_card == c){ 1111 if(sel_card == c){
1112 rb->lcd_drawrect(LCD_WIDTH2 -(CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+1, 2, CARD_WIDTH-1, CARD_HEIGHT-1); 1112 rb->lcd_drawrect(LCD_WIDTH2 -(CARD_WIDTH*4+8)+CARD_WIDTH*i+i*2+1, 2, CARD_WIDTH-1, CARD_HEIGHT-1);
1113 } 1113 }
1114 } 1114 }
1115 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); 1115 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);
1116 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); 1116 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);
1117 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); 1117 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);
@@ -1127,46 +1127,46 @@ int solitaire(void){
1127 } 1127 }
1128 1128
1129 /* draw the remains */ 1129 /* draw the remains */
1130 1130
1131 1131
1132 if(rem != NOT_A_CARD) { 1132 if(rem != NOT_A_CARD) {
1133 coun_rem = coun_rem>2?coun_rem=2:coun_rem; 1133 coun_rem = coun_rem>2?coun_rem=2:coun_rem;
1134 if(cur_rem != NOT_A_CARD && find_prev_card(cur_rem) != NOT_A_CARD && CARDS_PER_DRAW != 1) { 1134 if(cur_rem != NOT_A_CARD && find_prev_card(cur_rem) != NOT_A_CARD && CARDS_PER_DRAW != 1) {
1135 j = (coun_rem)*(BMPWIDTH_c+2); 1135 j = (coun_rem)*(BMPWIDTH_c+2);
1136 for(i=0;i<=coun_rem;i++) { 1136 for(i=0;i<=coun_rem;i++) {
1137 if (i>0 && i<3){ 1137 if (i>0 && i<3){
1138#if LCD_DEPTH>1 1138#if LCD_DEPTH>1
1139 #ifdef HAVE_LCD_COLOR 1139 #ifdef HAVE_LCD_COLOR
1140 rb->lcd_set_foreground(LCD_WHITE); 1140 rb->lcd_set_foreground(LCD_WHITE);
1141 rb->lcd_set_background(LCD_WHITE); 1141 rb->lcd_set_background(LCD_WHITE);
1142 #else 1142 #else
1143 rb->lcd_set_foreground(LCD_DEFAULT_BG); 1143 rb->lcd_set_foreground(LCD_DEFAULT_BG);
1144 rb->lcd_set_background(LCD_DEFAULT_BG); 1144 rb->lcd_set_background(LCD_DEFAULT_BG);
1145 #endif 1145 #endif
1146#endif 1146#endif
1147 rb->lcd_fillrect(CARD_WIDTH+4+j+1, 2, BMPWIDTH_c+1, CARD_HEIGHT-1); 1147 rb->lcd_fillrect(CARD_WIDTH+4+j+1, 2, BMPWIDTH_c+1, CARD_HEIGHT-1);
1148 #if LCD_DEPTH>1 1148 #if LCD_DEPTH>1
1149 rb->lcd_set_foreground(LCD_BLACK); 1149 rb->lcd_set_foreground(LCD_BLACK);
1150 #endif 1150 #endif
1151 rb->lcd_drawline(CARD_WIDTH+4+j+1,1,CARD_WIDTH+4+j+BMPWIDTH_c+2,1); /* top line */ 1151 rb->lcd_drawline(CARD_WIDTH+4+j+1,1,CARD_WIDTH+4+j+BMPWIDTH_c+2,1); /* top line */
1152 rb->lcd_drawline(CARD_WIDTH+4+j+1,CARD_HEIGHT+1,CARD_WIDTH+4+j+BMPWIDTH_c+2,CARD_HEIGHT+1); /* bottom line */ 1152 rb->lcd_drawline(CARD_WIDTH+4+j+1,CARD_HEIGHT+1,CARD_WIDTH+4+j+BMPWIDTH_c+2,CARD_HEIGHT+1); /* bottom line */
1153 rb->lcd_drawline(CARD_WIDTH+4+j,2,CARD_WIDTH+4+j,CARD_HEIGHT); /* right line */ 1153 rb->lcd_drawline(CARD_WIDTH+4+j,2,CARD_WIDTH+4+j,CARD_HEIGHT); /* right line */
1154 1154
1155 1155
1156 prevcard = cur_rem; 1156 prevcard = cur_rem;
1157 for(x=0;i>x;x++) 1157 for(x=0;i>x;x++)
1158 prevcard = find_prev_card(prevcard); 1158 prevcard = find_prev_card(prevcard);
1159 #if LCD_DEPTH>1 1159 #if LCD_DEPTH>1
1160 rb->lcd_set_foreground(colors[deck[prevcard].suit]); 1160 rb->lcd_set_foreground(colors[deck[prevcard].suit]);
1161 #ifdef HAVE_LCD_COLOR 1161 #ifdef HAVE_LCD_COLOR
1162 rb->lcd_set_background(LCD_WHITE); 1162 rb->lcd_set_background(LCD_WHITE);
1163 #endif 1163 #endif
1164 #endif 1164 #endif
1165 rb->lcd_mono_bitmap(numbers[deck[prevcard].num], CARD_WIDTH+4+j+1, 3, BMPWIDTH_c, BMPHEIGHT_c); 1165 rb->lcd_mono_bitmap(numbers[deck[prevcard].num], CARD_WIDTH+4+j+1, 3, BMPWIDTH_c, BMPHEIGHT_c);
1166 rb->lcd_mono_bitmap(suits[deck[prevcard].suit], CARD_WIDTH+4+j+1, 4+BMPHEIGHT_c, BMPWIDTH_c, BMPHEIGHT_c); 1166 rb->lcd_mono_bitmap(suits[deck[prevcard].suit], CARD_WIDTH+4+j+1, 4+BMPHEIGHT_c, BMPWIDTH_c, BMPHEIGHT_c);
1167 1167
1168 1168
1169 } 1169 }
1170 j -= BMPWIDTH_c+2; 1170 j -= BMPWIDTH_c+2;
1171 } 1171 }
1172 } 1172 }
@@ -1175,28 +1175,28 @@ int solitaire(void){
1175#endif 1175#endif
1176 if(CARDS_PER_DRAW==1 || cur_rem==NOT_A_CARD) 1176 if(CARDS_PER_DRAW==1 || cur_rem==NOT_A_CARD)
1177 j=0; 1177 j=0;
1178 else 1178 else
1179 j=(coun_rem)*(BMPWIDTH_c+2); 1179 j=(coun_rem)*(BMPWIDTH_c+2);
1180 if(cur_rem != NOT_A_CARD){ 1180 if(cur_rem != NOT_A_CARD){
1181 rb->lcd_drawline(CARD_WIDTH+4+j+1,1,CARD_WIDTH+4+j+CARD_WIDTH-1,1); /* top line */ 1181 rb->lcd_drawline(CARD_WIDTH+4+j+1,1,CARD_WIDTH+4+j+CARD_WIDTH-1,1); /* top line */
1182 rb->lcd_drawline(CARD_WIDTH+4+j,2,CARD_WIDTH+4+j,CARD_HEIGHT); /* left line */ 1182 rb->lcd_drawline(CARD_WIDTH+4+j,2,CARD_WIDTH+4+j,CARD_HEIGHT); /* left line */
1183 rb->lcd_drawline(CARD_WIDTH+4+j+1,CARD_HEIGHT+1,CARD_WIDTH+4+j+CARD_WIDTH - 1,CARD_HEIGHT+1); /* bottom line */ 1183 rb->lcd_drawline(CARD_WIDTH+4+j+1,CARD_HEIGHT+1,CARD_WIDTH+4+j+CARD_WIDTH - 1,CARD_HEIGHT+1); /* bottom line */
1184 rb->lcd_drawline(CARD_WIDTH+4+j+CARD_WIDTH,2,CARD_WIDTH+4+j+CARD_WIDTH,CARD_HEIGHT); /* right line */ 1184 rb->lcd_drawline(CARD_WIDTH+4+j+CARD_WIDTH,2,CARD_WIDTH+4+j+CARD_WIDTH,CARD_HEIGHT); /* right line */
1185 } 1185 }
1186 1186
1187 rb->lcd_drawline(2,1,CARD_WIDTH+1,1); /* top line */ 1187 rb->lcd_drawline(2,1,CARD_WIDTH+1,1); /* top line */
1188 rb->lcd_drawline(1,2,1,CARD_HEIGHT); /* left line */ 1188 rb->lcd_drawline(1,2,1,CARD_HEIGHT); /* left line */
1189 rb->lcd_drawline(2,CARD_HEIGHT+1,CARD_WIDTH + 1,CARD_HEIGHT+1); /* bottom line */ 1189 rb->lcd_drawline(2,CARD_HEIGHT+1,CARD_WIDTH + 1,CARD_HEIGHT+1); /* bottom line */
1190 rb->lcd_drawline(CARD_WIDTH+2,2,CARD_WIDTH+2,CARD_HEIGHT); /* right line */ 1190 rb->lcd_drawline(CARD_WIDTH+2,2,CARD_WIDTH+2,CARD_HEIGHT); /* right line */
1191 1191
1192 if(cur_rem != NOT_A_CARD){ 1192 if(cur_rem != NOT_A_CARD){
1193#if LCD_DEPTH>1 1193#if LCD_DEPTH>1
1194 #ifdef HAVE_LCD_COLOR 1194 #ifdef HAVE_LCD_COLOR
1195 rb->lcd_set_foreground(LCD_WHITE); 1195 rb->lcd_set_foreground(LCD_WHITE);
1196 rb->lcd_set_background(LCD_WHITE); 1196 rb->lcd_set_background(LCD_WHITE);
1197 #else 1197 #else
1198 rb->lcd_set_foreground(LCD_DEFAULT_BG); 1198 rb->lcd_set_foreground(LCD_DEFAULT_BG);
1199 rb->lcd_set_background(LCD_DEFAULT_BG); 1199 rb->lcd_set_background(LCD_DEFAULT_BG);
1200 #endif 1200 #endif
1201#endif 1201#endif
1202 rb->lcd_fillrect(CARD_WIDTH+4+j+1, 2, CARD_WIDTH-1, CARD_HEIGHT-1); 1202 rb->lcd_fillrect(CARD_WIDTH+4+j+1, 2, CARD_WIDTH-1, CARD_HEIGHT-1);
@@ -1221,9 +1221,9 @@ int solitaire(void){
1221 rb->lcd_bitmap(solitaire_cardback, 2, 2, 1221 rb->lcd_bitmap(solitaire_cardback, 2, 2,
1222 BMPWIDTH_CARDBACK, BMPHEIGHT_CARDBACK); 1222 BMPWIDTH_CARDBACK, BMPHEIGHT_CARDBACK);
1223#endif 1223#endif
1224 } 1224 }
1225 } 1225 }
1226 1226
1227 1227
1228 /* draw the cursor */ 1228 /* draw the cursor */
1229 if(cur_col == REM_COL && rem != NOT_A_CARD){ 1229 if(cur_col == REM_COL && rem != NOT_A_CARD){
@@ -1235,8 +1235,8 @@ int solitaire(void){
1235 rb->lcd_fillrect(CARD_WIDTH+4+1, 2,CARD_WIDTH-1, CARD_HEIGHT-1); 1235 rb->lcd_fillrect(CARD_WIDTH+4+1, 2,CARD_WIDTH-1, CARD_HEIGHT-1);
1236 rb->lcd_set_drawmode(DRMODE_SOLID); 1236 rb->lcd_set_drawmode(DRMODE_SOLID);
1237 } 1237 }
1238 1238
1239 1239
1240 rb->lcd_update(); 1240 rb->lcd_update();
1241 1241
1242 /* what to do when a key is pressed ... */ 1242 /* what to do when a key is pressed ... */
@@ -1297,7 +1297,7 @@ int solitaire(void){
1297 cur_col = (cur_col - COL_NUM + 1)%(SUITS + 1) + COL_NUM; 1297 cur_col = (cur_col - COL_NUM + 1)%(SUITS + 1) + COL_NUM;
1298 if(cur_col == REM_COL){ 1298 if(cur_col == REM_COL){
1299 cur_card = cur_rem; 1299 cur_card = cur_rem;
1300 } 1300 }
1301 else { 1301 else {
1302 cur_card = find_last_card(cur_col); 1302 cur_card = find_last_card(cur_col);
1303 } 1303 }
@@ -1375,6 +1375,10 @@ int solitaire(void){
1375 } else if(sel_card == cur_card) { 1375 } else if(sel_card == cur_card) {
1376 move_card(deck[sel_card].suit + COL_NUM, sel_card); 1376 move_card(deck[sel_card].suit + COL_NUM, sel_card);
1377 sel_card = NOT_A_CARD; 1377 sel_card = NOT_A_CARD;
1378 if( cur_col == REM_COL )
1379 {
1380 cur_card = cur_rem;
1381 }
1378 /* try moving cards */ 1382 /* try moving cards */
1379 } else { 1383 } else {
1380 if(move_card(cur_col, sel_card) == MOVE_OK){ 1384 if(move_card(cur_col, sel_card) == MOVE_OK){
@@ -1411,19 +1415,19 @@ int solitaire(void){
1411 1415
1412 1416
1413#ifdef SOL_REM 1417#ifdef SOL_REM
1414 case SOL_REM: 1418 case SOL_REM:
1415 if(sel_card != NOT_A_CARD){ 1419 if(sel_card != NOT_A_CARD){
1416 /* unselect selected card */ 1420 /* unselect selected card */
1417 sel_card = NOT_A_CARD; 1421 sel_card = NOT_A_CARD;
1418 break; 1422 break;
1419 } 1423 }
1420 if(rem != NOT_A_CARD && cur_rem != NOT_A_CARD) { 1424 if(rem != NOT_A_CARD && cur_rem != NOT_A_CARD) {
1421 sel_card=cur_rem; 1425 sel_card=cur_rem;
1422 break; 1426 break;
1423 } 1427 }
1424 break; 1428 break;
1425#endif 1429#endif
1426 1430
1427 /* unselect selected card or ... */ 1431 /* unselect selected card or ... */
1428 /* draw new cards from the remains of the deck */ 1432 /* draw new cards from the remains of the deck */
1429 case SOL_DRAW: 1433 case SOL_DRAW:
@@ -1446,7 +1450,7 @@ int solitaire(void){
1446 } else { 1450 } else {
1447 i = CARDS_PER_DRAW; 1451 i = CARDS_PER_DRAW;
1448 } 1452 }
1449 1453
1450 while(i>0 && deck[cur_rem].next != NOT_A_CARD){ 1454 while(i>0 && deck[cur_rem].next != NOT_A_CARD){
1451 cur_rem = deck[cur_rem].next; 1455 cur_rem = deck[cur_rem].next;
1452 i--; 1456 i--;
@@ -1463,7 +1467,7 @@ int solitaire(void){
1463 if(cur_col == REM_COL && cur_card == cur_rem_old) { 1467 if(cur_col == REM_COL && cur_card == cur_rem_old) {
1464 cur_card = cur_rem; 1468 cur_card = cur_rem;
1465 sel_card = NOT_A_CARD; 1469 sel_card = NOT_A_CARD;
1466 } 1470 }
1467 } 1471 }
1468 break; 1472 break;
1469 1473
@@ -1472,7 +1476,7 @@ int solitaire(void){
1472 case SOL_RC_QUIT: 1476 case SOL_RC_QUIT:
1473#endif 1477#endif
1474 case SOL_QUIT: 1478 case SOL_QUIT:
1475#if LCD_DEPTH>1 1479#if LCD_DEPTH>1
1476 rb->lcd_set_background(LCD_DEFAULT_BG); 1480 rb->lcd_set_background(LCD_DEFAULT_BG);
1477#endif 1481#endif
1478 switch(solitaire_menu(MENU_DURINGGAME)){ 1482 switch(solitaire_menu(MENU_DURINGGAME)){
@@ -1481,7 +1485,7 @@ int solitaire(void){
1481 1485
1482 case MENU_USB: 1486 case MENU_USB:
1483 return SOLITAIRE_USB; 1487 return SOLITAIRE_USB;
1484 1488
1485 case MENU_RESTART: 1489 case MENU_RESTART:
1486 solitaire_init(); 1490 solitaire_init();
1487 break; 1491 break;