added using separate constants for tiles in EM engine caves and game logic
[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 };
50
51 struct LevelInfo_EM
52 {
53   int file_version;
54
55   struct CAVE *cav;
56 };
57
58 struct GraphicInfo_EM
59 {
60   Bitmap *bitmap;
61   int src_x, src_y;
62   int src_offset_x, src_offset_y;
63   int dst_offset_x, dst_offset_y;
64   int width, height;
65
66   Bitmap *crumbled_bitmap;
67   int crumbled_src_x, crumbled_src_y;
68   int crumbled_border_size;
69   int crumbled_tile_size;
70
71   boolean has_crumbled_graphics;
72   boolean preserve_background;
73
74   int unique_identifier;        /* used to identify needed screen updates */
75 };
76
77 struct EngineSnapshotInfo_EM
78 {
79   struct GameInfo_EM game_em;
80   struct LOGIC lev;
81   struct PLAYER ply[MAX_PLAYERS];
82
83   int frame;
84   int screen_x;
85   int screen_y;
86 };
87
88
89 // ----------------------------------------------------------------------------
90 // exported functions
91 // ----------------------------------------------------------------------------
92
93 extern struct GlobalInfo_EM global_em_info;
94 extern struct GameInfo_EM game_em;
95 extern struct LevelInfo_EM native_em_level;
96 extern struct GraphicInfo_EM graphic_info_em_object[TILE_MAX][8];
97 extern struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][PLY_MAX][8];
98 extern struct EngineSnapshotInfo_EM engine_snapshot_em;
99
100 void em_open_all(void);
101 void em_close_all(void);
102
103 void InitGfxBuffers_EM(void);
104
105 void InitGameEngine_EM(void);
106 void GameActions_EM(byte *, boolean);
107
108 unsigned int InitEngineRandom_EM(int);
109
110 void setLevelInfoToDefaults_EM(void);
111 boolean LoadNativeLevel_EM(char *, boolean);
112
113 int getFieldbufferOffsetX_EM(void);
114 int getFieldbufferOffsetY_EM(void);
115
116 void BlitScreenToBitmap_EM(Bitmap *);
117 void RedrawPlayfield_EM(boolean);
118
119 void LoadEngineSnapshotValues_EM(void);
120 void SaveEngineSnapshotValues_EM(void);
121
122 boolean checkIfAllPlayersFitToScreen(void);
123
124 int map_em_element_C_to_X(int);
125 int map_em_element_X_to_C(int);
126
127 #endif  // EXPORT_H