Another strong code change. This one focusses Set management:
[neverball] / ball / set.h
1 #ifndef SET_H
2 #define SET_H
3
4 #include "base_config.h"
5 #include "level.h"
6
7 /*---------------------------------------------------------------------------*/
8
9 #define SET_FILE "sets.txt"
10 #define MAXSET 16
11 #define MAXLVL 25
12 #define NSCORE  3
13
14 /* A score structure */
15 struct score
16 {
17     char player[NSCORE+1][MAXNAM]; /* player name */
18     int  timer[NSCORE+1];          /* time elapsed */
19     int  coins[NSCORE+1];          /* coins collected */
20 };
21
22 /* A level information of a set */
23 struct set_level
24 {
25     struct score time_score;  /* ruch the goal score */
26     struct score goal_score;  /* open the goal score */
27     struct score coin_score;  /* most coin score */
28
29     const char *numbername;   /* name of level (eg. B1) */
30 };
31
32 /* A pack of levels */
33 struct set
34 {
35     /* set global info */
36     int number;               /* number of the set */
37         
38     char init_levels[MAXSTR]; /* levels list file */
39     char init_scores[MAXSTR]; /* levels intals score file */
40     char user_scores[MAXSTR]; /* lever user highscore file */
41
42     char shot[MAXSTR];        /* screenshot image file*/
43     char name[MAXSTR];        /* set name */
44     char desc[MAXSTR];        /* set description */
45
46     struct score time_score;  /* challenge score */
47     struct score coin_score;  /* challenge score */
48     
49     /* levels info */
50     
51     int count;                /* number of levels */
52     int limit;                /* last opened level */
53     struct set_level levels[MAXLVL]; /* info for each level */
54 };
55
56 /*---------------------------------------------------------------------------*/
57
58 void set_init();
59
60 int  set_exists(int);
61 const struct set *get_set(int);
62
63 /*---------------------------------------------------------------------------*/
64
65 int  set_extra_bonus_opened(const struct set *);
66 int  set_completed(const struct set *);
67
68 int  set_level_exists(const struct set *, int);
69 int  set_level_opened(const struct set *, int);
70 int  set_level_extra_bonus(const struct set *, int);
71
72 /*---------------------------------------------------------------------------*/
73
74 void set_goto(int i);
75 const struct set *curr_set(void);
76
77 const struct level *get_level(int);
78
79 /*---------------------------------------------------------------------------*/
80
81 void set_finish_level(struct level_game *, const char *);
82 void score_change_name(struct level_game *, const char *);
83
84 /*---------------------------------------------------------------------------*/
85
86 void level_snap(int);
87
88 void set_cheat(void);
89
90 /*---------------------------------------------------------------------------*/
91
92 #endif