1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2024 by Artsoft Entertainment
7 // https://www.artsoft.org/
8 // ----------------------------------------------------------------------------
10 // ============================================================================
15 // ============================================================================
16 // functions and definitions exported from game_mm to main program
17 // ============================================================================
19 // ----------------------------------------------------------------------------
20 // constant definitions
21 // ----------------------------------------------------------------------------
23 #define MM_MAX_PLAYFIELD_WIDTH MAX_PLAYFIELD_WIDTH
24 #define MM_MAX_PLAYFIELD_HEIGHT MAX_PLAYFIELD_HEIGHT
26 #define MM_STD_PLAYFIELD_WIDTH 16
27 #define MM_STD_PLAYFIELD_HEIGHT 12
29 #define MM_MAX_PLAYFIELD_SIZE (MM_MAX_PLAYFIELD_WIDTH * \
30 MM_MAX_PLAYFIELD_HEIGHT)
32 #define MAX_NUM_AMOEBA 100
33 #define MAX_NUM_BEAMERS 8
35 #define MAX_LASER_LEN 256
36 #define MAX_LASER_ENERGY 100
37 #define MAX_LASER_OVERLOAD 100
39 #define MM_LEVEL_SCORE_ELEMENTS 16
41 #define MM_MAX_BALL_CONTENTS 16
43 #define MM_MAX_LEVEL_NAME_LEN 32
44 #define MM_MAX_LEVEL_AUTHOR_LEN 32
47 #define EL_MM_START_1_NATIVE 0
48 #define EL_MM_END_1_NATIVE 159
50 #define EL_MM_CHAR_START_NATIVE 160
51 #define EL_MM_CHAR_END_NATIVE 239
53 #define EL_MM_START_2_NATIVE 240
54 #define EL_MM_END_2_NATIVE 430
56 #define EL_MM_START_3_NATIVE 431
57 #define EL_MM_END_3_NATIVE 450
59 #define EL_MM_RUNTIME_START_NATIVE 500
60 #define EL_MM_RUNTIME_END_NATIVE 504
62 // elements to be specially mapped
63 #define EL_MM_EMPTY_NATIVE 0
64 #define EL_DF_EMPTY_NATIVE 304
67 #define SND_MM_GAME_LEVELTIME_CHARGING 0
68 #define SND_MM_GAME_HEALTH_CHARGING 1
71 // ----------------------------------------------------------------------------
72 // data structure definitions
73 // ----------------------------------------------------------------------------
108 struct XY start_edge;
113 struct DamageList damage[MAX_LASER_LEN + 10];
116 struct XY edge[MAX_LASER_LEN + 10];
119 struct BeamerInfo beamer[MAX_NUM_BEAMERS][2];
120 int beamer_edge[MAX_NUM_BEAMERS];
121 int beamer_nr[MAX_NUM_BEAMERS];
131 int dest_element_last;
132 int dest_element_last_x;
133 int dest_element_last_y;
134 boolean stops_inside_element;
146 struct CycleList cycle[MM_MAX_PLAYFIELD_SIZE];
149 struct MovingList pacman[MM_MAX_PLAYFIELD_SIZE];
154 int kettles_still_needed;
155 int lights_still_needed;
157 int ball_choice_pos; // current content element choice position
158 boolean laser_red, laser_green, laser_blue;
160 boolean has_mcduffin;
161 boolean level_solved;
164 char *game_over_message;
166 boolean cheat_no_overload;
167 boolean cheat_no_explosion;
169 int laser_overload_value;
170 boolean laser_enabled;
175 int file_version; // version of file the level was stored with
176 int game_version; // version of game engine to play this level
177 boolean encoding_16bit_field; // level contains 16-bit elements
183 boolean auto_count_kettles;
184 boolean mm_laser_red, mm_laser_green, mm_laser_blue;
185 boolean df_laser_red, df_laser_green, df_laser_blue;
186 char name[MM_MAX_LEVEL_NAME_LEN + 1];
187 char author[MM_MAX_LEVEL_AUTHOR_LEN + 1];
188 int score[MM_LEVEL_SCORE_ELEMENTS];
195 int num_ball_contents;
196 int ball_choice_mode;
197 int ball_content[MM_MAX_BALL_CONTENTS];
198 boolean rotate_ball_content;
199 boolean explode_ball;
201 short field[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
204 struct EngineSnapshotInfo_MM
206 struct GameInfo_MM game_mm;
208 struct LaserInfo laser;
210 short Ur[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
211 short Hit[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
212 short Box[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
213 short Angle[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
220 int last_LX, last_LY, last_hit_mask;
224 DelayCounter rotate_delay;
225 DelayCounter pacman_delay;
226 DelayCounter energy_delay;
227 DelayCounter overload_delay;
231 // ----------------------------------------------------------------------------
232 // exported functions
233 // ----------------------------------------------------------------------------
235 extern struct GameInfo_MM game_mm;
236 extern struct LevelInfo_MM native_mm_level;
237 extern struct EngineSnapshotInfo_MM engine_snapshot_mm;
239 extern short Ur[MM_MAX_PLAYFIELD_WIDTH][MM_MAX_PLAYFIELD_HEIGHT];
241 void mm_open_all(void);
243 void InitElementProperties_MM(void);
245 void InitGfxBuffers_MM(void);
247 void InitGameEngine_MM(void);
248 void InitGameActions_MM(void);
249 void GameActions_MM(struct MouseActionInfo);
251 void DrawLaser_MM(void);
252 void DrawTileCursor_MM(int, int, boolean);
254 boolean ClickElement(int, int, int);
256 unsigned int InitEngineRandom_MM(int);
258 void setLevelInfoToDefaults_MM(void);
259 void copyInternalEngineVars_MM(void);
260 boolean LoadNativeLevel_MM(char *, boolean);
261 void SaveNativeLevel_MM(char *);
263 int getFieldbufferOffsetX_MM(void);
264 int getFieldbufferOffsetY_MM(void);
266 int getFlippedTileX_MM(int);
267 int getFlippedTileY_MM(int);
268 int getFlippedTileXY_MM(int);
270 void BlitScreenToBitmap_MM(Bitmap *);
271 void RedrawPlayfield_MM(void);
273 void LoadEngineSnapshotValues_MM(void);
274 void SaveEngineSnapshotValues_MM(void);
276 int getButtonFromTouchPosition(int, int, int, int);
278 #endif // EXPORT_MM_H