#define LEVEL_H
#include "base_config.h"
-#define NSCORE 3
+#include "score.h"
+#include "levels.h"
/*---------------------------------------------------------------------------*/
-/* A score structure */
-
-struct score
+struct level
{
- char player[NSCORE+1][MAXNAM]; /* player name */
- int timer[NSCORE+1]; /* time elapsed */
- int coins[NSCORE+1]; /* coins collected */
-};
+ char file[PATHMAX];
+ char back[PATHMAX];
+ char grad[PATHMAX];
+ char shot[PATHMAX];
+ char song[PATHMAX];
-void score_init_hs(struct score *, int, int);
+ char message[MAXSTR];
-/*---------------------------------------------------------------------------*/
+ char version[MAXSTR];
+ char author[MAXSTR];
-/* A simple level */
+ int time; /* Time limit */
+ int goal; /* Coins needed */
-struct level
-{
- /* Level identity */
-
- char file[MAXSTR]; /* sol main file */
- char name[MAXSTR]; /* the level name */
- int version; /* the level version */
- char author[MAXSTR]; /* the author */
-
- /* Time and goal information */
-
- int time; /* time limit */
- int goal; /* coins needed */
-
- struct score time_score; /* "best time" score */
- struct score goal_score; /* "unlock goal" score */
- struct score coin_score; /* "most coin" score */
-
- /* Regarding set information */
-
- struct set * set; /* set (NULL in single mode) */
- int number; /* level number in the set */
- char numbername[3]; /* string representation of the number (eg. B1) */
- int is_locked; /* Is the level unplayable */
- int is_bonus; /* Is the level an extra-bonus level? */
- int is_completed; /* Is the level goal terminated? */
- int is_last; /* Is the level the last of the set? */
-
- /* Other metadata (files are relative the data file) */
-
- char message[MAXSTR]; /* intro message */
- char back[MAXSTR]; /* sol background file */
- char grad[MAXSTR]; /* gradiant backgound image */
- char shot[MAXSTR]; /* screenshot image */
- char song[MAXSTR]; /* song file */
-};
+ struct
+ {
+ struct score best_times;
+ struct score unlock_goal;
+ struct score most_coins;
+ }
+ score;
-int level_load(const char *, struct level *);
+ /* Set information. */
-void level_dump_info(const struct level *);
+ struct set *set;
-/*---------------------------------------------------------------------------*/
+ int number;
-/* A level for the playing */
+ /* String representation of the number (eg. "IV") */
+ char repr[MAXSTR];
-struct level_game
-{
- int mode; /* game mode */
- const struct level *level; /* the level played */
-
- int goal; /* coins needed */
- int time; /* time limit */
-
- /* MODE_CHALLENGE only */
- int score; /* coin total */
- int balls; /* live count */
- int times; /* time total */
-
- /* Once a level is finished */
- int state; /* state ending */
- int coins; /* coins collected */
- int timer; /* time elapsed */
- int state_value; /* more precision about the state: skip for goal */
-
- /* rank = 3 => unclassed */
- int coin_rank; /* rank in the level high-scores */
- int goal_rank; /* rank in the level high-scores */
- int time_rank; /* rank in the level high-scores */
- int score_rank; /* rank in the set high-scores */
- int times_rank; /* rank in the set high-scores */
-
- /* What about the game and the set? */
- int dead; /* Is the game over and lost? */
- int win; /* Is the game over and win? */
- int unlock; /* Is the next level newly unlocked */
- const struct level *next_level; /* next level (NULL no next level) */
+ int is_locked;
+ int is_bonus;
+ int is_completed;
};
+int level_load(const char *, struct level *);
+void level_dump(const struct level *);
+
+int level_replay(const char *);
+int level_play(const struct level *, int);
+void level_stat(int, int, int);
+void level_stop(void);
+int level_next(void);
+int level_same(void);
+
/*---------------------------------------------------------------------------*/
-#define MODE_CHALLENGE 1
-#define MODE_NORMAL 2
-#define MODE_PRACTICE 3
-#define MODE_SINGLE 4
+int count_extra_balls(int, int);
-const char *mode_to_str(int);
+void level_update_player_name(void);
/*---------------------------------------------------------------------------*/
#define GAME_NONE 0 /* No event (or aborted) */
#define GAME_TIME 1 /* Time's up */
-#define GAME_GOAL 2 /* Goal reached */
-#define GAME_FALL 3 /* Fall out */
-#define GAME_SPEC 4 /* Special goal reached */
+#define GAME_GOAL 2 /* Goal reached */
+#define GAME_FALL 3 /* Fall out */
-const char *state_to_str(int);
+const char *status_to_str(int);
#endif