Since the --replay command line option, extension and basename stuff is not exclusive...
[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
15     /* The following reflects the file structure. */
16
17     /* magic number */
18     /* replay file version */
19     int    timer;           /* elapsed time */
20     int    coins;           /* coin number */
21     int    state;           /* how the replay end */
22     int    mode;            /* game mode */
23     time_t date;            /* date of creation */
24     char   player[MAXNAM];  /* player name */
25     char   shot[PATHMAX];   /* image filename */
26     char   file[PATHMAX];   /* level filename */
27     char   back[PATHMAX];   /* level bg filename */
28     char   grad[PATHMAX];   /* level gradiant filename */
29     char   song[PATHMAX];   /* level song filename */
30     int    time;            /* time limit (! training mode) */
31     int    goal;            /* coin to open the goal (! training mode) */
32     int    score;           /* sum of coins (challenge mode) */
33     int    balls;           /* number of balls (challenge mode) */
34     int    times;           /* total time (challenge mode) */
35     char   nb_version[20];  /* neverball version used */
36 };
37
38
39 /*---------------------------------------------------------------------------*/
40
41 #define MAXDEMO 256
42
43 int                demo_scan(void);
44 const char        *demo_pick(void);
45 const struct demo *demo_get(int);
46
47 const char *date_to_str(time_t);
48
49 int  demo_exists(char *);
50 void demo_unique(char *);
51
52 /*---------------------------------------------------------------------------*/
53
54 int  demo_play_init(const char *, const struct level *,
55                     const struct level_game *);
56 void demo_play_step(float);
57 void demo_play_stop(const struct level_game *);
58 int  demo_play_saved(void);
59 void demo_play_save(const char *);
60
61 /*---------------------------------------------------------------------------*/
62
63 int  demo_replay_init(const char *, struct level_game *);
64 int  demo_replay_step(float *);
65 void demo_replay_stop(int);
66 void demo_replay_dump_info(void);
67 const struct demo *curr_demo_replay(void);
68
69 /*---------------------------------------------------------------------------*/
70
71 #endif