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_number;
29 struct TextPosInfo gems;
30 struct TextPosInfo inventory;
31 struct TextPosInfo key[MAX_NUM_KEYS];
32 struct TextPosInfo key_white;
33 struct TextPosInfo key_white_count;
34 struct TextPosInfo score;
35 struct TextPosInfo time;
36 struct TextPosInfo time_hh;
37 struct TextPosInfo time_mm;
38 struct TextPosInfo time_ss;
39 struct TextPosInfo drop_next_1;
40 struct TextPosInfo drop_next_2;
41 struct TextPosInfo drop_next_3;
42 struct TextPosInfo drop_next_4;
43 struct TextPosInfo drop_next_5;
44 struct TextPosInfo drop_next_6;
45 struct TextPosInfo drop_next_7;
46 struct TextPosInfo drop_next_8;
47 struct TextPosInfo shield_normal;
48 struct TextPosInfo shield_normal_time;
49 struct TextPosInfo shield_deadly;
50 struct TextPosInfo shield_deadly_time;
51 struct TextPosInfo exit;
52 struct TextPosInfo em_exit;
53 struct TextPosInfo sp_exit;
54 struct TextPosInfo steel_exit;
55 struct TextPosInfo em_steel_exit;
56 struct TextPosInfo emc_magic_ball;
57 struct TextPosInfo emc_magic_ball_switch;
58 struct TextPosInfo light_switch;
59 struct TextPosInfo light_switch_time;
60 struct TextPosInfo timegate_switch;
61 struct TextPosInfo timegate_switch_time;
62 struct TextPosInfo switchgate_switch;
63 struct TextPosInfo emc_lenses;
64 struct TextPosInfo emc_lenses_time;
65 struct TextPosInfo emc_magnifier;
66 struct TextPosInfo emc_magnifier_time;
67 struct TextPosInfo balloon_switch;
68 struct TextPosInfo dynabomb_number;
69 struct TextPosInfo dynabomb_size;
70 struct TextPosInfo dynabomb_power;
71 struct TextPosInfo penguins;
72 struct TextPosInfo sokoban_objects;
73 struct TextPosInfo sokoban_fields;
74 struct TextPosInfo robot_wheel;
75 struct TextPosInfo conveyor_belt_1;
76 struct TextPosInfo conveyor_belt_1_switch;
77 struct TextPosInfo conveyor_belt_2;
78 struct TextPosInfo conveyor_belt_2_switch;
79 struct TextPosInfo conveyor_belt_3;
80 struct TextPosInfo conveyor_belt_3_switch;
81 struct TextPosInfo conveyor_belt_4;
82 struct TextPosInfo conveyor_belt_4_switch;
83 struct TextPosInfo magic_wall;
84 struct TextPosInfo magic_wall_time;
85 struct TextPosInfo bd_magic_wall;
86 struct TextPosInfo dc_magic_wall;
87 struct TextPosInfo player_name;
88 struct TextPosInfo level_name;
89 struct TextPosInfo level_author;
94 struct MenuPosInfo stop;
95 struct MenuPosInfo pause;
96 struct MenuPosInfo play;
97 struct MenuPosInfo sound_music;
98 struct MenuPosInfo sound_loops;
99 struct MenuPosInfo sound_simple;
117 /* values for control panel */
118 struct GamePanelInfo panel;
119 struct GameButtonInfo button;
121 /* values for engine initialization */
122 int default_push_delay_fixed;
123 int default_push_delay_random;
125 /* constant within running game */
128 int initial_move_delay[MAX_PLAYERS];
129 int initial_move_delay_value[MAX_PLAYERS];
130 int initial_push_delay_value;
132 /* flags to handle bugs in and changes between different engine versions */
133 /* (for the latest engine version, these flags should always be "FALSE") */
134 boolean use_change_when_pushing_bug;
135 boolean use_block_last_field_bug;
136 boolean max_num_changes_per_frame;
137 boolean use_reverse_scan_direction;
139 /* variable within running game */
140 int yamyam_content_nr;
141 boolean magic_wall_active;
142 int magic_wall_time_left;
144 int timegate_time_left;
150 boolean explosions_delayed;
151 boolean envelope_active;
153 /* values for the new EMC elements */
154 int lenses_time_left;
155 int magnify_time_left;
159 /* values for player idle animation (no effect on engine) */
160 int player_boring_delay_fixed;
161 int player_boring_delay_random;
162 int player_sleeping_delay_fixed;
163 int player_sleeping_delay_random;
165 /* values for special game initialization control */
166 boolean restart_level;
168 /* values for special game control */
169 int centered_player_nr;
170 int centered_player_nr_next;
171 boolean set_centered_player;
173 /* values for random number generator initialization after snapshot */
174 unsigned long num_random_calls;
179 boolean present; /* player present in level playfield */
180 boolean connected; /* player connected (locally or via network) */
181 boolean active; /* player present and connected */
182 boolean killed; /* player maybe present/active, but killed */
184 int index_nr; /* player number (0 to 3) */
185 int index_bit; /* player number bit (1 << 0 to 1 << 3) */
186 int element_nr; /* element (EL_PLAYER_1 to EL_PLAYER_4) */
187 int client_nr; /* network client identifier */
189 byte action; /* action from local input device */
190 byte effective_action; /* action acknowledged from network server
191 or summarized over all configured input
192 devices when in single player mode */
193 byte programmed_action; /* action forced by game itself (like moving
194 through doors); overrides other actions */
196 int jx, jy, last_jx, last_jy;
197 int MovDir, MovPos, GfxDir, GfxPos;
198 int Frame, StepFrame;
205 boolean block_last_field;
206 int block_delay_adjustment; /* needed for different engine versions */
208 boolean can_fall_into_acid;
212 boolean LevelSolved, GameOver;
214 boolean LevelSolved_GameWon;
215 boolean LevelSolved_GameEnd;
216 boolean LevelSolved_PanelOff;
217 boolean LevelSolved_SaveTape;
218 boolean LevelSolved_SaveScore;
226 boolean is_auto_moving;
229 boolean is_collecting;
231 boolean is_switching;
233 boolean is_dropping_pressed;
240 int frame_counter_bored;
241 int frame_counter_sleeping;
243 int anim_delay_counter;
244 int post_delay_counter;
247 int action_waiting, last_action_waiting;
248 int special_action_bored;
249 int special_action_sleeping;
251 int num_special_action_bored;
252 int num_special_action_sleeping;
254 int switch_x, switch_y;
260 int move_delay_value;
261 int move_delay_value_next;
262 int move_delay_reset_counter;
265 int push_delay_value;
267 unsigned long actual_frame_counter;
270 int drop_pressed_delay;
277 int gems_still_needed;
278 int sokobanfields_still_needed;
279 int lights_still_needed;
280 int friends_still_needed;
281 int key[MAX_NUM_KEYS];
283 int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
284 int shield_normal_time_left;
285 int shield_deadly_time_left;
287 int inventory_element[MAX_INVENTORY_SIZE];
288 int inventory_infinite_element;
292 extern struct GameInfo game;
293 extern struct PlayerInfo stored_player[MAX_PLAYERS], *local_player;
297 void DEBUG_SetMaximumDynamite();
300 void GetPlayerConfig(void);
301 int GetElementFromGroupElement(int);
303 void DrawGameValue_Time(int);
304 void DrawGameDoorValues(void);
306 void InitGameSound();
309 void UpdateEngineValues(int, int);
313 void InitPlayerGfxAnimation(struct PlayerInfo *, int, int);
314 void Moving2Blocked(int, int, int *, int *);
315 void Blocked2Moving(int, int, int *, int *);
316 void DrawDynamite(int, int);
318 void StartGameActions(boolean, boolean, long);
320 void GameActions(void);
321 void GameActions_EM_Main();
322 void GameActions_RND();
324 void ScrollLevel(int, int);
326 void InitPlayLevelSound();
327 void PlayLevelSound_EM(int, int, int, int);
329 void RaiseScore(int);
330 void RaiseScoreElement(int);
332 void RequestQuitGameExt(boolean, boolean, char *);
333 void RequestQuitGame(boolean);
335 unsigned int InitEngineRandom_RND(long);
336 unsigned int RND(int);
338 void FreeEngineSnapshot();
339 void LoadEngineSnapshot();
340 void SaveEngineSnapshot();
341 boolean CheckEngineSnapshot();
343 void CreateGameButtons();
344 void FreeGameButtons();
345 void UnmapGameButtons();