1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
7 // http://www.artsoft.org/
8 // ----------------------------------------------------------------------------
10 // ============================================================================
12 #include "libgame/libgame.h"
22 Bitmap *bitmap_db_store;
23 Bitmap *bitmap_db_cross;
24 Bitmap *bitmap_db_field;
25 Bitmap *bitmap_db_panel;
26 Bitmap *bitmap_db_door_1;
27 Bitmap *bitmap_db_door_2;
28 Bitmap *bitmap_db_toons;
29 DrawBuffer *fieldbuffer;
30 DrawBuffer *drawto_field;
33 boolean level_editor_test_game = FALSE;
34 boolean network_playing = FALSE;
36 #if defined(TARGET_SDL)
37 boolean network_server = FALSE;
38 SDL_Thread *server_thread;
41 int key_joystick_mapping = 0;
43 boolean redraw[2 + MAX_LEV_FIELDX + 2][2 + MAX_LEV_FIELDY + 2];
44 int redraw_x1 = 0, redraw_y1 = 0;
46 short Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
47 short MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
48 short MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
49 short MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
50 short ChangeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
51 short ChangePage[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
52 short CustomValue[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
53 short Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
54 short Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
55 short StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
56 short Back[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
57 boolean Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
58 boolean Pushed[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
59 short ChangeCount[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
60 short ChangeEvent[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
61 short WasJustMoving[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
62 short WasJustFalling[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
63 short CheckCollision[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
64 short CheckImpact[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
65 short AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
66 short AmoebaCnt[MAX_NUM_AMOEBA];
67 short AmoebaCnt2[MAX_NUM_AMOEBA];
68 short ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
69 short ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
70 short ExplodeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
71 int RunnerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
72 int PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
74 int GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
75 int GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
76 int GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
77 int GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
78 int GfxDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
79 int GfxRedraw[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
81 int ActiveElement[MAX_NUM_ELEMENTS];
82 int ActiveButton[NUM_IMAGE_FILES];
83 int ActiveFont[NUM_FONTS];
85 int lev_fieldx, lev_fieldy;
86 int scroll_x, scroll_y;
88 int WIN_XSIZE = 672, WIN_YSIZE = 560;
89 int SCR_FIELDX = 17, SCR_FIELDY = 17;
90 int REAL_SX = 6, REAL_SY = 6;
92 int DX = 566, DY = 60;
93 int VX = 566, VY = 400;
94 int EX = 566, EY = 356;
96 int FULL_SXSIZE = 2 + 17 * TILEX + 2; /* 2 + SXSIZE + 2 */
97 int FULL_SYSIZE = 2 + 17 * TILEY + 2; /* 2 + SYSIZE + 2 */
98 int SXSIZE = 17 * TILEX; /* SCR_FIELDX * TILEX */
99 int SYSIZE = 17 * TILEY; /* SCR_FIELDY * TILEY */
106 int TILESIZE_VAR = TILESIZE;
110 int ScreenMovDir = MV_NONE, ScreenMovPos = 0;
111 int ScreenGfxPos = 0;
112 int BorderElement = EL_STEELWALL;
113 int GameFrameDelay = GAME_FRAME_DELAY;
114 int FfwdFrameDelay = FFWD_FRAME_DELAY;
117 int SBX_Left, SBX_Right;
118 int SBY_Upper, SBY_Lower;
123 int TimeFrames, TimePlayed, TimeLeft, TapeTime;
125 boolean network_player_action_received = FALSE;
127 struct LevelSetInfo levelset;
128 struct LevelInfo level, level_template;
129 struct PlayerInfo stored_player[MAX_PLAYERS], *local_player = NULL;
130 struct HiScore highscore[MAX_SCORE_ENTRIES];
131 struct TapeInfo tape;
132 struct SetupInfo setup;
133 struct GameInfo game;
134 struct GlobalInfo global;
135 struct BorderInfo border;
136 struct ViewportInfo viewport;
137 struct TitleFadingInfo fading;
138 struct TitleFadingInfo title_initial_default;
139 struct TitleFadingInfo title_default;
140 struct TitleMessageInfo titlemessage_initial_default;
141 struct TitleMessageInfo titlemessage_initial[MAX_NUM_TITLE_MESSAGES];
142 struct TitleMessageInfo titlemessage_default;
143 struct TitleMessageInfo titlemessage[MAX_NUM_TITLE_MESSAGES];
144 struct TitleMessageInfo readme;
145 struct InitInfo init, init_last;
146 struct MenuInfo menu;
147 struct DoorInfo door_1, door_2;
148 struct RequestInfo request;
149 struct PreviewInfo preview;
150 struct EditorInfo editor;
152 struct GraphicInfo *graphic_info = NULL;
153 struct SoundInfo *sound_info = NULL;
154 struct MusicInfo *music_info = NULL;
155 struct MusicFileInfo *music_file_info = NULL;
156 struct HelpAnimInfo *helpanim_info = NULL;
158 SetupFileHash *helptext_info = NULL;
159 SetupFileHash *image_config_hash = NULL;
160 SetupFileHash *element_token_hash = NULL;
161 SetupFileHash *graphic_token_hash = NULL;
162 SetupFileHash *font_token_hash = NULL;
165 /* ------------------------------------------------------------------------- */
166 /* element definitions */
167 /* ------------------------------------------------------------------------- */
169 struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1];
171 /* this contains predefined structure elements to initialize "element_info" */
172 struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
174 /* keyword to start parser: "ELEMENT_INFO_START" <-- do not change! */
176 /* ----------------------------------------------------------------------- */
177 /* "real" level file elements */
178 /* ----------------------------------------------------------------------- */
228 "bug (random start direction)"
233 "spaceship (random start direction)"
238 "yam yam (random start direction)"
268 "quicksand (with rock)"
298 "dropping amoeba (EM style)"
313 "Conway's wall of life"
336 "robot_wheel.active",
338 "magic wheel (running)"
383 "gray door (opened by key 1)"
388 "gray door (opened by key 2)"
393 "gray door (opened by key 3)"
398 "gray door (opened by key 4)"
408 "pac man (random start direction)"
413 "invisible normal wall"
438 "amoeba with content"
458 "growing wall (horizontal, visible)"
473 "wall with BD style diamond"
476 "wall_emerald_yellow",
478 "wall with yellow emerald"
488 "magic wall (BD style)"
491 "invisible_steelwall",
493 "invisible steel wall"
496 "sokoban_field_player",
498 "sokoban field with player"
501 "dynabomb_increase_number",
503 "increases number of bombs"
506 "dynabomb_increase_size",
508 "increases explosion size"
511 "dynabomb_increase_power",
513 "increases power of explosion"
521 "sokoban_field_empty",
523 "sokoban empty field"
526 "sokoban_field_full",
528 "sokoban field with object"
531 "bd_butterfly.right",
533 "butterfly (starts moving right)"},
537 "butterfly (starts moving up)"
542 "butterfly (starts moving left)"},
546 "butterfly (starts moving down)"},
550 "firefly (starts moving right)"
555 "firefly (starts moving up)"
560 "firefly (starts moving left)"
565 "firefly (starts moving down)"
570 "butterfly (random start direction)"
575 "firefly (random start direction)"
600 "bug (starts moving right)"
605 "bug (starts moving up)"
610 "bug (starts moving left)"
615 "bug (starts moving down)"
620 "spaceship (starts moving right)"},
624 "spaceship (starts moving up)"
629 "spaceship (starts moving left)"},
633 "spaceship (starts moving down)"},
637 "pac man (starts moving right)"
642 "pac man (starts moving up)"
647 "pac man (starts moving left)"
652 "pac man (starts moving down)"
667 "wall with red emerald"
670 "wall_emerald_purple",
672 "wall with purple emerald"
677 "acid pool (top left)"
680 "acid_pool_topright",
682 "acid pool (top right)"
685 "acid_pool_bottomleft",
687 "acid pool (bottom left)"
695 "acid_pool_bottomright",
697 "acid pool (bottom right)"
702 "normal wall (BD style)"
727 "mole (random start direction)"
767 "fire breathing dragon"
770 "em_key_1_file_obsolete",
1080 "char_bracketright",
1175 "expandable_wall_horizontal",
1177 "growing wall (horizontal)"
1180 "expandable_wall_vertical",
1182 "growing wall (vertical)"
1185 "expandable_wall_any",
1187 "growing wall (any direction)"
1210 "em_key_2_file_obsolete",
1215 "em_key_3_file_obsolete",
1220 "em_key_4_file_obsolete",
1272 "port (leading right)"
1277 "port (leading down)"
1282 "port (leading left)"
1290 "sp_gravity_port_right",
1292 "gravity-on/off port (leading right)"
1295 "sp_gravity_port_down",
1297 "gravity-on/off port (leading down)"
1300 "sp_gravity_port_left",
1302 "gravity-on/off port (leading left)"
1305 "sp_gravity_port_up",
1307 "gravity-on/off port (leading up)"
1335 "sp_port_horizontal",
1342 "port (any direction)"
1365 "sp_hardware_base_1",
1370 "sp_hardware_green",
1385 "sp_hardware_yellow",
1390 "sp_hardware_base_2",
1395 "sp_hardware_base_3",
1400 "sp_hardware_base_4",
1405 "sp_hardware_base_5",
1410 "sp_hardware_base_6",
1427 "gray door (EM style, key 1)"
1432 "gray door (EM style, key 2)"
1437 "gray door (EM style, key 3)"
1442 "gray door (EM style, key 4)"
1447 "dynamite (EM style)"
1450 "em_dynamite.active",
1452 "burning dynamite (EM style)"
1480 "dc_gate_white_gray",
1482 "gray door (opened by white key)"
1502 "switch gate (open)"
1505 "switchgate_closed",
1507 "switch gate (closed)"
1510 "switchgate_switch_up",
1511 "switchgate_switch",
1512 "switch for switch gate"
1515 "switchgate_switch_down",
1516 "switchgate_switch",
1517 "switch for switch gate"
1530 "conveyor_belt_1_left",
1532 "conveyor belt 1 (left)"
1535 "conveyor_belt_1_middle",
1537 "conveyor belt 1 (middle)"
1540 "conveyor_belt_1_right",
1542 "conveyor belt 1 (right)"
1545 "conveyor_belt_1_switch_left",
1546 "conveyor_belt_switch",
1547 "switch for conveyor belt 1 (left)"
1550 "conveyor_belt_1_switch_middle",
1551 "conveyor_belt_switch",
1552 "switch for conveyor belt 1 (middle)"
1555 "conveyor_belt_1_switch_right",
1556 "conveyor_belt_switch",
1557 "switch for conveyor belt 1 (right)"
1560 "conveyor_belt_2_left",
1562 "conveyor belt 2 (left)"
1565 "conveyor_belt_2_middle",
1567 "conveyor belt 2 (middle)"
1570 "conveyor_belt_2_right",
1572 "conveyor belt 2 (right)"
1575 "conveyor_belt_2_switch_left",
1576 "conveyor_belt_switch",
1577 "switch for conveyor belt 2 (left)"
1580 "conveyor_belt_2_switch_middle",
1581 "conveyor_belt_switch",
1582 "switch for conveyor belt 2 (middle)"
1585 "conveyor_belt_2_switch_right",
1586 "conveyor_belt_switch",
1587 "switch for conveyor belt 2 (right)"
1590 "conveyor_belt_3_left",
1592 "conveyor belt 3 (left)"
1595 "conveyor_belt_3_middle",
1597 "conveyor belt 3 (middle)"
1600 "conveyor_belt_3_right",
1602 "conveyor belt 3 (right)"
1605 "conveyor_belt_3_switch_left",
1606 "conveyor_belt_switch",
1607 "switch for conveyor belt 3 (left)"
1610 "conveyor_belt_3_switch_middle",
1611 "conveyor_belt_switch",
1612 "switch for conveyor belt 3 (middle)"
1615 "conveyor_belt_3_switch_right",
1616 "conveyor_belt_switch",
1617 "switch for conveyor belt 3 (right)"
1620 "conveyor_belt_4_left",
1622 "conveyor belt 4 (left)"
1625 "conveyor_belt_4_middle",
1627 "conveyor belt 4 (middle)"
1630 "conveyor_belt_4_right",
1632 "conveyor belt 4 (right)"
1635 "conveyor_belt_4_switch_left",
1636 "conveyor_belt_switch",
1637 "switch for conveyor belt 4 (left)"
1640 "conveyor_belt_4_switch_middle",
1641 "conveyor_belt_switch",
1642 "switch for conveyor belt 4 (middle)"
1645 "conveyor_belt_4_switch_right",
1646 "conveyor_belt_switch",
1647 "switch for conveyor belt 4 (right)"
1652 "land mine (not removable)"
1655 "envelope_obsolete",
1657 "envelope (OBSOLETE)"
1662 "light switch (off)"
1665 "light_switch.active",
1672 "sign (exclamation)"
1675 "sign_radioactivity",
1677 "sign (radio activity)"
1687 "sign (wheel chair)"
1710 "sign_entry_forbidden",
1712 "sign (entry forbidden)"
1715 "sign_emergency_exit",
1717 "sign (emergency exit)"
1732 "mole (starts moving left)"
1737 "mole (starts moving right)"
1742 "mole (starts moving up)"
1747 "mole (starts moving down)"
1750 "steelwall_slippery",
1752 "slippery steel wall"
1762 "dx unknown element 15"
1767 "dx unknown element 42"
1782 "shield (deadly, kills enemies)"
1792 "time gate (closed)"
1795 "timegate_switch.active",
1797 "switch for time gate"
1802 "switch for time gate"
1810 "balloon_switch_left",
1812 "wind switch (left)"
1815 "balloon_switch_right",
1817 "wind switch (right)"
1820 "balloon_switch_up",
1825 "balloon_switch_down",
1827 "wind switch (down)"
1830 "balloon_switch_any",
1832 "wind switch (any direction)"
1897 "tube (any direction)"
1910 "tube_vertical_left",
1912 "tube (vertical & left)"
1915 "tube_vertical_right",
1917 "tube (vertical & right)"
1920 "tube_horizontal_up",
1922 "tube (horizontal & up)"
1925 "tube_horizontal_down",
1927 "tube (horizontal & down)"
1937 "tube (left & down)"
1947 "tube (right & down)"
1962 "stable bomb (DX style)"
2472 "custom element 100"
2477 "custom element 101"
2482 "custom element 102"
2487 "custom element 103"
2492 "custom element 104"
2497 "custom element 105"
2502 "custom element 106"
2507 "custom element 107"
2512 "custom element 108"
2517 "custom element 109"
2522 "custom element 110"
2527 "custom element 111"
2532 "custom element 112"
2537 "custom element 113"
2542 "custom element 114"
2547 "custom element 115"
2552 "custom element 116"
2557 "custom element 117"
2562 "custom element 118"
2567 "custom element 119"
2572 "custom element 120"
2577 "custom element 121"
2582 "custom element 122"
2587 "custom element 123"
2592 "custom element 124"
2597 "custom element 125"
2602 "custom element 126"
2607 "custom element 127"
2612 "custom element 128"
2617 "custom element 129"
2622 "custom element 130"
2627 "custom element 131"
2632 "custom element 132"
2637 "custom element 133"
2642 "custom element 134"
2647 "custom element 135"
2652 "custom element 136"
2657 "custom element 137"
2662 "custom element 138"
2667 "custom element 139"
2672 "custom element 140"
2677 "custom element 141"
2682 "custom element 142"
2687 "custom element 143"
2692 "custom element 144"
2697 "custom element 145"
2702 "custom element 146"
2707 "custom element 147"
2712 "custom element 148"
2717 "custom element 149"
2722 "custom element 150"
2727 "custom element 151"
2732 "custom element 152"
2737 "custom element 153"
2742 "custom element 154"
2747 "custom element 155"
2752 "custom element 156"
2757 "custom element 157"
2762 "custom element 158"
2767 "custom element 159"
2772 "custom element 160"
2777 "custom element 161"
2782 "custom element 162"
2787 "custom element 163"
2792 "custom element 164"
2797 "custom element 165"
2802 "custom element 166"
2807 "custom element 167"
2812 "custom element 168"
2817 "custom element 169"
2822 "custom element 170"
2827 "custom element 171"
2832 "custom element 172"
2837 "custom element 173"
2842 "custom element 174"
2847 "custom element 175"
2852 "custom element 176"
2857 "custom element 177"
2862 "custom element 178"
2867 "custom element 179"
2872 "custom element 180"
2877 "custom element 181"
2882 "custom element 182"
2887 "custom element 183"
2892 "custom element 184"
2897 "custom element 185"
2902 "custom element 186"
2907 "custom element 187"
2912 "custom element 188"
2917 "custom element 189"
2922 "custom element 190"
2927 "custom element 191"
2932 "custom element 192"
2937 "custom element 193"
2942 "custom element 194"
2947 "custom element 195"
2952 "custom element 196"
2957 "custom element 197"
2962 "custom element 198"
2967 "custom element 199"
2972 "custom element 200"
2977 "custom element 201"
2982 "custom element 202"
2987 "custom element 203"
2992 "custom element 204"
2997 "custom element 205"
3002 "custom element 206"
3007 "custom element 207"
3012 "custom element 208"
3017 "custom element 209"
3022 "custom element 210"
3027 "custom element 211"
3032 "custom element 212"
3037 "custom element 213"
3042 "custom element 214"
3047 "custom element 215"
3052 "custom element 216"
3057 "custom element 217"
3062 "custom element 218"
3067 "custom element 219"
3072 "custom element 220"
3077 "custom element 221"
3082 "custom element 222"
3087 "custom element 223"
3092 "custom element 224"
3097 "custom element 225"
3102 "custom element 226"
3107 "custom element 227"
3112 "custom element 228"
3117 "custom element 229"
3122 "custom element 230"
3127 "custom element 231"
3132 "custom element 232"
3137 "custom element 233"
3142 "custom element 234"
3147 "custom element 235"
3152 "custom element 236"
3157 "custom element 237"
3162 "custom element 238"
3167 "custom element 239"
3172 "custom element 240"
3177 "custom element 241"
3182 "custom element 242"
3187 "custom element 243"
3192 "custom element 244"
3197 "custom element 245"
3202 "custom element 246"
3207 "custom element 247"
3212 "custom element 248"
3217 "custom element 249"
3222 "custom element 250"
3227 "custom element 251"
3232 "custom element 252"
3237 "custom element 253"
3242 "custom element 254"
3247 "custom element 255"
3252 "custom element 256"
3462 "element triggering change"
3467 "player triggering change"
3470 "sp_gravity_on_port_right",
3471 "sp_gravity_on_port",
3472 "gravity-on port (leading right)"
3475 "sp_gravity_on_port_down",
3476 "sp_gravity_on_port",
3477 "gravity-on port (leading down)"
3480 "sp_gravity_on_port_left",
3481 "sp_gravity_on_port",
3482 "gravity-on port (leading left)"
3485 "sp_gravity_on_port_up",
3486 "sp_gravity_on_port",
3487 "gravity-on port (leading up)"
3490 "sp_gravity_off_port_right",
3491 "sp_gravity_off_port",
3492 "gravity-off port (leading right)"
3495 "sp_gravity_off_port_down",
3496 "sp_gravity_off_port",
3497 "gravity-off port (leading down)"
3500 "sp_gravity_off_port_left",
3501 "sp_gravity_off_port",
3502 "gravity-off port (leading left)"
3505 "sp_gravity_off_port_up",
3506 "sp_gravity_off_port",
3507 "gravity-off port (leading up)"
3510 "balloon_switch_none",
3517 "door 5 (EMC style)",
3522 "door 6 (EMC style)",
3527 "door 7 (EMC style)",
3532 "door 8 (EMC style)",
3537 "gray door (EMC style, key 5)",
3542 "gray door (EMC style, key 6)",
3547 "gray door (EMC style, key 7)",
3552 "gray door (EMC style, key 8)",
3557 "key 5 (EMC style)",
3562 "key 6 (EMC style)",
3567 "key 7 (EMC style)",
3572 "key 8 (EMC style)",
3590 "emc_magic_ball.active",
3592 "magic ball (activated)",
3595 "emc_magic_ball_switch",
3596 "emc_magic_ball_switch",
3597 "magic ball switch (off)",
3600 "emc_magic_ball_switch.active",
3601 "emc_magic_ball_switch",
3602 "magic ball switch (on)",
3605 "emc_spring_bumper",
3606 "emc_spring_bumper",
3665 "emc_wall_slippery_1",
3670 "emc_wall_slippery_2",
3675 "emc_wall_slippery_3",
3680 "emc_wall_slippery_4",
3702 "CE value of element triggering change"
3707 "CE score of element triggering change"
3712 "CE value of current element"
3717 "CE score of current element"
3722 "yam yam (starts moving left)"
3727 "yam yam (starts moving right)"
3732 "yam yam (starts moving up)"
3737 "yam yam (starts moving down)"
3740 "bd_expandable_wall",
3742 "growing wall (horizontal, BD style)"
3747 "CE 8 positions earlier in list"
3752 "CE 7 positions earlier in list"
3757 "CE 6 positions earlier in list"
3762 "CE 5 positions earlier in list"
3767 "CE 4 positions earlier in list"
3772 "CE 3 positions earlier in list"
3777 "CE 2 positions earlier in list"
3782 "CE 1 position earlier in list"
3787 "the current custom element"
3792 "CE 1 position later in list"
3797 "CE 2 positions later in list"
3802 "CE 3 positions later in list"
3807 "CE 4 positions later in list"
3812 "CE 5 positions later in list"
3817 "CE 6 positions later in list"
3822 "CE 7 positions later in list"
3827 "CE 8 positions later in list"
3832 "this element matches any element"
3840 "steel_char_exclam",
3845 "steel_char_quotedbl",
3850 "steel_char_numbersign",
3855 "steel_char_dollar",
3860 "steel_char_percent",
3865 "steel_char_ampersand",
3870 "steel_char_apostrophe",
3875 "steel_char_parenleft",
3880 "steel_char_parenright",
3885 "steel_char_asterisk",
3905 "steel_char_period",
3970 "steel_char_semicolon",
3985 "steel_char_greater",
3990 "steel_char_question",
4130 "steel_char_bracketleft",
4135 "steel_char_backslash",
4140 "steel_char_bracketright",
4145 "steel_char_asciicircum",
4150 "steel_char_underscore",
4155 "steel_char_copyright",
4157 "steel letter '\xa9'"
4160 "steel_char_aumlaut",
4162 "steel letter '\xc4'"
4165 "steel_char_oumlaut",
4167 "steel letter '\xd6'"
4170 "steel_char_uumlaut",
4172 "steel letter '\xdc'"
4175 "steel_char_degree",
4177 "steel letter '\xb0'"
4180 "steel_char_trademark",
4182 "steel letter '\xae'"
4185 "steel_char_cursor",
4187 "steel letter '\xa0'"
4190 "steel_char_unused",
4195 "steel_char_unused",
4200 "steel_char_unused",
4205 "steel_char_unused",
4210 "steel_char_unused",
4215 "steel_char_unused",
4220 "steel_char_unused",
4222 "steel letter 'button'"
4225 "steel_char_unused",
4230 "steel_char_unused",
4232 "steel letter 'down'"
4285 "steel_exit_closed",
4295 "dc_steelwall_1_left",
4300 "dc_steelwall_1_right",
4302 "steel wall (right)"
4305 "dc_steelwall_1_top",
4310 "dc_steelwall_1_bottom",
4312 "steel wall (bottom)"
4315 "dc_steelwall_1_horizontal",
4317 "steel wall (top/bottom)"
4320 "dc_steelwall_1_vertical",
4322 "steel wall (left/right)"
4325 "dc_steelwall_1_topleft",
4327 "steel wall (top/left)"
4330 "dc_steelwall_1_topright",
4332 "steel wall (top/right)"
4335 "dc_steelwall_1_bottomleft",
4337 "steel wall (bottom/left)"
4340 "dc_steelwall_1_bottomright",
4342 "steel wall (bottom/right)"
4345 "dc_steelwall_1_topleft_2",
4347 "steel wall (top/left corner)"
4350 "dc_steelwall_1_topright_2",
4352 "steel wall (top/right corner)"
4355 "dc_steelwall_1_bottomleft_2",
4357 "steel wall (bottom/left corner)"
4360 "dc_steelwall_1_bottomright_2",
4362 "steel wall (bottom/right corner)"
4365 "dc_steelwall_2_left",
4370 "dc_steelwall_2_right",
4372 "steel wall (right)"
4375 "dc_steelwall_2_top",
4380 "dc_steelwall_2_bottom",
4382 "steel wall (bottom)"
4385 "dc_steelwall_2_horizontal",
4387 "steel wall (horizontal)"
4390 "dc_steelwall_2_vertical",
4392 "steel wall (vertical)"
4395 "dc_steelwall_2_middle",
4397 "steel wall (middle)"
4400 "dc_steelwall_2_single",
4402 "steel wall (single)"
4405 "dc_switchgate_switch_up",
4406 "switchgate_switch",
4407 "switch for switch gate (steel)"
4410 "dc_switchgate_switch_down",
4411 "switchgate_switch",
4412 "switch for switch gate (steel)"
4415 "dc_timegate_switch",
4417 "switch for time gate (steel)"
4420 "dc_timegate_switch.active",
4422 "switch for time gate (steel)"
4427 "land mine (DC style, removable)"
4430 "expandable_steelwall",
4432 "growing steel wall"
4435 "expandable_steelwall_horizontal",
4437 "growing steel wall (horizontal)"
4440 "expandable_steelwall_vertical",
4442 "growing steel wall (vertical)"
4445 "expandable_steelwall_any",
4447 "growing steel wall (any direction)"
4452 "closed exit (EM style)"
4457 "open exit (EM style)"
4460 "em_steel_exit_closed",
4462 "closed steel exit (EM style)"
4465 "em_steel_exit_open",
4467 "open steel exit (EM style)"
4470 "dc_gate_fake_gray",
4472 "gray door (opened by no key)"
4477 "magic wall (DC style)"
4480 "quicksand_fast_empty",
4482 "fast quicksand (empty)"
4485 "quicksand_fast_full",
4487 "fast quicksand (with rock)"
4490 "from_level_template",
4491 "from_level_template",
4492 "element taken from level template"
4495 /* ----------------------------------------------------------------------- */
4496 /* "real" (and therefore drawable) runtime elements */
4497 /* ----------------------------------------------------------------------- */
4500 "dynabomb_player_1.active",
4505 "dynabomb_player_2.active",
4510 "dynabomb_player_3.active",
4515 "dynabomb_player_4.active",
4520 "sp_disk_red.active",
4525 "switchgate.opening",
4530 "switchgate.closing",
4555 "invisible_steelwall.active",
4560 "invisible_wall.active",
4565 "invisible_sand.active",
4570 "conveyor_belt_1_left.active",
4575 "conveyor_belt_1_middle.active",
4580 "conveyor_belt_1_right.active",
4585 "conveyor_belt_2_left.active",
4590 "conveyor_belt_2_middle.active",
4595 "conveyor_belt_2_right.active",
4600 "conveyor_belt_3_left.active",
4605 "conveyor_belt_3_middle.active",
4610 "conveyor_belt_3_right.active",
4615 "conveyor_belt_4_left.active",
4620 "conveyor_belt_4_middle.active",
4625 "conveyor_belt_4_right.active",
4640 "steel_exit.opening",
4645 "steel_exit.closing",
4660 "em_steel_exit.opening",
4665 "em_steel_exit.closing",
4685 "sp_terminal.active",
4690 "sp_buggy_base.activating",
4695 "sp_buggy_base.active",
4710 "quicksand.emptying",
4715 "quicksand_fast.emptying",
4720 "magic_wall.active",
4725 "bd_magic_wall.active",
4730 "dc_magic_wall.active",
4740 "bd_magic_wall_full",
4745 "dc_magic_wall_full",
4750 "magic_wall.emptying",
4755 "bd_magic_wall.emptying",
4760 "dc_magic_wall.emptying",
4770 "bd_magic_wall_dead",
4775 "dc_magic_wall_dead",
4781 "emc_fake_grass.active",
4786 "gate_1_gray.active",
4791 "gate_2_gray.active",
4796 "gate_3_gray.active",
4801 "gate_4_gray.active",
4806 "em_gate_1_gray.active",
4811 "em_gate_2_gray.active",
4816 "em_gate_3_gray.active",
4821 "em_gate_4_gray.active",
4826 "emc_gate_5_gray.active",
4831 "emc_gate_6_gray.active",
4836 "emc_gate_7_gray.active",
4841 "emc_gate_8_gray.active",
4846 "dc_gate_white_gray.active",
4851 "emc_dripper.active",
4856 "emc_spring_bumper.active",
4857 "emc_spring_bumper",
4861 /* ----------------------------------------------------------------------- */
4862 /* "unreal" (and therefore not drawable) runtime elements */
4863 /* ----------------------------------------------------------------------- */
4891 "acid_splash_right",
4906 "expandable_wall.growing",
4911 "expandable_steelwall.growing",
4921 "player_is_leaving",
4926 "player_is_exploding_1",
4931 "player_is_exploding_2",
4936 "player_is_exploding_3",
4941 "player_is_exploding_4",
4946 "quicksand.filling",
4951 "quicksand_fast.filling",
4956 "magic_wall.filling",
4961 "bd_magic_wall.filling",
4966 "dc_magic_wall.filling",
4976 "diagonal.shrinking",
4986 /* ----------------------------------------------------------------------- */
4987 /* dummy elements (never used as game elements, only used as graphics) */
4988 /* ----------------------------------------------------------------------- */
4991 "steelwall_topleft",
4996 "steelwall_topright",
5001 "steelwall_bottomleft",
5006 "steelwall_bottomright",
5011 "steelwall_horizontal",
5016 "steelwall_vertical",
5021 "invisible_steelwall_topleft",
5026 "invisible_steelwall_topright",
5031 "invisible_steelwall_bottomleft",
5036 "invisible_steelwall_bottomright",
5041 "invisible_steelwall_horizontal",
5046 "invisible_steelwall_vertical",
5061 "dynabomb_player_1",
5066 "dynabomb_player_2",
5071 "dynabomb_player_3",
5076 "dynabomb_player_4",
5081 "shield_normal.active",
5086 "shield_deadly.active",
5156 "internal_clipboard_custom",
5158 "empty custom element"
5161 "internal_clipboard_change",
5166 "internal_clipboard_group",
5168 "empty group element"
5176 "internal_cascade_bd",
5178 "show Boulder Dash elements"
5181 "internal_cascade_bd.active",
5183 "hide Boulder Dash elements"
5186 "internal_cascade_em",
5188 "show Emerald Mine elements"
5191 "internal_cascade_em.active",
5193 "hide Emerald Mine elements"
5196 "internal_cascade_emc",
5198 "show Emerald Mine Club elements"
5201 "internal_cascade_emc.active",
5203 "hide Emerald Mine Club elements"
5206 "internal_cascade_rnd",
5208 "show Rocks'n'Diamonds elements"
5211 "internal_cascade_rnd.active",
5213 "hide Rocks'n'Diamonds elements"
5216 "internal_cascade_sb",
5218 "show Sokoban elements"
5221 "internal_cascade_sb.active",
5223 "hide Sokoban elements"
5226 "internal_cascade_sp",
5228 "show Supaplex elements"
5231 "internal_cascade_sp.active",
5233 "hide Supaplex elements"
5236 "internal_cascade_dc",
5238 "show Diamond Caves II elements"
5241 "internal_cascade_dc.active",
5243 "hide Diamond Caves II elements"
5246 "internal_cascade_dx",
5248 "show DX Boulderdash elements"
5251 "internal_cascade_dx.active",
5253 "hide DX Boulderdash elements"
5256 "internal_cascade_chars",
5258 "show text elements"
5261 "internal_cascade_chars.active",
5263 "hide text elements"
5266 "internal_cascade_steel_chars",
5268 "show steel text elements"
5271 "internal_cascade_steel_chars.active",
5273 "hide steel text elements"
5276 "internal_cascade_ce",
5278 "show custom elements"
5281 "internal_cascade_ce.active",
5283 "hide custom elements"
5286 "internal_cascade_ge",
5288 "show group elements"
5291 "internal_cascade_ge.active",
5293 "hide group elements"
5296 "internal_cascade_ref",
5298 "show reference elements"
5301 "internal_cascade_ref.active",
5303 "hide reference elements"
5306 "internal_cascade_user",
5308 "show user defined elements"
5311 "internal_cascade_user.active",
5313 "hide user defined elements"
5316 "internal_cascade_dynamic",
5318 "show elements used in this level"
5321 "internal_cascade_dynamic.active",
5323 "hide elements used in this level"
5326 /* keyword to stop parser: "ELEMENT_INFO_END" <-- do not change! */
5336 /* ------------------------------------------------------------------------- */
5337 /* element action and direction definitions */
5338 /* ------------------------------------------------------------------------- */
5340 struct ElementActionInfo element_action_info[NUM_ACTIONS + 1 + 1] =
5342 { ".[DEFAULT]", ACTION_DEFAULT, TRUE },
5343 { ".waiting", ACTION_WAITING, TRUE },
5344 { ".falling", ACTION_FALLING, TRUE },
5345 { ".moving", ACTION_MOVING, TRUE },
5346 { ".digging", ACTION_DIGGING, FALSE },
5347 { ".snapping", ACTION_SNAPPING, FALSE },
5348 { ".collecting", ACTION_COLLECTING, FALSE },
5349 { ".dropping", ACTION_DROPPING, FALSE },
5350 { ".pushing", ACTION_PUSHING, FALSE },
5351 { ".walking", ACTION_WALKING, FALSE },
5352 { ".passing", ACTION_PASSING, FALSE },
5353 { ".impact", ACTION_IMPACT, FALSE },
5354 { ".breaking", ACTION_BREAKING, FALSE },
5355 { ".activating", ACTION_ACTIVATING, FALSE },
5356 { ".deactivating", ACTION_DEACTIVATING, FALSE },
5357 { ".opening", ACTION_OPENING, FALSE },
5358 { ".closing", ACTION_CLOSING, FALSE },
5359 { ".attacking", ACTION_ATTACKING, TRUE },
5360 { ".growing", ACTION_GROWING, TRUE },
5361 { ".shrinking", ACTION_SHRINKING, FALSE },
5362 { ".active", ACTION_ACTIVE, TRUE },
5363 { ".filling", ACTION_FILLING, FALSE },
5364 { ".emptying", ACTION_EMPTYING, FALSE },
5365 { ".changing", ACTION_CHANGING, FALSE },
5366 { ".exploding", ACTION_EXPLODING, FALSE },
5367 { ".boring", ACTION_BORING, FALSE },
5368 { ".boring[1]", ACTION_BORING_1, FALSE },
5369 { ".boring[2]", ACTION_BORING_2, FALSE },
5370 { ".boring[3]", ACTION_BORING_3, FALSE },
5371 { ".boring[4]", ACTION_BORING_4, FALSE },
5372 { ".boring[5]", ACTION_BORING_5, FALSE },
5373 { ".boring[6]", ACTION_BORING_6, FALSE },
5374 { ".boring[7]", ACTION_BORING_7, FALSE },
5375 { ".boring[8]", ACTION_BORING_8, FALSE },
5376 { ".boring[9]", ACTION_BORING_9, FALSE },
5377 { ".boring[10]", ACTION_BORING_10, FALSE },
5378 { ".sleeping", ACTION_SLEEPING, FALSE },
5379 { ".sleeping[1]", ACTION_SLEEPING_1, FALSE },
5380 { ".sleeping[2]", ACTION_SLEEPING_2, FALSE },
5381 { ".sleeping[3]", ACTION_SLEEPING_3, FALSE },
5382 { ".awakening", ACTION_AWAKENING, FALSE },
5383 { ".dying", ACTION_DYING, FALSE },
5384 { ".turning", ACTION_TURNING, FALSE },
5385 { ".turning_from_left", ACTION_TURNING_FROM_LEFT, FALSE },
5386 { ".turning_from_right", ACTION_TURNING_FROM_RIGHT, FALSE },
5387 { ".turning_from_up", ACTION_TURNING_FROM_UP, FALSE },
5388 { ".turning_from_down", ACTION_TURNING_FROM_DOWN, FALSE },
5389 { ".smashed_by_rock", ACTION_SMASHED_BY_ROCK, FALSE },
5390 { ".smashed_by_spring", ACTION_SMASHED_BY_SPRING, FALSE },
5391 { ".eating", ACTION_EATING, FALSE },
5392 { ".twinkling", ACTION_TWINKLING, FALSE },
5393 { ".splashing", ACTION_SPLASHING, FALSE },
5394 { ".page[1]", ACTION_PAGE_1, FALSE },
5395 { ".page[2]", ACTION_PAGE_2, FALSE },
5396 { ".page[3]", ACTION_PAGE_3, FALSE },
5397 { ".page[4]", ACTION_PAGE_4, FALSE },
5398 { ".page[5]", ACTION_PAGE_5, FALSE },
5399 { ".page[6]", ACTION_PAGE_6, FALSE },
5400 { ".page[7]", ACTION_PAGE_7, FALSE },
5401 { ".page[8]", ACTION_PAGE_8, FALSE },
5402 { ".page[9]", ACTION_PAGE_9, FALSE },
5403 { ".page[10]", ACTION_PAGE_10, FALSE },
5404 { ".page[11]", ACTION_PAGE_11, FALSE },
5405 { ".page[12]", ACTION_PAGE_12, FALSE },
5406 { ".page[13]", ACTION_PAGE_13, FALSE },
5407 { ".page[14]", ACTION_PAGE_14, FALSE },
5408 { ".page[15]", ACTION_PAGE_15, FALSE },
5409 { ".page[16]", ACTION_PAGE_16, FALSE },
5410 { ".page[17]", ACTION_PAGE_17, FALSE },
5411 { ".page[18]", ACTION_PAGE_18, FALSE },
5412 { ".page[19]", ACTION_PAGE_19, FALSE },
5413 { ".page[20]", ACTION_PAGE_20, FALSE },
5414 { ".page[21]", ACTION_PAGE_21, FALSE },
5415 { ".page[22]", ACTION_PAGE_22, FALSE },
5416 { ".page[23]", ACTION_PAGE_23, FALSE },
5417 { ".page[24]", ACTION_PAGE_24, FALSE },
5418 { ".page[25]", ACTION_PAGE_25, FALSE },
5419 { ".page[26]", ACTION_PAGE_26, FALSE },
5420 { ".page[27]", ACTION_PAGE_27, FALSE },
5421 { ".page[28]", ACTION_PAGE_28, FALSE },
5422 { ".page[29]", ACTION_PAGE_29, FALSE },
5423 { ".page[30]", ACTION_PAGE_30, FALSE },
5424 { ".page[31]", ACTION_PAGE_31, FALSE },
5425 { ".page[32]", ACTION_PAGE_32, FALSE },
5426 { ".other", ACTION_OTHER, FALSE },
5428 /* empty suffix always matches -- check as last entry in InitSoundInfo() */
5429 { "", ACTION_DEFAULT, TRUE },
5434 struct ElementDirectionInfo element_direction_info[NUM_DIRECTIONS_FULL + 1] =
5436 { ".left", MV_BIT_LEFT },
5437 { ".right", MV_BIT_RIGHT },
5438 { ".up", MV_BIT_UP },
5439 { ".down", MV_BIT_DOWN },
5440 { ".upleft", MV_BIT_UP },
5441 { ".upright", MV_BIT_RIGHT },
5442 { ".downleft", MV_BIT_LEFT },
5443 { ".downright", MV_BIT_DOWN },
5448 struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] =
5450 { ".[DEFAULT]", GFX_SPECIAL_ARG_DEFAULT, },
5451 { ".LOADING", GFX_SPECIAL_ARG_LOADING, },
5452 { ".TITLE_INITIAL", GFX_SPECIAL_ARG_TITLE_INITIAL, },
5453 { ".TITLE", GFX_SPECIAL_ARG_TITLE, },
5454 { ".MAIN", GFX_SPECIAL_ARG_MAIN, },
5455 { ".LEVELS", GFX_SPECIAL_ARG_LEVELS },
5456 { ".LEVELNR", GFX_SPECIAL_ARG_LEVELNR },
5457 { ".SCORES", GFX_SPECIAL_ARG_SCORES, },
5458 { ".EDITOR", GFX_SPECIAL_ARG_EDITOR, },
5459 { ".INFO", GFX_SPECIAL_ARG_INFO, },
5460 { ".SETUP", GFX_SPECIAL_ARG_SETUP, },
5461 { ".PLAYING", GFX_SPECIAL_ARG_PLAYING, },
5462 { ".DOOR", GFX_SPECIAL_ARG_DOOR, },
5463 { ".TAPE", GFX_SPECIAL_ARG_TAPE, },
5464 { ".PANEL", GFX_SPECIAL_ARG_PANEL, },
5465 { ".PREVIEW", GFX_SPECIAL_ARG_PREVIEW, },
5466 { ".CRUMBLED", GFX_SPECIAL_ARG_CRUMBLED, },
5468 /* empty suffix always matches -- check as last entry in InitMusicInfo() */
5469 { "", GFX_SPECIAL_ARG_DEFAULT, },
5474 #include "conf_var.c" /* include auto-generated data structure definitions */
5477 /* ------------------------------------------------------------------------- */
5478 /* font definitions */
5479 /* ------------------------------------------------------------------------- */
5481 /* Important: When one entry is a prefix of another entry, the longer entry
5482 must come first, because the dynamic configuration does prefix matching!
5483 (These definitions must match the corresponding definitions in "main.h"!) */
5485 struct FontInfo font_info[NUM_FONTS + 1] =
5487 { "font.initial_1" },
5488 { "font.initial_2" },
5489 { "font.initial_3" },
5490 { "font.initial_4" },
5493 { "font.menu_1.active" },
5494 { "font.menu_2.active" },
5497 { "font.text_1.active" },
5498 { "font.text_2.active" },
5499 { "font.text_3.active" },
5500 { "font.text_4.active" },
5505 { "font.envelope_1" },
5506 { "font.envelope_2" },
5507 { "font.envelope_3" },
5508 { "font.envelope_4" },
5510 { "font.input_1.active" },
5511 { "font.input_2.active" },
5514 { "font.option_off" },
5515 { "font.option_on" },
5518 { "font.value_old" },
5519 { "font.level_number.active" },
5520 { "font.level_number" },
5521 { "font.tape_recorder" },
5522 { "font.game_info" },
5523 { "font.info.elements" },
5524 { "font.info.levelset" },
5530 /* ------------------------------------------------------------------------- */
5531 /* music token prefix definitions */
5532 /* ------------------------------------------------------------------------- */
5534 struct MusicPrefixInfo music_prefix_info[NUM_MUSIC_PREFIXES + 1] =
5536 { "background", TRUE },
5542 /* ========================================================================= */
5544 /* ========================================================================= */
5546 static void print_usage()
5549 "Usage: %s [OPTION]... [HOSTNAME [PORT]]\n"
5552 " -d, --display HOSTNAME[:SCREEN] specify X server display\n"
5553 " -b, --basepath DIRECTORY alternative base DIRECTORY\n"
5554 " -l, --level DIRECTORY alternative level DIRECTORY\n"
5555 " -g, --graphics DIRECTORY alternative graphics DIRECTORY\n"
5556 " -s, --sounds DIRECTORY alternative sounds DIRECTORY\n"
5557 " -m, --music DIRECTORY alternative music DIRECTORY\n"
5558 " -n, --network network multiplayer game\n"
5559 " --serveronly only start network server\n"
5560 " -v, --verbose verbose mode\n"
5561 " -V, --version show program version\n"
5562 " --debug display debugging information\n"
5563 " -e, --execute COMMAND execute batch COMMAND\n"
5565 "Valid commands for '--execute' option:\n"
5566 " \"print graphicsinfo.conf\" print default graphics config\n"
5567 " \"print soundsinfo.conf\" print default sounds config\n"
5568 " \"print musicinfo.conf\" print default music config\n"
5569 " \"print editorsetup.conf\" print default editor config\n"
5570 " \"print helpanim.conf\" print default helpanim config\n"
5571 " \"print helptext.conf\" print default helptext config\n"
5572 " \"dump level FILE\" dump level data from FILE\n"
5573 " \"dump tape FILE\" dump tape data from FILE\n"
5574 " \"autoplay LEVELDIR [NR ...]\" play level tapes for LEVELDIR\n"
5575 " \"convert LEVELDIR [NR]\" convert levels in LEVELDIR\n"
5576 " \"create images DIRECTORY\" write BMP images to DIRECTORY\n"
5578 program.command_basename);
5581 static void print_version()
5583 printf("%s %d.%d.%d.%d\n",
5584 PROGRAM_TITLE_STRING,
5585 PROGRAM_VERSION_MAJOR,
5586 PROGRAM_VERSION_MINOR,
5587 PROGRAM_VERSION_PATCH,
5588 PROGRAM_VERSION_BUILD);
5592 SDL_version sdl_version;
5594 SDL_VERSION(&sdl_version);
5595 printf("- SDL %d.%d.%d\n",
5600 SDL_IMAGE_VERSION(&sdl_version);
5601 printf("- SDL_image %d.%d.%d\n",
5606 SDL_MIXER_VERSION(&sdl_version);
5607 printf("- SDL_mixer %d.%d.%d\n",
5612 SDL_NET_VERSION(&sdl_version);
5613 printf("- SDL_net %d.%d.%d\n",
5620 int main(int argc, char *argv[])
5622 InitProgramInfo(argv[0], USERDATA_DIRECTORY, USERDATA_DIRECTORY_UNIX,
5623 PROGRAM_TITLE_STRING, ICON_TITLE_STRING, SDL_ICON_FILENAME,
5624 COOKIE_PREFIX, GAME_VERSION_ACTUAL);
5626 InitWindowTitleFunction(getWindowTitleString);
5627 InitExitMessageFunction(DisplayExitMessage);
5628 InitExitFunction(CloseAllAndExit);
5629 InitPlatformDependentStuff();
5631 GetOptions(argv, print_usage, print_version);
5637 return 0; /* to keep compilers happy */