Rev 4537 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4537 | Rev 4668 | ||
---|---|---|---|
Line 47... | Line 47... | ||
47 | "\tThe Regents of the University of California. All rights reserved.\n"; |
47 | "\tThe Regents of the University of California. All rights reserved.\n"; |
48 | 48 | ||
49 | #include <sys/time.h> |
49 | #include <sys/time.h> |
50 | #include <sys/types.h> |
50 | #include <sys/types.h> |
51 | #include <err.h> |
51 | #include <err.h> |
- | 52 | #include <errno.h> |
|
52 | #include <stdio.h> |
53 | #include <stdio.h> |
53 | #include <stdlib.h> |
54 | #include <stdlib.h> |
54 | #include <string.h> |
55 | #include <string.h> |
55 | #include <unistd.h> |
56 | #include <unistd.h> |
56 | #include <getopt.h> |
57 | #include <getopt.h> |
Line 204... | Line 205... | ||
204 | printf("on "); |
205 | printf("on "); |
205 | else |
206 | else |
206 | printf("off"); |
207 | printf("off"); |
207 | break; |
208 | break; |
208 | case 'h': |
209 | case 'h': |
- | 210 | loadscores(); |
|
209 | showscores(firstgame); |
211 | showscores(firstgame); |
210 | tetris_menu_draw(*level); |
212 | tetris_menu_draw(*level); |
211 | break; |
213 | break; |
212 | case 's': |
214 | case 's': |
213 | firstgame = 0; |
215 | firstgame = 0; |
Line 295... | Line 297... | ||
295 | "%s - left %s - rotate %s - right %s - drop %s - pause %s - quit", |
297 | "%s - left %s - rotate %s - right %s - drop %s - pause %s - quit", |
296 | key_write[0], key_write[1], key_write[2], key_write[3], |
298 | key_write[0], key_write[1], key_write[2], key_write[3], |
297 | key_write[4], key_write[5]); |
299 | key_write[4], key_write[5]); |
298 | 300 | ||
299 | scr_init(); |
301 | scr_init(); |
- | 302 | if (loadscores() != EOK) |
|
300 | initscores(); |
303 | initscores(); |
- | 304 | ||
301 | while (tetris_menu(&level)) { |
305 | while (tetris_menu(&level)) { |
302 | fallrate = 1000000 / level; |
306 | fallrate = 1000000 / level; |
303 | 307 | ||
304 | scr_clear(); |
308 | scr_clear(); |
305 | setup_board(); |
309 | setup_board(); |
Line 413... | Line 417... | ||
413 | scr_msg(key_msg, 1); |
417 | scr_msg(key_msg, 1); |
414 | } |
418 | } |
415 | } |
419 | } |
416 | 420 | ||
417 | scr_clear(); |
421 | scr_clear(); |
- | 422 | loadscores(); |
|
418 | insertscore(score, level); |
423 | insertscore(score, level); |
- | 424 | savescores(); |
|
419 | score = 0; |
425 | score = 0; |
420 | } |
426 | } |
421 | 427 | ||
422 | scr_clear(); |
428 | scr_clear(); |
423 | printf("\nGame over.\n"); |
429 | printf("\nGame over.\n"); |