1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * (c) 1995-98 Artsoft Entertainment *
8 * phone: ++49 +521 290471 *
9 * email: aeglos@valinor.owl.de *
10 *----------------------------------------------------------*
12 ***********************************************************/
30 GC gc, clip_gc[NUM_PIXMAPS], tile_clip_gc;
31 Pixmap pix[NUM_PIXMAPS];
32 Pixmap clipmask[NUM_PIXMAPS], tile_clipmask[NUM_TILES];
34 #ifdef USE_XPM_LIBRARY
35 XpmAttributes xpm_att[NUM_PICTURES];
38 Drawable drawto, drawto_field, backbuffer, fieldbuffer;
43 char *sound_device_name = SOUND_DEVICE;
44 int joystick_device = 0;
45 char *joystick_device_name[MAX_PLAYERS] =
53 char *program_name = NULL;
55 int game_status = MAINMENU;
56 boolean level_editor_test_game = FALSE;
57 boolean network_playing = FALSE;
58 int button_status = MB_NOT_PRESSED;
59 boolean motion_status = FALSE;
60 int key_joystick_mapping = 0;
61 int global_joystick_status = JOYSTICK_STATUS;
62 int joystick_status = JOYSTICK_STATUS;
63 int sound_status = SOUND_STATUS;
64 boolean sound_loops_allowed = FALSE;
66 boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
67 int redraw_x1 = 0, redraw_y1 = 0;
71 short Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
72 short Ur[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
73 short MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
74 short MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
75 short MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
76 short Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
77 short Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
78 short StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
79 short Frame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
80 boolean Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
81 short JustHit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
82 short AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
83 short AmoebaCnt[MAX_NUM_AMOEBA], AmoebaCnt2[MAX_NUM_AMOEBA];
84 unsigned long Elementeigenschaften[MAX_ELEMENTS];
86 int level_nr, leveldir_nr, num_leveldirs;
87 int lev_fieldx,lev_fieldy, scroll_x,scroll_y;
89 int FX = SX, FY = SY, ScrollStepSize;
90 int ScreenMovDir = MV_NO_MOVING, ScreenMovPos = 0;
92 int BorderElement = EL_BETON;
93 int GameFrameDelay = GAME_FRAME_DELAY;
94 int FfwdFrameDelay = FFWD_FRAME_DELAY;
95 int BX1 = 0, BY1 = 0, BX2 = SCR_FIELDX-1, BY2 = SCR_FIELDY-1;
96 int SBX_Left, SBX_Right;
97 int SBY_Upper, SBY_Lower;
98 int ZX,ZY, ExitX,ExitY;
100 int FrameCounter, TimeFrames, TimePlayed, TimeLeft;
102 boolean network_player_action_received = FALSE;
104 struct LevelDirInfo leveldir[MAX_LEVDIR_ENTRIES];
105 struct LevelInfo level;
106 struct PlayerInfo stored_player[MAX_PLAYERS], *local_player = NULL;
107 struct HiScore highscore[MAX_SCORE_ENTRIES];
108 struct SoundInfo Sound[NUM_SOUNDS];
109 struct TapeInfo tape;
110 struct OptionInfo options;
111 struct SetupInfo setup;
112 struct SetupFileList *setup_list = NULL;
113 struct SetupFileList *level_setup_list = NULL;
114 struct GameInfo game;
115 struct GlobalInfo global;
117 /* data needed for playing sounds */
118 char *sound_name[NUM_SOUNDS] =
184 /* background music */
185 int background_loop[] =
195 int num_bg_loops = sizeof(background_loop)/sizeof(int);
197 char *element_info[] =
216 "quicksand with rock",
239 "gray door (opened by red key)",
240 "gray door (opened by yellow key)",
241 "gray door (opened by green key)",
242 "gray door (opened by blue key)",
245 "invisible normal wall",
247 "ligh bulb (glowing)",
250 "amoeba with content",
255 "diamond (BD style)",
257 "wall with BD style diamond",
258 "wall with yellow emerald",
260 "magic wall (BD style)",
261 "invisible steel wall",
263 "increases number of bombs",
264 "increases explosion size",
265 "increases power of explosion",
267 "sokoban empty field",
268 "sokoban field with object",
269 "butterfly (starts moving right)",
270 "butterfly (starts moving up)",
271 "butterfly (starts moving left)",
272 "butterfly (starts moving down)",
273 "firefly (starts moving right)",
274 "firefly (starts moving up)",
275 "firefly (starts moving left)",
276 "firefly (starts moving down)",
283 "bug (starts moving right)",
284 "bug (starts moving up)",
285 "bug (starts moving left)",
286 "bug (starts moving down)",
287 "spaceship (starts moving right)",
288 "spaceship (starts moving up)",
289 "spaceship (starts moving left)",
290 "spaceship (starts moving down)",
291 "pac man (starts moving right)",
292 "pac man (starts moving up)",
293 "pac man (starts moving left)",
294 "pac man (starts moving down)",
297 "wall with red emerald",
298 "wall with violet emerald",
317 "fire breathing dragon",
399 "growing wall (horizontally)",
400 "growing wall (vertically)",
401 "growing wall (all directions)",
418 "port (leading right)",
419 "port (leading down)",
420 "port (leading left)",
422 "port (leading right)",
423 "port (leading down)",
424 "port (leading left)",
431 "port (horizontally)",
432 "port (all directions)",
463 "gray door (opened by white key)",
467 "switch gate (open)",
468 "switch gate (closed)",
469 "switch for switch gate",
471 "time gate with magic wheel",
472 "green conveyor belt (left)",
473 "green conveyor belt (middle)",
474 "green conveyor belt (right)",
475 "switch for green conveyor belt",
476 "red conveyor belt (left)",
477 "red conveyor belt (middle)",
478 "red conveyor belt (right)",
479 "switch for red conveyor belt",
480 "blue conveyor belt (left)",
481 "blue conveyor belt (middle)",
482 "blue conveyor belt (right)",
483 "switch for blue conveyor belt",
487 "sign (exclamation)",
488 "sign (radio activity)",
490 "sign (wheel chair)",
499 "mole (starts moving left)",
500 "mole (starts moving right)",
501 "mole (starts moving up)",
502 "mole (starts moving down)",
517 "-------------------------------",
521 int main(int argc, char *argv[])
523 program_name = (strrchr(argv[0],'/') ? strrchr(argv[0],'/') + 1 : argv[0]);
533 exit(0); /* to keep compilers happy */