diff options
author | Antoine Cellerier <dionoea@videolan.org> | 2007-06-06 21:10:48 +0000 |
---|---|---|
committer | Antoine Cellerier <dionoea@videolan.org> | 2007-06-06 21:10:48 +0000 |
commit | e8c94d898ddd164ca644063c12d14f760832d408 (patch) | |
tree | 05025287e0e0749d8df8fe72d9363cc2b87de4a1 /apps | |
parent | d90042dbaac563db8f181cc76c5a21034a577b29 (diff) | |
download | rockbox-e8c94d898ddd164ca644063c12d14f760832d408.tar.gz rockbox-e8c94d898ddd164ca644063c12d14f760832d408.zip |
* Speed up the level transition in Star for iPod Video (else it's sloooooow).
* Remove a bunch of trailing spaces.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13578 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/star.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/apps/plugins/star.c b/apps/plugins/star.c index 2e27fd280b..415c6d2c31 100644 --- a/apps/plugins/star.c +++ b/apps/plugins/star.c | |||
@@ -514,26 +514,31 @@ void star_display_text(char *str, bool waitkey) | |||
514 | /* FIXME: this crashes on the Gigabeat but not in the sim */ | 514 | /* FIXME: this crashes on the Gigabeat but not in the sim */ |
515 | static void star_transition_update(void) | 515 | static void star_transition_update(void) |
516 | { | 516 | { |
517 | int center_x = LCD_WIDTH / 2; | 517 | const int center_x = LCD_WIDTH / 2; |
518 | int center_y = LCD_HEIGHT / 2; | 518 | const int center_y = LCD_HEIGHT / 2; |
519 | int x = 0; | 519 | int x = 0; |
520 | int y = 0; | 520 | int y = 0; |
521 | #if LCD_WIDTH >= LCD_HEIGHT | 521 | #if LCD_WIDTH >= LCD_HEIGHT |
522 | int lcd_demi_width = LCD_WIDTH / 2; | 522 | #if defined(IPOD_VIDEO) |
523 | const int step = 4; | ||
524 | #else | ||
525 | const int step = 1; | ||
526 | #endif | ||
527 | const int lcd_demi_width = LCD_WIDTH / 2; | ||
523 | int var_y = 0; | 528 | int var_y = 0; |
524 | 529 | ||
525 | for (; x < lcd_demi_width ; x++) | 530 | for (; x < lcd_demi_width ; x+=step) |
526 | { | 531 | { |
527 | var_y += LCD_HEIGHT; | 532 | var_y += LCD_HEIGHT; |
528 | if (var_y > LCD_WIDTH) | 533 | if (var_y > LCD_WIDTH) |
529 | { | 534 | { |
530 | var_y -= LCD_WIDTH; | 535 | var_y -= LCD_WIDTH; |
531 | y++; | 536 | y+=step; |
532 | } | 537 | } |
533 | rb->lcd_update_rect(center_x - x, center_y - y, x * 2, 1); | 538 | rb->lcd_update_rect(center_x - x, center_y - y, x*2, step); |
534 | rb->lcd_update_rect(center_x - x, center_y - y, 1, y * 2); | 539 | rb->lcd_update_rect(center_x - x, center_y - y, step, y*2); |
535 | rb->lcd_update_rect(center_x + x - 1, center_y - y, 1, y * 2); | 540 | rb->lcd_update_rect(center_x + x - step, center_y - y, step, y*2); |
536 | rb->lcd_update_rect(center_x - x, center_y + y - 1, x * 2, 1); | 541 | rb->lcd_update_rect(center_x - x, center_y + y - step, x*2, step); |
537 | STAR_SLEEP | 542 | STAR_SLEEP |
538 | } | 543 | } |
539 | #else | 544 | #else |
@@ -577,7 +582,7 @@ static void star_display_board_info(int current_level) | |||
577 | label_pos_y = LCD_HEIGHT - char_height; | 582 | label_pos_y = LCD_HEIGHT - char_height; |
578 | tile_pos_y = label_pos_y + (char_height - TILE_HEIGHT) / 2; | 583 | tile_pos_y = label_pos_y + (char_height - TILE_HEIGHT) / 2; |
579 | } | 584 | } |
580 | 585 | ||
581 | rb->snprintf(str_info, sizeof(str_info), "L:%02d", current_level + 1); | 586 | rb->snprintf(str_info, sizeof(str_info), "L:%02d", current_level + 1); |
582 | rb->lcd_putsxy(STAR_OFFSET_X, label_pos_y, str_info); | 587 | rb->lcd_putsxy(STAR_OFFSET_X, label_pos_y, str_info); |
583 | rb->snprintf(str_info, sizeof(str_info), "S:%02d", star_count); | 588 | rb->snprintf(str_info, sizeof(str_info), "S:%02d", star_count); |
@@ -602,12 +607,12 @@ static int star_load_level(int current_level) | |||
602 | { | 607 | { |
603 | int x, y; | 608 | int x, y; |
604 | char *ptr_tab; | 609 | char *ptr_tab; |
605 | 610 | ||
606 | if (current_level < 0) | 611 | if (current_level < 0) |
607 | current_level = 0; | 612 | current_level = 0; |
608 | else if (current_level > STAR_LEVEL_COUNT-1) | 613 | else if (current_level > STAR_LEVEL_COUNT-1) |
609 | current_level = STAR_LEVEL_COUNT-1; | 614 | current_level = STAR_LEVEL_COUNT-1; |
610 | 615 | ||
611 | 616 | ||
612 | ptr_tab = levels + current_level * STAR_LEVEL_SIZE; | 617 | ptr_tab = levels + current_level * STAR_LEVEL_SIZE; |
613 | control = STAR_CONTROL_BALL; | 618 | control = STAR_CONTROL_BALL; |
@@ -671,7 +676,7 @@ static void star_animate_tile(int tile_no, int start_x, int start_y, | |||
671 | int delta_x, int delta_y) | 676 | int delta_x, int delta_y) |
672 | { | 677 | { |
673 | int i; | 678 | int i; |
674 | 679 | ||
675 | if (delta_x != 0) /* horizontal */ | 680 | if (delta_x != 0) /* horizontal */ |
676 | { | 681 | { |
677 | for (i = 1 ; i <= TILE_WIDTH ; i++) | 682 | for (i = 1 ; i <= TILE_WIDTH ; i++) |
@@ -849,7 +854,7 @@ static int star_run_game(int current_level) | |||
849 | rb->lcd_clear_display(); | 854 | rb->lcd_clear_display(); |
850 | star_display_text("Congratulations!", true); | 855 | star_display_text("Congratulations!", true); |
851 | rb->lcd_update(); | 856 | rb->lcd_update(); |
852 | 857 | ||
853 | /* There is no such level as STAR_LEVEL_COUNT so it can't be the | 858 | /* There is no such level as STAR_LEVEL_COUNT so it can't be the |
854 | * current_level */ | 859 | * current_level */ |
855 | current_level--; | 860 | current_level--; |
@@ -867,13 +872,13 @@ static int star_menu(void) | |||
867 | { | 872 | { |
868 | int selection, level=1; | 873 | int selection, level=1; |
869 | bool menu_quit = false; | 874 | bool menu_quit = false; |
870 | 875 | ||
871 | /* get the size of char */ | 876 | /* get the size of char */ |
872 | rb->lcd_getstringsize("a", &char_width, &char_height); | 877 | rb->lcd_getstringsize("a", &char_width, &char_height); |
873 | 878 | ||
874 | MENUITEM_STRINGLIST(menu,"Star Menu",NULL,"Play","Choose Level", | 879 | MENUITEM_STRINGLIST(menu,"Star Menu",NULL,"Play","Choose Level", |
875 | "Information","Keys","Quit"); | 880 | "Information","Keys","Quit"); |
876 | 881 | ||
877 | while(!menu_quit) | 882 | while(!menu_quit) |
878 | { | 883 | { |
879 | switch(rb->do_menu(&menu, &selection)) | 884 | switch(rb->do_menu(&menu, &selection)) |
@@ -882,7 +887,7 @@ static int star_menu(void) | |||
882 | menu_quit = true; | 887 | menu_quit = true; |
883 | break; | 888 | break; |
884 | case 1: | 889 | case 1: |
885 | rb->set_int("Level", "", UNIT_INT, &level, | 890 | rb->set_int("Level", "", UNIT_INT, &level, |
886 | NULL, 1, 1, STAR_LEVEL_COUNT, NULL ); | 891 | NULL, 1, 1, STAR_LEVEL_COUNT, NULL ); |
887 | break; | 892 | break; |
888 | case 2: | 893 | case 2: |
@@ -950,7 +955,7 @@ static int star_menu(void) | |||
950 | break; | 955 | break; |
951 | } | 956 | } |
952 | } | 957 | } |
953 | 958 | ||
954 | if (selection == MENU_START) | 959 | if (selection == MENU_START) |
955 | { | 960 | { |
956 | rb->lcd_setfont(FONT_SYSFIXED); | 961 | rb->lcd_setfont(FONT_SYSFIXED); |
@@ -958,7 +963,7 @@ static int star_menu(void) | |||
958 | level--; | 963 | level--; |
959 | star_run_game(level); | 964 | star_run_game(level); |
960 | } | 965 | } |
961 | 966 | ||
962 | return PLUGIN_OK; | 967 | return PLUGIN_OK; |
963 | } | 968 | } |
964 | 969 | ||