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_CE_SCORE 8
34 struct TextPosInfo level_number;
35 struct TextPosInfo gems;
36 struct TextPosInfo inventory_count;
37 struct TextPosInfo inventory_first[NUM_PANEL_INVENTORY];
38 struct TextPosInfo inventory_last[NUM_PANEL_INVENTORY];
39 struct TextPosInfo key[MAX_NUM_KEYS];
40 struct TextPosInfo key_white;
41 struct TextPosInfo key_white_count;
42 struct TextPosInfo score;
43 struct TextPosInfo time;
44 struct TextPosInfo time_hh;
45 struct TextPosInfo time_mm;
46 struct TextPosInfo time_ss;
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 emc_magic_ball;
53 struct TextPosInfo emc_magic_ball_switch;
54 struct TextPosInfo light_switch;
55 struct TextPosInfo light_switch_time;
56 struct TextPosInfo timegate_switch;
57 struct TextPosInfo timegate_switch_time;
58 struct TextPosInfo switchgate_switch;
59 struct TextPosInfo emc_lenses;
60 struct TextPosInfo emc_lenses_time;
61 struct TextPosInfo emc_magnifier;
62 struct TextPosInfo emc_magnifier_time;
63 struct TextPosInfo balloon_switch;
64 struct TextPosInfo dynabomb_number;
65 struct TextPosInfo dynabomb_size;
66 struct TextPosInfo dynabomb_power;
67 struct TextPosInfo penguins;
68 struct TextPosInfo sokoban_objects;
69 struct TextPosInfo sokoban_fields;
70 struct TextPosInfo robot_wheel;
71 struct TextPosInfo conveyor_belt[NUM_BELTS];
72 struct TextPosInfo conveyor_belt_switch[NUM_BELTS];
73 struct TextPosInfo magic_wall;
74 struct TextPosInfo magic_wall_time;
75 struct TextPosInfo gravity_state;
76 struct TextPosInfo ce_score[NUM_PANEL_CE_SCORE];
77 struct TextPosInfo ce_score_element[NUM_PANEL_CE_SCORE];
78 struct TextPosInfo player_name;
79 struct TextPosInfo level_name;
80 struct TextPosInfo level_author;
85 struct MenuPosInfo stop;
86 struct MenuPosInfo pause;
87 struct MenuPosInfo play;
88 struct MenuPosInfo sound_music;
89 struct MenuPosInfo sound_loops;
90 struct MenuPosInfo sound_simple;
108 /* values for control panel */
109 struct GamePanelInfo panel;
110 struct GameButtonInfo button;
112 /* values for graphics engine customization */
113 int forced_scroll_delay_value;
114 int scroll_delay_value;
116 /* values for engine initialization */
117 int default_push_delay_fixed;
118 int default_push_delay_random;
120 /* constant within running game */
123 int initial_move_delay[MAX_PLAYERS];
124 int initial_move_delay_value[MAX_PLAYERS];
125 int initial_push_delay_value;
127 /* flags to handle bugs in and changes between different engine versions */
128 /* (for the latest engine version, these flags should always be "FALSE") */
129 boolean use_change_when_pushing_bug;
130 boolean use_block_last_field_bug;
131 boolean max_num_changes_per_frame;
132 boolean use_reverse_scan_direction;
134 /* variable within running game */
135 int yamyam_content_nr;
136 boolean robot_wheel_active;
137 boolean magic_wall_active;
138 int magic_wall_time_left;
140 int timegate_time_left;
146 boolean explosions_delayed;
147 boolean envelope_active;
149 /* values for the new EMC elements */
150 int lenses_time_left;
151 int magnify_time_left;
155 /* values for player idle animation (no effect on engine) */
156 int player_boring_delay_fixed;
157 int player_boring_delay_random;
158 int player_sleeping_delay_fixed;
159 int player_sleeping_delay_random;
161 /* values for special game initialization control */
162 boolean restart_level;
164 /* values for special game control */
165 int centered_player_nr;
166 int centered_player_nr_next;
167 boolean set_centered_player;
169 /* values for random number generator initialization after snapshot */
170 unsigned long num_random_calls;
175 boolean present; /* player present in level playfield */
176 boolean connected; /* player connected (locally or via network) */
177 boolean active; /* player present and connected */
178 boolean killed; /* player maybe present/active, but killed */
180 int index_nr; /* player number (0 to 3) */
181 int index_bit; /* player number bit (1 << 0 to 1 << 3) */
182 int element_nr; /* element (EL_PLAYER_1 to EL_PLAYER_4) */
183 int client_nr; /* network client identifier */
185 byte action; /* action from local input device */
186 byte effective_action; /* action acknowledged from network server
187 or summarized over all configured input
188 devices when in single player mode */
189 byte programmed_action; /* action forced by game itself (like moving
190 through doors); overrides other actions */
192 int jx, jy, last_jx, last_jy;
193 int MovDir, MovPos, GfxDir, GfxPos;
194 int Frame, StepFrame;
201 boolean block_last_field;
202 int block_delay_adjustment; /* needed for different engine versions */
204 boolean can_fall_into_acid;
208 boolean LevelSolved, GameOver;
210 boolean LevelSolved_GameWon;
211 boolean LevelSolved_GameEnd;
212 boolean LevelSolved_PanelOff;
213 boolean LevelSolved_SaveTape;
214 boolean LevelSolved_SaveScore;
222 boolean is_auto_moving;
225 boolean is_collecting;
227 boolean is_switching;
229 boolean is_dropping_pressed;
236 int frame_counter_bored;
237 int frame_counter_sleeping;
239 int anim_delay_counter;
240 int post_delay_counter;
243 int action_waiting, last_action_waiting;
244 int special_action_bored;
245 int special_action_sleeping;
247 int num_special_action_bored;
248 int num_special_action_sleeping;
250 int switch_x, switch_y;
256 int move_delay_value;
257 int move_delay_value_next;
258 int move_delay_reset_counter;
261 int push_delay_value;
263 unsigned long actual_frame_counter;
266 int drop_pressed_delay;
273 int gems_still_needed;
274 int sokobanfields_still_needed;
275 int lights_still_needed;
276 int friends_still_needed;
277 int key[MAX_NUM_KEYS];
279 int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
280 int shield_normal_time_left;
281 int shield_deadly_time_left;
283 int inventory_element[MAX_INVENTORY_SIZE];
284 int inventory_infinite_element;
288 extern struct GameInfo game;
289 extern struct PlayerInfo stored_player[MAX_PLAYERS], *local_player;
293 void DEBUG_SetMaximumDynamite();
296 void GetPlayerConfig(void);
297 int GetElementFromGroupElement(int);
299 void DrawGameValue_Time(int);
300 void DrawGameDoorValues(void);
302 void InitGameSound();
305 void UpdateEngineValues(int, int);
309 void InitPlayerGfxAnimation(struct PlayerInfo *, int, int);
310 void Moving2Blocked(int, int, int *, int *);
311 void Blocked2Moving(int, int, int *, int *);
312 void DrawDynamite(int, int);
314 void StartGameActions(boolean, boolean, long);
316 void GameActions(void);
317 void GameActions_EM_Main();
318 void GameActions_RND();
320 void ScrollLevel(int, int);
322 void InitPlayLevelSound();
323 void PlayLevelSound_EM(int, int, int, int);
325 void RaiseScore(int);
326 void RaiseScoreElement(int);
328 void RequestQuitGameExt(boolean, boolean, char *);
329 void RequestQuitGame(boolean);
331 unsigned int InitEngineRandom_RND(long);
332 unsigned int RND(int);
334 void FreeEngineSnapshot();
335 void LoadEngineSnapshot();
336 void SaveEngineSnapshot();
337 boolean CheckEngineSnapshot();
339 void CreateGameButtons();
340 void FreeGameButtons();
341 void UnmapGameButtons();