2 * Copyright (C) 2003 Robert Kooima
4 * NEVERBALL is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published
6 * by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
23 /*---------------------------------------------------------------------------*/
25 void score_init_hs(struct score *s, int timer, int coins)
28 strcpy(s->player[0], "Hard");
29 strcpy(s->player[1], "Medium");
30 strcpy(s->player[2], "Easy");
31 strcpy(s->player[3], "");
32 for (i = 0; i < NSCORE+1; i++)
39 /*---------------------------------------------------------------------------*/
41 int level_load(const char *filename, struct level *level)
42 /* Load the sol file 'filename' and fill the 'level' structure
43 * return 1 on success, 0 on error
44 * TODO: Currently this function does nothing since metadata are not stored
45 * in the sol file. Therefore the sol file in not loaded */
49 memset(&sol, 0, sizeof(sol));
51 /* Try to load the sol file */
52 if (!sol_load_only_file(&sol, filename))
54 fprintf(stderr, "Error while loading level file '%s': ", filename);
58 fprintf(stderr, _("Not a valid level file\n"));
65 strcpy(level->file, filename);
67 /* Init hs with default values */
68 score_init_hs(&level->time_score, 59999, 0);
69 score_init_hs(&level->goal_score, 59999, 0);
70 score_init_hs(&level->coin_score, 59999, 0);
71 /* Consider that true HS are set latter by the caller */
76 level->numbername = "0";
80 /* Considers that internal data are set by the caller */
85 void level_dump_info(const struct level * level)
87 printf("filename: %s\n"
94 level->file, level->back, level->grad, level->shot, level->song,
95 level->time, level->goal);
98 /*---------------------------------------------------------------------------*/
100 const char * mode_to_str(int m)
104 case MODE_CHALLENGE: return _("Challenge");
105 case MODE_NORMAL: return _("Normal");
106 case MODE_PRACTICE: return _("Practice");
107 case MODE_SINGLE: return _("Single");
108 default: return "???";
112 /*---------------------------------------------------------------------------*/
114 const char * state_to_str(int m)
118 case GAME_NONE: return _("Aborted");
119 case GAME_TIME: return _("Time-out");
120 case GAME_GOAL: return _("Success");
121 case GAME_FALL: return _("Fall-out");
122 default: return "???";
126 /*---------------------------------------------------------------------------*/