Replace strong level path from replay with a couple (name/version) of the level.
[neverball] / ball / demo.h
1 #ifndef DEMO_H
2 #define DEMO_H
3
4 #include <time.h>
5 #include "level.h"
6
7 /*---------------------------------------------------------------------------*/
8
9 /* Demo information structure (header) */
10 struct demo
11 {
12     char   name[PATHMAX];      /* demo basename */
13     char   filename[MAXSTR];   /* demo path */
14     const struct level *level; /* the level played by the demo */
15
16     /* The following reflects the file structure. */
17
18     /* magic number */
19     /* replay file version */
20     int    timer;           /* elapsed time */
21     int    coins;           /* coin number */
22     int    state;           /* how the replay end */
23     int    mode;            /* game mode */
24     time_t date;            /* date of creation */
25     char   player[MAXNAM];  /* player name */
26     char   l_name[MAXSTR];  /* internal level name */
27     char   l_ver[MAXSTR];   /* internal level version */
28     int    time;            /* time limit (! training mode) */
29     int    goal;            /* coin to open the goal (! training mode) */
30     int    score;           /* sum of coins (challenge mode) */
31     int    balls;           /* number of balls (challenge mode) */
32     int    times;           /* total time (challenge mode) */
33     char   nb_version[20];  /* neverball version used */
34 };
35
36
37 /*---------------------------------------------------------------------------*/
38
39 #define MAXDEMO 256
40
41 int                demo_scan(void);
42 const char        *demo_pick(void);
43 const struct demo *demo_get(int);
44
45 const char *date_to_str(time_t);
46
47 int  demo_exists(char *);
48 void demo_unique(char *);
49
50 /*---------------------------------------------------------------------------*/
51
52 int  demo_play_init(const char *, const struct level *,
53                     const struct level_game *);
54 void demo_play_step(float);
55 void demo_play_stop(const struct level_game *);
56 int  demo_play_saved(void);
57 void demo_play_save(const char *);
58
59 /*---------------------------------------------------------------------------*/
60
61 int  demo_replay_init(const char *, struct level_game *);
62 int  demo_replay_step(float *);
63 void demo_replay_stop(int);
64 void demo_replay_dump_info(void);
65 const struct demo *curr_demo_replay(void);
66
67 /*---------------------------------------------------------------------------*/
68
69 #endif