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 ***********************************************************/
18 #define MAX_INVENTORY_SIZE 1000
19 #define STD_NUM_KEYS 4
20 #define MAX_NUM_KEYS 8
35 /* values for control panel */
36 struct GamePanelInfo panel;
38 /* values for engine initialization */
39 int default_push_delay_fixed;
40 int default_push_delay_random;
42 /* constant within running game */
45 int initial_move_delay[MAX_PLAYERS];
46 int initial_move_delay_value[MAX_PLAYERS];
47 int initial_push_delay_value;
49 /* flags to handle bugs in and changes between different engine versions */
50 /* (for the latest engine version, these flags should always be "FALSE") */
51 boolean use_change_when_pushing_bug;
52 boolean use_block_last_field_bug;
53 boolean max_num_changes_per_frame;
54 boolean use_reverse_scan_direction;
56 /* variable within running game */
57 int yamyam_content_nr;
58 boolean magic_wall_active;
59 int magic_wall_time_left;
61 int timegate_time_left;
67 boolean explosions_delayed;
68 boolean envelope_active;
70 /* values for the new EMC elements */
72 int magnify_time_left;
76 /* values for player idle animation (no effect on engine) */
77 int player_boring_delay_fixed;
78 int player_boring_delay_random;
79 int player_sleeping_delay_fixed;
80 int player_sleeping_delay_random;
82 /* values for special game initialization control */
83 boolean restart_level;
85 /* values for special game control */
86 int centered_player_nr;
87 int centered_player_nr_next;
88 boolean set_centered_player;
90 /* values for random number generator initialization after snapshot */
91 unsigned long num_random_calls;
96 boolean present; /* player present in level playfield */
97 boolean connected; /* player connected (locally or via network) */
98 boolean active; /* player present and connected */
99 boolean killed; /* player maybe present/active, but killed */
101 int index_nr; /* player number (0 to 3) */
102 int index_bit; /* player number bit (1 << 0 to 1 << 3) */
103 int element_nr; /* element (EL_PLAYER_1 to EL_PLAYER_4) */
104 int client_nr; /* network client identifier */
106 byte action; /* action from local input device */
107 byte effective_action; /* action acknowledged from network server
108 or summarized over all configured input
109 devices when in single player mode */
110 byte programmed_action; /* action forced by game itself (like moving
111 through doors); overrides other actions */
113 int jx, jy, last_jx, last_jy;
114 int MovDir, MovPos, GfxDir, GfxPos;
115 int Frame, StepFrame;
122 boolean block_last_field;
123 int block_delay_adjustment; /* needed for different engine versions */
125 boolean can_fall_into_acid;
129 boolean LevelSolved, GameOver;
131 boolean LevelSolved_GameEnd;
132 boolean LevelSolved_SaveTape;
133 boolean LevelSolved_SaveScore;
141 boolean is_auto_moving;
144 boolean is_collecting;
146 boolean is_switching;
148 boolean is_dropping_pressed;
155 int frame_counter_bored;
156 int frame_counter_sleeping;
158 int anim_delay_counter;
159 int post_delay_counter;
162 int action_waiting, last_action_waiting;
163 int special_action_bored;
164 int special_action_sleeping;
166 int num_special_action_bored;
167 int num_special_action_sleeping;
169 int switch_x, switch_y;
175 int move_delay_value;
176 int move_delay_value_next;
177 int move_delay_reset_counter;
180 int push_delay_value;
182 unsigned long actual_frame_counter;
185 int drop_pressed_delay;
192 int gems_still_needed;
193 int sokobanfields_still_needed;
194 int lights_still_needed;
195 int friends_still_needed;
196 int key[MAX_NUM_KEYS];
197 int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
198 int shield_normal_time_left;
199 int shield_deadly_time_left;
201 int inventory_element[MAX_INVENTORY_SIZE];
202 int inventory_infinite_element;
206 extern struct GameInfo game;
207 extern struct PlayerInfo stored_player[MAX_PLAYERS], *local_player;
211 void DEBUG_SetMaximumDynamite();
214 void GetPlayerConfig(void);
216 void DrawGameValue_Time(int);
217 void DrawGameDoorValues(void);
219 void InitGameSound();
222 void UpdateEngineValues(int, int);
226 void InitPlayerGfxAnimation(struct PlayerInfo *, int, int);
227 void Moving2Blocked(int, int, int *, int *);
228 void Blocked2Moving(int, int, int *, int *);
229 void DrawDynamite(int, int);
231 void StartGameActions(boolean, boolean, long);
233 void GameActions(void);
234 void GameActions_EM_Main();
235 void GameActions_RND();
237 void ScrollLevel(int, int);
239 void InitPlayLevelSound();
240 void PlayLevelSound_EM(int, int, int, int);
242 void RaiseScore(int);
243 void RaiseScoreElement(int);
245 void RequestQuitGameExt(boolean, boolean, char *);
246 void RequestQuitGame(boolean);
248 unsigned int InitEngineRandom_RND(long);
249 unsigned int RND(int);
251 void FreeEngineSnapshot();
252 void LoadEngineSnapshot();
253 void SaveEngineSnapshot();
254 boolean CheckEngineSnapshot();
256 void CreateGameButtons();
257 void FreeGameButtons();
258 void UnmapGameButtons();