rnd-20030111-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 #define ANIM_RANDOM             (1 << 5)
28
29 /* values for toon animation direction */
30 #define ANIMDIR_LEFT    1
31 #define ANIMDIR_RIGHT   2
32 #define ANIMDIR_UP      4
33 #define ANIMDIR_DOWN    8
34
35 #define ANIMPOS_ANY     0
36 #define ANIMPOS_LEFT    1
37 #define ANIMPOS_RIGHT   2
38 #define ANIMPOS_UP      4
39 #define ANIMPOS_DOWN    8
40 #define ANIMPOS_UPPER   16
41
42
43 struct ToonScreenInfo
44 {
45   Bitmap *save_buffer;
46   void (*update_function)(void);
47   void (*prepare_backbuffer_function)(void);
48   boolean (*redraw_needed_function)(void);
49
50   struct ToonInfo *toons;
51   int num_toons;
52
53   int startx, starty;
54   int width, height;
55
56   int frame_delay_value;
57 };
58
59 struct ToonInfo
60 {
61   int graphic;
62   int width, height;
63   int src_x, src_y;
64   int anim_frames;
65   int move_delay;
66   int stepsize;
67   int anim_mode;
68   int direction;
69   int position;
70
71   int anim_delay;
72   int start_frame;
73   Bitmap *bitmap;       /* dynamically initialized */
74 };
75
76
77 int getAnimationFrame(int, int, int, int, int);
78
79 void InitToonScreen(Bitmap *, void (*update_function)(void),
80                     void (*prepare_backbuffer_function)(void),
81                     boolean (*redraw_needed_function)(void),
82                     struct ToonInfo *, int, int, int, int, int, int);
83 void InitAnimation(void);
84 void StopAnimation(void);
85 void DoAnimation(void);
86
87 #endif  /* TOONS_H */