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"
22 Bitmap *bitmap_db_field, *bitmap_db_door;
23 DrawBuffer *fieldbuffer;
24 DrawBuffer *drawto_field;
27 boolean level_editor_test_game = FALSE;
28 boolean network_playing = FALSE;
30 #if defined(TARGET_SDL)
31 boolean network_server = FALSE;
32 SDL_Thread *server_thread;
35 int key_joystick_mapping = 0;
37 boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
38 int redraw_x1 = 0, redraw_y1 = 0;
40 short Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
41 short MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
42 short MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
43 short MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
44 short ChangeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
45 short ChangePage[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 short Back[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
50 boolean Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
51 boolean Pushed[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
52 boolean Changed[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
53 short ChangeEvent[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
54 short WasJustMoving[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
55 short WasJustFalling[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
56 short CheckCollision[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
57 short AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
58 short AmoebaCnt[MAX_NUM_AMOEBA];
59 short AmoebaCnt2[MAX_NUM_AMOEBA];
60 short ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
61 short ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
62 short ExplodeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
63 int RunnerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
64 int PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
66 unsigned long Properties[MAX_NUM_ELEMENTS][NUM_EP_BITFIELDS];
68 int GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
69 int GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
70 int GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
71 int GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
72 int GfxDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
74 int lev_fieldx, lev_fieldy;
75 int scroll_x, scroll_y;
79 int ScreenMovDir = MV_NO_MOVING, ScreenMovPos = 0;
81 int BorderElement = EL_STEELWALL;
82 int GameFrameDelay = GAME_FRAME_DELAY;
83 int FfwdFrameDelay = FFWD_FRAME_DELAY;
85 int BX2 = SCR_FIELDX - 1, BY2 = SCR_FIELDY - 1;
86 int SBX_Left, SBX_Right;
87 int SBY_Upper, SBY_Lower;
92 int TimeFrames, TimePlayed, TimeLeft, TapeTime;
94 boolean network_player_action_received = FALSE;
96 struct LevelSetInfo levelset;
97 struct LevelInfo level, level_template;
98 struct PlayerInfo stored_player[MAX_PLAYERS], *local_player = NULL;
99 struct HiScore highscore[MAX_SCORE_ENTRIES];
100 struct TapeInfo tape;
101 struct SetupInfo setup;
102 struct GameInfo game;
103 struct GlobalInfo global;
104 struct MenuInfo menu;
105 struct DoorInfo door_1, door_2;
106 struct GraphicInfo *graphic_info = NULL;
107 struct SoundInfo *sound_info = NULL;
108 struct MusicInfo *music_info = NULL;
109 struct MusicFileInfo *music_file_info = NULL;
110 struct HelpAnimInfo *helpanim_info = NULL;
111 SetupFileHash *helptext_info = NULL;
114 /* ------------------------------------------------------------------------- */
115 /* element definitions */
116 /* ------------------------------------------------------------------------- */
118 struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1];
120 /* this contains predefined structure elements to initialize "element_info" */
121 struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
123 /* keyword to start parser: "ELEMENT_INFO_START" <-- do not change! */
125 /* ----------------------------------------------------------------------- */
126 /* "real" level file elements */
127 /* ----------------------------------------------------------------------- */
177 "bug (random start direction)"
182 "spaceship (random start direction)"
217 "quicksand with rock"
262 "Conway's wall of life"
285 "robot_wheel.active",
287 "magic wheel (running)"
332 "gray door (opened by red key)"
337 "gray door (opened by yellow key)"},
341 "gray door (opened by green key)"},
345 "gray door (opened by blue key)"},
354 "pac man (random start direction)"
359 "invisible normal wall"
384 "amoeba with content"
419 "wall with BD style diamond"
422 "wall_emerald_yellow",
424 "wall with yellow emerald"
434 "magic wall (BD style)"
437 "invisible_steelwall",
439 "invisible steel wall"
442 "sokoban_field_player",
444 "sokoban field with player"
447 "dynabomb_increase_number",
449 "increases number of bombs"
452 "dynabomb_increase_size",
454 "increases explosion size"
457 "dynabomb_increase_power",
459 "increases power of explosion"
467 "sokoban_field_empty",
469 "sokoban empty field"
472 "sokoban_field_full",
474 "sokoban field with object"
477 "bd_butterfly.right",
479 "butterfly (starts moving right)"},
483 "butterfly (starts moving up)"
488 "butterfly (starts moving left)"},
492 "butterfly (starts moving down)"},
496 "firefly (starts moving right)"
501 "firefly (starts moving up)"
506 "firefly (starts moving left)"
511 "firefly (starts moving down)"
516 "butterfly (random start direction)"
521 "firefly (random start direction)"
546 "bug (starts moving right)"
551 "bug (starts moving up)"
556 "bug (starts moving left)"
561 "bug (starts moving down)"
566 "spaceship (starts moving right)"},
570 "spaceship (starts moving up)"
575 "spaceship (starts moving left)"},
579 "spaceship (starts moving down)"},
583 "pac man (starts moving right)"
588 "pac man (starts moving up)"
593 "pac man (starts moving left)"
598 "pac man (starts moving down)"
613 "wall with red emerald"
616 "wall_emerald_purple",
618 "wall with purple emerald"
623 "acid pool (top left)"
626 "acid_pool_topright",
628 "acid pool (top right)"
631 "acid_pool_bottomleft",
633 "acid pool (bottom left)"
641 "acid_pool_bottomright",
643 "acid pool (bottom right)"
648 "normal wall (BD style)"
673 "mole (random start direction)"
713 "fire breathing dragon"
716 "em_key_1_file_obsolete",
1026 "char_bracketright",
1121 "expandable_wall_horizontal",
1123 "growing wall (horizontal)"
1126 "expandable_wall_vertical",
1128 "growing wall (vertical)"
1131 "expandable_wall_any",
1133 "growing wall (any direction)"
1138 "red door (EM style)"
1143 "yellow door (EM style)"
1148 "green door (EM style)"
1153 "blue door (EM style)"
1156 "em_key_2_file_obsolete",
1161 "em_key_3_file_obsolete",
1166 "em_key_4_file_obsolete",
1218 "port (leading right)"
1223 "port (leading down)"
1228 "port (leading left)"
1236 "sp_gravity_port_right",
1238 "gravity port (leading right)"
1241 "sp_gravity_port_down",
1243 "gravity port (leading down)"
1246 "sp_gravity_port_left",
1248 "gravity port (leading left)"
1251 "sp_gravity_port_up",
1253 "gravity port (leading up)"
1281 "sp_port_horizontal",
1288 "port (any direction)"
1311 "sp_hardware_base_1",
1316 "sp_hardware_green",
1331 "sp_hardware_yellow",
1336 "sp_hardware_base_2",
1341 "sp_hardware_base_3",
1346 "sp_hardware_base_4",
1351 "sp_hardware_base_5",
1356 "sp_hardware_base_6",
1373 "gray door (EM style, red key)"
1378 "gray door (EM style, yellow key)"
1383 "gray door (EM style, green key)"
1388 "gray door (EM style, blue key)"
1428 "gray door (opened by white key)"
1448 "switch gate (open)"
1451 "switchgate_closed",
1453 "switch gate (closed)"
1456 "switchgate_switch_up",
1457 "switchgate_switch",
1458 "switch for switch gate"
1461 "switchgate_switch_down",
1462 "switchgate_switch",
1463 "switch for switch gate"
1476 "conveyor_belt_1_left",
1478 "red conveyor belt (left)"
1481 "conveyor_belt_1_middle",
1483 "red conveyor belt (middle)"
1486 "conveyor_belt_1_right",
1488 "red conveyor belt (right)"
1491 "conveyor_belt_1_switch_left",
1492 "conveyor_belt_switch",
1493 "switch for red conveyor belt (left)"
1496 "conveyor_belt_1_switch_middle",
1497 "conveyor_belt_switch",
1498 "switch for red conveyor belt (middle)"
1501 "conveyor_belt_1_switch_right",
1502 "conveyor_belt_switch",
1503 "switch for red conveyor belt (right)"
1506 "conveyor_belt_2_left",
1508 "yellow conveyor belt (left)"
1511 "conveyor_belt_2_middle",
1513 "yellow conveyor belt (middle)"
1516 "conveyor_belt_2_right",
1518 "yellow conveyor belt (right)"
1521 "conveyor_belt_2_switch_left",
1522 "conveyor_belt_switch",
1523 "switch for yellow conveyor belt (left)"
1526 "conveyor_belt_2_switch_middle",
1527 "conveyor_belt_switch",
1528 "switch for yellow conveyor belt (middle)"
1531 "conveyor_belt_2_switch_right",
1532 "conveyor_belt_switch",
1533 "switch for yellow conveyor belt (right)"
1536 "conveyor_belt_3_left",
1538 "green conveyor belt (left)"
1541 "conveyor_belt_3_middle",
1543 "green conveyor belt (middle)"
1546 "conveyor_belt_3_right",
1548 "green conveyor belt (right)"
1551 "conveyor_belt_3_switch_left",
1552 "conveyor_belt_switch",
1553 "switch for green conveyor belt (left)"
1556 "conveyor_belt_3_switch_middle",
1557 "conveyor_belt_switch",
1558 "switch for green conveyor belt (middle)"
1561 "conveyor_belt_3_switch_right",
1562 "conveyor_belt_switch",
1563 "switch for green conveyor belt (right)"
1566 "conveyor_belt_4_left",
1568 "blue conveyor belt (left)"
1571 "conveyor_belt_4_middle",
1573 "blue conveyor belt (middle)"
1576 "conveyor_belt_4_right",
1578 "blue conveyor belt (right)"
1581 "conveyor_belt_4_switch_left",
1582 "conveyor_belt_switch",
1583 "switch for blue conveyor belt (left)"
1586 "conveyor_belt_4_switch_middle",
1587 "conveyor_belt_switch",
1588 "switch for blue conveyor belt (middle)"
1591 "conveyor_belt_4_switch_right",
1592 "conveyor_belt_switch",
1593 "switch for blue conveyor belt (right)"
1601 "envelope_obsolete",
1603 "envelope (OBSOLETE)"
1608 "light switch (off)"
1611 "light_switch.active",
1618 "sign (exclamation)"
1621 "sign_radioactivity",
1623 "sign (radio activity)"
1633 "sign (wheel chair)"
1678 "mole (starts moving left)"
1683 "mole (starts moving right)"
1688 "mole (starts moving up)"
1693 "mole (starts moving down)"
1696 "steelwall_slippery",
1698 "slippery steel wall"
1708 "dx unknown element 15"
1713 "dx unknown element 42"
1728 "shield (deadly, kills enemies)"
1738 "time gate (closed)"
1741 "timegate_switch.active",
1743 "switch for time gate"
1748 "switch for time gate"
1756 "balloon_switch_left",
1758 "send balloon to the left"
1761 "balloon_switch_right",
1763 "send balloon to the right"
1766 "balloon_switch_up",
1771 "balloon_switch_down",
1776 "balloon_switch_any",
1778 "send balloon in pressed direction"
1843 "tube (any direction)"
1856 "tube_vertical_left",
1858 "tube (vertical & left)"
1861 "tube_vertical_right",
1863 "tube (vertical & right)"
1866 "tube_horizontal_up",
1868 "tube (horizontal & up)"
1871 "tube_horizontal_down",
1873 "tube (horizontal & down)"
1883 "tube (left & down)"
1893 "tube (right & down)"
1908 "stable bomb (DX style)"
2418 "custom element 100"
2423 "custom element 101"
2428 "custom element 102"
2433 "custom element 103"
2438 "custom element 104"
2443 "custom element 105"
2448 "custom element 106"
2453 "custom element 107"
2458 "custom element 108"
2463 "custom element 109"
2468 "custom element 110"
2473 "custom element 111"
2478 "custom element 112"
2483 "custom element 113"
2488 "custom element 114"
2493 "custom element 115"
2498 "custom element 116"
2503 "custom element 117"
2508 "custom element 118"
2513 "custom element 119"
2518 "custom element 120"
2523 "custom element 121"
2528 "custom element 122"
2533 "custom element 123"
2538 "custom element 124"
2543 "custom element 125"
2548 "custom element 126"
2553 "custom element 127"
2558 "custom element 128"
2563 "custom element 129"
2568 "custom element 130"
2573 "custom element 131"
2578 "custom element 132"
2583 "custom element 133"
2588 "custom element 134"
2593 "custom element 135"
2598 "custom element 136"
2603 "custom element 137"
2608 "custom element 138"
2613 "custom element 139"
2618 "custom element 140"
2623 "custom element 141"
2628 "custom element 142"
2633 "custom element 143"
2638 "custom element 144"
2643 "custom element 145"
2648 "custom element 146"
2653 "custom element 147"
2658 "custom element 148"
2663 "custom element 149"
2668 "custom element 150"
2673 "custom element 151"
2678 "custom element 152"
2683 "custom element 153"
2688 "custom element 154"
2693 "custom element 155"
2698 "custom element 156"
2703 "custom element 157"
2708 "custom element 158"
2713 "custom element 159"
2718 "custom element 160"
2723 "custom element 161"
2728 "custom element 162"
2733 "custom element 163"
2738 "custom element 164"
2743 "custom element 165"
2748 "custom element 166"
2753 "custom element 167"
2758 "custom element 168"
2763 "custom element 169"
2768 "custom element 170"
2773 "custom element 171"
2778 "custom element 172"
2783 "custom element 173"
2788 "custom element 174"
2793 "custom element 175"
2798 "custom element 176"
2803 "custom element 177"
2808 "custom element 178"
2813 "custom element 179"
2818 "custom element 180"
2823 "custom element 181"
2828 "custom element 182"
2833 "custom element 183"
2838 "custom element 184"
2843 "custom element 185"
2848 "custom element 186"
2853 "custom element 187"
2858 "custom element 188"
2863 "custom element 189"
2868 "custom element 190"
2873 "custom element 191"
2878 "custom element 192"
2883 "custom element 193"
2888 "custom element 194"
2893 "custom element 195"
2898 "custom element 196"
2903 "custom element 197"
2908 "custom element 198"
2913 "custom element 199"
2918 "custom element 200"
2923 "custom element 201"
2928 "custom element 202"
2933 "custom element 203"
2938 "custom element 204"
2943 "custom element 205"
2948 "custom element 206"
2953 "custom element 207"
2958 "custom element 208"
2963 "custom element 209"
2968 "custom element 210"
2973 "custom element 211"
2978 "custom element 212"
2983 "custom element 213"
2988 "custom element 214"
2993 "custom element 215"
2998 "custom element 216"
3003 "custom element 217"
3008 "custom element 218"
3013 "custom element 219"
3018 "custom element 220"
3023 "custom element 221"
3028 "custom element 222"
3033 "custom element 223"
3038 "custom element 224"
3043 "custom element 225"
3048 "custom element 226"
3053 "custom element 227"
3058 "custom element 228"
3063 "custom element 229"
3068 "custom element 230"
3073 "custom element 231"
3078 "custom element 232"
3083 "custom element 233"
3088 "custom element 234"
3093 "custom element 235"
3098 "custom element 236"
3103 "custom element 237"
3108 "custom element 238"
3113 "custom element 239"
3118 "custom element 240"
3123 "custom element 241"
3128 "custom element 242"
3133 "custom element 243"
3138 "custom element 244"
3143 "custom element 245"
3148 "custom element 246"
3153 "custom element 247"
3158 "custom element 248"
3163 "custom element 249"
3168 "custom element 250"
3173 "custom element 251"
3178 "custom element 252"
3183 "custom element 253"
3188 "custom element 254"
3193 "custom element 255"
3198 "custom element 256"
3203 "red key (EM style)"
3208 "yellow key (EM style)"
3213 "green key (EM style)"
3218 "blue key (EM style)"
3408 "element triggering change"
3413 "player triggering change"
3416 "sp_gravity_on_port_right",
3418 "gravity on port (leading right)"
3421 "sp_gravity_on_port_down",
3423 "gravity on port (leading down)"
3426 "sp_gravity_on_port_left",
3428 "gravity on port (leading left)"
3431 "sp_gravity_on_port_up",
3433 "gravity on port (leading up)"
3436 "sp_gravity_off_port_right",
3438 "gravity off port (leading right)"
3441 "sp_gravity_off_port_down",
3443 "gravity off port (leading down)"
3446 "sp_gravity_off_port_left",
3448 "gravity off port (leading left)"
3451 "sp_gravity_off_port_up",
3453 "gravity off port (leading up)"
3456 "balloon_switch_none",
3458 "stop moving balloon"
3463 "door 5 (EMC style)",
3468 "door 6 (EMC style)",
3473 "door 7 (EMC style)",
3478 "door 8 (EMC style)",
3483 "gray door (EMC style, key 5)",
3488 "gray door (EMC style, key 6)",
3493 "gray door (EMC style, key 7)",
3498 "gray door (EMC style, key 8)",
3503 "key 5 (EMC style)",
3508 "key 6 (EMC style)",
3513 "key 7 (EMC style)",
3518 "key 8 (EMC style)",
3536 "emc_magic_ball.active",
3538 "magic ball (activated)",
3541 "emc_magic_ball_switch",
3542 "emc_magic_ball_switch",
3543 "magic ball switch (off)",
3546 "emc_magic_ball_switch.active",
3547 "emc_magic_ball_switch",
3548 "magic ball switch (on)",
3551 "emc_spring_bumper",
3552 "emc_spring_bumper",
3611 "emc_wall_slippery_1",
3616 "emc_wall_slippery_2",
3621 "emc_wall_slippery_3",
3626 "emc_wall_slippery_4",
3646 /* ----------------------------------------------------------------------- */
3647 /* "real" (and therefore drawable) runtime elements */
3648 /* ----------------------------------------------------------------------- */
3651 "dynabomb_player_1.active",
3656 "dynabomb_player_2.active",
3661 "dynabomb_player_3.active",
3666 "dynabomb_player_4.active",
3671 "sp_disk_red.active",
3676 "switchgate.opening",
3681 "switchgate.closing",
3706 "invisible_steelwall.active",
3711 "invisible_wall.active",
3716 "invisible_sand.active",
3721 "conveyor_belt_1_left.active",
3726 "conveyor_belt_1_middle.active",
3731 "conveyor_belt_1_right.active",
3736 "conveyor_belt_2_left.active",
3741 "conveyor_belt_2_middle.active",
3746 "conveyor_belt_2_right.active",
3751 "conveyor_belt_3_left.active",
3756 "conveyor_belt_3_middle.active",
3761 "conveyor_belt_3_right.active",
3766 "conveyor_belt_4_left.active",
3771 "conveyor_belt_4_middle.active",
3776 "conveyor_belt_4_right.active",
3806 "sp_terminal.active",
3811 "sp_buggy_base.activating",
3816 "sp_buggy_base.active",
3831 "quicksand.emptying",
3836 "magic_wall.active",
3841 "bd_magic_wall.active",
3851 "bd_magic_wall_full",
3856 "magic_wall.emptying",
3861 "bd_magic_wall.emptying",
3871 "bd_magic_wall_dead",
3876 /* ----------------------------------------------------------------------- */
3877 /* "unreal" (and therefore not drawable) runtime elements */
3878 /* ----------------------------------------------------------------------- */
3906 "acid_splash_right",
3921 "expandable_wall.growing",
3931 "player_is_leaving",
3936 "player_is_exploding_1",
3941 "player_is_exploding_2",
3946 "player_is_exploding_3",
3951 "player_is_exploding_4",
3956 "quicksand.filling",
3961 "magic_wall.filling",
3966 "bd_magic_wall.filling",
3971 /* ----------------------------------------------------------------------- */
3972 /* dummy elements (never used as game elements, only used as graphics) */
3973 /* ----------------------------------------------------------------------- */
3976 "steelwall_topleft",
3981 "steelwall_topright",
3986 "steelwall_bottomleft",
3991 "steelwall_bottomright",
3996 "steelwall_horizontal",
4001 "steelwall_vertical",
4006 "invisible_steelwall_topleft",
4011 "invisible_steelwall_topright",
4016 "invisible_steelwall_bottomleft",
4021 "invisible_steelwall_bottomright",
4026 "invisible_steelwall_horizontal",
4031 "invisible_steelwall_vertical",
4046 "dynabomb_player_1",
4051 "dynabomb_player_2",
4056 "dynabomb_player_3",
4061 "dynabomb_player_4",
4066 "shield_normal.active",
4071 "shield_deadly.active",
4101 "internal_clipboard_custom",
4103 "empty custom element"
4106 "internal_clipboard_change",
4111 "internal_clipboard_group",
4113 "empty group element"
4121 /* keyword to stop parser: "ELEMENT_INFO_END" <-- do not change! */
4131 /* ------------------------------------------------------------------------- */
4132 /* element action and direction definitions */
4133 /* ------------------------------------------------------------------------- */
4135 struct ElementActionInfo element_action_info[NUM_ACTIONS + 1 + 1] =
4137 { ".[DEFAULT]", ACTION_DEFAULT, TRUE },
4138 { ".waiting", ACTION_WAITING, TRUE },
4139 { ".falling", ACTION_FALLING, TRUE },
4140 { ".moving", ACTION_MOVING, TRUE },
4141 { ".digging", ACTION_DIGGING, FALSE },
4142 { ".snapping", ACTION_SNAPPING, FALSE },
4143 { ".collecting", ACTION_COLLECTING, FALSE },
4144 { ".dropping", ACTION_DROPPING, FALSE },
4145 { ".pushing", ACTION_PUSHING, FALSE },
4146 { ".walking", ACTION_WALKING, FALSE },
4147 { ".passing", ACTION_PASSING, FALSE },
4148 { ".impact", ACTION_IMPACT, FALSE },
4149 { ".breaking", ACTION_BREAKING, FALSE },
4150 { ".activating", ACTION_ACTIVATING, FALSE },
4151 { ".deactivating", ACTION_DEACTIVATING, FALSE },
4152 { ".opening", ACTION_OPENING, FALSE },
4153 { ".closing", ACTION_CLOSING, FALSE },
4154 { ".attacking", ACTION_ATTACKING, TRUE },
4155 { ".growing", ACTION_GROWING, TRUE },
4156 { ".shrinking", ACTION_SHRINKING, FALSE },
4157 { ".active", ACTION_ACTIVE, TRUE },
4158 { ".filling", ACTION_FILLING, FALSE },
4159 { ".emptying", ACTION_EMPTYING, FALSE },
4160 { ".changing", ACTION_CHANGING, FALSE },
4161 { ".exploding", ACTION_EXPLODING, FALSE },
4162 { ".boring", ACTION_BORING, FALSE },
4163 { ".boring[1]", ACTION_BORING_1, FALSE },
4164 { ".boring[2]", ACTION_BORING_2, FALSE },
4165 { ".boring[3]", ACTION_BORING_3, FALSE },
4166 { ".boring[4]", ACTION_BORING_4, FALSE },
4167 { ".boring[5]", ACTION_BORING_5, FALSE },
4168 { ".boring[6]", ACTION_BORING_6, FALSE },
4169 { ".boring[7]", ACTION_BORING_7, FALSE },
4170 { ".boring[8]", ACTION_BORING_8, FALSE },
4171 { ".boring[9]", ACTION_BORING_9, FALSE },
4172 { ".boring[10]", ACTION_BORING_10, FALSE },
4173 { ".sleeping", ACTION_SLEEPING, FALSE },
4174 { ".sleeping[1]", ACTION_SLEEPING_1, FALSE },
4175 { ".sleeping[2]", ACTION_SLEEPING_2, FALSE },
4176 { ".sleeping[3]", ACTION_SLEEPING_3, FALSE },
4177 { ".awakening", ACTION_AWAKENING, FALSE },
4178 { ".dying", ACTION_DYING, FALSE },
4179 { ".turning", ACTION_TURNING, FALSE },
4180 { ".turning_from_left", ACTION_TURNING_FROM_LEFT, FALSE },
4181 { ".turning_from_right", ACTION_TURNING_FROM_RIGHT, FALSE },
4182 { ".turning_from_up", ACTION_TURNING_FROM_UP, FALSE },
4183 { ".turning_from_down", ACTION_TURNING_FROM_DOWN, FALSE },
4184 { ".smashed_by_rock", ACTION_SMASHED_BY_ROCK, FALSE },
4185 { ".smashed_by_spring", ACTION_SMASHED_BY_SPRING, FALSE },
4186 { ".slurped_by_spring", ACTION_SLURPED_BY_SPRING, FALSE },
4187 { ".twinkling", ACTION_TWINKLING, FALSE },
4188 { ".splashing", ACTION_SPLASHING, FALSE },
4189 { ".other", ACTION_OTHER, FALSE },
4191 /* empty suffix always matches -- check as last entry in InitSoundInfo() */
4192 { "", ACTION_DEFAULT, TRUE },
4197 struct ElementDirectionInfo element_direction_info[NUM_DIRECTIONS + 1] =
4199 { ".left", MV_BIT_LEFT },
4200 { ".right", MV_BIT_RIGHT },
4201 { ".up", MV_BIT_UP },
4202 { ".down", MV_BIT_DOWN },
4207 struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] =
4209 { ".[DEFAULT]", GAME_MODE_DEFAULT, },
4210 { ".MAIN", GAME_MODE_MAIN, },
4211 { ".LEVELS", GAME_MODE_LEVELS },
4212 { ".SCORES", GAME_MODE_SCORES, },
4213 { ".EDITOR", GAME_MODE_EDITOR, },
4214 { ".INFO", GAME_MODE_INFO, },
4215 { ".SETUP", GAME_MODE_SETUP, },
4216 { ".PLAYING", GAME_MODE_PLAYING, },
4217 { ".DOOR", GAME_MODE_PSEUDO_DOOR, },
4218 { ".PREVIEW", GAME_MODE_PSEUDO_PREVIEW, },
4219 { ".CRUMBLED", GAME_MODE_PSEUDO_CRUMBLED, },
4221 /* empty suffix always matches -- check as last entry in InitMusicInfo() */
4222 { "", GAME_MODE_DEFAULT, },
4227 struct TokenIntPtrInfo image_config_vars[] =
4229 { "global.num_toons", &global.num_toons },
4231 { "menu.draw_xoffset", &menu.draw_xoffset[GFX_SPECIAL_ARG_DEFAULT]},
4232 { "menu.draw_yoffset", &menu.draw_yoffset[GFX_SPECIAL_ARG_DEFAULT]},
4233 { "menu.draw_xoffset.MAIN", &menu.draw_xoffset[GFX_SPECIAL_ARG_MAIN] },
4234 { "menu.draw_yoffset.MAIN", &menu.draw_yoffset[GFX_SPECIAL_ARG_MAIN] },
4235 { "menu.draw_xoffset.LEVELS", &menu.draw_xoffset[GFX_SPECIAL_ARG_LEVELS] },
4236 { "menu.draw_yoffset.LEVELS", &menu.draw_yoffset[GFX_SPECIAL_ARG_LEVELS] },
4237 { "menu.draw_xoffset.SCORES", &menu.draw_xoffset[GFX_SPECIAL_ARG_SCORES] },
4238 { "menu.draw_yoffset.SCORES", &menu.draw_yoffset[GFX_SPECIAL_ARG_SCORES] },
4239 { "menu.draw_xoffset.EDITOR", &menu.draw_xoffset[GFX_SPECIAL_ARG_EDITOR] },
4240 { "menu.draw_yoffset.EDITOR", &menu.draw_yoffset[GFX_SPECIAL_ARG_EDITOR] },
4241 { "menu.draw_xoffset.INFO", &menu.draw_xoffset[GFX_SPECIAL_ARG_INFO] },
4242 { "menu.draw_yoffset.INFO", &menu.draw_yoffset[GFX_SPECIAL_ARG_INFO] },
4243 { "menu.draw_xoffset.SETUP", &menu.draw_xoffset[GFX_SPECIAL_ARG_SETUP] },
4244 { "menu.draw_yoffset.SETUP", &menu.draw_yoffset[GFX_SPECIAL_ARG_SETUP] },
4246 { "menu.scrollbar_xoffset", &menu.scrollbar_xoffset },
4248 { "menu.list_size", &menu.list_size[GFX_SPECIAL_ARG_DEFAULT] },
4249 { "menu.list_size.LEVELS", &menu.list_size[GFX_SPECIAL_ARG_LEVELS] },
4250 { "menu.list_size.SCORES", &menu.list_size[GFX_SPECIAL_ARG_SCORES] },
4251 { "menu.list_size.INFO", &menu.list_size[GFX_SPECIAL_ARG_INFO] },
4253 { "door_1.step_offset", &door_1.step_offset },
4254 { "door_1.step_delay", &door_1.step_delay },
4255 { "door_1.anim_mode", &door_1.anim_mode },
4256 { "door_2.step_offset", &door_2.step_offset },
4257 { "door_2.step_delay", &door_2.step_delay },
4258 { "door_2.anim_mode", &door_2.anim_mode },
4260 { "[player].boring_delay_fixed", &game.player_boring_delay_fixed },
4261 { "[player].boring_delay_random", &game.player_boring_delay_random },
4262 { "[player].sleeping_delay_fixed", &game.player_sleeping_delay_fixed },
4263 { "[player].sleeping_delay_random", &game.player_sleeping_delay_random },
4269 /* ------------------------------------------------------------------------- */
4270 /* font definitions */
4271 /* ------------------------------------------------------------------------- */
4273 /* Important: When one entry is a prefix of another entry, the longer entry
4274 must come first, because the dynamic configuration does prefix matching! */
4276 struct FontInfo font_info[NUM_FONTS + 1] =
4278 { "font.initial_1" },
4279 { "font.initial_2" },
4280 { "font.initial_3" },
4281 { "font.initial_4" },
4286 { "font.text_1.active" },
4287 { "font.text_2.active" },
4288 { "font.text_3.active" },
4289 { "font.text_4.active" },
4294 { "font.envelope_1" },
4295 { "font.envelope_2" },
4296 { "font.envelope_3" },
4297 { "font.envelope_4" },
4298 { "font.input_1.active" },
4299 { "font.input_2.active" },
4302 { "font.option_off" },
4303 { "font.option_on" },
4306 { "font.value_old" },
4307 { "font.level_number" },
4308 { "font.tape_recorder" },
4309 { "font.game_info" },
4313 /* ------------------------------------------------------------------------- */
4314 /* music token prefix definitions */
4315 /* ------------------------------------------------------------------------- */
4317 struct MusicPrefixInfo music_prefix_info[NUM_MUSIC_PREFIXES + 1] =
4319 { "background", TRUE },
4325 /* ========================================================================= */
4327 /* ========================================================================= */
4329 static void print_usage()
4332 "Usage: %s [OPTION]... [HOSTNAME [PORT]]\n"
4335 " -d, --display HOSTNAME[:SCREEN] specify X server display\n"
4336 " -b, --basepath DIRECTORY alternative base DIRECTORY\n"
4337 " -l, --level DIRECTORY alternative level DIRECTORY\n"
4338 " -g, --graphics DIRECTORY alternative graphics DIRECTORY\n"
4339 " -s, --sounds DIRECTORY alternative sounds DIRECTORY\n"
4340 " -m, --music DIRECTORY alternative music DIRECTORY\n"
4341 " -n, --network network multiplayer game\n"
4342 " --serveronly only start network server\n"
4343 " -v, --verbose verbose mode\n"
4344 " --debug display debugging information\n"
4345 " -e, --execute COMMAND execute batch COMMAND\n"
4347 "Valid commands for '--execute' option:\n"
4348 " \"print graphicsinfo.conf\" print default graphics config\n"
4349 " \"print soundsinfo.conf\" print default sounds config\n"
4350 " \"print musicinfo.conf\" print default music config\n"
4351 " \"print editorsetup.conf\" print default editor config\n"
4352 " \"print helpanim.conf\" print default helpanim config\n"
4353 " \"print helptext.conf\" print default helptext config\n"
4354 " \"dump level FILE\" dump level data from FILE\n"
4355 " \"dump tape FILE\" dump tape data from FILE\n"
4356 " \"autoplay LEVELDIR [NR ...]\" play level tapes for LEVELDIR\n"
4357 " \"convert LEVELDIR [NR]\" convert levels in LEVELDIR\n"
4359 program.command_basename);
4362 int main(int argc, char *argv[])
4364 InitProgramInfo(argv[0], USERDATA_DIRECTORY,
4365 PROGRAM_TITLE_STRING, getWindowTitleString(),
4366 ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME,
4367 MSDOS_POINTER_FILENAME,
4368 COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL);
4370 InitExitFunction(CloseAllAndExit);
4371 InitPlatformDependentStuff();
4373 GetOptions(argv, print_usage);
4379 return 0; /* to keep compilers happy */