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