-void read_high_score_table() {
- FILE *f;
- int i;
-
- f = open_score_file("r");
- if(f) {
- // If the file exists, read from it
- for(i = 0; i<8; i++) {
- char s[1024];
- int highscore;
- if(fscanf (f, "%d %[^\n]", &highscore, s) != 2) {
- break;
- }
- if(high[i].allocated) {
- free(high[i].name);
- }
- high[i].name = strdup(s);
- high[i].score = highscore;
- high[i].allocated = 1;
- }
- fclose(f);
- }
-}
-
-void write_high_score_table() {
- FILE *f;
- int i;
-
- f = open_score_file("w");
- if(f) {
- // If the file exists, write to it
- for(i = 0; i<8; i++) {
- fprintf (f, "%d %s\n", high[i].score, high[i].name);
- }
- fclose(f);
- }
-}
-void snprintscore(char *s, size_t n, int score) {
- int min = score/60000;
- int sec = score/1000%60;
- int tenths = score%1000/100;
- if(min) {
- snprintf(s, n, "%2d:%.2d.%d", min, sec, tenths);
- } else {
- snprintf(s, n, " %2d.%d", sec, tenths);
- }
-}
-float rnd() {
- return (float)random()/(float)RAND_MAX;
-}
-void init_engine_dots() {