1
0
Fork 0
forked from len0rd/rockbox

blackjack: Set foreground color and background color properly after canceled to input amount.

Make quit button a shortcut to no in yes/no selection as it used to.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23844 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Teruaki Kawashima 2009-12-04 11:56:32 +00:00
parent f51e1f9821
commit 31f2981d99

View file

@ -955,7 +955,7 @@ static unsigned int blackjack_get_yes_no(char message[20]) {
case BJACK_SELECT: breakout = true; case BJACK_SELECT: breakout = true;
break; break;
case BJACK_QUIT: breakout = true; case BJACK_QUIT: breakout = true;
choice = BJ_QUIT; choice = 1;
break; break;
} }
} }
@ -975,7 +975,7 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit,
signed int start) { signed int start) {
int button; int button;
char str[9]; char str[9];
bool changed = false; bool breakout = false, changed = false;
unsigned int w, h; unsigned int w, h;
signed int amount; signed int amount;
@ -1035,7 +1035,7 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit,
37*w / 2, 8*h -3); 37*w / 2, 8*h -3);
#endif #endif
while(true) { while(!breakout) {
button = rb->button_get(true); button = rb->button_get(true);
switch(button) { switch(button) {
@ -1076,14 +1076,12 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit,
changed = true; changed = true;
break; break;
case BJACK_QUIT: case BJACK_QUIT:
return 0; breakout = true;
amount = 0;
break;
case BJACK_SELECT: case BJACK_SELECT:
#if LCD_DEPTH > 1 breakout = true;
rb->lcd_set_foreground(FG_COLOR); break;
rb->lcd_set_background(BG_COLOR);
#endif
rb->lcd_clear_display();
return amount;
} }
if(changed) { if(changed) {
@ -1101,6 +1099,13 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit,
changed = false; changed = false;
} }
} }
#if LCD_DEPTH > 1
rb->lcd_set_foreground(FG_COLOR);
rb->lcd_set_background(BG_COLOR);
#endif
rb->lcd_clear_display();
return amount;
} }
/***************************************************************************** /*****************************************************************************
@ -1127,7 +1132,7 @@ static void double_down(struct game_context* bj) {
* means a split has already occurred and the first hand is done. * means a split has already occurred and the first hand is done.
******************************************************************************/ ******************************************************************************/
static void split(struct game_context* bj) { static void split(struct game_context* bj) {
if (blackjack_get_yes_no("Split?") == 1) if (blackjack_get_yes_no("Split?") != 0)
bj->split_status = 1; bj->split_status = 1;
else { else {
bj->split_status = 2; bj->split_status = 2;
@ -1149,7 +1154,7 @@ static unsigned int insurance(struct game_context* bj) {
bj->asked_insurance = true; bj->asked_insurance = true;
max_amount = bj->current_bet < (unsigned int)bj->player_money ? max_amount = bj->current_bet < (unsigned int)bj->player_money ?
bj->current_bet/2 : (unsigned int)bj->player_money; bj->current_bet/2 : (unsigned int)bj->player_money;
if (insurance == 1) return 0; if (insurance != 0) return 0;
insurance = blackjack_get_amount("How much?", 0, max_amount, 0); insurance = blackjack_get_amount("How much?", 0, max_amount, 0);
redraw_board(bj); redraw_board(bj);
@ -1275,8 +1280,8 @@ static int blackjack(struct game_context* bj) {
bool dbl_down = false; bool dbl_down = false;
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
rb->lcd_set_background(BG_COLOR); rb->lcd_set_background(BG_COLOR);
rb->lcd_set_foreground(FG_COLOR); rb->lcd_set_foreground(FG_COLOR);
#endif #endif
/******************** /********************