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