1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * (c) 1995-2006 Artsoft Entertainment *
6 * Detmolder Strasse 189 *
9 * e-mail: info@artsoft.org *
10 *----------------------------------------------------------*
12 ***********************************************************/
17 /* (not included here due to collisions with Emerald Mine engine definitions) */
18 /* #include "main.h" */
20 #define MAX_INVENTORY_SIZE 1000
21 #define STD_NUM_KEYS 4
22 #define MAX_NUM_KEYS 8
28 struct TextPosInfo level;
29 struct TextPosInfo gems;
30 struct TextPosInfo inventory;
31 struct TextPosInfo keys;
32 struct TextPosInfo score;
33 struct TextPosInfo time;
35 struct TextPosInfo time_hh;
36 struct TextPosInfo time_mm;
37 struct TextPosInfo time_ss;
38 struct TextPosInfo drop_next_1;
39 struct TextPosInfo drop_next_2;
40 struct TextPosInfo drop_next_3;
41 struct TextPosInfo drop_next_4;
42 struct TextPosInfo drop_next_5;
43 struct TextPosInfo drop_next_6;
44 struct TextPosInfo drop_next_7;
45 struct TextPosInfo drop_next_8;
46 struct TextPosInfo emc_keys;
47 struct TextPosInfo key_1;
48 struct TextPosInfo key_2;
49 struct TextPosInfo key_3;
50 struct TextPosInfo key_4;
51 struct TextPosInfo key_5;
52 struct TextPosInfo key_6;
53 struct TextPosInfo key_7;
54 struct TextPosInfo key_8;
55 struct TextPosInfo key_white;
56 struct TextPosInfo key_white_count;
57 struct TextPosInfo shield_normal;
58 struct TextPosInfo shield_normal_time;
59 struct TextPosInfo shield_deadly;
60 struct TextPosInfo shield_deadly_time;
61 struct TextPosInfo exit;
62 struct TextPosInfo em_exit;
63 struct TextPosInfo sp_exit;
64 struct TextPosInfo steel_exit;
65 struct TextPosInfo em_steel_exit;
66 struct TextPosInfo emc_magic_ball;
67 struct TextPosInfo emc_magic_ball_switch;
68 struct TextPosInfo emc_magic_ball_time;
69 struct TextPosInfo light_switch;
70 struct TextPosInfo light_switch_time;
71 struct TextPosInfo timegate_switch;
72 struct TextPosInfo timegate_switch_time;
73 struct TextPosInfo switchgate_switch;
74 struct TextPosInfo emc_lenses;
75 struct TextPosInfo emc_lenses_time;
76 struct TextPosInfo emc_magnifier;
77 struct TextPosInfo emc_magnifier_time;
78 struct TextPosInfo balloon_switch;
79 struct TextPosInfo dynabomb_number;
80 struct TextPosInfo dynabomb_size;
81 struct TextPosInfo dynabomb_power;
82 struct TextPosInfo penguins;
83 struct TextPosInfo sokoban_objects;
84 struct TextPosInfo sokoban_fields;
85 struct TextPosInfo robot_wheel;
86 struct TextPosInfo conveyor_belt_1;
87 struct TextPosInfo conveyor_belt_1_switch;
88 struct TextPosInfo conveyor_belt_2;
89 struct TextPosInfo conveyor_belt_2_switch;
90 struct TextPosInfo conveyor_belt_3;
91 struct TextPosInfo conveyor_belt_3_switch;
92 struct TextPosInfo conveyor_belt_4;
93 struct TextPosInfo conveyor_belt_4_switch;
94 struct TextPosInfo magic_wall;
95 struct TextPosInfo magic_wall_time;
96 struct TextPosInfo bd_magic_wall;
97 struct TextPosInfo dc_magic_wall;
98 struct TextPosInfo player_name;
99 struct TextPosInfo level_name;
100 struct TextPosInfo level_author;
103 struct GameButtonInfo
105 struct MenuPosInfo stop;
106 struct MenuPosInfo pause;
107 struct MenuPosInfo play;
108 struct MenuPosInfo sound_music;
109 struct MenuPosInfo sound_loops;
110 struct MenuPosInfo sound_simple;
128 /* values for control panel */
129 struct GamePanelInfo panel;
130 struct GameButtonInfo button;
132 /* values for engine initialization */
133 int default_push_delay_fixed;
134 int default_push_delay_random;
136 /* constant within running game */
139 int initial_move_delay[MAX_PLAYERS];
140 int initial_move_delay_value[MAX_PLAYERS];
141 int initial_push_delay_value;
143 /* flags to handle bugs in and changes between different engine versions */
144 /* (for the latest engine version, these flags should always be "FALSE") */
145 boolean use_change_when_pushing_bug;
146 boolean use_block_last_field_bug;
147 boolean max_num_changes_per_frame;
148 boolean use_reverse_scan_direction;
150 /* variable within running game */
151 int yamyam_content_nr;
152 boolean magic_wall_active;
153 int magic_wall_time_left;
155 int timegate_time_left;
161 boolean explosions_delayed;
162 boolean envelope_active;
164 /* values for the new EMC elements */
165 int lenses_time_left;
166 int magnify_time_left;
170 /* values for player idle animation (no effect on engine) */
171 int player_boring_delay_fixed;
172 int player_boring_delay_random;
173 int player_sleeping_delay_fixed;
174 int player_sleeping_delay_random;
176 /* values for special game initialization control */
177 boolean restart_level;
179 /* values for special game control */
180 int centered_player_nr;
181 int centered_player_nr_next;
182 boolean set_centered_player;
184 /* values for random number generator initialization after snapshot */
185 unsigned long num_random_calls;
190 boolean present; /* player present in level playfield */
191 boolean connected; /* player connected (locally or via network) */
192 boolean active; /* player present and connected */
193 boolean killed; /* player maybe present/active, but killed */
195 int index_nr; /* player number (0 to 3) */
196 int index_bit; /* player number bit (1 << 0 to 1 << 3) */
197 int element_nr; /* element (EL_PLAYER_1 to EL_PLAYER_4) */
198 int client_nr; /* network client identifier */
200 byte action; /* action from local input device */
201 byte effective_action; /* action acknowledged from network server
202 or summarized over all configured input
203 devices when in single player mode */
204 byte programmed_action; /* action forced by game itself (like moving
205 through doors); overrides other actions */
207 int jx, jy, last_jx, last_jy;
208 int MovDir, MovPos, GfxDir, GfxPos;
209 int Frame, StepFrame;
216 boolean block_last_field;
217 int block_delay_adjustment; /* needed for different engine versions */
219 boolean can_fall_into_acid;
223 boolean LevelSolved, GameOver;
225 boolean LevelSolved_GameWon;
226 boolean LevelSolved_GameEnd;
227 boolean LevelSolved_PanelOff;
228 boolean LevelSolved_SaveTape;
229 boolean LevelSolved_SaveScore;
237 boolean is_auto_moving;
240 boolean is_collecting;
242 boolean is_switching;
244 boolean is_dropping_pressed;
251 int frame_counter_bored;
252 int frame_counter_sleeping;
254 int anim_delay_counter;
255 int post_delay_counter;
258 int action_waiting, last_action_waiting;
259 int special_action_bored;
260 int special_action_sleeping;
262 int num_special_action_bored;
263 int num_special_action_sleeping;
265 int switch_x, switch_y;
271 int move_delay_value;
272 int move_delay_value_next;
273 int move_delay_reset_counter;
276 int push_delay_value;
278 unsigned long actual_frame_counter;
281 int drop_pressed_delay;
288 int gems_still_needed;
289 int sokobanfields_still_needed;
290 int lights_still_needed;
291 int friends_still_needed;
292 int key[MAX_NUM_KEYS];
294 int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
295 int shield_normal_time_left;
296 int shield_deadly_time_left;
298 int inventory_element[MAX_INVENTORY_SIZE];
299 int inventory_infinite_element;
303 extern struct GameInfo game;
304 extern struct PlayerInfo stored_player[MAX_PLAYERS], *local_player;
308 void DEBUG_SetMaximumDynamite();
311 void GetPlayerConfig(void);
312 int GetElementFromGroupElement(int);
314 void DrawGameValue_Time(int);
315 void DrawGameDoorValues(void);
317 void InitGameSound();
320 void UpdateEngineValues(int, int);
324 void InitPlayerGfxAnimation(struct PlayerInfo *, int, int);
325 void Moving2Blocked(int, int, int *, int *);
326 void Blocked2Moving(int, int, int *, int *);
327 void DrawDynamite(int, int);
329 void StartGameActions(boolean, boolean, long);
331 void GameActions(void);
332 void GameActions_EM_Main();
333 void GameActions_RND();
335 void ScrollLevel(int, int);
337 void InitPlayLevelSound();
338 void PlayLevelSound_EM(int, int, int, int);
340 void RaiseScore(int);
341 void RaiseScoreElement(int);
343 void RequestQuitGameExt(boolean, boolean, char *);
344 void RequestQuitGame(boolean);
346 unsigned int InitEngineRandom_RND(long);
347 unsigned int RND(int);
349 void FreeEngineSnapshot();
350 void LoadEngineSnapshot();
351 void SaveEngineSnapshot();
352 boolean CheckEngineSnapshot();
354 void CreateGameButtons();
355 void FreeGameButtons();
356 void UnmapGameButtons();