Starting header clean-up.
[neverball] / ball / level.h
1 #ifndef LEVEL_H
2 #define LEVEL_H
3
4 #include "base_config.h"
5 #define NSCORE  3
6
7 /*---------------------------------------------------------------------------*/
8
9 /* A score structure */
10
11 struct score
12 {
13     char player[NSCORE + 1][MAXNAM]; /* player name */
14     int  timer[NSCORE + 1];          /* time elapsed */
15     int  coins[NSCORE + 1];          /* coins collected */
16 };
17
18 void score_init_hs(struct score *, int, int);
19
20 /*---------------------------------------------------------------------------*/
21
22 /* A simple level */
23
24 struct level
25 {
26     /* Level identity */
27
28     char file[MAXSTR];    /* sol main file */
29     char name[MAXSTR];    /* the level name */
30     int  version;         /* the level version */
31     char author[MAXSTR];  /* the author */
32
33     /* Time and goal information */
34
35     int time;             /* time limit */
36     int goal;             /* coins needed */
37
38     struct score time_score;  /* "best time" score */
39     struct score goal_score;  /* "unlock goal" score */
40     struct score coin_score;  /* "most coin" score */
41
42     /* Regarding set information */
43
44     struct set *set;        /* set (NULL in single mode) */
45     int number;             /* level number in the set */
46     char numbername[3];     /* string representation of the number (eg. B1) */
47     int is_locked;          /* Is the level unplayable */
48     int is_bonus;           /* Is the level an extra-bonus level? */
49     int is_completed;       /* Is the level goal terminated? */
50     int is_last;            /* Is the level the last of the set? */
51
52     /* Other metadata (files are relative the data file) */
53
54     char message[MAXSTR]; /* intro message */
55     char back[MAXSTR];    /* sol background file */
56     char grad[MAXSTR];    /* gradiant backgound image */
57     char shot[MAXSTR];    /* screenshot image */
58     char song[MAXSTR];    /* song file */
59 };
60
61 int level_load(const char *, struct level *);
62
63 void level_dump_info(const struct level *);
64
65 /*---------------------------------------------------------------------------*/
66
67 /* A level for the playing */
68
69 struct level_game
70 {
71     int mode;          /* game mode */
72     const struct level *level; /* the level played */
73
74     int goal;          /* coins needed */
75     int time;          /* time limit */
76
77     /* MODE_CHALLENGE only */
78     int score;         /* coin total */
79     int balls;         /* live count */
80     int times;         /* time total */
81
82     /* Once a level is finished */
83     int state;         /* state ending */
84     int coins;         /* coins collected */
85     int timer;         /* time elapsed */
86     int state_value;   /* more precision about the state: skip for goal */
87
88     /* rank = 3  => unclassed */
89     int coin_rank;     /* rank in the level high-scores */
90     int goal_rank;     /* rank in the level high-scores */
91     int time_rank;     /* rank in the level high-scores */
92     int score_rank;    /* rank in the set high-scores */
93     int times_rank;    /* rank in the set high-scores */
94
95     /* What about the game and the set? */
96     int dead;          /* Is the game over and lost? */
97     int win;           /* Is the game over and win? */
98     int unlock;        /* Is the next level newly unlocked */
99     const struct level *next_level; /* next level (NULL no next level) */
100 };
101
102 /*---------------------------------------------------------------------------*/
103
104 #define MODE_CHALLENGE  1
105 #define MODE_NORMAL     2
106 #define MODE_PRACTICE   3
107 #define MODE_SINGLE     4
108
109 const char *mode_to_str(int);
110
111 /*---------------------------------------------------------------------------*/
112
113 #define GAME_NONE 0     /* No event (or aborted) */
114 #define GAME_TIME 1     /* Time's up */
115 #define GAME_GOAL 2     /* Goal reached */
116 #define GAME_FALL 3     /* Fall out */
117 #define GAME_SPEC 4     /* Special goal reached */
118
119 const char *state_to_str(int);
120
121 #endif