added separate initial and runtime level structure definitions for EM engine
[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   boolean level_solved;
32   boolean game_over;
33
34   boolean any_player_moving;
35   boolean any_player_snapping;
36
37   boolean use_single_button;
38   boolean use_snap_key_bug;
39
40   int last_moving_player;
41   int last_player_direction[MAX_PLAYERS];
42
43   struct LOGIC *lev;
44   struct PLAYER *ply[MAX_PLAYERS];
45 };
46
47 struct LevelInfo_EM
48 {
49   int file_version;
50
51   struct CAVE *cav;
52 };
53
54 struct GraphicInfo_EM
55 {
56   Bitmap *bitmap;
57   int src_x, src_y;
58   int src_offset_x, src_offset_y;
59   int dst_offset_x, dst_offset_y;
60   int width, height;
61
62   Bitmap *crumbled_bitmap;
63   int crumbled_src_x, crumbled_src_y;
64   int crumbled_border_size;
65   int crumbled_tile_size;
66
67   boolean has_crumbled_graphics;
68   boolean preserve_background;
69
70   int unique_identifier;        /* used to identify needed screen updates */
71 };
72
73 struct EngineSnapshotInfo_EM
74 {
75   struct GameInfo_EM game_em;
76   unsigned int RandomEM;
77   struct LOGIC lev;
78   struct PLAYER ply[MAX_PLAYERS];
79   int screen_x;
80   int screen_y;
81   int frame;
82 };
83
84
85 // ----------------------------------------------------------------------------
86 // exported functions
87 // ----------------------------------------------------------------------------
88
89 extern struct GlobalInfo_EM global_em_info;
90 extern struct GameInfo_EM game_em;
91 extern struct LevelInfo_EM native_em_level;
92 extern struct GraphicInfo_EM graphic_info_em_object[TILE_MAX][8];
93 extern struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][PLY_MAX][8];
94 extern struct EngineSnapshotInfo_EM engine_snapshot_em;
95
96 void em_open_all(void);
97 void em_close_all(void);
98
99 void InitGfxBuffers_EM(void);
100
101 void InitGameEngine_EM(void);
102 void GameActions_EM(byte *, boolean);
103
104 unsigned int InitEngineRandom_EM(int);
105
106 void setLevelInfoToDefaults_EM(void);
107 boolean LoadNativeLevel_EM(char *, boolean);
108
109 int getFieldbufferOffsetX_EM(void);
110 int getFieldbufferOffsetY_EM(void);
111
112 void BlitScreenToBitmap_EM(Bitmap *);
113 void RedrawPlayfield_EM(boolean);
114
115 void LoadEngineSnapshotValues_EM(void);
116 void SaveEngineSnapshotValues_EM(void);
117
118 boolean checkIfAllPlayersFitToScreen(void);
119
120 #endif  // EXPORT_H