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 magic_wall_active;
149 int magic_wall_time_left;
151 int timegate_time_left;
157 boolean explosions_delayed;
158 boolean envelope_active;
160 /* values for the new EMC elements */
161 int lenses_time_left;
162 int magnify_time_left;
166 /* values for player idle animation (no effect on engine) */
167 int player_boring_delay_fixed;
168 int player_boring_delay_random;
169 int player_sleeping_delay_fixed;
170 int player_sleeping_delay_random;
172 /* values for special game initialization control */
173 boolean restart_level;
175 /* values for special game control */
176 int centered_player_nr;
177 int centered_player_nr_next;
178 boolean set_centered_player;
180 /* values for random number generator initialization after snapshot */
181 unsigned long num_random_calls;
186 boolean present; /* player present in level playfield */
187 boolean connected; /* player connected (locally or via network) */
188 boolean active; /* player present and connected */
189 boolean killed; /* player maybe present/active, but killed */
191 int index_nr; /* player number (0 to 3) */
192 int index_bit; /* player number bit (1 << 0 to 1 << 3) */
193 int element_nr; /* element (EL_PLAYER_1 to EL_PLAYER_4) */
194 int client_nr; /* network client identifier */
196 byte action; /* action from local input device */
197 byte effective_action; /* action acknowledged from network server
198 or summarized over all configured input
199 devices when in single player mode */
200 byte programmed_action; /* action forced by game itself (like moving
201 through doors); overrides other actions */
203 int jx, jy, last_jx, last_jy;
204 int MovDir, MovPos, GfxDir, GfxPos;
205 int Frame, StepFrame;
212 boolean block_last_field;
213 int block_delay_adjustment; /* needed for different engine versions */
215 boolean can_fall_into_acid;
219 boolean LevelSolved, GameOver;
221 boolean LevelSolved_GameWon;
222 boolean LevelSolved_GameEnd;
223 boolean LevelSolved_PanelOff;
224 boolean LevelSolved_SaveTape;
225 boolean LevelSolved_SaveScore;
233 boolean is_auto_moving;
236 boolean is_collecting;
238 boolean is_switching;
240 boolean is_dropping_pressed;
247 int frame_counter_bored;
248 int frame_counter_sleeping;
250 int anim_delay_counter;
251 int post_delay_counter;
254 int action_waiting, last_action_waiting;
255 int special_action_bored;
256 int special_action_sleeping;
258 int num_special_action_bored;
259 int num_special_action_sleeping;
261 int switch_x, switch_y;
267 int move_delay_value;
268 int move_delay_value_next;
269 int move_delay_reset_counter;
272 int push_delay_value;
274 unsigned long actual_frame_counter;
277 int drop_pressed_delay;
284 int gems_still_needed;
285 int sokobanfields_still_needed;
286 int lights_still_needed;
287 int friends_still_needed;
288 int key[MAX_NUM_KEYS];
290 int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
291 int shield_normal_time_left;
292 int shield_deadly_time_left;
294 int inventory_element[MAX_INVENTORY_SIZE];
295 int inventory_infinite_element;
299 extern struct GameInfo game;
300 extern struct PlayerInfo stored_player[MAX_PLAYERS], *local_player;
304 void DEBUG_SetMaximumDynamite();
307 void GetPlayerConfig(void);
308 int GetElementFromGroupElement(int);
310 void DrawGameValue_Time(int);
311 void DrawGameDoorValues(void);
313 void InitGameSound();
316 void UpdateEngineValues(int, int);
320 void InitPlayerGfxAnimation(struct PlayerInfo *, int, int);
321 void Moving2Blocked(int, int, int *, int *);
322 void Blocked2Moving(int, int, int *, int *);
323 void DrawDynamite(int, int);
325 void StartGameActions(boolean, boolean, long);
327 void GameActions(void);
328 void GameActions_EM_Main();
329 void GameActions_RND();
331 void ScrollLevel(int, int);
333 void InitPlayLevelSound();
334 void PlayLevelSound_EM(int, int, int, int);
336 void RaiseScore(int);
337 void RaiseScoreElement(int);
339 void RequestQuitGameExt(boolean, boolean, char *);
340 void RequestQuitGame(boolean);
342 unsigned int InitEngineRandom_RND(long);
343 unsigned int RND(int);
345 void FreeEngineSnapshot();
346 void LoadEngineSnapshot();
347 void SaveEngineSnapshot();
348 boolean CheckEngineSnapshot();
350 void CreateGameButtons();
351 void FreeGameButtons();
352 void UnmapGameButtons();