rnd-20021227-2-src
[rocksndiamonds.git] / src / libgame / toons.h
1 /***********************************************************
2 * Artsoft Retro-Game Library                               *
3 *----------------------------------------------------------*
4 * (c) 1995-2002 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * toons.h                                                  *
12 ***********************************************************/
13
14 #ifndef TOONS_H
15 #define TOONS_H
16
17 #include "system.h"
18
19
20 /* values for animation mode (frame order and direction) */
21 #define ANIM_NONE               0
22 #define ANIM_LOOP               (1 << 0)
23 #define ANIM_LINEAR             (1 << 1)
24 #define ANIM_PINGPONG           (1 << 2)
25 #define ANIM_PINGPONG2          (1 << 3)
26 #define ANIM_REVERSE            (1 << 4)
27
28 /* values for toon animation direction */
29 #define ANIMDIR_LEFT    1
30 #define ANIMDIR_RIGHT   2
31 #define ANIMDIR_UP      4
32 #define ANIMDIR_DOWN    8
33
34 #define ANIMPOS_ANY     0
35 #define ANIMPOS_LEFT    1
36 #define ANIMPOS_RIGHT   2
37 #define ANIMPOS_UP      4
38 #define ANIMPOS_DOWN    8
39 #define ANIMPOS_UPPER   16
40
41
42 struct ToonScreenInfo
43 {
44   Bitmap *save_buffer;
45   void (*update_function)(void);
46   void (*prepare_backbuffer_function)(void);
47   boolean (*redraw_needed_function)(void);
48
49   struct ToonInfo *toons;
50   int num_toons;
51
52   int startx, starty;
53   int width, height;
54
55   int frame_delay_value;
56 };
57
58 struct ToonInfo
59 {
60   int graphic;
61   int width, height;
62   int src_x, src_y;
63   int anim_frames;
64   int move_delay;
65   int stepsize;
66   int anim_mode;
67   int direction;
68   int position;
69
70   int anim_delay;
71   int start_frame;
72   Bitmap *bitmap;       /* dynamically initialized */
73 };
74
75
76 int getAnimationFrame(int, int, int, int, int);
77
78 void InitToonScreen(Bitmap *, void (*update_function)(void),
79                     void (*prepare_backbuffer_function)(void),
80                     boolean (*redraw_needed_function)(void),
81                     struct ToonInfo *, int, int, int, int, int, int);
82 void InitAnimation(void);
83 void StopAnimation(void);
84 void DoAnimation(void);
85
86 #endif  /* TOONS_H */