1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * (c) 1995-2002 Artsoft Entertainment *
6 * Detmolder Strasse 189 *
9 * e-mail: info@artsoft.org *
10 *----------------------------------------------------------*
12 ***********************************************************/
14 #include "libgame/libgame.h"
23 Bitmap *pix[NUM_BITMAPS];
25 Bitmap *bitmap_db_field, *bitmap_db_door;
27 Pixmap tile_clipmask[NUM_TILES];
29 DrawBuffer *fieldbuffer;
30 DrawBuffer *drawto_field;
32 int game_status = MAINMENU;
33 boolean level_editor_test_game = FALSE;
34 boolean network_playing = FALSE;
36 int key_joystick_mapping = 0;
38 boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
39 int redraw_x1 = 0, redraw_y1 = 0;
41 short Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
42 short Ur[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
43 short MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
44 short MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
45 short MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
46 short Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
47 short Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
48 short StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
49 boolean Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
50 short JustStopped[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
51 short AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
52 short AmoebaCnt[MAX_NUM_AMOEBA];
53 short AmoebaCnt2[MAX_NUM_AMOEBA];
54 short ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
55 short ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
57 unsigned long Properties1[MAX_NUM_ELEMENTS];
58 unsigned long Properties2[MAX_NUM_ELEMENTS];
60 int GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
61 int GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
62 int GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
64 int lev_fieldx, lev_fieldy;
65 int scroll_x, scroll_y;
69 int ScreenMovDir = MV_NO_MOVING, ScreenMovPos = 0;
71 int BorderElement = EL_STEELWALL;
72 int GameFrameDelay = GAME_FRAME_DELAY;
73 int FfwdFrameDelay = FFWD_FRAME_DELAY;
75 int BX2 = SCR_FIELDX - 1, BY2 = SCR_FIELDY - 1;
76 int SBX_Left, SBX_Right;
77 int SBY_Upper, SBY_Lower;
82 int TimeFrames, TimePlayed, TimeLeft;
84 boolean network_player_action_received = FALSE;
86 struct LevelInfo level;
87 struct PlayerInfo stored_player[MAX_PLAYERS], *local_player = NULL;
88 struct HiScore highscore[MAX_SCORE_ENTRIES];
90 struct SetupInfo setup;
92 struct GlobalInfo global;
93 struct GraphicInfo *graphic_info = NULL;
94 struct SoundInfo *sound_info = NULL;
97 /* ------------------------------------------------------------------------- */
98 /* element definitions */
99 /* ------------------------------------------------------------------------- */
101 struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1] =
103 /* ----------------------------------------------------------------------- */
104 /* "real" level file elements */
105 /* ----------------------------------------------------------------------- */
195 "quicksand with rock"
240 "Conway's wall of life"
263 "robot_wheel_active",
265 "magic wheel (running)"
310 "gray door (opened by red key)"
315 "gray door (opened by yellow key)"},
319 "gray door (opened by green key)"},
323 "gray door (opened by blue key)"},
337 "invisible normal wall"
362 "amoeba with content"
397 "wall with BD style diamond"
400 "wall_emerald_yellow",
402 "wall with yellow emerald"
412 "magic wall (BD style)"
415 "invisible_steelwall",
417 "invisible steel wall"
427 "increases number of bombs"
432 "increases explosion size"
437 "increases power of explosion"
445 "sokoban_field_empty",
447 "sokoban empty field"
450 "sokoban_field_full",
452 "sokoban field with object"
455 "bd_butterfly_right",
457 "butterfly (starts moving right)"},
461 "butterfly (starts moving up)"
466 "butterfly (starts moving left)"},
470 "butterfly (starts moving down)"},
474 "firefly (starts moving right)"
479 "firefly (starts moving up)"
484 "firefly (starts moving left)"
489 "firefly (starts moving down)"
524 "bug (starts moving right)"
529 "bug (starts moving up)"
534 "bug (starts moving left)"
539 "bug (starts moving down)"
544 "spaceship (starts moving right)"},
548 "spaceship (starts moving up)"
553 "spaceship (starts moving left)"},
557 "spaceship (starts moving down)"},
561 "pac man (starts moving right)"
566 "pac man (starts moving up)"
571 "pac man (starts moving left)"
576 "pac man (starts moving down)"
591 "wall with red emerald"
594 "wall_emerald_purple",
596 "wall with purple emerald"
601 "acid pool (top left)"
606 "acid pool (top right)"
609 "acidpool_bottomleft",
611 "acid pool (bottom left)"
619 "acidpool_bottomright",
621 "acid pool (bottom right)"
626 "normal wall (BD style)"
691 "fire breathing dragon"
1101 "growing wall (horizontal)"
1106 "growing wall (vertical)"
1111 "growing wall (all directions)"
1116 "red door (EM style)"
1121 "yellow door (EM style)"
1126 "green door (EM style)"
1131 "blue door (EM style)"
1136 "yellow key (EM style)"
1141 "green key (EM style)"
1146 "blue key (EM style)"
1196 "port (leading right)"
1201 "port (leading down)"
1206 "port (leading left)"
1216 "port (leading right)"
1221 "port (leading down)"
1226 "port (leading left)"
1266 "port (all directions)"
1351 "gray door (EM style, red key)"
1356 "gray door (EM style, yellow key)"
1361 "gray door (EM style, green key)"
1366 "gray door (EM style, blue key)"
1406 "gray door (opened by white key)"
1426 "switch gate (open)"
1429 "switchgate_closed",
1431 "switch gate (closed)"
1434 "switchgate_switch_up",
1435 "switchgate_switch",
1436 "switch for switch gate"
1439 "switchgate_switch_down",
1440 "switchgate_switch",
1441 "switch for switch gate"
1454 "conveyor_belt1_left",
1456 "red conveyor belt (left)"
1459 "conveyor_belt1_middle",
1461 "red conveyor belt (middle)"
1464 "conveyor_belt1_right",
1466 "red conveyor belt (right)"
1469 "conveyor_belt1_switch_left",
1470 "conveyor_belt_switch",
1471 "switch for red conveyor belt (left)"
1474 "conveyor_belt1_switch_middle",
1475 "conveyor_belt_switch",
1476 "switch for red conveyor belt (middle)"
1479 "conveyor_belt1_switch_right",
1480 "conveyor_belt_switch",
1481 "switch for red conveyor belt (right)"
1484 "conveyor_belt2_left",
1486 "yellow conveyor belt (left)"
1489 "conveyor_belt2_middle",
1491 "yellow conveyor belt (middle)"
1494 "conveyor_belt2_right",
1496 "yellow conveyor belt (right)"
1499 "conveyor_belt2_switch_left",
1500 "conveyor_belt_switch",
1501 "switch for yellow conveyor belt (left)"
1504 "conveyor_belt2_switch_middle",
1505 "conveyor_belt_switch",
1506 "switch for yellow conveyor belt (middle)"
1509 "conveyor_belt2_switch_right",
1510 "conveyor_belt_switch",
1511 "switch for yellow conveyor belt (right)"
1514 "conveyor_belt3_left",
1516 "green conveyor belt (left)"
1519 "conveyor_belt3_middle",
1521 "green conveyor belt (middle)"
1524 "conveyor_belt3_right",
1526 "green conveyor belt (right)"
1529 "conveyor_belt3_switch_left",
1530 "conveyor_belt_switch",
1531 "switch for green conveyor belt (left)"
1534 "conveyor_belt3_switch_middle",
1535 "conveyor_belt_switch",
1536 "switch for green conveyor belt (middle)"
1539 "conveyor_belt3_switch_right",
1540 "conveyor_belt_switch",
1541 "switch for green conveyor belt (right)"
1544 "conveyor_belt4_left",
1546 "blue conveyor belt (left)"
1549 "conveyor_belt4_middle",
1551 "blue conveyor belt (middle)"
1554 "conveyor_belt4_right",
1556 "blue conveyor belt (right)"
1559 "conveyor_belt4_switch_left",
1560 "conveyor_belt_switch",
1561 "switch for blue conveyor belt (left)"
1564 "conveyor_belt4_switch_middle",
1565 "conveyor_belt_switch",
1566 "switch for blue conveyor belt (middle)"
1569 "conveyor_belt4_switch_right",
1570 "conveyor_belt_switch",
1571 "switch for blue conveyor belt (right)"
1586 "light switch (off)"
1589 "light_switch_active",
1596 "sign (exclamation)"
1599 "sign_radioactivity",
1601 "sign (radio activity)"
1611 "sign (wheel chair)"
1656 "mole (starts moving left)"
1661 "mole (starts moving right)"
1666 "mole (starts moving up)"
1671 "mole (starts moving down)"
1674 "steelwall_slanted",
1676 "steel wall (slanted)"
1686 "dx unknown element 15"
1691 "dx unknown element 42"
1706 "shield (deadly, kills enemies)"
1716 "time gate (closed)"
1719 "timegate_switch_active",
1721 "switch for time gate"
1726 "switch for time gate"
1734 "balloon_send_left",
1736 "send balloon to the left"
1739 "balloon_send_right",
1741 "send balloon to the right"
1749 "balloon_send_down",
1754 "balloon_send_any_direction",
1756 "send balloon in any direction"
1779 "emc_wall_pillar_upper",
1784 "emc_wall_pillar_middle",
1789 "emc_wall_pillar_lower",
1821 "tube (all directions)"
1834 "tube_vertical_left",
1836 "tube (vertical & left)"
1839 "tube_vertical_right",
1841 "tube (vertical & right)"
1844 "tube_horizontal_up",
1846 "tube (horizontal & up)"
1849 "tube_horizontal_down",
1851 "tube (horizontal & down)"
1861 "tube (left & down)"
1871 "tube (right & down)"
1886 "stable bomb (DX style)"
2396 "custom element 100"
2401 "custom element 101"
2406 "custom element 102"
2411 "custom element 103"
2416 "custom element 104"
2421 "custom element 105"
2426 "custom element 106"
2431 "custom element 107"
2436 "custom element 108"
2441 "custom element 109"
2446 "custom element 110"
2451 "custom element 111"
2456 "custom element 112"
2461 "custom element 113"
2466 "custom element 114"
2471 "custom element 115"
2476 "custom element 116"
2481 "custom element 117"
2486 "custom element 118"
2491 "custom element 119"
2496 "custom element 120"
2501 "custom element 121"
2506 "custom element 122"
2511 "custom element 123"
2516 "custom element 124"
2521 "custom element 125"
2526 "custom element 126"
2531 "custom element 127"
2536 "custom element 128"
2539 /* ----------------------------------------------------------------------- */
2540 /* "real" (and therefore drawable) runtime elements */
2541 /* ----------------------------------------------------------------------- */
2564 "dynabomb_player1_active",
2569 "dynabomb_player2_active",
2574 "dynabomb_player3_active",
2579 "dynabomb_player4_active",
2584 "sp_disk_red_active",
2589 "switchgate_opening",
2594 "switchgate_closing",
2619 "invisible_steelwall_active",
2624 "invisible_wall_active",
2629 "invisible_sand_active",
2634 "conveyor_belt1_left_active",
2639 "conveyor_belt1_middle_active",
2644 "conveyor_belt1_right_active",
2649 "conveyor_belt2_left_active",
2654 "conveyor_belt2_middle_active",
2659 "conveyor_belt2_right_active",
2664 "conveyor_belt3_left_active",
2669 "conveyor_belt3_middle_active",
2674 "conveyor_belt3_right_active",
2679 "conveyor_belt4_left_active",
2684 "conveyor_belt4_middle_active",
2689 "conveyor_belt4_right_active",
2704 "sp_terminal_active",
2709 "sp_buggy_base_activating",
2714 "sp_buggy_base_active",
2729 "quicksand_emptying",
2734 "magic_wall_active",
2739 "bd_magic_wall_active",
2749 "bd_magic_wall_full",
2754 "magic_wall_emptying",
2759 "bd_magic_wall_emptying",
2769 "bd_magic_wall_dead",
2774 /* ----------------------------------------------------------------------- */
2775 /* "unreal" (and therefore not drawable) runtime elements */
2776 /* ----------------------------------------------------------------------- */
2799 "acid_splash_right",
2814 "wall_growing_active",
2824 "player_is_leaving",
2829 "quicksand_filling",
2834 "magic_wall_filling",
2839 "bd_magic_wall_filling",
2844 /* ----------------------------------------------------------------------- */
2845 /* dummy elements (never used as game elements, only used as graphics) */
2846 /* ----------------------------------------------------------------------- */
2849 "steelwall_topleft",
2854 "steelwall_topright",
2859 "steelwall_bottomleft",
2864 "steelwall_bottomright",
2869 "steelwall_horizontal",
2874 "steelwall_vertical",
2879 "invisible_steelwall_topleft",
2884 "invisible_steelwall_topright",
2889 "invisible_steelwall_bottomleft",
2894 "invisible_steelwall_bottomright",
2899 "invisible_steelwall_horizontal",
2904 "invisible_steelwall_vertical",
2919 "shield_normal_active",
2924 "shield_deadly_active",
2937 /* ------------------------------------------------------------------------- */
2938 /* element action and direction definitions */
2939 /* ------------------------------------------------------------------------- */
2941 struct ElementActionInfo element_action_info[NUM_ACTIONS + 1] =
2943 { ".[DEFAULT]", ACTION_DEFAULT, TRUE },
2944 { ".waiting", ACTION_WAITING, TRUE },
2945 { ".falling", ACTION_FALLING, TRUE },
2946 { ".moving", ACTION_MOVING, TRUE },
2947 { ".digging", ACTION_DIGGING, FALSE },
2948 { ".snapping", ACTION_SNAPPING, FALSE },
2949 { ".collecting", ACTION_COLLECTING, FALSE },
2950 { ".pushing", ACTION_PUSHING, FALSE },
2951 { ".passing", ACTION_PASSING, FALSE },
2952 { ".impact", ACTION_IMPACT, FALSE },
2953 { ".cracking", ACTION_CRACKING, FALSE },
2954 { ".breaking", ACTION_BREAKING, FALSE },
2955 { ".activating", ACTION_ACTIVATING, FALSE },
2956 { ".opening", ACTION_OPENING, FALSE },
2957 { ".closing", ACTION_CLOSING, FALSE },
2958 { ".eating", ACTION_EATING, FALSE },
2959 { ".attacking", ACTION_ATTACKING, TRUE },
2960 { ".growing", ACTION_GROWING, TRUE },
2961 { ".shrinking", ACTION_SHRINKING, FALSE },
2962 { ".active", ACTION_ACTIVE, TRUE },
2963 { ".other", ACTION_OTHER, FALSE },
2968 struct ElementDirectionInfo element_direction_info[NUM_DIRECTIONS + 1] =
2970 { ".left", MV_BIT_LEFT },
2971 { ".right", MV_BIT_RIGHT },
2972 { ".up", MV_BIT_UP },
2973 { ".down", MV_BIT_DOWN },
2978 struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1] =
2986 /* ------------------------------------------------------------------------- */
2987 /* font definitions */
2988 /* ------------------------------------------------------------------------- */
2990 struct FontInfo font_info[NUM_FONTS + 1] =
2992 { "font.initial_1" },
2993 { "font.initial_2" },
2994 { "font.initial_3" },
2995 { "font.initial_4" },
3000 { "font.medium_1" },
3001 { "font.medium_2" },
3002 { "font.medium_3" },
3003 { "font.medium_4" },
3014 /* ========================================================================= */
3016 /* ========================================================================= */
3018 int main(int argc, char *argv[])
3020 InitCommandName(argv[0]);
3021 InitExitFunction(CloseAllAndExit);
3022 InitPlatformDependantStuff();
3030 return 0; /* to keep compilers happy */