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;
49 /* values for control panel */
50 struct GamePanelInfo panel;
52 /* values for engine initialization */
53 int default_push_delay_fixed;
54 int default_push_delay_random;
56 /* constant within running game */
59 int initial_move_delay[MAX_PLAYERS];
60 int initial_move_delay_value[MAX_PLAYERS];
61 int initial_push_delay_value;
63 /* flags to handle bugs in and changes between different engine versions */
64 /* (for the latest engine version, these flags should always be "FALSE") */
65 boolean use_change_when_pushing_bug;
66 boolean use_block_last_field_bug;
67 boolean max_num_changes_per_frame;
68 boolean use_reverse_scan_direction;
70 /* variable within running game */
71 int yamyam_content_nr;
72 boolean magic_wall_active;
73 int magic_wall_time_left;
75 int timegate_time_left;
81 boolean explosions_delayed;
82 boolean envelope_active;
84 /* values for the new EMC elements */
86 int magnify_time_left;
90 /* values for player idle animation (no effect on engine) */
91 int player_boring_delay_fixed;
92 int player_boring_delay_random;
93 int player_sleeping_delay_fixed;
94 int player_sleeping_delay_random;
96 /* values for special game initialization control */
97 boolean restart_level;
99 /* values for special game control */
100 int centered_player_nr;
101 int centered_player_nr_next;
102 boolean set_centered_player;
104 /* values for random number generator initialization after snapshot */
105 unsigned long num_random_calls;
110 boolean present; /* player present in level playfield */
111 boolean connected; /* player connected (locally or via network) */
112 boolean active; /* player present and connected */
113 boolean killed; /* player maybe present/active, but killed */
115 int index_nr; /* player number (0 to 3) */
116 int index_bit; /* player number bit (1 << 0 to 1 << 3) */
117 int element_nr; /* element (EL_PLAYER_1 to EL_PLAYER_4) */
118 int client_nr; /* network client identifier */
120 byte action; /* action from local input device */
121 byte effective_action; /* action acknowledged from network server
122 or summarized over all configured input
123 devices when in single player mode */
124 byte programmed_action; /* action forced by game itself (like moving
125 through doors); overrides other actions */
127 int jx, jy, last_jx, last_jy;
128 int MovDir, MovPos, GfxDir, GfxPos;
129 int Frame, StepFrame;
136 boolean block_last_field;
137 int block_delay_adjustment; /* needed for different engine versions */
139 boolean can_fall_into_acid;
143 boolean LevelSolved, GameOver;
145 boolean LevelSolved_GameEnd;
146 boolean LevelSolved_SaveTape;
147 boolean LevelSolved_SaveScore;
155 boolean is_auto_moving;
158 boolean is_collecting;
160 boolean is_switching;
162 boolean is_dropping_pressed;
169 int frame_counter_bored;
170 int frame_counter_sleeping;
172 int anim_delay_counter;
173 int post_delay_counter;
176 int action_waiting, last_action_waiting;
177 int special_action_bored;
178 int special_action_sleeping;
180 int num_special_action_bored;
181 int num_special_action_sleeping;
183 int switch_x, switch_y;
189 int move_delay_value;
190 int move_delay_value_next;
191 int move_delay_reset_counter;
194 int push_delay_value;
196 unsigned long actual_frame_counter;
199 int drop_pressed_delay;
206 int gems_still_needed;
207 int sokobanfields_still_needed;
208 int lights_still_needed;
209 int friends_still_needed;
210 int key[MAX_NUM_KEYS];
212 int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
213 int shield_normal_time_left;
214 int shield_deadly_time_left;
216 int inventory_element[MAX_INVENTORY_SIZE];
217 int inventory_infinite_element;
221 extern struct GameInfo game;
222 extern struct PlayerInfo stored_player[MAX_PLAYERS], *local_player;
226 void DEBUG_SetMaximumDynamite();
229 void GetPlayerConfig(void);
231 void DrawGameValue_Time(int);
232 void DrawGameDoorValues(void);
234 void InitGameSound();
237 void UpdateEngineValues(int, int);
241 void InitPlayerGfxAnimation(struct PlayerInfo *, int, int);
242 void Moving2Blocked(int, int, int *, int *);
243 void Blocked2Moving(int, int, int *, int *);
244 void DrawDynamite(int, int);
246 void StartGameActions(boolean, boolean, long);
248 void GameActions(void);
249 void GameActions_EM_Main();
250 void GameActions_RND();
252 void ScrollLevel(int, int);
254 void InitPlayLevelSound();
255 void PlayLevelSound_EM(int, int, int, int);
257 void RaiseScore(int);
258 void RaiseScoreElement(int);
260 void RequestQuitGameExt(boolean, boolean, char *);
261 void RequestQuitGame(boolean);
263 unsigned int InitEngineRandom_RND(long);
264 unsigned int RND(int);
266 void FreeEngineSnapshot();
267 void LoadEngineSnapshot();
268 void SaveEngineSnapshot();
269 boolean CheckEngineSnapshot();
271 void CreateGameButtons();
272 void FreeGameButtons();
273 void UnmapGameButtons();