]> icculus.org git repositories - btb/d2x.git/blob - libmve/mvelib.h
memset ogl font bitmap data since the copy function leaves some (unused) parts uninit...
[btb/d2x.git] / libmve / mvelib.h
1 #ifndef INCLUDED_MVELIB_H
2 #define INCLUDED_MVELIB_H
3
4 #include <stdio.h>
5 #include <stdlib.h>
6
7 #include "libmve.h"
8
9 extern mve_cb_Read mve_read;
10 extern mve_cb_Alloc mve_alloc;
11 extern mve_cb_Free mve_free;
12 extern mve_cb_ShowFrame mve_showframe;
13 extern mve_cb_SetPalette mve_setpalette;
14
15 /*
16  * structure for maintaining info on a MVEFILE stream
17  */
18 typedef struct MVEFILE
19 {
20     void           *stream;
21     unsigned char  *cur_chunk;
22     int             buf_size;
23     int             cur_fill;
24     int             next_segment;
25 } MVEFILE;
26
27 /*
28  * open a .MVE file
29  */
30 MVEFILE *mvefile_open(void *stream);
31
32 /*
33  * close a .MVE file
34  */
35 void mvefile_close(MVEFILE *movie);
36
37 /*
38  * get size of next segment in chunk (-1 if no more segments in chunk)
39  */
40 int mvefile_get_next_segment_size(MVEFILE *movie);
41
42 /*
43  * get type of next segment in chunk (0xff if no more segments in chunk)
44  */
45 unsigned char mvefile_get_next_segment_major(MVEFILE *movie);
46
47 /*
48  * get subtype (version) of next segment in chunk (0xff if no more segments in
49  * chunk)
50  */
51 unsigned char mvefile_get_next_segment_minor(MVEFILE *movie);
52
53 /*
54  * see next segment (return NULL if no next segment)
55  */
56 unsigned char *mvefile_get_next_segment(MVEFILE *movie);
57
58 /*
59  * advance to next segment
60  */
61 void mvefile_advance_segment(MVEFILE *movie);
62
63 /*
64  * fetch the next chunk (return 0 if at end of stream)
65  */
66 int mvefile_fetch_next_chunk(MVEFILE *movie);
67
68 /*
69  * callback for segment type
70  */
71 typedef int (*MVESEGMENTHANDLER)(unsigned char major, unsigned char minor, unsigned char *data, int len, void *context);
72
73 /*
74  * structure for maintaining an MVE stream
75  */
76 typedef struct MVESTREAM
77 {
78     MVEFILE                    *movie;
79     void                       *context;
80     MVESEGMENTHANDLER           handlers[32];
81 } MVESTREAM;
82
83 /*
84  * open an MVE stream
85  */
86 MVESTREAM *mve_open(void *stream);
87
88 /*
89  * close an MVE stream
90  */
91 void mve_close(MVESTREAM *movie);
92
93 /*
94  * reset an MVE stream
95  */
96 void mve_reset(MVESTREAM *movie);
97
98 /*
99  * set segment type handler
100  */
101 void mve_set_handler(MVESTREAM *movie, unsigned char major, MVESEGMENTHANDLER handler);
102
103 /*
104  * set segment handler context
105  */
106 void mve_set_handler_context(MVESTREAM *movie, void *context);
107
108 /*
109  * play next chunk
110  */
111 int mve_play_next_chunk(MVESTREAM *movie);
112
113 #endif /* INCLUDED_MVELIB_H */