summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/solitaire.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index cd86c34ad6..a0423b133a 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -1012,6 +1012,11 @@ enum { SOLITAIRE_WIN, SOLITAIRE_QUIT, SOLITAIRE_USB };
1012/** 1012/**
1013 * Bouncing cards at the end of the game 1013 * Bouncing cards at the end of the game
1014 */ 1014 */
1015
1016#define BC_ACCEL ((1<<16)*LCD_HEIGHT/128)
1017#define BC_MYSPEED (6*BC_ACCEL)
1018#define BC_MXSPEED (6*LCD_WIDTH/160)
1019
1015int bouncing_cards( void ) 1020int bouncing_cards( void )
1016{ 1021{
1017 int i, j, x, vx, y, fp_y, fp_vy, button; 1022 int i, j, x, vx, y, fp_y, fp_vy, button;
@@ -1029,24 +1034,25 @@ int bouncing_cards( void )
1029 for( j = 0; j < SUITS; j++ ) 1034 for( j = 0; j < SUITS; j++ )
1030 { 1035 {
1031 x = LCD_WIDTH-(CARD_WIDTH*4+4+MARGIN)+CARD_WIDTH*j+j+1; 1036 x = LCD_WIDTH-(CARD_WIDTH*4+4+MARGIN)+CARD_WIDTH*j+j+1;
1032 fp_y = MARGIN<<8; 1037 fp_y = MARGIN<<16;
1033 1038
1034 vx = rb->rand()%8-5; 1039 vx = rb->rand() % (4*BC_MXSPEED/3) - BC_MXSPEED;
1035 if( !vx ) vx = -6; 1040 if( vx >= 0 )
1041 vx++;
1036 1042
1037 fp_vy = -rb->rand()%(6<<8); 1043 fp_vy = -rb->rand() % BC_MYSPEED;
1038 1044
1039 while( x < LCD_WIDTH && x + CARD_WIDTH > 0 ) 1045 while( x < LCD_WIDTH && x + CARD_WIDTH > 0 )
1040 { 1046 {
1041 fp_vy += 1<<8; 1047 fp_vy += BC_ACCEL;
1042 x += vx; 1048 x += vx;
1043 fp_y += fp_vy; 1049 fp_y += fp_vy;
1044 if( fp_y >= (LCD_HEIGHT-CARD_HEIGHT) << 8 ) 1050 if( fp_y >= (LCD_HEIGHT-CARD_HEIGHT) << 16 )
1045 { 1051 {
1046 fp_vy = -fp_vy*3/4; 1052 fp_vy = -fp_vy*4/5;
1047 fp_y = (LCD_HEIGHT-CARD_HEIGHT) << 8; 1053 fp_y = (LCD_HEIGHT-CARD_HEIGHT) << 16;
1048 } 1054 }
1049 y = fp_y >> 8; 1055 y = fp_y >> 16;
1050 draw_card( &deck[j*CARDS_PER_SUIT+i], x, y, 1056 draw_card( &deck[j*CARDS_PER_SUIT+i], x, y,
1051 false, false, false ); 1057 false, false, false );
1052 rb->lcd_update_rect( x<0?0:x, y<0?0:y, 1058 rb->lcd_update_rect( x<0?0:x, y<0?0:y,