diff options
Diffstat (limited to 'apps/plugins/snake2.c')
-rw-r--r-- | apps/plugins/snake2.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c index 4b51a55f34..e83e298beb 100644 --- a/apps/plugins/snake2.c +++ b/apps/plugins/snake2.c | |||
@@ -100,7 +100,7 @@ int load_all_levels(void) | |||
100 | 100 | ||
101 | while(rb->read_line(fd, buf, 64)) | 101 | while(rb->read_line(fd, buf, 64)) |
102 | { | 102 | { |
103 | if(buf[0] == '-') /* Separator? */ | 103 | if(rb->strlen(buf) == 0) /* Separator? */ |
104 | { | 104 | { |
105 | num_levels++; | 105 | num_levels++; |
106 | if(num_levels > max_levels) | 106 | if(num_levels > max_levels) |
@@ -149,19 +149,18 @@ int load_level( int level_number ) | |||
149 | { | 149 | { |
150 | switch(level_cache[level_number][y][x]) | 150 | switch(level_cache[level_number][y][x]) |
151 | { | 151 | { |
152 | case '1': | 152 | case '|': |
153 | board[x][y] = NORTH; | 153 | board[x][y] = NORTH; |
154 | break; | 154 | break; |
155 | 155 | ||
156 | case '2': | 156 | case '-': |
157 | board[x][y] = EAST; | 157 | board[x][y] = EAST; |
158 | break; | 158 | break; |
159 | 159 | ||
160 | case 'H': | 160 | case '+': |
161 | board[x][y] = HEAD; | 161 | board[x][y] = HEAD; |
162 | break; | 162 | break; |
163 | } | 163 | } |
164 | |||
165 | } | 164 | } |
166 | } | 165 | } |
167 | return 1; | 166 | return 1; |
@@ -238,7 +237,8 @@ void new_level(int level) | |||
238 | void init_snake(void) | 237 | void init_snake(void) |
239 | { | 238 | { |
240 | num_apples_to_get=1; | 239 | num_apples_to_get=1; |
241 | level_from_file = 1; | 240 | if(game_type == 1) |
241 | level_from_file = 1; | ||
242 | game_b_level=1; | 242 | game_b_level=1; |
243 | new_level(level_from_file); | 243 | new_level(level_from_file); |
244 | } | 244 | } |
@@ -863,6 +863,10 @@ void game_init(void) | |||
863 | apple=0; | 863 | apple=0; |
864 | score=0; | 864 | score=0; |
865 | 865 | ||
866 | |||
867 | clear_board(); | ||
868 | load_level( level_from_file ); | ||
869 | |||
866 | while (1) | 870 | while (1) |
867 | { | 871 | { |
868 | switch (rb->button_get(true)) | 872 | switch (rb->button_get(true)) |
@@ -904,9 +908,9 @@ void game_init(void) | |||
904 | rb->lcd_clear_display(); | 908 | rb->lcd_clear_display(); |
905 | redraw(); | 909 | redraw(); |
906 | /*TODO: CENTER ALL TEXT!!!!*/ | 910 | /*TODO: CENTER ALL TEXT!!!!*/ |
907 | rb->snprintf(plevel,sizeof(plevel),"Speed - %d ",level); | 911 | rb->snprintf(plevel,sizeof(plevel),"Speed - %d",level); |
908 | rb->lcd_putsxy(LCD_WIDTH/2 - 30,5, plevel); | 912 | rb->lcd_putsxy(LCD_WIDTH/2 - 30,5, plevel); |
909 | rb->snprintf(plevel,sizeof(plevel),"F1 - Maze %d ",level_from_file); | 913 | rb->snprintf(plevel,sizeof(plevel),"F1 - Maze %d",level_from_file); |
910 | rb->lcd_putsxy(18, 20, plevel); | 914 | rb->lcd_putsxy(18, 20, plevel); |
911 | if(game_type==0) | 915 | if(game_type==0) |
912 | rb->lcd_putsxy(18, 30, "F3 - Game A"); | 916 | rb->lcd_putsxy(18, 30, "F3 - Game A"); |
@@ -934,9 +938,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
934 | return PLUGIN_OK; | 938 | return PLUGIN_OK; |
935 | } | 939 | } |
936 | 940 | ||
937 | /*load the 1st level in*/ | ||
938 | load_level( level_from_file ); | ||
939 | |||
940 | while(quit==0) | 941 | while(quit==0) |
941 | { | 942 | { |
942 | game_init(); | 943 | game_init(); |
@@ -949,8 +950,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
949 | 950 | ||
950 | /*Start Game:*/ | 951 | /*Start Game:*/ |
951 | game(); | 952 | game(); |
952 | |||
953 | clear_board(); | ||
954 | } | 953 | } |
955 | } | 954 | } |
956 | 955 | ||