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 white_keys;
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_time;
68 struct TextPosInfo light_switch;
69 struct TextPosInfo light_switch_time;
70 struct TextPosInfo timegate_switch;
71 struct TextPosInfo timegate_switch_time;
72 struct TextPosInfo switchgate_switch;
73 struct TextPosInfo emc_lenses;
74 struct TextPosInfo emc_lenses_time;
75 struct TextPosInfo emc_magnifier;
76 struct TextPosInfo emc_magnifier_time;
77 struct TextPosInfo balloon_switch;
78 struct TextPosInfo dynabomb_number;
79 struct TextPosInfo dynabomb_size;
80 struct TextPosInfo dynabomb_power;
81 struct TextPosInfo penguins;
82 struct TextPosInfo sokoban_objects;
83 struct TextPosInfo sokoban_fields;
84 struct TextPosInfo robot_wheel;
85 struct TextPosInfo conveyor_belt_1;
86 struct TextPosInfo conveyor_belt_2;
87 struct TextPosInfo conveyor_belt_3;
88 struct TextPosInfo conveyor_belt_4;
89 struct TextPosInfo conveyor_belt_1_switch;
90 struct TextPosInfo conveyor_belt_2_switch;
91 struct TextPosInfo conveyor_belt_3_switch;
92 struct TextPosInfo conveyor_belt_4_switch;
93 struct TextPosInfo magic_wall;
94 struct TextPosInfo magic_wall_time;
95 struct TextPosInfo bd_magic_wall;
96 struct TextPosInfo dc_magic_wall;
97 struct TextPosInfo player_name;
98 struct TextPosInfo level_name;
99 struct TextPosInfo level_author;
100 struct TextPosInfo stop;
101 struct TextPosInfo pause;
102 struct TextPosInfo play;
103 struct TextPosInfo sound_music;
104 struct TextPosInfo sound_loops;
105 struct TextPosInfo sound_simple;
121 /* values for control panel */
122 struct GamePanelInfo panel;
124 /* values for engine initialization */
125 int default_push_delay_fixed;
126 int default_push_delay_random;
128 /* constant within running game */
131 int initial_move_delay[MAX_PLAYERS];
132 int initial_move_delay_value[MAX_PLAYERS];
133 int initial_push_delay_value;
135 /* flags to handle bugs in and changes between different engine versions */
136 /* (for the latest engine version, these flags should always be "FALSE") */
137 boolean use_change_when_pushing_bug;
138 boolean use_block_last_field_bug;
139 boolean max_num_changes_per_frame;
140 boolean use_reverse_scan_direction;
142 /* variable within running game */
143 int yamyam_content_nr;
144 boolean magic_wall_active;
145 int magic_wall_time_left;
147 int timegate_time_left;
153 boolean explosions_delayed;
154 boolean envelope_active;
156 /* values for the new EMC elements */
157 int lenses_time_left;
158 int magnify_time_left;
162 /* values for player idle animation (no effect on engine) */
163 int player_boring_delay_fixed;
164 int player_boring_delay_random;
165 int player_sleeping_delay_fixed;
166 int player_sleeping_delay_random;
168 /* values for special game initialization control */
169 boolean restart_level;
171 /* values for special game control */
172 int centered_player_nr;
173 int centered_player_nr_next;
174 boolean set_centered_player;
176 /* values for random number generator initialization after snapshot */
177 unsigned long num_random_calls;
182 boolean present; /* player present in level playfield */
183 boolean connected; /* player connected (locally or via network) */
184 boolean active; /* player present and connected */
185 boolean killed; /* player maybe present/active, but killed */
187 int index_nr; /* player number (0 to 3) */
188 int index_bit; /* player number bit (1 << 0 to 1 << 3) */
189 int element_nr; /* element (EL_PLAYER_1 to EL_PLAYER_4) */
190 int client_nr; /* network client identifier */
192 byte action; /* action from local input device */
193 byte effective_action; /* action acknowledged from network server
194 or summarized over all configured input
195 devices when in single player mode */
196 byte programmed_action; /* action forced by game itself (like moving
197 through doors); overrides other actions */
199 int jx, jy, last_jx, last_jy;
200 int MovDir, MovPos, GfxDir, GfxPos;
201 int Frame, StepFrame;
208 boolean block_last_field;
209 int block_delay_adjustment; /* needed for different engine versions */
211 boolean can_fall_into_acid;
215 boolean LevelSolved, GameOver;
217 boolean LevelSolved_GameWon;
218 boolean LevelSolved_GameEnd;
219 boolean LevelSolved_PanelOff;
220 boolean LevelSolved_SaveTape;
221 boolean LevelSolved_SaveScore;
229 boolean is_auto_moving;
232 boolean is_collecting;
234 boolean is_switching;
236 boolean is_dropping_pressed;
243 int frame_counter_bored;
244 int frame_counter_sleeping;
246 int anim_delay_counter;
247 int post_delay_counter;
250 int action_waiting, last_action_waiting;
251 int special_action_bored;
252 int special_action_sleeping;
254 int num_special_action_bored;
255 int num_special_action_sleeping;
257 int switch_x, switch_y;
263 int move_delay_value;
264 int move_delay_value_next;
265 int move_delay_reset_counter;
268 int push_delay_value;
270 unsigned long actual_frame_counter;
273 int drop_pressed_delay;
280 int gems_still_needed;
281 int sokobanfields_still_needed;
282 int lights_still_needed;
283 int friends_still_needed;
284 int key[MAX_NUM_KEYS];
286 int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
287 int shield_normal_time_left;
288 int shield_deadly_time_left;
290 int inventory_element[MAX_INVENTORY_SIZE];
291 int inventory_infinite_element;
295 extern struct GameInfo game;
296 extern struct PlayerInfo stored_player[MAX_PLAYERS], *local_player;
300 void DEBUG_SetMaximumDynamite();
303 void GetPlayerConfig(void);
304 int GetElementFromGroupElement(int);
306 void DrawGameValue_Time(int);
307 void DrawGameDoorValues(void);
309 void InitGameSound();
312 void UpdateEngineValues(int, int);
316 void InitPlayerGfxAnimation(struct PlayerInfo *, int, int);
317 void Moving2Blocked(int, int, int *, int *);
318 void Blocked2Moving(int, int, int *, int *);
319 void DrawDynamite(int, int);
321 void StartGameActions(boolean, boolean, long);
323 void GameActions(void);
324 void GameActions_EM_Main();
325 void GameActions_RND();
327 void ScrollLevel(int, int);
329 void InitPlayLevelSound();
330 void PlayLevelSound_EM(int, int, int, int);
332 void RaiseScore(int);
333 void RaiseScoreElement(int);
335 void RequestQuitGameExt(boolean, boolean, char *);
336 void RequestQuitGame(boolean);
338 unsigned int InitEngineRandom_RND(long);
339 unsigned int RND(int);
341 void FreeEngineSnapshot();
342 void LoadEngineSnapshot();
343 void SaveEngineSnapshot();
344 boolean CheckEngineSnapshot();
346 void CreateGameButtons();
347 void FreeGameButtons();
348 void UnmapGameButtons();