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_GameWon;
146 boolean LevelSolved_GameEnd;
147 boolean LevelSolved_PanelOff;
148 boolean LevelSolved_SaveTape;
149 boolean LevelSolved_SaveScore;
157 boolean is_auto_moving;
160 boolean is_collecting;
162 boolean is_switching;
164 boolean is_dropping_pressed;
171 int frame_counter_bored;
172 int frame_counter_sleeping;
174 int anim_delay_counter;
175 int post_delay_counter;
178 int action_waiting, last_action_waiting;
179 int special_action_bored;
180 int special_action_sleeping;
182 int num_special_action_bored;
183 int num_special_action_sleeping;
185 int switch_x, switch_y;
191 int move_delay_value;
192 int move_delay_value_next;
193 int move_delay_reset_counter;
196 int push_delay_value;
198 unsigned long actual_frame_counter;
201 int drop_pressed_delay;
208 int gems_still_needed;
209 int sokobanfields_still_needed;
210 int lights_still_needed;
211 int friends_still_needed;
212 int key[MAX_NUM_KEYS];
214 int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
215 int shield_normal_time_left;
216 int shield_deadly_time_left;
218 int inventory_element[MAX_INVENTORY_SIZE];
219 int inventory_infinite_element;
223 extern struct GameInfo game;
224 extern struct PlayerInfo stored_player[MAX_PLAYERS], *local_player;
228 void DEBUG_SetMaximumDynamite();
231 void GetPlayerConfig(void);
233 void DrawGameValue_Time(int);
234 void DrawGameDoorValues(void);
236 void InitGameSound();
239 void UpdateEngineValues(int, int);
243 void InitPlayerGfxAnimation(struct PlayerInfo *, int, int);
244 void Moving2Blocked(int, int, int *, int *);
245 void Blocked2Moving(int, int, int *, int *);
246 void DrawDynamite(int, int);
248 void StartGameActions(boolean, boolean, long);
250 void GameActions(void);
251 void GameActions_EM_Main();
252 void GameActions_RND();
254 void ScrollLevel(int, int);
256 void InitPlayLevelSound();
257 void PlayLevelSound_EM(int, int, int, int);
259 void RaiseScore(int);
260 void RaiseScoreElement(int);
262 void RequestQuitGameExt(boolean, boolean, char *);
263 void RequestQuitGame(boolean);
265 unsigned int InitEngineRandom_RND(long);
266 unsigned int RND(int);
268 void FreeEngineSnapshot();
269 void LoadEngineSnapshot();
270 void SaveEngineSnapshot();
271 boolean CheckEngineSnapshot();
273 void CreateGameButtons();
274 void FreeGameButtons();
275 void UnmapGameButtons();