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
22 #define STD_NUM_KEYS 4
23 #define MAX_NUM_KEYS 8
26 #define NUM_BELT_PARTS 3
28 #define NUM_PANEL_INVENTORY 8
29 #define NUM_PANEL_ELEMENTS 8
30 #define NUM_PANEL_CE_SCORE 8
35 struct TextPosInfo level_number;
36 struct TextPosInfo gems;
37 struct TextPosInfo inventory_count;
38 struct TextPosInfo inventory_first[NUM_PANEL_INVENTORY];
39 struct TextPosInfo inventory_last[NUM_PANEL_INVENTORY];
40 struct TextPosInfo key[MAX_NUM_KEYS];
41 struct TextPosInfo key_white;
42 struct TextPosInfo key_white_count;
43 struct TextPosInfo score;
44 struct TextPosInfo time;
45 struct TextPosInfo time_hh;
46 struct TextPosInfo time_mm;
47 struct TextPosInfo time_ss;
48 struct TextPosInfo shield_normal;
49 struct TextPosInfo shield_normal_time;
50 struct TextPosInfo shield_deadly;
51 struct TextPosInfo shield_deadly_time;
52 struct TextPosInfo exit;
53 struct TextPosInfo emc_magic_ball;
54 struct TextPosInfo emc_magic_ball_switch;
55 struct TextPosInfo light_switch;
56 struct TextPosInfo light_switch_time;
57 struct TextPosInfo timegate_switch;
58 struct TextPosInfo timegate_switch_time;
59 struct TextPosInfo switchgate_switch;
60 struct TextPosInfo emc_lenses;
61 struct TextPosInfo emc_lenses_time;
62 struct TextPosInfo emc_magnifier;
63 struct TextPosInfo emc_magnifier_time;
64 struct TextPosInfo balloon_switch;
65 struct TextPosInfo dynabomb_number;
66 struct TextPosInfo dynabomb_size;
67 struct TextPosInfo dynabomb_power;
68 struct TextPosInfo penguins;
69 struct TextPosInfo sokoban_objects;
70 struct TextPosInfo sokoban_fields;
71 struct TextPosInfo robot_wheel;
72 struct TextPosInfo conveyor_belt[NUM_BELTS];
73 struct TextPosInfo conveyor_belt_switch[NUM_BELTS];
74 struct TextPosInfo magic_wall;
75 struct TextPosInfo magic_wall_time;
76 struct TextPosInfo gravity_state;
77 struct TextPosInfo element[NUM_PANEL_ELEMENTS];
78 struct TextPosInfo element_count[NUM_PANEL_ELEMENTS];
79 struct TextPosInfo ce_score[NUM_PANEL_CE_SCORE];
80 struct TextPosInfo ce_score_element[NUM_PANEL_CE_SCORE];
81 struct TextPosInfo player_name;
82 struct TextPosInfo level_name;
83 struct TextPosInfo level_author;
88 struct MenuPosInfo stop;
89 struct MenuPosInfo pause;
90 struct MenuPosInfo play;
91 struct MenuPosInfo sound_music;
92 struct MenuPosInfo sound_loops;
93 struct MenuPosInfo sound_simple;
111 /* values for control panel */
112 struct GamePanelInfo panel;
113 struct GameButtonInfo button;
115 /* values for graphics engine customization */
116 int forced_scroll_delay_value;
117 int scroll_delay_value;
119 /* values for engine initialization */
120 int default_push_delay_fixed;
121 int default_push_delay_random;
123 /* constant within running game */
126 int initial_move_delay[MAX_PLAYERS];
127 int initial_move_delay_value[MAX_PLAYERS];
128 int initial_push_delay_value;
130 /* flags to handle bugs in and changes between different engine versions */
131 /* (for the latest engine version, these flags should always be "FALSE") */
132 boolean use_change_when_pushing_bug;
133 boolean use_block_last_field_bug;
134 boolean max_num_changes_per_frame;
135 boolean use_reverse_scan_direction;
137 /* variable within running game */
138 int yamyam_content_nr;
139 boolean robot_wheel_active;
140 boolean magic_wall_active;
141 int magic_wall_time_left;
143 int timegate_time_left;
149 boolean explosions_delayed;
150 boolean envelope_active;
152 /* values for the new EMC elements */
153 int lenses_time_left;
154 int magnify_time_left;
158 /* values for player idle animation (no effect on engine) */
159 int player_boring_delay_fixed;
160 int player_boring_delay_random;
161 int player_sleeping_delay_fixed;
162 int player_sleeping_delay_random;
164 /* values for special game initialization control */
165 boolean restart_level;
167 /* values for special game control */
168 int centered_player_nr;
169 int centered_player_nr_next;
170 boolean set_centered_player;
172 /* values for random number generator initialization after snapshot */
173 unsigned long num_random_calls;
178 boolean present; /* player present in level playfield */
179 boolean connected; /* player connected (locally or via network) */
180 boolean active; /* player present and connected */
181 boolean killed; /* player maybe present/active, but killed */
183 int index_nr; /* player number (0 to 3) */
184 int index_bit; /* player number bit (1 << 0 to 1 << 3) */
185 int element_nr; /* element (EL_PLAYER_1 to EL_PLAYER_4) */
186 int client_nr; /* network client identifier */
188 byte action; /* action from local input device */
189 byte effective_action; /* action acknowledged from network server
190 or summarized over all configured input
191 devices when in single player mode */
192 byte programmed_action; /* action forced by game itself (like moving
193 through doors); overrides other actions */
195 int jx, jy, last_jx, last_jy;
196 int MovDir, MovPos, GfxDir, GfxPos;
197 int Frame, StepFrame;
204 boolean block_last_field;
205 int block_delay_adjustment; /* needed for different engine versions */
207 boolean can_fall_into_acid;
211 boolean LevelSolved, GameOver;
213 boolean LevelSolved_GameWon;
214 boolean LevelSolved_GameEnd;
215 boolean LevelSolved_PanelOff;
216 boolean LevelSolved_SaveTape;
217 boolean LevelSolved_SaveScore;
218 int LevelSolved_CountingTime;
219 int LevelSolved_CountingScore;
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();
347 void RedrawGameButtons();