diff options
Diffstat (limited to 'apps/plugins/snake2.c')
-rw-r--r-- | apps/plugins/snake2.c | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c index 3d8b973074..3368f4e2ab 100644 --- a/apps/plugins/snake2.c +++ b/apps/plugins/snake2.c | |||
@@ -415,7 +415,7 @@ static struct highscore highscores[NUM_SCORES]; | |||
415 | #define LEVELS_FILE PLUGIN_GAMES_DIR "/snake2.levels" | 415 | #define LEVELS_FILE PLUGIN_GAMES_DIR "/snake2.levels" |
416 | #define SCORE_FILE PLUGIN_GAMES_DATA_DIR "/snake2.score" | 416 | #define SCORE_FILE PLUGIN_GAMES_DATA_DIR "/snake2.score" |
417 | 417 | ||
418 | int load_all_levels(void) | 418 | static int load_all_levels(void) |
419 | { | 419 | { |
420 | int linecnt = 0; | 420 | int linecnt = 0; |
421 | int fd; | 421 | int fd; |
@@ -465,7 +465,7 @@ int load_all_levels(void) | |||
465 | ** Completely clear the board of walls and/or snake | 465 | ** Completely clear the board of walls and/or snake |
466 | */ | 466 | */ |
467 | 467 | ||
468 | void clear_board( void) | 468 | static void clear_board( void) |
469 | { | 469 | { |
470 | int x,y; | 470 | int x,y; |
471 | 471 | ||
@@ -478,7 +478,7 @@ void clear_board( void) | |||
478 | } | 478 | } |
479 | } | 479 | } |
480 | 480 | ||
481 | int load_level( int level_number ) | 481 | static int load_level( int level_number ) |
482 | { | 482 | { |
483 | int x,y; | 483 | int x,y; |
484 | clear_board(); | 484 | clear_board(); |
@@ -510,7 +510,7 @@ int load_level( int level_number ) | |||
510 | ** in the direction buffer. If there is something in the | 510 | ** in the direction buffer. If there is something in the |
511 | ** next part of the buffer then that is moved to the first place | 511 | ** next part of the buffer then that is moved to the first place |
512 | */ | 512 | */ |
513 | void get_direction( void ) | 513 | static void get_direction( void ) |
514 | { | 514 | { |
515 | /*if 1st place is empty*/ | 515 | /*if 1st place is empty*/ |
516 | if(ardirectionbuffer[0] != -1) | 516 | if(ardirectionbuffer[0] != -1) |
@@ -532,7 +532,7 @@ void get_direction( void ) | |||
532 | /* | 532 | /* |
533 | ** Sets the direction | 533 | ** Sets the direction |
534 | */ | 534 | */ |
535 | void set_direction(int newdir) | 535 | static void set_direction(int newdir) |
536 | { | 536 | { |
537 | if(ardirectionbuffer[0] != newdir) | 537 | if(ardirectionbuffer[0] != newdir) |
538 | { | 538 | { |
@@ -552,7 +552,7 @@ void set_direction(int newdir) | |||
552 | } | 552 | } |
553 | } | 553 | } |
554 | 554 | ||
555 | void new_level(int level) | 555 | static void new_level(int level) |
556 | { | 556 | { |
557 | load_level(level); | 557 | load_level(level); |
558 | 558 | ||
@@ -573,7 +573,7 @@ void new_level(int level) | |||
573 | num_apples_to_got=0; | 573 | num_apples_to_got=0; |
574 | } | 574 | } |
575 | 575 | ||
576 | void init_snake(void) | 576 | static void init_snake(void) |
577 | { | 577 | { |
578 | num_apples_to_get=1; | 578 | num_apples_to_get=1; |
579 | if(game_type == 1) | 579 | if(game_type == 1) |
@@ -583,7 +583,7 @@ void init_snake(void) | |||
583 | } | 583 | } |
584 | 584 | ||
585 | #if (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128) | 585 | #if (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128) |
586 | void draw_frame_bitmap(int header_type) | 586 | static void draw_frame_bitmap(int header_type) |
587 | { | 587 | { |
588 | rb->lcd_bitmap(header_type==1? snake2_header1: snake2_header2, 0, 0, | 588 | rb->lcd_bitmap(header_type==1? snake2_header1: snake2_header2, 0, 0, |
589 | BMPWIDTH_snake2_header, BMPHEIGHT_snake2_header); | 589 | BMPWIDTH_snake2_header, BMPHEIGHT_snake2_header); |
@@ -602,7 +602,7 @@ void draw_frame_bitmap(int header_type) | |||
602 | ** Draws the apple. If it doesn't exist then | 602 | ** Draws the apple. If it doesn't exist then |
603 | ** a new one get's created. | 603 | ** a new one get's created. |
604 | */ | 604 | */ |
605 | void draw_apple_bit(int x, int y) | 605 | static void draw_apple_bit(int x, int y) |
606 | { | 606 | { |
607 | rb->lcd_fillrect((CENTER_X+x*MULTIPLIER)+1, CENTER_Y+y*MULTIPLIER, | 607 | rb->lcd_fillrect((CENTER_X+x*MULTIPLIER)+1, CENTER_Y+y*MULTIPLIER, |
608 | MODIFIER_2, MODIFIER_1); | 608 | MODIFIER_2, MODIFIER_1); |
@@ -610,7 +610,7 @@ void draw_apple_bit(int x, int y) | |||
610 | MODIFIER_1, MODIFIER_2); | 610 | MODIFIER_1, MODIFIER_2); |
611 | } | 611 | } |
612 | 612 | ||
613 | void draw_apple( void ) | 613 | static void draw_apple( void ) |
614 | { | 614 | { |
615 | int x,y; | 615 | int x,y; |
616 | 616 | ||
@@ -646,7 +646,7 @@ void draw_apple( void ) | |||
646 | * x x * | 646 | * x x * |
647 | * x x * | 647 | * x x * |
648 | */ | 648 | */ |
649 | void draw_vertical_bit(int x, int y) | 649 | static void draw_vertical_bit(int x, int y) |
650 | { | 650 | { |
651 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER, | 651 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER, |
652 | MODIFIER_2, MODIFIER_1); | 652 | MODIFIER_2, MODIFIER_1); |
@@ -658,7 +658,7 @@ void draw_vertical_bit(int x, int y) | |||
658 | X X X X | 658 | X X X X |
659 | * * * * | 659 | * * * * |
660 | */ | 660 | */ |
661 | void draw_horizontal_bit(int x, int y) | 661 | static void draw_horizontal_bit(int x, int y) |
662 | { | 662 | { |
663 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER, CENTER_Y+y*MULTIPLIER+1, | 663 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER, CENTER_Y+y*MULTIPLIER+1, |
664 | MODIFIER_1, MODIFIER_2); | 664 | MODIFIER_1, MODIFIER_2); |
@@ -670,7 +670,7 @@ void draw_horizontal_bit(int x, int y) | |||
670 | * X X X | 670 | * X X X |
671 | * X X * | 671 | * X X * |
672 | */ | 672 | */ |
673 | void draw_n_to_e_bit(int x, int y) | 673 | static void draw_n_to_e_bit(int x, int y) |
674 | { | 674 | { |
675 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER+2, | 675 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER+2, |
676 | MODIFIER_2, MODIFIER_2); | 676 | MODIFIER_2, MODIFIER_2); |
@@ -684,7 +684,7 @@ void draw_n_to_e_bit(int x, int y) | |||
684 | * X X X | 684 | * X X X |
685 | * X X * | 685 | * X X * |
686 | */ | 686 | */ |
687 | void draw_w_to_s_bit(int x, int y) | 687 | static void draw_w_to_s_bit(int x, int y) |
688 | { | 688 | { |
689 | draw_n_to_e_bit(x,y); | 689 | draw_n_to_e_bit(x,y); |
690 | } | 690 | } |
@@ -695,7 +695,7 @@ void draw_w_to_s_bit(int x, int y) | |||
695 | X X X * | 695 | X X X * |
696 | * X X * | 696 | * X X * |
697 | */ | 697 | */ |
698 | void draw_n_to_w_bit(int x, int y) | 698 | static void draw_n_to_w_bit(int x, int y) |
699 | { | 699 | { |
700 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER, CENTER_Y+y*MULTIPLIER+1, | 700 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER, CENTER_Y+y*MULTIPLIER+1, |
701 | MODIFIER_2, MODIFIER_2); | 701 | MODIFIER_2, MODIFIER_2); |
@@ -709,7 +709,7 @@ void draw_n_to_w_bit(int x, int y) | |||
709 | X X X * | 709 | X X X * |
710 | * X X * | 710 | * X X * |
711 | */ | 711 | */ |
712 | void draw_e_to_s_bit(int x, int y) | 712 | static void draw_e_to_s_bit(int x, int y) |
713 | { | 713 | { |
714 | draw_n_to_w_bit(x, y); | 714 | draw_n_to_w_bit(x, y); |
715 | } | 715 | } |
@@ -720,7 +720,7 @@ void draw_e_to_s_bit(int x, int y) | |||
720 | * * X X | 720 | * * X X |
721 | * * * * | 721 | * * * * |
722 | */ | 722 | */ |
723 | void draw_s_to_e_bit(int x, int y) | 723 | static void draw_s_to_e_bit(int x, int y) |
724 | { | 724 | { |
725 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER, | 725 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER, |
726 | MODIFIER_2, MODIFIER_2); | 726 | MODIFIER_2, MODIFIER_2); |
@@ -734,7 +734,7 @@ void draw_s_to_e_bit(int x, int y) | |||
734 | * * X X | 734 | * * X X |
735 | * * * * | 735 | * * * * |
736 | */ | 736 | */ |
737 | void draw_w_to_n_bit(int x, int y) | 737 | static void draw_w_to_n_bit(int x, int y) |
738 | { | 738 | { |
739 | draw_s_to_e_bit(x,y); | 739 | draw_s_to_e_bit(x,y); |
740 | } | 740 | } |
@@ -745,7 +745,7 @@ void draw_w_to_n_bit(int x, int y) | |||
745 | X X * * | 745 | X X * * |
746 | * * * * | 746 | * * * * |
747 | */ | 747 | */ |
748 | void draw_e_to_n_bit(int x, int y) | 748 | static void draw_e_to_n_bit(int x, int y) |
749 | { | 749 | { |
750 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER, | 750 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER, |
751 | MODIFIER_2, MODIFIER_2); | 751 | MODIFIER_2, MODIFIER_2); |
@@ -759,21 +759,22 @@ void draw_e_to_n_bit(int x, int y) | |||
759 | X X * * | 759 | X X * * |
760 | * * * * | 760 | * * * * |
761 | */ | 761 | */ |
762 | void draw_s_to_w_bit(int x, int y) | 762 | static void draw_s_to_w_bit(int x, int y) |
763 | { | 763 | { |
764 | draw_e_to_n_bit(x, y); | 764 | draw_e_to_n_bit(x, y); |
765 | } | 765 | } |
766 | 766 | ||
767 | void draw_head_bit(int x, int y) | 767 | static void draw_head_bit(int x, int y) |
768 | { | 768 | { |
769 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER, CENTER_Y+y*MULTIPLIER, | 769 | rb->lcd_fillrect(CENTER_X+x*MULTIPLIER, CENTER_Y+y*MULTIPLIER, |
770 | MODIFIER_1, MODIFIER_1); | 770 | MODIFIER_1, MODIFIER_1); |
771 | } | 771 | } |
772 | 772 | ||
773 | #if 0 /* unused */ | ||
773 | /* | 774 | /* |
774 | ** Draws a wall/obsticals | 775 | ** Draws a wall/obsticals |
775 | */ | 776 | */ |
776 | void draw_boundary ( void ) | 777 | static void draw_boundary ( void ) |
777 | { | 778 | { |
778 | int x, y; | 779 | int x, y; |
779 | 780 | ||
@@ -799,11 +800,12 @@ void draw_boundary ( void ) | |||
799 | board[0][HEIGHT-1] = SOUTH_EAST; | 800 | board[0][HEIGHT-1] = SOUTH_EAST; |
800 | board[WIDTH-1][HEIGHT-1] = EAST_NORTH; | 801 | board[WIDTH-1][HEIGHT-1] = EAST_NORTH; |
801 | } | 802 | } |
803 | #endif | ||
802 | 804 | ||
803 | /* | 805 | /* |
804 | ** Redraw the entire board | 806 | ** Redraw the entire board |
805 | */ | 807 | */ |
806 | void redraw (void) | 808 | static void redraw (void) |
807 | { | 809 | { |
808 | int x,y; | 810 | int x,y; |
809 | 811 | ||
@@ -860,7 +862,7 @@ void redraw (void) | |||
860 | ** Draws the snake bit described by nCurrentBit at position x/y | 862 | ** Draws the snake bit described by nCurrentBit at position x/y |
861 | ** deciding whether it's a corner bit by examing the nPrevious bit | 863 | ** deciding whether it's a corner bit by examing the nPrevious bit |
862 | */ | 864 | */ |
863 | void draw_snake_bit(int currentbit, int previousbit, int x, int y) | 865 | static void draw_snake_bit(int currentbit, int previousbit, int x, int y) |
864 | { | 866 | { |
865 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 867 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
866 | draw_head_bit(x, y); | 868 | draw_head_bit(x, y); |
@@ -942,7 +944,7 @@ void draw_snake_bit(int currentbit, int previousbit, int x, int y) | |||
942 | } | 944 | } |
943 | } | 945 | } |
944 | 946 | ||
945 | void redraw_snake(void) | 947 | static void redraw_snake(void) |
946 | { | 948 | { |
947 | int x = tailx, y = taily; | 949 | int x = tailx, y = taily; |
948 | int olddir, newdir = board[x][y]; | 950 | int olddir, newdir = board[x][y]; |
@@ -989,7 +991,7 @@ void redraw_snake(void) | |||
989 | /* | 991 | /* |
990 | ** Death 'sequence' and end game stuff. | 992 | ** Death 'sequence' and end game stuff. |
991 | */ | 993 | */ |
992 | void die (void) | 994 | static void die (void) |
993 | { | 995 | { |
994 | int button; | 996 | int button; |
995 | bool done=false; | 997 | bool done=false; |
@@ -1045,7 +1047,7 @@ void die (void) | |||
1045 | ** sets of the death sequence. What we want is it to only return a true/false | 1047 | ** sets of the death sequence. What we want is it to only return a true/false |
1046 | ** depending on whether a collision occured. | 1048 | ** depending on whether a collision occured. |
1047 | */ | 1049 | */ |
1048 | void collision ( int x, int y ) | 1050 | static void collision ( int x, int y ) |
1049 | { | 1051 | { |
1050 | int bdeath=0; | 1052 | int bdeath=0; |
1051 | 1053 | ||
@@ -1096,7 +1098,7 @@ void collision ( int x, int y ) | |||
1096 | } | 1098 | } |
1097 | } | 1099 | } |
1098 | 1100 | ||
1099 | void move( void ) | 1101 | static void move( void ) |
1100 | { | 1102 | { |
1101 | int taildir; | 1103 | int taildir; |
1102 | /*this actually sets the dir variable.*/ | 1104 | /*this actually sets the dir variable.*/ |
@@ -1177,7 +1179,7 @@ void move( void ) | |||
1177 | applecountdown--; | 1179 | applecountdown--; |
1178 | } | 1180 | } |
1179 | 1181 | ||
1180 | void frame (void) | 1182 | static void frame (void) |
1181 | { | 1183 | { |
1182 | int olddir, noldx, noldy, temp; | 1184 | int olddir, noldx, noldy, temp; |
1183 | noldx = headx; | 1185 | noldx = headx; |
@@ -1235,7 +1237,7 @@ void frame (void) | |||
1235 | rb->lcd_update(); | 1237 | rb->lcd_update(); |
1236 | } | 1238 | } |
1237 | 1239 | ||
1238 | void game_pause (void) | 1240 | static void game_pause (void) |
1239 | { | 1241 | { |
1240 | int button; | 1242 | int button; |
1241 | 1243 | ||
@@ -1276,7 +1278,7 @@ void game_pause (void) | |||
1276 | } | 1278 | } |
1277 | } | 1279 | } |
1278 | 1280 | ||
1279 | void game (void) | 1281 | static void game (void) |
1280 | { | 1282 | { |
1281 | int button; | 1283 | int button; |
1282 | 1284 | ||
@@ -1365,7 +1367,7 @@ void game (void) | |||
1365 | 1367 | ||
1366 | } | 1368 | } |
1367 | 1369 | ||
1368 | void select_maze(void) | 1370 | static void select_maze(void) |
1369 | { | 1371 | { |
1370 | int button; | 1372 | int button; |
1371 | 1373 | ||
@@ -1440,7 +1442,7 @@ void select_maze(void) | |||
1440 | 1442 | ||
1441 | } | 1443 | } |
1442 | 1444 | ||
1443 | void game_init(void) | 1445 | static void game_init(void) |
1444 | { | 1446 | { |
1445 | int selection = 0; | 1447 | int selection = 0; |
1446 | 1448 | ||