Make sure strncpy always keeps one byte untouched for NUL
[neverball] / ball / demo.h
1 #ifndef DEMO_H
2 #define DEMO_H
3
4 #include <time.h>
5 #include <stdio.h>
6
7 #include "level.h"
8 #include "fs.h"
9
10 /*---------------------------------------------------------------------------*/
11
12 struct demo
13 {
14     char   name[PATHMAX];     /* demo basename    */
15     char   filename[MAXSTR];  /* demo path        */
16
17     char   player[MAXSTR];
18     time_t date;
19
20     int    timer;
21     int    coins;
22     int    status;
23     int    mode;
24
25     char   shot[PATHMAX];   /* image filename */
26     char   file[PATHMAX];   /* level filename */
27
28     int    time;            /* time limit        */
29     int    goal;            /* coin limit        */
30     int    goal_e;          /* goal enabled flag */
31     int    score;           /* total coins       */
32     int    balls;           /* number of balls   */
33     int    times;           /* total time        */
34 };
35
36 /*---------------------------------------------------------------------------*/
37
38 struct demo *demo_load(const char *);
39 void         demo_free(struct demo *);
40
41 int  demo_exists(const char *);
42
43 const char *demo_format_name(const char *fmt,
44                              const char *set,
45                              const char *level);
46
47 /*---------------------------------------------------------------------------*/
48
49 int  demo_play_init(const char *, const struct level *,
50                     int, int, int, int, int, int, int);
51 void demo_play_step(void);
52 void demo_play_stat(int, int, int);
53 void demo_play_stop(void);
54
55 int  demo_saved (void);
56 void demo_rename(const char *);
57
58 void demo_rename_player(const char *name, const char *player);
59
60 /*---------------------------------------------------------------------------*/
61
62 int  demo_replay_init(const char *, int *, int *, int *, int *, int *);
63 int  demo_replay_step(float);
64 void demo_replay_stop(int);
65
66 const struct demo *curr_demo_replay(void);
67
68 /*---------------------------------------------------------------------------*/
69
70 fs_file demo_file(void);
71
72 /*---------------------------------------------------------------------------*/
73
74 #endif