added configurability of different window size for title screens
[rocksndiamonds.git] / src / cartoons.c
1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
5 //                  Holger Schemel
6 //                  info@artsoft.org
7 //                  http://www.artsoft.org/
8 // ----------------------------------------------------------------------------
9 // cartoons.c
10 // ============================================================================
11
12 #include "cartoons.h"
13 #include "main.h"
14 #include "tools.h"
15
16
17 /* values for toon definition */
18 #define MAX_NUM_TOONS                   20
19
20 static struct ToonInfo toons[MAX_NUM_TOONS];
21
22 static void PrepareBackbuffer()
23 {
24   if (game_status != GAME_MODE_PLAYING)
25     return;
26
27   BlitScreenToBitmap(backbuffer);
28 }
29
30 boolean ToonNeedsRedraw()
31 {
32   return TRUE;
33 }
34
35 void InitToons()
36 {
37   int num_toons = MAX_NUM_TOONS;
38   int i;
39
40   if (global.num_toons >= 0 && global.num_toons < MAX_NUM_TOONS)
41     num_toons = global.num_toons;
42
43   for (i = 0; i < num_toons; i++)
44   {
45     int graphic = IMG_TOON_1 + i;
46     struct FileInfo *image = getImageListEntryFromImageID(graphic);
47
48     toons[i].bitmap = graphic_info[graphic].bitmap;
49
50     toons[i].src_x = graphic_info[graphic].src_x;
51     toons[i].src_y = graphic_info[graphic].src_y;
52
53     toons[i].width  = graphic_info[graphic].width;
54     toons[i].height = graphic_info[graphic].height;
55
56     toons[i].anim_frames      = graphic_info[graphic].anim_frames;
57     toons[i].anim_delay       = graphic_info[graphic].anim_delay;
58     toons[i].anim_mode        = graphic_info[graphic].anim_mode;
59     toons[i].anim_start_frame = graphic_info[graphic].anim_start_frame;
60
61     toons[i].step_offset = graphic_info[graphic].step_offset;
62     toons[i].step_delay  = graphic_info[graphic].step_delay;
63
64     toons[i].direction = image->parameter[GFX_ARG_DIRECTION];
65     toons[i].position = image->parameter[GFX_ARG_POSITION];
66   }
67
68   InitToonScreen(bitmap_db_toons,
69                  BackToFront, PrepareBackbuffer, ToonNeedsRedraw,
70                  toons, num_toons,
71                  REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE,
72                  GAME_FRAME_DELAY);
73 }