5e0cdca29e4af4b2e96a38b22496bfde3469f1fd
[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 struct demo
10 {
11     char   name[PATHMAX];      /* demo basename */
12     char   filename[MAXSTR];  /* demo path */
13
14     int    timer;           /* elapsed time */
15     int    coins;           /* coin number */
16     int    state;           /* how the replay end */
17     int    mode;            /* game mode */
18     time_t date;            /* date of creation */
19     char   player[MAXNAM];  /* player name */
20     char   shot[PATHMAX];   /* image filename */
21     char   file[PATHMAX];   /* level filename */
22     char   back[PATHMAX];   /* level bg filename */
23     char   grad[PATHMAX];   /* level gradient filename */
24     char   song[PATHMAX];   /* level song filename */
25     int    time;            /* time limit (! training mode) */
26     int    goal;            /* coin to open the goal (! training mode) */
27     int    score;           /* sum of coins (challenge mode) */
28     int    balls;           /* number of balls (challenge mode) */
29     int    times;           /* total time (challenge mode) */
30 };
31
32
33 /*---------------------------------------------------------------------------*/
34
35 #define MAXDEMO 256
36
37 int                demo_scan(void);
38 const char        *demo_pick(void);
39 const struct demo *demo_get(int);
40
41 const char *date_to_str(time_t);
42
43 int  demo_exists(const char *);
44 void demo_unique(char *);
45
46 /*---------------------------------------------------------------------------*/
47
48 int  demo_play_init(const char *, const struct level *,
49                     const struct level_game *);
50 void demo_play_step(float);
51 void demo_play_stop(const struct level_game *);
52 int  demo_play_saved(void);
53 void demo_play_save(const char *);
54
55 /*---------------------------------------------------------------------------*/
56
57 int  demo_replay_init(const char *, struct level_game *);
58 int  demo_replay_step(float *);
59 void demo_replay_stop(int);
60 void demo_replay_dump_info(void);
61 const struct demo *curr_demo_replay(void);
62
63 /*---------------------------------------------------------------------------*/
64
65 #endif