added support for BD game engine to Makefile for Android
[rocksndiamonds.git] / src / game_em / export_em.h
1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2024 by Artsoft Entertainment
5 //                  Holger Schemel
6 //                  info@artsoft.org
7 //                  https://www.artsoft.org/
8 // ----------------------------------------------------------------------------
9 // export_em.h
10 // ============================================================================
11
12 #ifndef EXPORT_EM_H
13 #define EXPORT_EM_H
14
15 // ============================================================================
16 // functions and definitions exported from game_em to main program
17 // ============================================================================
18
19 #include "emerald.h"
20 #include "cave.h"
21
22
23 // ----------------------------------------------------------------------------
24 // constant definitions
25 // ----------------------------------------------------------------------------
26
27 #define EM_MAX_CAVE_WIDTH               CAVE_WIDTH
28 #define EM_MAX_CAVE_HEIGHT              CAVE_HEIGHT
29
30
31 // ----------------------------------------------------------------------------
32 // exported structures
33 // ----------------------------------------------------------------------------
34
35 struct GlobalInfo_EM
36 {
37   Bitmap *screenbuffer;
38 };
39
40 struct GameInfo_EM
41 {
42   unsigned int random;
43
44   boolean level_solved;
45   boolean game_over;
46
47   boolean any_player_moving;
48   boolean any_player_snapping;
49
50   int last_moving_player;
51   int last_player_direction[MAX_PLAYERS];
52
53   struct LOGIC *lev;
54   struct PLAYER *ply[MAX_PLAYERS];
55
56   // flags to handle bugs in and changes between different engine versions
57   boolean use_single_button;
58   boolean use_snap_key_bug;
59   boolean use_random_bug;
60   boolean use_old_explosions;
61   boolean use_old_android;
62   boolean use_old_push_elements;
63   boolean use_old_push_into_acid;
64   boolean use_wrap_around;
65   boolean use_push_delay;
66 };
67
68 struct LevelInfo_EM
69 {
70   int file_version;
71
72   struct CAVE *cav;
73 };
74
75 struct GraphicInfo_EM
76 {
77   Bitmap *bitmap;
78   int src_x, src_y;
79   int src_offset_x, src_offset_y;
80   int dst_offset_x, dst_offset_y;
81   int width, height;
82
83   Bitmap *crumbled_bitmap;
84   int crumbled_src_x, crumbled_src_y;
85   int crumbled_border_size;
86   int crumbled_tile_size;
87
88   boolean has_crumbled_graphics;
89   boolean preserve_background;
90
91   int unique_identifier;        // used to identify needed screen updates
92 };
93
94 struct EngineSnapshotInfo_EM
95 {
96   struct GameInfo_EM game_em;
97   struct LOGIC lev;
98   struct PLAYER ply[MAX_PLAYERS];
99
100   int frame;
101   int screen_x;
102   int screen_y;
103 };
104
105
106 // ----------------------------------------------------------------------------
107 // exported functions
108 // ----------------------------------------------------------------------------
109
110 extern struct GlobalInfo_EM global_em_info;
111 extern struct GameInfo_EM game_em;
112 extern struct LevelInfo_EM native_em_level;
113 extern struct GraphicInfo_EM graphic_info_em_object[GAME_TILE_MAX][8];
114 extern struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][PLY_MAX][8];
115 extern struct EngineSnapshotInfo_EM engine_snapshot_em;
116
117 void em_open_all(void);
118 void em_close_all(void);
119
120 void InitGfxBuffers_EM(void);
121
122 void InitGameEngine_EM(void);
123 void GameActions_EM(byte[MAX_PLAYERS]);
124
125 unsigned int InitEngineRandom_EM(int);
126
127 void setLevelInfoToDefaults_EM(void);
128 boolean LoadNativeLevel_EM(char *, boolean);
129
130 int getFieldbufferOffsetX_EM(void);
131 int getFieldbufferOffsetY_EM(void);
132
133 void BlitScreenToBitmap_EM(Bitmap *);
134 void RedrawPlayfield_EM(boolean);
135
136 void LoadEngineSnapshotValues_EM(void);
137 void SaveEngineSnapshotValues_EM(void);
138
139 boolean checkIfAllPlayersFitToScreen(void);
140
141 int map_em_element_C_to_X(int);
142 int map_em_element_X_to_C(int);
143
144 #endif  // EXPORT_EM_H