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