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 emc_magic_ball_time;
59 struct TextPosInfo light_switch;
60 struct TextPosInfo light_switch_time;
61 struct TextPosInfo timegate_switch;
62 struct TextPosInfo timegate_switch_time;
63 struct TextPosInfo switchgate_switch;
64 struct TextPosInfo emc_lenses;
65 struct TextPosInfo emc_lenses_time;
66 struct TextPosInfo emc_magnifier;
67 struct TextPosInfo emc_magnifier_time;
68 struct TextPosInfo balloon_switch;
69 struct TextPosInfo dynabomb_number;
70 struct TextPosInfo dynabomb_size;
71 struct TextPosInfo dynabomb_power;
72 struct TextPosInfo penguins;
73 struct TextPosInfo sokoban_objects;
74 struct TextPosInfo sokoban_fields;
75 struct TextPosInfo robot_wheel;
76 struct TextPosInfo conveyor_belt_1;
77 struct TextPosInfo conveyor_belt_1_switch;
78 struct TextPosInfo conveyor_belt_2;
79 struct TextPosInfo conveyor_belt_2_switch;
80 struct TextPosInfo conveyor_belt_3;
81 struct TextPosInfo conveyor_belt_3_switch;
82 struct TextPosInfo conveyor_belt_4;
83 struct TextPosInfo conveyor_belt_4_switch;
84 struct TextPosInfo magic_wall;
85 struct TextPosInfo magic_wall_time;
86 struct TextPosInfo bd_magic_wall;
87 struct TextPosInfo dc_magic_wall;
88 struct TextPosInfo player_name;
89 struct TextPosInfo level_name;
90 struct TextPosInfo level_author;
95 struct MenuPosInfo stop;
96 struct MenuPosInfo pause;
97 struct MenuPosInfo play;
98 struct MenuPosInfo sound_music;
99 struct MenuPosInfo sound_loops;
100 struct MenuPosInfo sound_simple;
118 /* values for control panel */
119 struct GamePanelInfo panel;
120 struct GameButtonInfo button;
122 /* values for engine initialization */
123 int default_push_delay_fixed;
124 int default_push_delay_random;
126 /* constant within running game */
129 int initial_move_delay[MAX_PLAYERS];
130 int initial_move_delay_value[MAX_PLAYERS];
131 int initial_push_delay_value;
133 /* flags to handle bugs in and changes between different engine versions */
134 /* (for the latest engine version, these flags should always be "FALSE") */
135 boolean use_change_when_pushing_bug;
136 boolean use_block_last_field_bug;
137 boolean max_num_changes_per_frame;
138 boolean use_reverse_scan_direction;
140 /* variable within running game */
141 int yamyam_content_nr;
142 boolean magic_wall_active;
143 int magic_wall_time_left;
145 int timegate_time_left;
151 boolean explosions_delayed;
152 boolean envelope_active;
154 /* values for the new EMC elements */
155 int lenses_time_left;
156 int magnify_time_left;
160 /* values for player idle animation (no effect on engine) */
161 int player_boring_delay_fixed;
162 int player_boring_delay_random;
163 int player_sleeping_delay_fixed;
164 int player_sleeping_delay_random;
166 /* values for special game initialization control */
167 boolean restart_level;
169 /* values for special game control */
170 int centered_player_nr;
171 int centered_player_nr_next;
172 boolean set_centered_player;
174 /* values for random number generator initialization after snapshot */
175 unsigned long num_random_calls;
180 boolean present; /* player present in level playfield */
181 boolean connected; /* player connected (locally or via network) */
182 boolean active; /* player present and connected */
183 boolean killed; /* player maybe present/active, but killed */
185 int index_nr; /* player number (0 to 3) */
186 int index_bit; /* player number bit (1 << 0 to 1 << 3) */
187 int element_nr; /* element (EL_PLAYER_1 to EL_PLAYER_4) */
188 int client_nr; /* network client identifier */
190 byte action; /* action from local input device */
191 byte effective_action; /* action acknowledged from network server
192 or summarized over all configured input
193 devices when in single player mode */
194 byte programmed_action; /* action forced by game itself (like moving
195 through doors); overrides other actions */
197 int jx, jy, last_jx, last_jy;
198 int MovDir, MovPos, GfxDir, GfxPos;
199 int Frame, StepFrame;
206 boolean block_last_field;
207 int block_delay_adjustment; /* needed for different engine versions */
209 boolean can_fall_into_acid;
213 boolean LevelSolved, GameOver;
215 boolean LevelSolved_GameWon;
216 boolean LevelSolved_GameEnd;
217 boolean LevelSolved_PanelOff;
218 boolean LevelSolved_SaveTape;
219 boolean LevelSolved_SaveScore;
227 boolean is_auto_moving;
230 boolean is_collecting;
232 boolean is_switching;
234 boolean is_dropping_pressed;
241 int frame_counter_bored;
242 int frame_counter_sleeping;
244 int anim_delay_counter;
245 int post_delay_counter;
248 int action_waiting, last_action_waiting;
249 int special_action_bored;
250 int special_action_sleeping;
252 int num_special_action_bored;
253 int num_special_action_sleeping;
255 int switch_x, switch_y;
261 int move_delay_value;
262 int move_delay_value_next;
263 int move_delay_reset_counter;
266 int push_delay_value;
268 unsigned long actual_frame_counter;
271 int drop_pressed_delay;
278 int gems_still_needed;
279 int sokobanfields_still_needed;
280 int lights_still_needed;
281 int friends_still_needed;
282 int key[MAX_NUM_KEYS];
284 int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
285 int shield_normal_time_left;
286 int shield_deadly_time_left;
288 int inventory_element[MAX_INVENTORY_SIZE];
289 int inventory_infinite_element;
293 extern struct GameInfo game;
294 extern struct PlayerInfo stored_player[MAX_PLAYERS], *local_player;
298 void DEBUG_SetMaximumDynamite();
301 void GetPlayerConfig(void);
302 int GetElementFromGroupElement(int);
304 void DrawGameValue_Time(int);
305 void DrawGameDoorValues(void);
307 void InitGameSound();
310 void UpdateEngineValues(int, int);
314 void InitPlayerGfxAnimation(struct PlayerInfo *, int, int);
315 void Moving2Blocked(int, int, int *, int *);
316 void Blocked2Moving(int, int, int *, int *);
317 void DrawDynamite(int, int);
319 void StartGameActions(boolean, boolean, long);
321 void GameActions(void);
322 void GameActions_EM_Main();
323 void GameActions_RND();
325 void ScrollLevel(int, int);
327 void InitPlayLevelSound();
328 void PlayLevelSound_EM(int, int, int, int);
330 void RaiseScore(int);
331 void RaiseScoreElement(int);
333 void RequestQuitGameExt(boolean, boolean, char *);
334 void RequestQuitGame(boolean);
336 unsigned int InitEngineRandom_RND(long);
337 unsigned int RND(int);
339 void FreeEngineSnapshot();
340 void LoadEngineSnapshot();
341 void SaveEngineSnapshot();
342 boolean CheckEngineSnapshot();
344 void CreateGameButtons();
345 void FreeGameButtons();
346 void UnmapGameButtons();