diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2005-10-06 12:42:19 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2005-10-06 12:42:19 +0000 |
commit | 1c3a83c44e6dd18990d813c2f12e83bab67f313a (patch) | |
tree | 59b6ad9145b1c49070b014dbd48e9fc1dcb20709 /apps/plugins/solitaire.c | |
parent | af48260399151e575bc40c7a648e3a2e0037e04e (diff) | |
download | rockbox-1c3a83c44e6dd18990d813c2f12e83bab67f313a.tar.gz rockbox-1c3a83c44e6dd18990d813c2f12e83bab67f313a.zip |
Patch #1264727 by Dave Hooper, Colorize red cards on screens with LCD_DEPTH > 1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7583 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/solitaire.c')
-rw-r--r-- | apps/plugins/solitaire.c | 135 |
1 files changed, 81 insertions, 54 deletions
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index 89cadc3592..b2af0828e2 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c | |||
@@ -23,11 +23,10 @@ Solitaire by dionoea | |||
23 | use arrows to move the cursor | 23 | use arrows to move the cursor |
24 | use ON to select cards, move cards, reveal hidden cards, ... | 24 | use ON to select cards, move cards, reveal hidden cards, ... |
25 | use PLAY to move a card from the remains' stack to the top of the cursor | 25 | use PLAY to move a card from the remains' stack to the top of the cursor |
26 | use F1 to put card under cursor on one of the 4 final color stacks | 26 | use F1 to put card under cursor on one of the 4 final stacks |
27 | use F2 to un-select card if a card was selected, else draw 3 new cards | 27 | use F2 to un-select card if a card was selected, else draw 3 new cards |
28 | out of the remains' stack | 28 | out of the remains' stack |
29 | use F3 to put card on top of the remains' stack on one of the 4 final color | 29 | use F3 to put card on top of the remains' stack on one of the 4 final stacks |
30 | stacks | ||
31 | 30 | ||
32 | *****************************************************************************/ | 31 | *****************************************************************************/ |
33 | 32 | ||
@@ -115,27 +114,37 @@ static struct plugin_api* rb; | |||
115 | #define HELP_SOL_MOVE "ON: Select cards, Move cards, reveal hidden cards ..." | 114 | #define HELP_SOL_MOVE "ON: Select cards, Move cards, reveal hidden cards ..." |
116 | #define HELP_SOL_DRAW "F2: Un-select a card if it was selected. Else, draw 3 new cards out of the remains' stack." | 115 | #define HELP_SOL_DRAW "F2: Un-select a card if it was selected. Else, draw 3 new cards out of the remains' stack." |
117 | #define HELP_SOL_REM2CUR "PLAY: Put the card on top of the remains' stack on top of the cursor." | 116 | #define HELP_SOL_REM2CUR "PLAY: Put the card on top of the remains' stack on top of the cursor." |
118 | #define HELP_SOL_CUR2STACK "F1: Put the card under the cursor on one of the 4 final color stacks." | 117 | #define HELP_SOL_CUR2STACK "F1: Put the card under the cursor on one of the 4 final stacks." |
119 | #define HELP_SOL_REM2STACK "F3: Put the card on top of the remains' stack on one of the 4 final color stacks." | 118 | #define HELP_SOL_REM2STACK "F3: Put the card on top of the remains' stack on one of the 4 final stacks." |
120 | 119 | ||
121 | #elif CONFIG_KEYPAD == ONDIO_PAD | 120 | #elif CONFIG_KEYPAD == ONDIO_PAD |
122 | #define HELP_SOL_MOVE "MODE: Select cards, Move cards, reveal hidden cards ..." | 121 | #define HELP_SOL_MOVE "MODE: Select cards, Move cards, reveal hidden cards ..." |
123 | #define HELP_SOL_DRAW "MODE..: Un-select a card if it was selected. Else, draw 3 new cards out of the remains' stack." | 122 | #define HELP_SOL_DRAW "MODE..: Un-select a card if it was selected. Else, draw 3 new cards out of the remains' stack." |
124 | #define HELP_SOL_REM2CUR "LEFT..: Put the card on top of the remains' stack on top of the cursor." | 123 | #define HELP_SOL_REM2CUR "LEFT..: Put the card on top of the remains' stack on top of the cursor." |
125 | #define HELP_SOL_CUR2STACK "RIGHT..: Put the card under the cursor on one of the 4 final color stacks." | 124 | #define HELP_SOL_CUR2STACK "RIGHT..: Put the card under the cursor on one of the 4 final stacks." |
126 | #define HELP_SOL_REM2STACK "UP..: Put the card on top of the remains' stack on one of the 4 final color stacks." | 125 | #define HELP_SOL_REM2STACK "UP..: Put the card on top of the remains' stack on one of the 4 final stacks." |
127 | 126 | ||
128 | #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ | 127 | #elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ |
129 | (CONFIG_KEYPAD == IRIVER_H300_PAD) | 128 | (CONFIG_KEYPAD == IRIVER_H300_PAD) |
130 | #define HELP_SOL_MOVE "SELECT: Select cards, Move cards, reveal hidden cards ..." | 129 | #define HELP_SOL_MOVE "SELECT: Select cards, Move cards, reveal hidden cards ..." |
131 | #define HELP_SOL_DRAW "REC: Un-select a card if it was selected. Else, draw 3 new cards out of the remains' stack." | 130 | #define HELP_SOL_DRAW "REC: Un-select a card if it was selected. Else, draw 3 new cards out of the remains' stack." |
132 | #define HELP_SOL_REM2CUR "PLAY+LEFT: Put the card on top of the remains' stack on top of the cursor." | 131 | #define HELP_SOL_REM2CUR "PLAY+LEFT: Put the card on top of the remains' stack on top of the cursor." |
133 | #define HELP_SOL_CUR2STACK "SELECT..: Put the card under the cursor on one of the 4 final color stacks." | 132 | #define HELP_SOL_CUR2STACK "SELECT..: Put the card under the cursor on one of the 4 final stacks." |
134 | #define HELP_SOL_REM2STACK "PLAY+RIGHT: Put the card on top of the remains' stack on one of the 4 final color stacks." | 133 | #define HELP_SOL_REM2STACK "PLAY+RIGHT: Put the card on top of the remains' stack on one of the 4 final stacks." |
135 | 134 | ||
136 | #endif | 135 | #endif |
137 | 136 | ||
138 | static unsigned char colors[4][8] = { | 137 | #if LCD_DEPTH>1 |
138 | #ifdef HAVE_LCD_COLOR | ||
139 | static const unsigned struct rgb colors[4] = { | ||
140 | { 0, 0, 0 }, { LCD_MAX_RED, 0, 0 }, { 0, 0, 0 }, { LCD_MAX_RED, 0, 0 } | ||
141 | }; | ||
142 | #else | ||
143 | static const int colors[4] = { LCD_BLACK, LCD_MAX_LEVEL/2, LCD_BLACK, LCD_MAX_LEVEL/2 }; | ||
144 | #endif | ||
145 | #endif | ||
146 | |||
147 | static const unsigned char suits[4][8] = { | ||
139 | /* Spades */ | 148 | /* Spades */ |
140 | {0x00, /* ........ */ | 149 | {0x00, /* ........ */ |
141 | 0x18, /* ...O.... */ | 150 | 0x18, /* ...O.... */ |
@@ -296,20 +305,20 @@ static unsigned char numbers[13][8] = { | |||
296 | 305 | ||
297 | #define NOT_A_CARD 255 | 306 | #define NOT_A_CARD 255 |
298 | 307 | ||
299 | /* number of cards per color */ | 308 | /* number of cards per suit */ |
300 | #define CARDS_PER_COLOR 13 | 309 | #define CARDS_PER_SUIT 13 |
301 | 310 | ||
302 | /* number of colors */ | 311 | /* number of suits */ |
303 | #define COLORS 4 | 312 | #define SUITS 4 |
304 | 313 | ||
305 | /* number of columns */ | 314 | /* number of columns */ |
306 | #define COL_NUM 7 | 315 | #define COL_NUM 7 |
307 | 316 | ||
308 | /* pseudo column numbers to be used for cursor coordinates */ | 317 | /* pseudo column numbers to be used for cursor coordinates */ |
309 | /* columns COL_NUM t COL_NUM + COLORS - 1 correspond to the color stacks */ | 318 | /* columns COL_NUM t COL_NUM + SUITS - 1 correspond to the final stacks */ |
310 | #define STACKS_COL COL_NUM | 319 | #define STACKS_COL COL_NUM |
311 | /* column COL_NUM + COLORS corresponds to the remains' stack */ | 320 | /* column COL_NUM + SUITS corresponds to the remains' stack */ |
312 | #define REM_COL (STACKS_COL + COLORS) | 321 | #define REM_COL (STACKS_COL + SUITS) |
313 | 322 | ||
314 | #define NOT_A_COL 255 | 323 | #define NOT_A_COL 255 |
315 | 324 | ||
@@ -321,7 +330,7 @@ static unsigned char numbers[13][8] = { | |||
321 | #define CARD_HEIGHT 10 | 330 | #define CARD_HEIGHT 10 |
322 | 331 | ||
323 | typedef struct card { | 332 | typedef struct card { |
324 | unsigned char color : 2; | 333 | unsigned char suit : 2; |
325 | unsigned char num : 4; | 334 | unsigned char num : 4; |
326 | unsigned char known : 1; | 335 | unsigned char known : 1; |
327 | unsigned char used : 1;/* this is what is used when dealing cards */ | 336 | unsigned char used : 1;/* this is what is used when dealing cards */ |
@@ -331,11 +340,11 @@ typedef struct card { | |||
331 | unsigned char next_random_card(card *deck){ | 340 | unsigned char next_random_card(card *deck){ |
332 | unsigned char i,r; | 341 | unsigned char i,r; |
333 | 342 | ||
334 | r = rb->rand()%(COLORS * CARDS_PER_COLOR)+1; | 343 | r = rb->rand()%(SUITS * CARDS_PER_SUIT)+1; |
335 | i = 0; | 344 | i = 0; |
336 | 345 | ||
337 | while(r>0){ | 346 | while(r>0){ |
338 | i = (i + 1)%(COLORS * CARDS_PER_COLOR); | 347 | i = (i + 1)%(SUITS * CARDS_PER_SUIT); |
339 | if(!deck[i].used) r--; | 348 | if(!deck[i].used) r--; |
340 | } | 349 | } |
341 | 350 | ||
@@ -587,7 +596,7 @@ unsigned char cur_col; | |||
587 | unsigned char sel_card; | 596 | unsigned char sel_card; |
588 | 597 | ||
589 | /* the deck */ | 598 | /* the deck */ |
590 | card deck[COLORS * CARDS_PER_COLOR]; | 599 | card deck[SUITS * CARDS_PER_SUIT]; |
591 | 600 | ||
592 | /* the remaining cards */ | 601 | /* the remaining cards */ |
593 | unsigned char rem; | 602 | unsigned char rem; |
@@ -596,8 +605,8 @@ unsigned char cur_rem; | |||
596 | /* the 7 game columns */ | 605 | /* the 7 game columns */ |
597 | unsigned char cols[COL_NUM]; | 606 | unsigned char cols[COL_NUM]; |
598 | 607 | ||
599 | /* the 4 final color stacks */ | 608 | /* the 4 final stacks */ |
600 | unsigned char stacks[COLORS]; | 609 | unsigned char stacks[SUITS]; |
601 | 610 | ||
602 | /* initialize the game */ | 611 | /* initialize the game */ |
603 | void solitaire_init(void){ | 612 | void solitaire_init(void){ |
@@ -605,13 +614,13 @@ void solitaire_init(void){ | |||
605 | int i,j; | 614 | int i,j; |
606 | 615 | ||
607 | /* init deck */ | 616 | /* init deck */ |
608 | for(i=0;i<COLORS;i++){ | 617 | for(i=0;i<SUITS;i++){ |
609 | for(j=0;j<CARDS_PER_COLOR;j++){ | 618 | for(j=0;j<CARDS_PER_SUIT;j++){ |
610 | deck[i*CARDS_PER_COLOR+j].color = i; | 619 | deck[i*CARDS_PER_SUIT+j].suit = i; |
611 | deck[i*CARDS_PER_COLOR+j].num = j; | 620 | deck[i*CARDS_PER_SUIT+j].num = j; |
612 | deck[i*CARDS_PER_COLOR+j].known = 1; | 621 | deck[i*CARDS_PER_SUIT+j].known = 1; |
613 | deck[i*CARDS_PER_COLOR+j].used = 0; | 622 | deck[i*CARDS_PER_SUIT+j].used = 0; |
614 | deck[i*CARDS_PER_COLOR+j].next = NOT_A_CARD; | 623 | deck[i*CARDS_PER_SUIT+j].next = NOT_A_CARD; |
615 | } | 624 | } |
616 | } | 625 | } |
617 | 626 | ||
@@ -635,7 +644,7 @@ void solitaire_init(void){ | |||
635 | rem = next_random_card(deck); | 644 | rem = next_random_card(deck); |
636 | c = rem; | 645 | c = rem; |
637 | 646 | ||
638 | for(i=1; i<COLORS * CARDS_PER_COLOR - COL_NUM * (COL_NUM + 1)/2; i++){ | 647 | for(i=1; i<SUITS * CARDS_PER_SUIT - COL_NUM * (COL_NUM + 1)/2; i++){ |
639 | deck[c].next = next_random_card(deck); | 648 | deck[c].next = next_random_card(deck); |
640 | c = deck[c].next; | 649 | c = deck[c].next; |
641 | } | 650 | } |
@@ -643,7 +652,7 @@ void solitaire_init(void){ | |||
643 | /* we now finished dealing the cards. The game can start ! (at last) */ | 652 | /* we now finished dealing the cards. The game can start ! (at last) */ |
644 | 653 | ||
645 | /* init the stack */ | 654 | /* init the stack */ |
646 | for(i = 0; i<COLORS; i++){ | 655 | for(i = 0; i<SUITS; i++){ |
647 | stacks[i] = NOT_A_CARD; | 656 | stacks[i] = NOT_A_CARD; |
648 | } | 657 | } |
649 | 658 | ||
@@ -673,7 +682,7 @@ unsigned char find_card_col(unsigned char card){ | |||
673 | } | 682 | } |
674 | } | 683 | } |
675 | 684 | ||
676 | for(i=0; i<COLORS; i++){ | 685 | for(i=0; i<SUITS; i++){ |
677 | c = stacks[i]; | 686 | c = stacks[i]; |
678 | while(c!=NOT_A_CARD){ | 687 | while(c!=NOT_A_CARD){ |
679 | if(c == card) return STACKS_COL + i; | 688 | if(c == card) return STACKS_COL + i; |
@@ -689,7 +698,7 @@ unsigned char find_card_col(unsigned char card){ | |||
689 | unsigned char find_prev_card(unsigned char card){ | 698 | unsigned char find_prev_card(unsigned char card){ |
690 | int i; | 699 | int i; |
691 | 700 | ||
692 | for(i=0; i<COLORS*CARDS_PER_COLOR; i++){ | 701 | for(i=0; i<SUITS*CARDS_PER_SUIT; i++){ |
693 | if(deck[i].next == card) return i; | 702 | if(deck[i].next == card) return i; |
694 | } | 703 | } |
695 | 704 | ||
@@ -739,7 +748,7 @@ unsigned char move_card(unsigned char dest_col, unsigned char src_card){ | |||
739 | dest_card = find_last_card(dest_col); | 748 | dest_card = find_last_card(dest_col); |
740 | src_card_prev = find_prev_card(src_card); | 749 | src_card_prev = find_prev_card(src_card); |
741 | 750 | ||
742 | /* you can't move more than one card at a time from the colors stack */ | 751 | /* you can't move more than one card at a time from the final stack */ |
743 | /* to the rest of the game */ | 752 | /* to the rest of the game */ |
744 | if(src_col >= COL_NUM && src_col < REM_COL | 753 | if(src_col >= COL_NUM && src_col < REM_COL |
745 | && deck[src_card].next != NOT_A_CARD){ | 754 | && deck[src_card].next != NOT_A_CARD){ |
@@ -750,12 +759,12 @@ unsigned char move_card(unsigned char dest_col, unsigned char src_card){ | |||
750 | if(dest_col < COL_NUM){ | 759 | if(dest_col < COL_NUM){ |
751 | /* ... check is we are on an empty color and that the src is a king */ | 760 | /* ... check is we are on an empty color and that the src is a king */ |
752 | if(dest_card == NOT_A_CARD | 761 | if(dest_card == NOT_A_CARD |
753 | && deck[src_card].num == CARDS_PER_COLOR - 1){ | 762 | && deck[src_card].num == CARDS_PER_SUIT - 1){ |
754 | /* this is a winning combination */ | 763 | /* this is a winning combination */ |
755 | cols[dest_col] = src_card; | 764 | cols[dest_col] = src_card; |
756 | } | 765 | } |
757 | /* ... or check if the cards follow one another and have same color */ | 766 | /* ... or check if the cards follow one another and have same suit */ |
758 | else if((deck[dest_card].color + deck[src_card].color)%2==1 | 767 | else if((deck[dest_card].suit + deck[src_card].suit)%2==1 |
759 | && deck[dest_card].num == deck[src_card].num + 1){ | 768 | && deck[dest_card].num == deck[src_card].num + 1){ |
760 | /* this is a winning combination */ | 769 | /* this is a winning combination */ |
761 | deck[dest_card].next = src_card; | 770 | deck[dest_card].next = src_card; |
@@ -766,20 +775,20 @@ unsigned char move_card(unsigned char dest_col, unsigned char src_card){ | |||
766 | return MOVE_NOT_OK; | 775 | return MOVE_NOT_OK; |
767 | } | 776 | } |
768 | } | 777 | } |
769 | /* if we are on one of the 4 color stacks ... */ | 778 | /* if we are on one of the 4 final stacks ... */ |
770 | else if(dest_col < REM_COL){ | 779 | else if(dest_col < REM_COL){ |
771 | /* ... check if we are on an empty stack, that the src is an | 780 | /* ... check if we are on an empty stack, that the src is an |
772 | * ace and that this is the good color stack */ | 781 | * ace and that this is the good final stack */ |
773 | if(dest_card == NOT_A_CARD | 782 | if(dest_card == NOT_A_CARD |
774 | && deck[src_card].num == 0 | 783 | && deck[src_card].num == 0 |
775 | && deck[src_card].color == dest_col - STACKS_COL){ | 784 | && deck[src_card].suit == dest_col - STACKS_COL){ |
776 | /* this is a winning combination */ | 785 | /* this is a winning combination */ |
777 | stacks[dest_col - STACKS_COL] = src_card; | 786 | stacks[dest_col - STACKS_COL] = src_card; |
778 | } | 787 | } |
779 | /* ... or check if the cards follow one another, have the same | 788 | /* ... or check if the cards follow one another, have the same |
780 | * color and {that src has no .next element or is from the remains' | 789 | * suit and {that src has no .next element or is from the remains' |
781 | * stack} */ | 790 | * stack} */ |
782 | else if(deck[dest_card].color == deck[src_card].color | 791 | else if(deck[dest_card].suit == deck[src_card].suit |
783 | && deck[dest_card].num + 1 == deck[src_card].num | 792 | && deck[dest_card].num + 1 == deck[src_card].num |
784 | && (deck[src_card].next == NOT_A_CARD || src_col == REM_COL) ){ | 793 | && (deck[src_card].next == NOT_A_CARD || src_col == REM_COL) ){ |
785 | /* this is a winning combination */ | 794 | /* this is a winning combination */ |
@@ -902,8 +911,14 @@ int solitaire(void){ | |||
902 | rb->lcd_set_drawmode(DRMODE_SOLID); | 911 | rb->lcd_set_drawmode(DRMODE_SOLID); |
903 | /* known card */ | 912 | /* known card */ |
904 | if(deck[c].known){ | 913 | if(deck[c].known){ |
914 | #if LCD_DEPTH>1 | ||
915 | rb->lcd_set_foreground(colors[deck[c].suit]); | ||
916 | #endif | ||
905 | rb->lcd_mono_bitmap(numbers[deck[c].num], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1, j, 8, 8); | 917 | rb->lcd_mono_bitmap(numbers[deck[c].num], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1, j, 8, 8); |
906 | rb->lcd_mono_bitmap(colors[deck[c].color], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+7, j, 8, 8); | 918 | rb->lcd_mono_bitmap(suits[deck[c].suit], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+7, j, 8, 8); |
919 | #if LCD_DEPTH>1 | ||
920 | rb->lcd_set_foreground(LCD_BLACK); | ||
921 | #endif | ||
907 | } | 922 | } |
908 | /* draw top line of the card */ | 923 | /* draw top line of the card */ |
909 | rb->lcd_drawline(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1,j,i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+CARD_WIDTH-1,j); | 924 | rb->lcd_drawline(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1,j,i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+CARD_WIDTH-1,j); |
@@ -938,17 +953,23 @@ int solitaire(void){ | |||
938 | } | 953 | } |
939 | 954 | ||
940 | /* draw the stacks */ | 955 | /* draw the stacks */ |
941 | for(i=0; i<COLORS; i++){ | 956 | for(i=0; i<SUITS; i++){ |
942 | c = stacks[i]; | 957 | c = stacks[i]; |
943 | if(c!=NOT_A_CARD){ | 958 | if(c!=NOT_A_CARD){ |
944 | while(deck[c].next != NOT_A_CARD){ | 959 | while(deck[c].next != NOT_A_CARD){ |
945 | c = deck[c].next; | 960 | c = deck[c].next; |
946 | } | 961 | } |
947 | } | 962 | } |
963 | #if LCD_DEPTH>1 | ||
964 | rb->lcd_set_foreground(colors[i]); | ||
965 | #endif | ||
948 | if(c != NOT_A_CARD) { | 966 | if(c != NOT_A_CARD) { |
949 | rb->lcd_mono_bitmap(numbers[deck[c].num], LCD_WIDTH2 - CARD_WIDTH+1, i*CARD_HEIGHT, 8, 8); | 967 | rb->lcd_mono_bitmap(numbers[deck[c].num], LCD_WIDTH2 - CARD_WIDTH+1, i*CARD_HEIGHT, 8, 8); |
950 | } | 968 | } |
951 | rb->lcd_mono_bitmap(colors[i], LCD_WIDTH2 - CARD_WIDTH+7, i*CARD_HEIGHT, 8, 8); | 969 | rb->lcd_mono_bitmap(suits[i], LCD_WIDTH2 - CARD_WIDTH+7, i*CARD_HEIGHT, 8, 8); |
970 | #if LCD_DEPTH>1 | ||
971 | rb->lcd_set_foreground(colors[deck[c].suit]); | ||
972 | #endif | ||
952 | /* draw a selected card */ | 973 | /* draw a selected card */ |
953 | if(c != NOT_A_CARD) { | 974 | if(c != NOT_A_CARD) { |
954 | if(sel_card == c){ | 975 | if(sel_card == c){ |
@@ -978,9 +999,15 @@ int solitaire(void){ | |||
978 | rb->lcd_drawline(LCD_WIDTH2,LCD_HEIGHT-CARD_HEIGHT,LCD_WIDTH2,LCD_HEIGHT-2); | 999 | rb->lcd_drawline(LCD_WIDTH2,LCD_HEIGHT-CARD_HEIGHT,LCD_WIDTH2,LCD_HEIGHT-2); |
979 | #endif | 1000 | #endif |
980 | if(cur_rem != NOT_A_CARD){ | 1001 | if(cur_rem != NOT_A_CARD){ |
1002 | #if LCD_DEPTH>1 | ||
1003 | rb->lcd_set_foreground(colors[deck[cur_rem].suit]); | ||
1004 | #endif | ||
981 | rb->lcd_mono_bitmap(numbers[deck[cur_rem].num], LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT, 8, 8); | 1005 | rb->lcd_mono_bitmap(numbers[deck[cur_rem].num], LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT, 8, 8); |
982 | rb->lcd_mono_bitmap(colors[deck[cur_rem].color], LCD_WIDTH2 - CARD_WIDTH+7, LCD_HEIGHT-CARD_HEIGHT, 8, 8); | 1006 | rb->lcd_mono_bitmap(suits[deck[cur_rem].suit], LCD_WIDTH2 - CARD_WIDTH+7, LCD_HEIGHT-CARD_HEIGHT, 8, 8); |
983 | /* draw a selected card */ | 1007 | /* draw a selected card */ |
1008 | #if LCD_DEPTH>1 | ||
1009 | rb->lcd_set_foreground(LCD_BLACK); | ||
1010 | #endif | ||
984 | if(sel_card == cur_rem){ | 1011 | if(sel_card == cur_rem){ |
985 | rb->lcd_drawrect(LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT,CARD_WIDTH-1, CARD_HEIGHT-1); | 1012 | rb->lcd_drawrect(LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT,CARD_WIDTH-1, CARD_HEIGHT-1); |
986 | } | 1013 | } |
@@ -1001,7 +1028,7 @@ int solitaire(void){ | |||
1001 | switch(button){ | 1028 | switch(button){ |
1002 | 1029 | ||
1003 | /* move cursor to the last card of the previous column */ | 1030 | /* move cursor to the last card of the previous column */ |
1004 | /* or to the previous color stack */ | 1031 | /* or to the previous final stack */ |
1005 | /* or to the remains stack */ | 1032 | /* or to the remains stack */ |
1006 | case SOL_RIGHT: | 1033 | case SOL_RIGHT: |
1007 | #ifdef SOL_RIGHT_PRE | 1034 | #ifdef SOL_RIGHT_PRE |
@@ -1023,7 +1050,7 @@ int solitaire(void){ | |||
1023 | break; | 1050 | break; |
1024 | 1051 | ||
1025 | /* move cursor to the last card of the next column */ | 1052 | /* move cursor to the last card of the next column */ |
1026 | /* or to the next color stack */ | 1053 | /* or to the next final stack */ |
1027 | /* or to the remains stack */ | 1054 | /* or to the remains stack */ |
1028 | case SOL_LEFT: | 1055 | case SOL_LEFT: |
1029 | #ifdef SOL_LEFT_PRE | 1056 | #ifdef SOL_LEFT_PRE |
@@ -1051,7 +1078,7 @@ int solitaire(void){ | |||
1051 | break; | 1078 | break; |
1052 | #endif | 1079 | #endif |
1053 | if(cur_col >= COL_NUM) { | 1080 | if(cur_col >= COL_NUM) { |
1054 | cur_col = (cur_col - COL_NUM + 1)%(COLORS + 1) + COL_NUM; | 1081 | cur_col = (cur_col - COL_NUM + 1)%(SUITS + 1) + COL_NUM; |
1055 | if(cur_col == REM_COL){ | 1082 | if(cur_col == REM_COL){ |
1056 | cur_card = cur_rem; | 1083 | cur_card = cur_rem; |
1057 | } else { | 1084 | } else { |
@@ -1078,7 +1105,7 @@ int solitaire(void){ | |||
1078 | break; | 1105 | break; |
1079 | #endif | 1106 | #endif |
1080 | if(cur_col >= COL_NUM) { | 1107 | if(cur_col >= COL_NUM) { |
1081 | cur_col = (cur_col - COL_NUM + COLORS)%(COLORS + 1) + COL_NUM; | 1108 | cur_col = (cur_col - COL_NUM + SUITS)%(SUITS + 1) + COL_NUM; |
1082 | if(cur_col == REM_COL){ | 1109 | if(cur_col == REM_COL){ |
1083 | cur_card = cur_rem; | 1110 | cur_card = cur_rem; |
1084 | } else { | 1111 | } else { |
@@ -1103,7 +1130,7 @@ int solitaire(void){ | |||
1103 | break; | 1130 | break; |
1104 | #endif | 1131 | #endif |
1105 | if(cur_card != NOT_A_CARD){ | 1132 | if(cur_card != NOT_A_CARD){ |
1106 | move_card(deck[cur_card].color + STACKS_COL, cur_card); | 1133 | move_card(deck[cur_card].suit + STACKS_COL, cur_card); |
1107 | } | 1134 | } |
1108 | break; | 1135 | break; |
1109 | 1136 | ||
@@ -1125,7 +1152,7 @@ int solitaire(void){ | |||
1125 | } | 1152 | } |
1126 | /* unselect card or try putting card on one of the 4 stacks */ | 1153 | /* unselect card or try putting card on one of the 4 stacks */ |
1127 | } else if(sel_card == cur_card) { | 1154 | } else if(sel_card == cur_card) { |
1128 | move_card(deck[sel_card].color + COL_NUM, sel_card); | 1155 | move_card(deck[sel_card].suit + COL_NUM, sel_card); |
1129 | sel_card = NOT_A_CARD; | 1156 | sel_card = NOT_A_CARD; |
1130 | /* try moving cards */ | 1157 | /* try moving cards */ |
1131 | } else { | 1158 | } else { |
@@ -1153,7 +1180,7 @@ int solitaire(void){ | |||
1153 | break; | 1180 | break; |
1154 | #endif | 1181 | #endif |
1155 | if(cur_rem != NOT_A_CARD){ | 1182 | if(cur_rem != NOT_A_CARD){ |
1156 | move_card(deck[cur_rem].color + COL_NUM, cur_rem); | 1183 | move_card(deck[cur_rem].suit + COL_NUM, cur_rem); |
1157 | } | 1184 | } |
1158 | break; | 1185 | break; |
1159 | 1186 | ||