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 ***********************************************************/
14 #include "libgame/libgame.h"
23 Bitmap *bitmap_db_cross;
24 Bitmap *bitmap_db_field;
25 Bitmap *bitmap_db_panel;
26 Bitmap *bitmap_db_door;
27 Bitmap *bitmap_db_toons;
28 DrawBuffer *fieldbuffer;
29 DrawBuffer *drawto_field;
32 boolean level_editor_test_game = FALSE;
33 boolean network_playing = FALSE;
35 #if defined(TARGET_SDL)
36 boolean network_server = FALSE;
37 SDL_Thread *server_thread;
40 int key_joystick_mapping = 0;
42 boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
43 int redraw_x1 = 0, redraw_y1 = 0;
45 short Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
46 short MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
47 short MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
48 short MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
49 short ChangeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
50 short ChangePage[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
51 short CustomValue[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
52 short Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
53 short Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
54 short StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
55 short Back[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
56 boolean Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
57 boolean Pushed[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
58 short ChangeCount[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
59 short ChangeEvent[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
60 short WasJustMoving[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
61 short WasJustFalling[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
62 short CheckCollision[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
63 short CheckImpact[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
64 short AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
65 short AmoebaCnt[MAX_NUM_AMOEBA];
66 short AmoebaCnt2[MAX_NUM_AMOEBA];
67 short ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
68 short ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
69 short ExplodeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
70 int RunnerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
71 int PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
73 int GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
74 int GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
75 int GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
76 int GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
77 int GfxDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
78 int GfxRedraw[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
80 int ActiveElement[MAX_NUM_ELEMENTS];
81 int ActiveButton[NUM_IMAGE_FILES];
82 int ActiveFont[NUM_FONTS];
84 int lev_fieldx, lev_fieldy;
85 int scroll_x, scroll_y;
89 int ScreenMovDir = MV_NONE, ScreenMovPos = 0;
91 int BorderElement = EL_STEELWALL;
92 int GameFrameDelay = GAME_FRAME_DELAY;
93 int FfwdFrameDelay = FFWD_FRAME_DELAY;
95 int BX2 = SCR_FIELDX - 1, BY2 = SCR_FIELDY - 1;
96 int SBX_Left, SBX_Right;
97 int SBY_Upper, SBY_Lower;
102 int TimeFrames, TimePlayed, TimeLeft, TapeTime;
104 boolean network_player_action_received = FALSE;
106 struct LevelSetInfo levelset;
107 struct LevelInfo level, level_template;
108 struct PlayerInfo stored_player[MAX_PLAYERS], *local_player = NULL;
109 struct HiScore highscore[MAX_SCORE_ENTRIES];
110 struct TapeInfo tape;
111 struct SetupInfo setup;
112 struct GameInfo game;
113 struct GlobalInfo global;
114 struct BorderInfo border;
115 struct TitleFadingInfo fading;
116 struct TitleFadingInfo title_initial_default;
117 struct TitleFadingInfo title_default;
118 struct TitleMessageInfo titlemessage_initial_default;
119 struct TitleMessageInfo titlemessage_initial[MAX_NUM_TITLE_MESSAGES];
120 struct TitleMessageInfo titlemessage_default;
121 struct TitleMessageInfo titlemessage[MAX_NUM_TITLE_MESSAGES];
122 struct TitleMessageInfo readme;
123 struct InitInfo init;
124 struct MenuInfo menu;
125 struct DoorInfo door_1, door_2;
126 struct PreviewInfo preview;
127 struct GraphicInfo *graphic_info = NULL;
128 struct SoundInfo *sound_info = NULL;
129 struct MusicInfo *music_info = NULL;
130 struct MusicFileInfo *music_file_info = NULL;
131 struct HelpAnimInfo *helpanim_info = NULL;
132 SetupFileHash *helptext_info = NULL;
133 SetupFileHash *image_config_hash = NULL;
134 SetupFileHash *element_token_hash = NULL;
135 SetupFileHash *graphic_token_hash = NULL;
136 SetupFileHash *font_token_hash = NULL;
139 /* ------------------------------------------------------------------------- */
140 /* element definitions */
141 /* ------------------------------------------------------------------------- */
143 struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1];
145 /* this contains predefined structure elements to initialize "element_info" */
146 struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
148 /* keyword to start parser: "ELEMENT_INFO_START" <-- do not change! */
150 /* ----------------------------------------------------------------------- */
151 /* "real" level file elements */
152 /* ----------------------------------------------------------------------- */
202 "bug (random start direction)"
207 "spaceship (random start direction)"
212 "yam yam (random start direction)"
242 "quicksand (with rock)"
272 "dropping amoeba (EM style)"
287 "Conway's wall of life"
310 "robot_wheel.active",
312 "magic wheel (running)"
357 "gray door (opened by key 1)"
362 "gray door (opened by key 2)"
367 "gray door (opened by key 3)"
372 "gray door (opened by key 4)"
382 "pac man (random start direction)"
387 "invisible normal wall"
412 "amoeba with content"
432 "growing wall (horizontal, visible)"
447 "wall with BD style diamond"
450 "wall_emerald_yellow",
452 "wall with yellow emerald"
462 "magic wall (BD style)"
465 "invisible_steelwall",
467 "invisible steel wall"
470 "sokoban_field_player",
472 "sokoban field with player"
475 "dynabomb_increase_number",
477 "increases number of bombs"
480 "dynabomb_increase_size",
482 "increases explosion size"
485 "dynabomb_increase_power",
487 "increases power of explosion"
495 "sokoban_field_empty",
497 "sokoban empty field"
500 "sokoban_field_full",
502 "sokoban field with object"
505 "bd_butterfly.right",
507 "butterfly (starts moving right)"},
511 "butterfly (starts moving up)"
516 "butterfly (starts moving left)"},
520 "butterfly (starts moving down)"},
524 "firefly (starts moving right)"
529 "firefly (starts moving up)"
534 "firefly (starts moving left)"
539 "firefly (starts moving down)"
544 "butterfly (random start direction)"
549 "firefly (random start direction)"
574 "bug (starts moving right)"
579 "bug (starts moving up)"
584 "bug (starts moving left)"
589 "bug (starts moving down)"
594 "spaceship (starts moving right)"},
598 "spaceship (starts moving up)"
603 "spaceship (starts moving left)"},
607 "spaceship (starts moving down)"},
611 "pac man (starts moving right)"
616 "pac man (starts moving up)"
621 "pac man (starts moving left)"
626 "pac man (starts moving down)"
641 "wall with red emerald"
644 "wall_emerald_purple",
646 "wall with purple emerald"
651 "acid pool (top left)"
654 "acid_pool_topright",
656 "acid pool (top right)"
659 "acid_pool_bottomleft",
661 "acid pool (bottom left)"
669 "acid_pool_bottomright",
671 "acid pool (bottom right)"
676 "normal wall (BD style)"
701 "mole (random start direction)"
741 "fire breathing dragon"
744 "em_key_1_file_obsolete",
1054 "char_bracketright",
1149 "expandable_wall_horizontal",
1151 "growing wall (horizontal)"
1154 "expandable_wall_vertical",
1156 "growing wall (vertical)"
1159 "expandable_wall_any",
1161 "growing wall (any direction)"
1184 "em_key_2_file_obsolete",
1189 "em_key_3_file_obsolete",
1194 "em_key_4_file_obsolete",
1246 "port (leading right)"
1251 "port (leading down)"
1256 "port (leading left)"
1264 "sp_gravity_port_right",
1266 "gravity port (leading right)"
1269 "sp_gravity_port_down",
1271 "gravity port (leading down)"
1274 "sp_gravity_port_left",
1276 "gravity port (leading left)"
1279 "sp_gravity_port_up",
1281 "gravity port (leading up)"
1309 "sp_port_horizontal",
1316 "port (any direction)"
1339 "sp_hardware_base_1",
1344 "sp_hardware_green",
1359 "sp_hardware_yellow",
1364 "sp_hardware_base_2",
1369 "sp_hardware_base_3",
1374 "sp_hardware_base_4",
1379 "sp_hardware_base_5",
1384 "sp_hardware_base_6",
1401 "gray door (EM style, key 1)"
1406 "gray door (EM style, key 2)"
1411 "gray door (EM style, key 3)"
1416 "gray door (EM style, key 4)"
1421 "dynamite (EM style)"
1424 "em_dynamite.active",
1426 "burning dynamite (EM style)"
1454 "dc_gate_white_gray",
1456 "gray door (opened by white key)"
1476 "switch gate (open)"
1479 "switchgate_closed",
1481 "switch gate (closed)"
1484 "switchgate_switch_up",
1485 "switchgate_switch",
1486 "switch for switch gate"
1489 "switchgate_switch_down",
1490 "switchgate_switch",
1491 "switch for switch gate"
1504 "conveyor_belt_1_left",
1506 "conveyor belt 1 (left)"
1509 "conveyor_belt_1_middle",
1511 "conveyor belt 1 (middle)"
1514 "conveyor_belt_1_right",
1516 "conveyor belt 1 (right)"
1519 "conveyor_belt_1_switch_left",
1520 "conveyor_belt_switch",
1521 "switch for conveyor belt 1 (left)"
1524 "conveyor_belt_1_switch_middle",
1525 "conveyor_belt_switch",
1526 "switch for conveyor belt 1 (middle)"
1529 "conveyor_belt_1_switch_right",
1530 "conveyor_belt_switch",
1531 "switch for conveyor belt 1 (right)"
1534 "conveyor_belt_2_left",
1536 "conveyor belt 2 (left)"
1539 "conveyor_belt_2_middle",
1541 "conveyor belt 2 (middle)"
1544 "conveyor_belt_2_right",
1546 "conveyor belt 2 (right)"
1549 "conveyor_belt_2_switch_left",
1550 "conveyor_belt_switch",
1551 "switch for conveyor belt 2 (left)"
1554 "conveyor_belt_2_switch_middle",
1555 "conveyor_belt_switch",
1556 "switch for conveyor belt 2 (middle)"
1559 "conveyor_belt_2_switch_right",
1560 "conveyor_belt_switch",
1561 "switch for conveyor belt 2 (right)"
1564 "conveyor_belt_3_left",
1566 "conveyor belt 3 (left)"
1569 "conveyor_belt_3_middle",
1571 "conveyor belt 3 (middle)"
1574 "conveyor_belt_3_right",
1576 "conveyor belt 3 (right)"
1579 "conveyor_belt_3_switch_left",
1580 "conveyor_belt_switch",
1581 "switch for conveyor belt 3 (left)"
1584 "conveyor_belt_3_switch_middle",
1585 "conveyor_belt_switch",
1586 "switch for conveyor belt 3 (middle)"
1589 "conveyor_belt_3_switch_right",
1590 "conveyor_belt_switch",
1591 "switch for conveyor belt 3 (right)"
1594 "conveyor_belt_4_left",
1596 "conveyor belt 4 (left)"
1599 "conveyor_belt_4_middle",
1601 "conveyor belt 4 (middle)"
1604 "conveyor_belt_4_right",
1606 "conveyor belt 4 (right)"
1609 "conveyor_belt_4_switch_left",
1610 "conveyor_belt_switch",
1611 "switch for conveyor belt 4 (left)"
1614 "conveyor_belt_4_switch_middle",
1615 "conveyor_belt_switch",
1616 "switch for conveyor belt 4 (middle)"
1619 "conveyor_belt_4_switch_right",
1620 "conveyor_belt_switch",
1621 "switch for conveyor belt 4 (right)"
1626 "land mine (not removable)"
1629 "envelope_obsolete",
1631 "envelope (OBSOLETE)"
1636 "light switch (off)"
1639 "light_switch.active",
1646 "sign (exclamation)"
1649 "sign_radioactivity",
1651 "sign (radio activity)"
1661 "sign (wheel chair)"
1684 "sign_entry_forbidden",
1686 "sign (entry forbidden)"
1689 "sign_emergency_exit",
1691 "sign (emergency exit)"
1706 "mole (starts moving left)"
1711 "mole (starts moving right)"
1716 "mole (starts moving up)"
1721 "mole (starts moving down)"
1724 "steelwall_slippery",
1726 "slippery steel wall"
1736 "dx unknown element 15"
1741 "dx unknown element 42"
1756 "shield (deadly, kills enemies)"
1766 "time gate (closed)"
1769 "timegate_switch.active",
1771 "switch for time gate"
1776 "switch for time gate"
1784 "balloon_switch_left",
1786 "wind switch (left)"
1789 "balloon_switch_right",
1791 "wind switch (right)"
1794 "balloon_switch_up",
1799 "balloon_switch_down",
1801 "wind switch (down)"
1804 "balloon_switch_any",
1806 "wind switch (any direction)"
1871 "tube (any direction)"
1884 "tube_vertical_left",
1886 "tube (vertical & left)"
1889 "tube_vertical_right",
1891 "tube (vertical & right)"
1894 "tube_horizontal_up",
1896 "tube (horizontal & up)"
1899 "tube_horizontal_down",
1901 "tube (horizontal & down)"
1911 "tube (left & down)"
1921 "tube (right & down)"
1936 "stable bomb (DX style)"
2446 "custom element 100"
2451 "custom element 101"
2456 "custom element 102"
2461 "custom element 103"
2466 "custom element 104"
2471 "custom element 105"
2476 "custom element 106"
2481 "custom element 107"
2486 "custom element 108"
2491 "custom element 109"
2496 "custom element 110"
2501 "custom element 111"
2506 "custom element 112"
2511 "custom element 113"
2516 "custom element 114"
2521 "custom element 115"
2526 "custom element 116"
2531 "custom element 117"
2536 "custom element 118"
2541 "custom element 119"
2546 "custom element 120"
2551 "custom element 121"
2556 "custom element 122"
2561 "custom element 123"
2566 "custom element 124"
2571 "custom element 125"
2576 "custom element 126"
2581 "custom element 127"
2586 "custom element 128"
2591 "custom element 129"
2596 "custom element 130"
2601 "custom element 131"
2606 "custom element 132"
2611 "custom element 133"
2616 "custom element 134"
2621 "custom element 135"
2626 "custom element 136"
2631 "custom element 137"
2636 "custom element 138"
2641 "custom element 139"
2646 "custom element 140"
2651 "custom element 141"
2656 "custom element 142"
2661 "custom element 143"
2666 "custom element 144"
2671 "custom element 145"
2676 "custom element 146"
2681 "custom element 147"
2686 "custom element 148"
2691 "custom element 149"
2696 "custom element 150"
2701 "custom element 151"
2706 "custom element 152"
2711 "custom element 153"
2716 "custom element 154"
2721 "custom element 155"
2726 "custom element 156"
2731 "custom element 157"
2736 "custom element 158"
2741 "custom element 159"
2746 "custom element 160"
2751 "custom element 161"
2756 "custom element 162"
2761 "custom element 163"
2766 "custom element 164"
2771 "custom element 165"
2776 "custom element 166"
2781 "custom element 167"
2786 "custom element 168"
2791 "custom element 169"
2796 "custom element 170"
2801 "custom element 171"
2806 "custom element 172"
2811 "custom element 173"
2816 "custom element 174"
2821 "custom element 175"
2826 "custom element 176"
2831 "custom element 177"
2836 "custom element 178"
2841 "custom element 179"
2846 "custom element 180"
2851 "custom element 181"
2856 "custom element 182"
2861 "custom element 183"
2866 "custom element 184"
2871 "custom element 185"
2876 "custom element 186"
2881 "custom element 187"
2886 "custom element 188"
2891 "custom element 189"
2896 "custom element 190"
2901 "custom element 191"
2906 "custom element 192"
2911 "custom element 193"
2916 "custom element 194"
2921 "custom element 195"
2926 "custom element 196"
2931 "custom element 197"
2936 "custom element 198"
2941 "custom element 199"
2946 "custom element 200"
2951 "custom element 201"
2956 "custom element 202"
2961 "custom element 203"
2966 "custom element 204"
2971 "custom element 205"
2976 "custom element 206"
2981 "custom element 207"
2986 "custom element 208"
2991 "custom element 209"
2996 "custom element 210"
3001 "custom element 211"
3006 "custom element 212"
3011 "custom element 213"
3016 "custom element 214"
3021 "custom element 215"
3026 "custom element 216"
3031 "custom element 217"
3036 "custom element 218"
3041 "custom element 219"
3046 "custom element 220"
3051 "custom element 221"
3056 "custom element 222"
3061 "custom element 223"
3066 "custom element 224"
3071 "custom element 225"
3076 "custom element 226"
3081 "custom element 227"
3086 "custom element 228"
3091 "custom element 229"
3096 "custom element 230"
3101 "custom element 231"
3106 "custom element 232"
3111 "custom element 233"
3116 "custom element 234"
3121 "custom element 235"
3126 "custom element 236"
3131 "custom element 237"
3136 "custom element 238"
3141 "custom element 239"
3146 "custom element 240"
3151 "custom element 241"
3156 "custom element 242"
3161 "custom element 243"
3166 "custom element 244"
3171 "custom element 245"
3176 "custom element 246"
3181 "custom element 247"
3186 "custom element 248"
3191 "custom element 249"
3196 "custom element 250"
3201 "custom element 251"
3206 "custom element 252"
3211 "custom element 253"
3216 "custom element 254"
3221 "custom element 255"
3226 "custom element 256"
3436 "element triggering change"
3441 "player triggering change"
3444 "sp_gravity_on_port_right",
3446 "gravity on port (leading right)"
3449 "sp_gravity_on_port_down",
3451 "gravity on port (leading down)"
3454 "sp_gravity_on_port_left",
3456 "gravity on port (leading left)"
3459 "sp_gravity_on_port_up",
3461 "gravity on port (leading up)"
3464 "sp_gravity_off_port_right",
3466 "gravity off port (leading right)"
3469 "sp_gravity_off_port_down",
3471 "gravity off port (leading down)"
3474 "sp_gravity_off_port_left",
3476 "gravity off port (leading left)"
3479 "sp_gravity_off_port_up",
3481 "gravity off port (leading up)"
3484 "balloon_switch_none",
3491 "door 5 (EMC style)",
3496 "door 6 (EMC style)",
3501 "door 7 (EMC style)",
3506 "door 8 (EMC style)",
3511 "gray door (EMC style, key 5)",
3516 "gray door (EMC style, key 6)",
3521 "gray door (EMC style, key 7)",
3526 "gray door (EMC style, key 8)",
3531 "key 5 (EMC style)",
3536 "key 6 (EMC style)",
3541 "key 7 (EMC style)",
3546 "key 8 (EMC style)",
3564 "emc_magic_ball.active",
3566 "magic ball (activated)",
3569 "emc_magic_ball_switch",
3570 "emc_magic_ball_switch",
3571 "magic ball switch (off)",
3574 "emc_magic_ball_switch.active",
3575 "emc_magic_ball_switch",
3576 "magic ball switch (on)",
3579 "emc_spring_bumper",
3580 "emc_spring_bumper",
3639 "emc_wall_slippery_1",
3644 "emc_wall_slippery_2",
3649 "emc_wall_slippery_3",
3654 "emc_wall_slippery_4",
3676 "CE value of element triggering change"
3681 "CE score of element triggering change"
3686 "CE value of current element"
3691 "CE score of current element"
3696 "yam yam (starts moving left)"
3701 "yam yam (starts moving right)"
3706 "yam yam (starts moving up)"
3711 "yam yam (starts moving down)"
3714 "bd_expandable_wall",
3716 "growing wall (horizontal, BD style)"
3721 "CE 8 positions earlier in list"
3726 "CE 7 positions earlier in list"
3731 "CE 6 positions earlier in list"
3736 "CE 5 positions earlier in list"
3741 "CE 4 positions earlier in list"
3746 "CE 3 positions earlier in list"
3751 "CE 2 positions earlier in list"
3756 "CE 1 position earlier in list"
3761 "the current custom element"
3766 "CE 1 position later in list"
3771 "CE 2 positions later in list"
3776 "CE 3 positions later in list"
3781 "CE 4 positions later in list"
3786 "CE 5 positions later in list"
3791 "CE 6 positions later in list"
3796 "CE 7 positions later in list"
3801 "CE 8 positions later in list"
3806 "this element matches any element"
3814 "steel_char_exclam",
3819 "steel_char_quotedbl",
3824 "steel_char_numbersign",
3829 "steel_char_dollar",
3834 "steel_char_percent",
3839 "steel_char_ampersand",
3844 "steel_char_apostrophe",
3849 "steel_char_parenleft",
3854 "steel_char_parenright",
3859 "steel_char_asterisk",
3879 "steel_char_period",
3944 "steel_char_semicolon",
3959 "steel_char_greater",
3964 "steel_char_question",
4104 "steel_char_bracketleft",
4109 "steel_char_backslash",
4114 "steel_char_bracketright",
4119 "steel_char_asciicircum",
4124 "steel_char_underscore",
4129 "steel_char_copyright",
4134 "steel_char_aumlaut",
4139 "steel_char_oumlaut",
4144 "steel_char_uumlaut",
4149 "steel_char_degree",
4154 "steel_char_trademark",
4159 "steel_char_cursor",
4164 "steel_char_unused",
4169 "steel_char_unused",
4174 "steel_char_unused",
4179 "steel_char_unused",
4184 "steel_char_unused",
4189 "steel_char_unused",
4194 "steel_char_unused",
4196 "steel letter 'button'"
4199 "steel_char_unused",
4204 "steel_char_unused",
4206 "steel letter 'down'"
4259 "steel_exit_closed",
4269 "dc_steelwall_1_left",
4274 "dc_steelwall_1_right",
4276 "steel wall (right)"
4279 "dc_steelwall_1_top",
4284 "dc_steelwall_1_bottom",
4286 "steel wall (bottom)"
4289 "dc_steelwall_1_horizontal",
4291 "steel wall (top/bottom)"
4294 "dc_steelwall_1_vertical",
4296 "steel wall (left/right)"
4299 "dc_steelwall_1_topleft",
4301 "steel wall (top/left)"
4304 "dc_steelwall_1_topright",
4306 "steel wall (top/right)"
4309 "dc_steelwall_1_bottomleft",
4311 "steel wall (bottom/left)"
4314 "dc_steelwall_1_bottomright",
4316 "steel wall (bottom/right)"
4319 "dc_steelwall_1_topleft_2",
4321 "steel wall (top/left corner)"
4324 "dc_steelwall_1_topright_2",
4326 "steel wall (top/right corner)"
4329 "dc_steelwall_1_bottomleft_2",
4331 "steel wall (bottom/left corner)"
4334 "dc_steelwall_1_bottomright_2",
4336 "steel wall (bottom/right corner)"
4339 "dc_steelwall_2_left",
4344 "dc_steelwall_2_right",
4346 "steel wall (right)"
4349 "dc_steelwall_2_top",
4354 "dc_steelwall_2_bottom",
4356 "steel wall (bottom)"
4359 "dc_steelwall_2_horizontal",
4361 "steel wall (horizontal)"
4364 "dc_steelwall_2_vertical",
4366 "steel wall (vertical)"
4369 "dc_steelwall_2_middle",
4371 "steel wall (middle)"
4374 "dc_steelwall_2_single",
4376 "steel wall (single)"
4379 "dc_switchgate_switch_up",
4380 "switchgate_switch",
4381 "switch for switch gate (steel)"
4384 "dc_switchgate_switch_down",
4385 "switchgate_switch",
4386 "switch for switch gate (steel)"
4389 "dc_timegate_switch",
4391 "switch for time gate (steel)"
4394 "dc_timegate_switch.active",
4396 "switch for time gate (steel)"
4401 "land mine (DC style, removable)"
4404 "expandable_steelwall",
4406 "growing steel wall"
4409 "expandable_steelwall_horizontal",
4411 "growing steel wall (horizontal)"
4414 "expandable_steelwall_vertical",
4416 "growing steel wall (vertical)"
4419 "expandable_steelwall_any",
4421 "growing steel wall (any direction)"
4426 "closed exit (EM style)"
4431 "open exit (EM style)"
4434 "em_steel_exit_closed",
4436 "closed steel exit (EM style)"
4439 "em_steel_exit_open",
4441 "open steel exit (EM style)"
4444 "dc_gate_fake_gray",
4446 "gray door (opened by no key)"
4451 "magic wall (DC style)"
4454 "quicksand_fast_empty",
4456 "fast quicksand (empty)"
4459 "quicksand_fast_full",
4461 "fast quicksand (with rock)"
4464 /* ----------------------------------------------------------------------- */
4465 /* "real" (and therefore drawable) runtime elements */
4466 /* ----------------------------------------------------------------------- */
4469 "dynabomb_player_1.active",
4474 "dynabomb_player_2.active",
4479 "dynabomb_player_3.active",
4484 "dynabomb_player_4.active",
4489 "sp_disk_red.active",
4494 "switchgate.opening",
4499 "switchgate.closing",
4524 "invisible_steelwall.active",
4529 "invisible_wall.active",
4534 "invisible_sand.active",
4539 "conveyor_belt_1_left.active",
4544 "conveyor_belt_1_middle.active",
4549 "conveyor_belt_1_right.active",
4554 "conveyor_belt_2_left.active",
4559 "conveyor_belt_2_middle.active",
4564 "conveyor_belt_2_right.active",
4569 "conveyor_belt_3_left.active",
4574 "conveyor_belt_3_middle.active",
4579 "conveyor_belt_3_right.active",
4584 "conveyor_belt_4_left.active",
4589 "conveyor_belt_4_middle.active",
4594 "conveyor_belt_4_right.active",
4609 "steel_exit.opening",
4614 "steel_exit.closing",
4629 "em_steel_exit.opening",
4634 "em_steel_exit.closing",
4654 "sp_terminal.active",
4659 "sp_buggy_base.activating",
4664 "sp_buggy_base.active",
4679 "quicksand.emptying",
4684 "quicksand_fast.emptying",
4689 "magic_wall.active",
4694 "bd_magic_wall.active",
4699 "dc_magic_wall.active",
4709 "bd_magic_wall_full",
4714 "dc_magic_wall_full",
4719 "magic_wall.emptying",
4724 "bd_magic_wall.emptying",
4729 "dc_magic_wall.emptying",
4739 "bd_magic_wall_dead",
4744 "dc_magic_wall_dead",
4750 "emc_fake_grass.active",
4755 "gate_1_gray.active",
4760 "gate_2_gray.active",
4765 "gate_3_gray.active",
4770 "gate_4_gray.active",
4775 "em_gate_1_gray.active",
4780 "em_gate_2_gray.active",
4785 "em_gate_3_gray.active",
4790 "em_gate_4_gray.active",
4795 "emc_gate_5_gray.active",
4800 "emc_gate_6_gray.active",
4805 "emc_gate_7_gray.active",
4810 "emc_gate_8_gray.active",
4815 "dc_gate_white_gray.active",
4820 "emc_dripper.active",
4825 "emc_spring_bumper.active",
4826 "emc_spring_bumper",
4830 /* ----------------------------------------------------------------------- */
4831 /* "unreal" (and therefore not drawable) runtime elements */
4832 /* ----------------------------------------------------------------------- */
4860 "acid_splash_right",
4875 "expandable_wall.growing",
4880 "expandable_steelwall.growing",
4890 "player_is_leaving",
4895 "player_is_exploding_1",
4900 "player_is_exploding_2",
4905 "player_is_exploding_3",
4910 "player_is_exploding_4",
4915 "quicksand.filling",
4920 "quicksand_fast.filling",
4925 "magic_wall.filling",
4930 "bd_magic_wall.filling",
4935 "dc_magic_wall.filling",
4945 "diagonal.shrinking",
4955 /* ----------------------------------------------------------------------- */
4956 /* dummy elements (never used as game elements, only used as graphics) */
4957 /* ----------------------------------------------------------------------- */
4960 "steelwall_topleft",
4965 "steelwall_topright",
4970 "steelwall_bottomleft",
4975 "steelwall_bottomright",
4980 "steelwall_horizontal",
4985 "steelwall_vertical",
4990 "invisible_steelwall_topleft",
4995 "invisible_steelwall_topright",
5000 "invisible_steelwall_bottomleft",
5005 "invisible_steelwall_bottomright",
5010 "invisible_steelwall_horizontal",
5015 "invisible_steelwall_vertical",
5030 "dynabomb_player_1",
5035 "dynabomb_player_2",
5040 "dynabomb_player_3",
5045 "dynabomb_player_4",
5050 "shield_normal.active",
5055 "shield_deadly.active",
5125 "internal_clipboard_custom",
5127 "empty custom element"
5130 "internal_clipboard_change",
5135 "internal_clipboard_group",
5137 "empty group element"
5145 "internal_cascade_bd",
5147 "show Boulder Dash elements"
5150 "internal_cascade_bd.active",
5152 "hide Boulder Dash elements"
5155 "internal_cascade_em",
5157 "show Emerald Mine elements"
5160 "internal_cascade_em.active",
5162 "hide Emerald Mine elements"
5165 "internal_cascade_emc",
5167 "show Emerald Mine Club elements"
5170 "internal_cascade_emc.active",
5172 "hide Emerald Mine Club elements"
5175 "internal_cascade_rnd",
5177 "show Rocks'n'Diamonds elements"
5180 "internal_cascade_rnd.active",
5182 "hide Rocks'n'Diamonds elements"
5185 "internal_cascade_sb",
5187 "show Sokoban elements"
5190 "internal_cascade_sb.active",
5192 "hide Sokoban elements"
5195 "internal_cascade_sp",
5197 "show Supaplex elements"
5200 "internal_cascade_sp.active",
5202 "hide Supaplex elements"
5205 "internal_cascade_dc",
5207 "show Diamond Caves II elements"
5210 "internal_cascade_dc.active",
5212 "hide Diamond Caves II elements"
5215 "internal_cascade_dx",
5217 "show DX Boulderdash elements"
5220 "internal_cascade_dx.active",
5222 "hide DX Boulderdash elements"
5225 "internal_cascade_chars",
5227 "show text elements"
5230 "internal_cascade_chars.active",
5232 "hide text elements"
5235 "internal_cascade_steel_chars",
5237 "show steel text elements"
5240 "internal_cascade_steel_chars.active",
5242 "hide steel text elements"
5245 "internal_cascade_ce",
5247 "show custom elements"
5250 "internal_cascade_ce.active",
5252 "hide custom elements"
5255 "internal_cascade_ge",
5257 "show group elements"
5260 "internal_cascade_ge.active",
5262 "hide group elements"
5265 "internal_cascade_ref",
5267 "show reference elements"
5270 "internal_cascade_ref.active",
5272 "hide reference elements"
5275 "internal_cascade_user",
5277 "show user defined elements"
5280 "internal_cascade_user.active",
5282 "hide user defined elements"
5285 "internal_cascade_dynamic",
5287 "show elements used in this level"
5290 "internal_cascade_dynamic.active",
5292 "hide elements used in this level"
5295 /* keyword to stop parser: "ELEMENT_INFO_END" <-- do not change! */
5305 /* ------------------------------------------------------------------------- */
5306 /* element action and direction definitions */
5307 /* ------------------------------------------------------------------------- */
5309 struct ElementActionInfo element_action_info[NUM_ACTIONS + 1 + 1] =
5311 { ".[DEFAULT]", ACTION_DEFAULT, TRUE },
5312 { ".waiting", ACTION_WAITING, TRUE },
5313 { ".falling", ACTION_FALLING, TRUE },
5314 { ".moving", ACTION_MOVING, TRUE },
5315 { ".digging", ACTION_DIGGING, FALSE },
5316 { ".snapping", ACTION_SNAPPING, FALSE },
5317 { ".collecting", ACTION_COLLECTING, FALSE },
5318 { ".dropping", ACTION_DROPPING, FALSE },
5319 { ".pushing", ACTION_PUSHING, FALSE },
5320 { ".walking", ACTION_WALKING, FALSE },
5321 { ".passing", ACTION_PASSING, FALSE },
5322 { ".impact", ACTION_IMPACT, FALSE },
5323 { ".breaking", ACTION_BREAKING, FALSE },
5324 { ".activating", ACTION_ACTIVATING, FALSE },
5325 { ".deactivating", ACTION_DEACTIVATING, FALSE },
5326 { ".opening", ACTION_OPENING, FALSE },
5327 { ".closing", ACTION_CLOSING, FALSE },
5328 { ".attacking", ACTION_ATTACKING, TRUE },
5329 { ".growing", ACTION_GROWING, TRUE },
5330 { ".shrinking", ACTION_SHRINKING, FALSE },
5331 { ".active", ACTION_ACTIVE, TRUE },
5332 { ".filling", ACTION_FILLING, FALSE },
5333 { ".emptying", ACTION_EMPTYING, FALSE },
5334 { ".changing", ACTION_CHANGING, FALSE },
5335 { ".exploding", ACTION_EXPLODING, FALSE },
5336 { ".boring", ACTION_BORING, FALSE },
5337 { ".boring[1]", ACTION_BORING_1, FALSE },
5338 { ".boring[2]", ACTION_BORING_2, FALSE },
5339 { ".boring[3]", ACTION_BORING_3, FALSE },
5340 { ".boring[4]", ACTION_BORING_4, FALSE },
5341 { ".boring[5]", ACTION_BORING_5, FALSE },
5342 { ".boring[6]", ACTION_BORING_6, FALSE },
5343 { ".boring[7]", ACTION_BORING_7, FALSE },
5344 { ".boring[8]", ACTION_BORING_8, FALSE },
5345 { ".boring[9]", ACTION_BORING_9, FALSE },
5346 { ".boring[10]", ACTION_BORING_10, FALSE },
5347 { ".sleeping", ACTION_SLEEPING, FALSE },
5348 { ".sleeping[1]", ACTION_SLEEPING_1, FALSE },
5349 { ".sleeping[2]", ACTION_SLEEPING_2, FALSE },
5350 { ".sleeping[3]", ACTION_SLEEPING_3, FALSE },
5351 { ".awakening", ACTION_AWAKENING, FALSE },
5352 { ".dying", ACTION_DYING, FALSE },
5353 { ".turning", ACTION_TURNING, FALSE },
5354 { ".turning_from_left", ACTION_TURNING_FROM_LEFT, FALSE },
5355 { ".turning_from_right", ACTION_TURNING_FROM_RIGHT, FALSE },
5356 { ".turning_from_up", ACTION_TURNING_FROM_UP, FALSE },
5357 { ".turning_from_down", ACTION_TURNING_FROM_DOWN, FALSE },
5358 { ".smashed_by_rock", ACTION_SMASHED_BY_ROCK, FALSE },
5359 { ".smashed_by_spring", ACTION_SMASHED_BY_SPRING, FALSE },
5360 { ".eating", ACTION_EATING, FALSE },
5361 { ".twinkling", ACTION_TWINKLING, FALSE },
5362 { ".splashing", ACTION_SPLASHING, FALSE },
5363 { ".page[1]", ACTION_PAGE_1, FALSE },
5364 { ".page[2]", ACTION_PAGE_2, FALSE },
5365 { ".page[3]", ACTION_PAGE_3, FALSE },
5366 { ".page[4]", ACTION_PAGE_4, FALSE },
5367 { ".page[5]", ACTION_PAGE_5, FALSE },
5368 { ".page[6]", ACTION_PAGE_6, FALSE },
5369 { ".page[7]", ACTION_PAGE_7, FALSE },
5370 { ".page[8]", ACTION_PAGE_8, FALSE },
5371 { ".page[9]", ACTION_PAGE_9, FALSE },
5372 { ".page[10]", ACTION_PAGE_10, FALSE },
5373 { ".page[11]", ACTION_PAGE_11, FALSE },
5374 { ".page[12]", ACTION_PAGE_12, FALSE },
5375 { ".page[13]", ACTION_PAGE_13, FALSE },
5376 { ".page[14]", ACTION_PAGE_14, FALSE },
5377 { ".page[15]", ACTION_PAGE_15, FALSE },
5378 { ".page[16]", ACTION_PAGE_16, FALSE },
5379 { ".page[17]", ACTION_PAGE_17, FALSE },
5380 { ".page[18]", ACTION_PAGE_18, FALSE },
5381 { ".page[19]", ACTION_PAGE_19, FALSE },
5382 { ".page[20]", ACTION_PAGE_20, FALSE },
5383 { ".page[21]", ACTION_PAGE_21, FALSE },
5384 { ".page[22]", ACTION_PAGE_22, FALSE },
5385 { ".page[23]", ACTION_PAGE_23, FALSE },
5386 { ".page[24]", ACTION_PAGE_24, FALSE },
5387 { ".page[25]", ACTION_PAGE_25, FALSE },
5388 { ".page[26]", ACTION_PAGE_26, FALSE },
5389 { ".page[27]", ACTION_PAGE_27, FALSE },
5390 { ".page[28]", ACTION_PAGE_28, FALSE },
5391 { ".page[29]", ACTION_PAGE_29, FALSE },
5392 { ".page[30]", ACTION_PAGE_30, FALSE },
5393 { ".page[31]", ACTION_PAGE_31, FALSE },
5394 { ".page[32]", ACTION_PAGE_32, FALSE },
5395 { ".other", ACTION_OTHER, FALSE },
5397 /* empty suffix always matches -- check as last entry in InitSoundInfo() */
5398 { "", ACTION_DEFAULT, TRUE },
5403 struct ElementDirectionInfo element_direction_info[NUM_DIRECTIONS_FULL + 1] =
5405 { ".left", MV_BIT_LEFT },
5406 { ".right", MV_BIT_RIGHT },
5407 { ".up", MV_BIT_UP },
5408 { ".down", MV_BIT_DOWN },
5409 { ".upleft", MV_BIT_UP },
5410 { ".upright", MV_BIT_RIGHT },
5411 { ".downleft", MV_BIT_LEFT },
5412 { ".downright", MV_BIT_DOWN },
5417 struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] =
5419 { ".[DEFAULT]", GFX_SPECIAL_ARG_DEFAULT, },
5420 { ".LOADING", GFX_SPECIAL_ARG_LOADING, },
5421 { ".TITLE_INITIAL", GFX_SPECIAL_ARG_TITLE_INITIAL, },
5422 { ".TITLE", GFX_SPECIAL_ARG_TITLE, },
5423 { ".MAIN", GFX_SPECIAL_ARG_MAIN, },
5424 { ".LEVELS", GFX_SPECIAL_ARG_LEVELS },
5425 { ".SCORES", GFX_SPECIAL_ARG_SCORES, },
5426 { ".EDITOR", GFX_SPECIAL_ARG_EDITOR, },
5427 { ".INFO", GFX_SPECIAL_ARG_INFO, },
5428 { ".SETUP", GFX_SPECIAL_ARG_SETUP, },
5429 { ".PLAYING", GFX_SPECIAL_ARG_PLAYING, },
5430 { ".DOOR", GFX_SPECIAL_ARG_DOOR, },
5431 { ".PANEL", GFX_SPECIAL_ARG_PANEL, },
5432 { ".PREVIEW", GFX_SPECIAL_ARG_PREVIEW, },
5433 { ".CRUMBLED", GFX_SPECIAL_ARG_CRUMBLED, },
5435 /* empty suffix always matches -- check as last entry in InitMusicInfo() */
5436 { "", GFX_SPECIAL_ARG_DEFAULT, },
5441 #include "conf_var.c" /* include auto-generated data structure definitions */
5444 /* ------------------------------------------------------------------------- */
5445 /* font definitions */
5446 /* ------------------------------------------------------------------------- */
5448 /* Important: When one entry is a prefix of another entry, the longer entry
5449 must come first, because the dynamic configuration does prefix matching!
5450 (These definitions must match the corresponding definitions in "main.h"!) */
5452 struct FontInfo font_info[NUM_FONTS + 1] =
5454 { "font.initial_1" },
5455 { "font.initial_2" },
5456 { "font.initial_3" },
5457 { "font.initial_4" },
5460 { "font.menu_1.active" },
5461 { "font.menu_2.active" },
5464 { "font.text_1.active" },
5465 { "font.text_2.active" },
5466 { "font.text_3.active" },
5467 { "font.text_4.active" },
5472 { "font.envelope_1" },
5473 { "font.envelope_2" },
5474 { "font.envelope_3" },
5475 { "font.envelope_4" },
5476 { "font.input_1.active" },
5477 { "font.input_2.active" },
5480 { "font.option_off" },
5481 { "font.option_on" },
5484 { "font.value_old" },
5485 { "font.level_number.active" },
5486 { "font.level_number" },
5487 { "font.tape_recorder" },
5488 { "font.game_info" },
5489 { "font.info.elements" },
5490 { "font.info.levelset" },
5496 /* ------------------------------------------------------------------------- */
5497 /* music token prefix definitions */
5498 /* ------------------------------------------------------------------------- */
5500 struct MusicPrefixInfo music_prefix_info[NUM_MUSIC_PREFIXES + 1] =
5502 { "background", TRUE },
5508 /* ========================================================================= */
5510 /* ========================================================================= */
5512 static void print_usage()
5515 "Usage: %s [OPTION]... [HOSTNAME [PORT]]\n"
5518 " -d, --display HOSTNAME[:SCREEN] specify X server display\n"
5519 " -b, --basepath DIRECTORY alternative base DIRECTORY\n"
5520 " -l, --level DIRECTORY alternative level DIRECTORY\n"
5521 " -g, --graphics DIRECTORY alternative graphics DIRECTORY\n"
5522 " -s, --sounds DIRECTORY alternative sounds DIRECTORY\n"
5523 " -m, --music DIRECTORY alternative music DIRECTORY\n"
5524 " -n, --network network multiplayer game\n"
5525 " --serveronly only start network server\n"
5526 " -v, --verbose verbose mode\n"
5527 " --debug display debugging information\n"
5528 " --debug-x11-sync enable X11 synchronous mode\n"
5529 " -e, --execute COMMAND execute batch COMMAND\n"
5531 "Valid commands for '--execute' option:\n"
5532 " \"print graphicsinfo.conf\" print default graphics config\n"
5533 " \"print soundsinfo.conf\" print default sounds config\n"
5534 " \"print musicinfo.conf\" print default music config\n"
5535 " \"print editorsetup.conf\" print default editor config\n"
5536 " \"print helpanim.conf\" print default helpanim config\n"
5537 " \"print helptext.conf\" print default helptext config\n"
5538 " \"dump level FILE\" dump level data from FILE\n"
5539 " \"dump tape FILE\" dump tape data from FILE\n"
5540 " \"autoplay LEVELDIR [NR ...]\" play level tapes for LEVELDIR\n"
5541 " \"convert LEVELDIR [NR]\" convert levels in LEVELDIR\n"
5542 " \"create images DIRECTORY\" write BMP images to DIRECTORY\n"
5544 program.command_basename);
5547 int main(int argc, char *argv[])
5549 char * window_title_string = getWindowTitleString();
5551 InitProgramInfo(argv[0], USERDATA_DIRECTORY, USERDATA_DIRECTORY_UNIX,
5552 PROGRAM_TITLE_STRING, window_title_string, ICON_TITLE_STRING,
5553 X11_ICON_FILENAME, X11_ICONMASK_FILENAME, SDL_ICON_FILENAME,
5554 MSDOS_POINTER_FILENAME,
5555 COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL);
5557 InitExitFunction(CloseAllAndExit);
5558 InitPlatformDependentStuff();
5560 GetOptions(argv, print_usage);
5566 return 0; /* to keep compilers happy */