summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/snake2.c25
-rwxr-xr-xapps/plugins/snake2.levels236
2 files changed, 130 insertions, 131 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)
238void init_snake(void) 237void 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
diff --git a/apps/plugins/snake2.levels b/apps/plugins/snake2.levels
index eb7cea50da..6d7f429448 100755
--- a/apps/plugins/snake2.levels
+++ b/apps/plugins/snake2.levels
@@ -1,118 +1,118 @@
10000000000000000000000000000 1............................
20000000000000000000000000000 2............................
30000000000000000000000000000 3............................
40000000000000000000000000000 4............................
50000000000000000000000000000 5............................
60000000000000000000000000000 6............................
70000000000000000000000000000 7............................
80000000000000000000000000000 8............................
90000000000000000000000000000 9............................
100000000000000000000000000000 10............................
110000000000000000000000000000 11............................
120000000000000000000000000000 12............................
130000000000000000000000000000 13............................
140000000000000000000000000000 14............................
150000000000000000000000000000 15............................
160000000000000000000000000000 16............................
17---------------------------- 17
18H22222222222222222222222222H 18+--------------------------+
191000000000000000000000000001 19|..........................|
201000000000000000000000000001 20|..........................|
211000000000000000000000000001 21|..........................|
221000000000000000000000000001 22|..........................|
231000000000000000000000000001 23|..........................|
241000000000000000000000000001 24|..........................|
251000000000000000000000000001 25|..........................|
261000000000000000000000000001 26|..........................|
271000000000000000000000000001 27|..........................|
281000000000000000000000000001 28|..........................|
291000000000000000000000000001 29|..........................|
301000000000000000000000000001 30|..........................|
311000000000000000000000000001 31|..........................|
321000000000000000000000000001 32|..........................|
33H22222222222222222222222222H 33+--------------------------+
34---------------------------- 34
35H22222222220000000222222222H 35+----------.......---------+
361000000000000000000000000001 36|..........................|
371000000000000000000000000001 37|..........................|
381000000000000000000000000001 38|..........................|
391000000000000000000000000001 39|..........................|
401000000000000000000000000001 40|..........................|
410000000000000000000000000000 41............................
420000000000000000000000000000 42............................
430000000000000000000000000000 43............................
440000000000000000000000000000 44............................
450000000000000000000000000000 45............................
461000000000000000000000000001 46|..........................|
471000000000000000000000000001 47|..........................|
481000000000000000000000000001 48|..........................|
491000000000000000000000000001 49|..........................|
50H22222222220000000222222222H 50+----------.......---------+
51---------------------------- 51
5222222H2222222222222222H22222 52-----+----------------+-----
530000010000000000000000100000 53.....|................|.....
540000010000000000000000100000 54.....|................|.....
550000010000000000000000100000 55.....|................|.....
560000000000000000000000100000 56......................|.....
570000000000000000000000000000 57............................
580000000000000000000000000000 58............................
590000000000000000000000000000 59............................
600000000000000000000000000000 60............................
610000000000000000000000000000 61............................
620000000000000100000000000000 62.............|..............
630000000000000100000000000000 63.............|..............
640000000000000100000000000000 64.............|..............
650000100000000100000000000000 65....|........|..............
660000100000000100000000000000 66....|........|..............
672222H22222222H22222222222222 67----+--------+--------------
68---------------------------- 68
69H222222222H000000H222222222H 69+---------+......+---------+
701000000000100000010000000001 70|.........|......|.........|
711000000000100000010000000001 71|.........|......|.........|
721000000000100000010000000001 72|.........|......|.........|
731000000000H222222H0000000001 73|.........+------+.........|
741000000000000000000000000001 74|..........................|
75H22220000000000000000002222H 75+----..................----+
760000000000000000000000000000 76............................
770000000000000000000000000000 77............................
780000000000000000000000000000 78............................
79H22220000000000000000002222H 79+----..................----+
801000000000000000000000000001 80|..........................|
811000000000100000010000000001 81|.........|......|.........|
821000000000100000010000000001 82|.........|......|.........|
831000000000100000010000000001 83|.........|......|.........|
84H222222222H000000H222222222H 84+---------+......+---------+
85---------------------------- 85
86H22222222222222222222222222H 86+--------------------------+
871000000000000000000000000001 87|..........................|
881000000000000000000000000001 88|..........................|
891000001000000000000010000001 89|.....|.............|......|
901000001000000000000010000001 90|.....|.............|......|
911000001002222222220010000001 91|.....|..---------..|......|
92H00000100000000000001000000H 92+.....|.............|......+
930000000000000000000000000000 93............................
940000000000000000000000000000 94............................
950000000000000000000000000000 95............................
96H00000100000000000001000000H 96+.....|.............|......+
971000001002222222220010000001 97|.....|..---------..|......|
981000001000000000000010000001 98|.....|.............|......|
991000001000000000000010000001 99|.....|.............|......|
1001000000000000000000000000001 100|..........................|
101H22222222222222222222222222H 101+--------------------------+
102---------------------------- 102
103H220002222222222222222200000 103+--...-----------------.....
1041000000000100000000000000000 104|.........|.................
1051000000000100000000000000000 105|.........|.................
1061000000000100000000000000000 106|.........|.................
1070000000000100000000000000000 107..........|.................
1080000000000100000000000000000 108..........|.................
109H222222222H0000002222222222H 109+---------+......----------+
1100000000000000000000000000000 110............................
1110000000000000000000000000000 111............................
112H00000000000000000000000000H 112+..........................+
1131000000000000000000000000001 113|..........................|
114H22222222222222222222222222H 114+--------------------------+
1151000000000000000000000000001 115|..........................|
1161000000000000000000000000001 116|..........................|
1171000000000000000000000000001 117|..........................|
118H220002222222222222222200000 118+--...-----------------.....