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