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_count;
31 struct TextPosInfo inventory_first_1;
32 struct TextPosInfo inventory_first_2;
33 struct TextPosInfo inventory_first_3;
34 struct TextPosInfo inventory_first_4;
35 struct TextPosInfo inventory_first_5;
36 struct TextPosInfo inventory_first_6;
37 struct TextPosInfo inventory_first_7;
38 struct TextPosInfo inventory_first_8;
39 struct TextPosInfo inventory_last_1;
40 struct TextPosInfo inventory_last_2;
41 struct TextPosInfo inventory_last_3;
42 struct TextPosInfo inventory_last_4;
43 struct TextPosInfo inventory_last_5;
44 struct TextPosInfo inventory_last_6;
45 struct TextPosInfo inventory_last_7;
46 struct TextPosInfo inventory_last_8;
47 struct TextPosInfo key[MAX_NUM_KEYS];
48 struct TextPosInfo key_white;
49 struct TextPosInfo key_white_count;
50 struct TextPosInfo score;
51 struct TextPosInfo time;
52 struct TextPosInfo time_hh;
53 struct TextPosInfo time_mm;
54 struct TextPosInfo time_ss;
55 struct TextPosInfo shield_normal;
56 struct TextPosInfo shield_normal_time;
57 struct TextPosInfo shield_deadly;
58 struct TextPosInfo shield_deadly_time;
59 struct TextPosInfo exit;
60 struct TextPosInfo emc_magic_ball;
61 struct TextPosInfo emc_magic_ball_switch;
62 struct TextPosInfo light_switch;
63 struct TextPosInfo light_switch_time;
64 struct TextPosInfo timegate_switch;
65 struct TextPosInfo timegate_switch_time;
66 struct TextPosInfo switchgate_switch;
67 struct TextPosInfo emc_lenses;
68 struct TextPosInfo emc_lenses_time;
69 struct TextPosInfo emc_magnifier;
70 struct TextPosInfo emc_magnifier_time;
71 struct TextPosInfo balloon_switch;
72 struct TextPosInfo dynabomb_number;
73 struct TextPosInfo dynabomb_size;
74 struct TextPosInfo dynabomb_power;
75 struct TextPosInfo penguins;
76 struct TextPosInfo sokoban_objects;
77 struct TextPosInfo sokoban_fields;
78 struct TextPosInfo robot_wheel;
79 struct TextPosInfo conveyor_belt_1;
80 struct TextPosInfo conveyor_belt_1_switch;
81 struct TextPosInfo conveyor_belt_2;
82 struct TextPosInfo conveyor_belt_2_switch;
83 struct TextPosInfo conveyor_belt_3;
84 struct TextPosInfo conveyor_belt_3_switch;
85 struct TextPosInfo conveyor_belt_4;
86 struct TextPosInfo conveyor_belt_4_switch;
87 struct TextPosInfo magic_wall;
88 struct TextPosInfo magic_wall_time;
89 struct TextPosInfo gravity_state;
90 struct TextPosInfo player_name;
91 struct TextPosInfo level_name;
92 struct TextPosInfo level_author;
97 struct MenuPosInfo stop;
98 struct MenuPosInfo pause;
99 struct MenuPosInfo play;
100 struct MenuPosInfo sound_music;
101 struct MenuPosInfo sound_loops;
102 struct MenuPosInfo sound_simple;
120 /* values for control panel */
121 struct GamePanelInfo panel;
122 struct GameButtonInfo button;
124 /* values for graphics engine customization */
125 int forced_scroll_delay_value;
126 int scroll_delay_value;
128 /* values for engine initialization */
129 int default_push_delay_fixed;
130 int default_push_delay_random;
132 /* constant within running game */
135 int initial_move_delay[MAX_PLAYERS];
136 int initial_move_delay_value[MAX_PLAYERS];
137 int initial_push_delay_value;
139 /* flags to handle bugs in and changes between different engine versions */
140 /* (for the latest engine version, these flags should always be "FALSE") */
141 boolean use_change_when_pushing_bug;
142 boolean use_block_last_field_bug;
143 boolean max_num_changes_per_frame;
144 boolean use_reverse_scan_direction;
146 /* variable within running game */
147 int yamyam_content_nr;
148 boolean robot_wheel_active;
149 boolean magic_wall_active;
150 int magic_wall_time_left;
152 int timegate_time_left;
158 boolean explosions_delayed;
159 boolean envelope_active;
161 /* values for the new EMC elements */
162 int lenses_time_left;
163 int magnify_time_left;
167 /* values for player idle animation (no effect on engine) */
168 int player_boring_delay_fixed;
169 int player_boring_delay_random;
170 int player_sleeping_delay_fixed;
171 int player_sleeping_delay_random;
173 /* values for special game initialization control */
174 boolean restart_level;
176 /* values for special game control */
177 int centered_player_nr;
178 int centered_player_nr_next;
179 boolean set_centered_player;
181 /* values for random number generator initialization after snapshot */
182 unsigned long num_random_calls;
187 boolean present; /* player present in level playfield */
188 boolean connected; /* player connected (locally or via network) */
189 boolean active; /* player present and connected */
190 boolean killed; /* player maybe present/active, but killed */
192 int index_nr; /* player number (0 to 3) */
193 int index_bit; /* player number bit (1 << 0 to 1 << 3) */
194 int element_nr; /* element (EL_PLAYER_1 to EL_PLAYER_4) */
195 int client_nr; /* network client identifier */
197 byte action; /* action from local input device */
198 byte effective_action; /* action acknowledged from network server
199 or summarized over all configured input
200 devices when in single player mode */
201 byte programmed_action; /* action forced by game itself (like moving
202 through doors); overrides other actions */
204 int jx, jy, last_jx, last_jy;
205 int MovDir, MovPos, GfxDir, GfxPos;
206 int Frame, StepFrame;
213 boolean block_last_field;
214 int block_delay_adjustment; /* needed for different engine versions */
216 boolean can_fall_into_acid;
220 boolean LevelSolved, GameOver;
222 boolean LevelSolved_GameWon;
223 boolean LevelSolved_GameEnd;
224 boolean LevelSolved_PanelOff;
225 boolean LevelSolved_SaveTape;
226 boolean LevelSolved_SaveScore;
234 boolean is_auto_moving;
237 boolean is_collecting;
239 boolean is_switching;
241 boolean is_dropping_pressed;
248 int frame_counter_bored;
249 int frame_counter_sleeping;
251 int anim_delay_counter;
252 int post_delay_counter;
255 int action_waiting, last_action_waiting;
256 int special_action_bored;
257 int special_action_sleeping;
259 int num_special_action_bored;
260 int num_special_action_sleeping;
262 int switch_x, switch_y;
268 int move_delay_value;
269 int move_delay_value_next;
270 int move_delay_reset_counter;
273 int push_delay_value;
275 unsigned long actual_frame_counter;
278 int drop_pressed_delay;
285 int gems_still_needed;
286 int sokobanfields_still_needed;
287 int lights_still_needed;
288 int friends_still_needed;
289 int key[MAX_NUM_KEYS];
291 int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
292 int shield_normal_time_left;
293 int shield_deadly_time_left;
295 int inventory_element[MAX_INVENTORY_SIZE];
296 int inventory_infinite_element;
300 extern struct GameInfo game;
301 extern struct PlayerInfo stored_player[MAX_PLAYERS], *local_player;
305 void DEBUG_SetMaximumDynamite();
308 void GetPlayerConfig(void);
309 int GetElementFromGroupElement(int);
311 void DrawGameValue_Time(int);
312 void DrawGameDoorValues(void);
314 void InitGameSound();
317 void UpdateEngineValues(int, int);
321 void InitPlayerGfxAnimation(struct PlayerInfo *, int, int);
322 void Moving2Blocked(int, int, int *, int *);
323 void Blocked2Moving(int, int, int *, int *);
324 void DrawDynamite(int, int);
326 void StartGameActions(boolean, boolean, long);
328 void GameActions(void);
329 void GameActions_EM_Main();
330 void GameActions_RND();
332 void ScrollLevel(int, int);
334 void InitPlayLevelSound();
335 void PlayLevelSound_EM(int, int, int, int);
337 void RaiseScore(int);
338 void RaiseScoreElement(int);
340 void RequestQuitGameExt(boolean, boolean, char *);
341 void RequestQuitGame(boolean);
343 unsigned int InitEngineRandom_RND(long);
344 unsigned int RND(int);
346 void FreeEngineSnapshot();
347 void LoadEngineSnapshot();
348 void SaveEngineSnapshot();
349 boolean CheckEngineSnapshot();
351 void CreateGameButtons();
352 void FreeGameButtons();
353 void UnmapGameButtons();