X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fmain.c;h=1a4243f98dae958e5ddf865d0e50399c01a7a229;hp=109e88d0e6e09f49b1cd6cc2de744d716af83725;hb=67f3bfab902e53e0dc24a01eb6c0e4d274030a47;hpb=4666f6614557b1a47fda7442da7523519a4a1ac6 diff --git a/src/main.c b/src/main.c index 109e88d0..1a4243f9 100644 --- a/src/main.c +++ b/src/main.c @@ -4,7 +4,7 @@ // (c) 1995-2014 by Artsoft Entertainment // Holger Schemel // info@artsoft.org -// http://www.artsoft.org/ +// https://www.artsoft.org/ // ---------------------------------------------------------------------------- // main.c // ============================================================================ @@ -34,14 +34,9 @@ boolean game_status_last_screen = -1; boolean level_editor_test_game = FALSE; boolean network_playing = FALSE; -#if defined(TARGET_SDL) -boolean network_server = FALSE; -SDL_Thread *server_thread; -#endif - int key_joystick_mapping = 0; -short Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; +short Tile[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; short Last[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; short MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; short MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY]; @@ -135,7 +130,6 @@ struct LevelInfo level, level_template; struct PlayerInfo stored_player[MAX_PLAYERS], *local_player = NULL; struct HiScore highscore[MAX_SCORE_ENTRIES]; struct TapeInfo tape; -struct SetupInfo setup; struct GameInfo game; struct GlobalInfo global; struct BorderInfo border; @@ -551,7 +545,8 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = { "bd_butterfly.right", "bd_butterfly", - "butterfly (starts moving right)"}, + "butterfly (starts moving right)" + }, { "bd_butterfly.up", "bd_butterfly", @@ -560,11 +555,13 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = { "bd_butterfly.left", "bd_butterfly", - "butterfly (starts moving left)"}, + "butterfly (starts moving left)" + }, { "bd_butterfly.down", "bd_butterfly", - "butterfly (starts moving down)"}, + "butterfly (starts moving down)" + }, { "bd_firefly.right", "bd_firefly", @@ -638,7 +635,8 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = { "spaceship.right", "spaceship", - "spaceship (starts moving right)"}, + "spaceship (starts moving right)" + }, { "spaceship.up", "spaceship", @@ -647,11 +645,13 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = { "spaceship.left", "spaceship", - "spaceship (starts moving left)"}, + "spaceship (starts moving left)" + }, { "spaceship.down", "spaceship", - "spaceship (starts moving down)"}, + "spaceship (starts moving down)" + }, { "pacman.right", "pacman", @@ -1178,17 +1178,17 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = "letter ''" }, { - "char_unused", + "char_button", "char", "letter 'button'" }, { - "char_unused", + "char_up", "char", "letter 'up'" }, { - "char_unused", + "char_down", "char", "letter 'down'" }, @@ -1855,62 +1855,62 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = { "emc_steelwall_1", "steelwall", - "steel wall" + "steel wall 1 (EMC style)" }, { "emc_steelwall_2", "steelwall", - "steel wall" + "steel wall 2 (EMC style)" }, { "emc_steelwall_3", "steelwall", - "steel wall" + "steel wall 3 (EMC style)" }, { "emc_steelwall_4", "steelwall", - "steel wall" + "steel wall 4 (EMC style)" }, { "emc_wall_1", "wall", - "normal wall" + "normal wall 1 (EMC style)" }, { "emc_wall_2", "wall", - "normal wall" + "normal wall 2 (EMC style)" }, { "emc_wall_3", "wall", - "normal wall" + "normal wall 3 (EMC style)" }, { "emc_wall_4", "wall", - "normal wall" + "normal wall 4 (EMC style)" }, { "emc_wall_5", "wall", - "normal wall" + "normal wall 5 (EMC style)" }, { "emc_wall_6", "wall", - "normal wall" + "normal wall 6 (EMC style)" }, { "emc_wall_7", "wall", - "normal wall" + "normal wall 7 (EMC style)" }, { "emc_wall_8", "wall", - "normal wall" + "normal wall 8 (EMC style)" }, { "tube_any", @@ -3645,62 +3645,62 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = { "emc_wall_9", "wall", - "normal wall" + "normal wall 9 (EMC style)" }, { "emc_wall_10", "wall", - "normal wall" + "normal wall 10 (EMC style)" }, { "emc_wall_11", "wall", - "normal wall" + "normal wall 11 (EMC style)" }, { "emc_wall_12", "wall", - "normal wall" + "normal wall 12 (EMC style)" }, { "emc_wall_13", "wall", - "normal wall" + "normal wall 13 (EMC style)" }, { "emc_wall_14", "wall", - "normal wall" + "normal wall 14 (EMC style)" }, { "emc_wall_15", "wall", - "normal wall" + "normal wall 15 (EMC style)" }, { "emc_wall_16", "wall", - "normal wall" + "normal wall 16 (EMC style)" }, { "emc_wall_slippery_1", "wall", - "slippery wall" + "slippery wall 1 (EMC style)" }, { "emc_wall_slippery_2", "wall", - "slippery wall" + "slippery wall 2 (EMC style)" }, { "emc_wall_slippery_3", "wall", - "slippery wall" + "slippery wall 3 (EMC style)" }, { "emc_wall_slippery_4", "wall", - "slippery wall" + "slippery wall 4 (EMC style)" }, { "emc_fake_grass", @@ -4238,17 +4238,17 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = "steel letter ''" }, { - "steel_char_unused", + "steel_char_button", "steel_char", "steel letter 'button'" }, { - "steel_char_unused", + "steel_char_up", "steel_char", "steel letter 'up'" }, { - "steel_char_unused", + "steel_char_down", "steel_char", "steel letter 'down'" }, @@ -4315,112 +4315,112 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = { "dc_steelwall_1_left", "steelwall", - "steel wall (left)" + "steel wall 1 (left)" }, { "dc_steelwall_1_right", "steelwall", - "steel wall (right)" + "steel wall 1 (right)" }, { "dc_steelwall_1_top", "steelwall", - "steel wall (top)" + "steel wall 1 (top)" }, { "dc_steelwall_1_bottom", "steelwall", - "steel wall (bottom)" + "steel wall 1 (bottom)" }, { "dc_steelwall_1_horizontal", "steelwall", - "steel wall (top/bottom)" + "steel wall 1 (top/bottom)" }, { "dc_steelwall_1_vertical", "steelwall", - "steel wall (left/right)" + "steel wall 1 (left/right)" }, { "dc_steelwall_1_topleft", "steelwall", - "steel wall (top/left)" + "steel wall 1 (top/left)" }, { "dc_steelwall_1_topright", "steelwall", - "steel wall (top/right)" + "steel wall 1 (top/right)" }, { "dc_steelwall_1_bottomleft", "steelwall", - "steel wall (bottom/left)" + "steel wall 1 (bottom/left)" }, { "dc_steelwall_1_bottomright", "steelwall", - "steel wall (bottom/right)" + "steel wall 1 (bottom/right)" }, { "dc_steelwall_1_topleft_2", "steelwall", - "steel wall (top/left corner)" + "steel wall 1 (top/left corner)" }, { "dc_steelwall_1_topright_2", "steelwall", - "steel wall (top/right corner)" + "steel wall 1 (top/right corner)" }, { "dc_steelwall_1_bottomleft_2", "steelwall", - "steel wall (bottom/left corner)" + "steel wall 1 (bottom/left corner)" }, { "dc_steelwall_1_bottomright_2", "steelwall", - "steel wall (bottom/right corner)" + "steel wall 1 (bottom/right corner)" }, { "dc_steelwall_2_left", "steelwall", - "steel wall (left)" + "steel wall 2 (left)" }, { "dc_steelwall_2_right", "steelwall", - "steel wall (right)" + "steel wall 2 (right)" }, { "dc_steelwall_2_top", "steelwall", - "steel wall (top)" + "steel wall 2 (top)" }, { "dc_steelwall_2_bottom", "steelwall", - "steel wall (bottom)" + "steel wall 2 (bottom)" }, { "dc_steelwall_2_horizontal", "steelwall", - "steel wall (horizontal)" + "steel wall 2 (horizontal)" }, { "dc_steelwall_2_vertical", "steelwall", - "steel wall (vertical)" + "steel wall 2 (vertical)" }, { "dc_steelwall_2_middle", "steelwall", - "steel wall (middle)" + "steel wall 2 (middle)" }, { "dc_steelwall_2_single", "steelwall", - "steel wall (single)" + "steel wall 2 (single)" }, { "dc_switchgate_switch_up", @@ -4675,322 +4675,322 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = { "mm_steel_wall_1", "mm_steel_wall", - "steel wall" + "steel wall 1 (MM style)" }, { "mm_steel_wall_2", "mm_steel_wall", - "steel wall" + "steel wall 2 (MM style)" }, { "mm_steel_wall_3", "mm_steel_wall", - "steel wall" + "steel wall 3 (MM style)" }, { "mm_steel_wall_4", "mm_steel_wall", - "steel wall" + "steel wall 4 (MM style)" }, { "mm_steel_wall_5", "mm_steel_wall", - "steel wall" + "steel wall 5 (MM style)" }, { "mm_steel_wall_6", "mm_steel_wall", - "steel wall" + "steel wall 6 (MM style)" }, { "mm_steel_wall_7", "mm_steel_wall", - "steel wall" + "steel wall 7 (MM style)" }, { "mm_steel_wall_8", "mm_steel_wall", - "steel wall" + "steel wall 8 (MM style)" }, { "mm_steel_wall_9", "mm_steel_wall", - "steel wall" + "steel wall 9 (MM style)" }, { "mm_steel_wall_10", "mm_steel_wall", - "steel wall" + "steel wall 10 (MM style)" }, { "mm_steel_wall_11", "mm_steel_wall", - "steel wall" + "steel wall 11 (MM style)" }, { "mm_steel_wall_12", "mm_steel_wall", - "steel wall" + "steel wall 12 (MM style)" }, { "mm_steel_wall_13", "mm_steel_wall", - "steel wall" + "steel wall 13 (MM style)" }, { "mm_steel_wall_14", "mm_steel_wall", - "steel wall" + "steel wall 14 (MM style)" }, { "mm_steel_wall_15", "mm_steel_wall", - "steel wall" + "steel wall 15 (MM style)" }, { "mm_steel_wall_16", "mm_steel_wall", - "steel wall" + "steel wall 16 (MM style)" }, { "mm_wooden_wall_1", "mm_wooden_wall", - "wooden wall" + "wooden wall 1 (MM style)" }, { "mm_wooden_wall_2", "mm_wooden_wall", - "wooden wall" + "wooden wall 2 (MM style)" }, { "mm_wooden_wall_3", "mm_wooden_wall", - "wooden wall" + "wooden wall 3 (MM style)" }, { "mm_wooden_wall_4", "mm_wooden_wall", - "wooden wall" + "wooden wall 4 (MM style)" }, { "mm_wooden_wall_5", "mm_wooden_wall", - "wooden wall" + "wooden wall 5 (MM style)" }, { "mm_wooden_wall_6", "mm_wooden_wall", - "wooden wall" + "wooden wall 6 (MM style)" }, { "mm_wooden_wall_7", "mm_wooden_wall", - "wooden wall" + "wooden wall 7 (MM style)" }, { "mm_wooden_wall_8", "mm_wooden_wall", - "wooden wall" + "wooden wall 8 (MM style)" }, { "mm_wooden_wall_9", "mm_wooden_wall", - "wooden wall" + "wooden wall 9 (MM style)" }, { "mm_wooden_wall_10", "mm_wooden_wall", - "wooden wall" + "wooden wall 10 (MM style)" }, { "mm_wooden_wall_11", "mm_wooden_wall", - "wooden wall" + "wooden wall 11 (MM style)" }, { "mm_wooden_wall_12", "mm_wooden_wall", - "wooden wall" + "wooden wall 12 (MM style)" }, { "mm_wooden_wall_13", "mm_wooden_wall", - "wooden wall" + "wooden wall 13 (MM style)" }, { "mm_wooden_wall_14", "mm_wooden_wall", - "wooden wall" + "wooden wall 14 (MM style)" }, { "mm_wooden_wall_15", "mm_wooden_wall", - "wooden wall" + "wooden wall 15 (MM style)" }, { "mm_wooden_wall_16", "mm_wooden_wall", - "wooden wall" + "wooden wall 16 (MM style)" }, { "mm_ice_wall_1", "mm_ice_wall", - "ice wall" + "ice wall 1" }, { "mm_ice_wall_2", "mm_ice_wall", - "ice wall" + "ice wall 2" }, { "mm_ice_wall_3", "mm_ice_wall", - "ice wall" + "ice wall 3" }, { "mm_ice_wall_4", "mm_ice_wall", - "ice wall" + "ice wall 4" }, { "mm_ice_wall_5", "mm_ice_wall", - "ice wall" + "ice wall 5" }, { "mm_ice_wall_6", "mm_ice_wall", - "ice wall" + "ice wall 6" }, { "mm_ice_wall_7", "mm_ice_wall", - "ice wall" + "ice wall 7" }, { "mm_ice_wall_8", "mm_ice_wall", - "ice wall" + "ice wall 8" }, { "mm_ice_wall_9", "mm_ice_wall", - "ice wall" + "ice wall 9" }, { "mm_ice_wall_10", "mm_ice_wall", - "ice wall" + "ice wall 10" }, { "mm_ice_wall_11", "mm_ice_wall", - "ice wall" + "ice wall 11" }, { "mm_ice_wall_12", "mm_ice_wall", - "ice wall" + "ice wall 12" }, { "mm_ice_wall_13", "mm_ice_wall", - "ice wall" + "ice wall 13" }, { "mm_ice_wall_14", "mm_ice_wall", - "ice wall" + "ice wall 14" }, { "mm_ice_wall_15", "mm_ice_wall", - "ice wall" + "ice wall 15" }, { "mm_ice_wall_16", "mm_ice_wall", - "ice wall" + "ice wall 16" }, { "mm_amoeba_wall_1", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 1" }, { "mm_amoeba_wall_2", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 2" }, { "mm_amoeba_wall_3", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 3" }, { "mm_amoeba_wall_4", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 4" }, { "mm_amoeba_wall_5", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 5" }, { "mm_amoeba_wall_6", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 6" }, { "mm_amoeba_wall_7", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 7" }, { "mm_amoeba_wall_8", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 8" }, { "mm_amoeba_wall_9", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 9" }, { "mm_amoeba_wall_10", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 10" }, { "mm_amoeba_wall_11", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 11" }, { "mm_amoeba_wall_12", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 12" }, { "mm_amoeba_wall_13", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 13" }, { "mm_amoeba_wall_14", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 14" }, { "mm_amoeba_wall_15", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 15" }, { "mm_amoeba_wall_16", "mm_amoeba_wall", - "amoeba wall" + "amoeba wall 16" }, { "mm_wooden_block", @@ -5475,162 +5475,162 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = { "df_wooden_wall_1", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 1 (DF style)" }, { "df_wooden_wall_2", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 2 (DF style)" }, { "df_wooden_wall_3", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 3 (DF style)" }, { "df_wooden_wall_4", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 4 (DF style)" }, { "df_wooden_wall_5", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 5 (DF style)" }, { "df_wooden_wall_6", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 6 (DF style)" }, { "df_wooden_wall_7", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 7 (DF style)" }, { "df_wooden_wall_8", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 8 (DF style)" }, { "df_wooden_wall_9", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 9 (DF style)" }, { "df_wooden_wall_10", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 10 (DF style)" }, { "df_wooden_wall_11", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 11 (DF style)" }, { "df_wooden_wall_12", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 12 (DF style)" }, { "df_wooden_wall_13", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 13 (DF style)" }, { "df_wooden_wall_14", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 14 (DF style)" }, { "df_wooden_wall_15", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 15 (DF style)" }, { "df_wooden_wall_16", "df_wooden_wall", - "wooden wall (DF style)" + "wooden wall 16 (DF style)" }, { "df_steel_wall_1", "df_steel_wall", - "steel wall (DF style)" + "steel wall 1 (DF style)" }, { "df_steel_wall_2", "df_steel_wall", - "steel wall (DF style)" + "steel wall 2 (DF style)" }, { "df_steel_wall_3", "df_steel_wall", - "steel wall (DF style)" + "steel wall 3 (DF style)" }, { "df_steel_wall_4", "df_steel_wall", - "steel wall (DF style)" + "steel wall 4 (DF style)" }, { "df_steel_wall_5", "df_steel_wall", - "steel wall (DF style)" + "steel wall 5 (DF style)" }, { "df_steel_wall_6", "df_steel_wall", - "steel wall (DF style)" + "steel wall 6 (DF style)" }, { "df_steel_wall_7", "df_steel_wall", - "steel wall (DF style)" + "steel wall 7 (DF style)" }, { "df_steel_wall_8", "df_steel_wall", - "steel wall (DF style)" + "steel wall 8 (DF style)" }, { "df_steel_wall_9", "df_steel_wall", - "steel wall (DF style)" + "steel wall 9 (DF style)" }, { "df_steel_wall_10", "df_steel_wall", - "steel wall (DF style)" + "steel wall 10 (DF style)" }, { "df_steel_wall_11", "df_steel_wall", - "steel wall (DF style)" + "steel wall 11 (DF style)" }, { "df_steel_wall_12", "df_steel_wall", - "steel wall (DF style)" + "steel wall 12 (DF style)" }, { "df_steel_wall_13", "df_steel_wall", - "steel wall (DF style)" + "steel wall 13 (DF style)" }, { "df_steel_wall_14", "df_steel_wall", - "steel wall (DF style)" + "steel wall 14 (DF style)" }, { "df_steel_wall_15", "df_steel_wall", - "steel wall (DF style)" + "steel wall 15 (DF style)" }, { "df_steel_wall_16", "df_steel_wall", - "steel wall (DF style)" + "steel wall 16 (DF style)" }, { "df_empty_space", @@ -6230,12 +6230,12 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = { "mm_steel_wall", "mm_steel_wall", - "steel wall", + "steel wall (MM style)", }, { "mm_wooden_wall", "mm_wooden_wall", - "wooden wall", + "wooden wall (MM style)", }, { "mm_ice_wall", @@ -6267,6 +6267,16 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = "df_wooden_wall", "wooden wall (DF style)", }, + { + "spring.left", + "spring", + "spring (starts moving left)" + }, + { + "spring.right", + "spring", + "spring (starts moving right)" + }, // -------------------------------------------------------------------------- // "real" (and therefore drawable) runtime elements @@ -7571,6 +7581,11 @@ struct GlobalAnimNameInfo global_anim_name_info[NUM_GLOBAL_ANIM_TOKENS + 1] = { NULL } }; +struct GlobalAnimEventInfo global_anim_event_info = +{ + NULL, 0 +}; + // ---------------------------------------------------------------------------- // music token prefix definitions @@ -7604,7 +7619,7 @@ static void print_usage(void) " --serveronly only start network server\n" " -v, --verbose verbose mode\n" " -V, --version show program version\n" - " --debug display debugging information\n" + " --debug[=MODE] show (and limit) debug output\n" " -e, --execute COMMAND execute batch COMMAND\n" "\n" "Valid commands for '--execute' option:\n" @@ -7616,10 +7631,12 @@ static void print_usage(void) " \"print helptext.conf\" print default helptext config\n" " \"dump level FILE\" dump level data from FILE\n" " \"dump tape FILE\" dump tape data from FILE\n" - " \"autotest LEVELDIR [NR ...]\" test level tapes for LEVELDIR\n" " \"autoplay LEVELDIR [NR ...]\" play level tapes for LEVELDIR\n" " \"autoffwd LEVELDIR [NR ...]\" ffwd level tapes for LEVELDIR\n" " \"autowarp LEVELDIR [NR ...]\" warp level tapes for LEVELDIR\n" + " \"autotest LEVELDIR [NR ...]\" test level tapes for LEVELDIR\n" + " \"autofix LEVELDIR [NR ...]\" test and fix tapes for LEVELDIR\n" + " \"patch tapes MODE LEVELDIR [NR]\" patch level tapes for LEVELDIR\n" " \"convert LEVELDIR [NR]\" convert levels in LEVELDIR\n" " \"create images DIRECTORY\" write BMP images to DIRECTORY\n" " \"create CE image DIRECTORY\" write BMP image to DIRECTORY\n" @@ -7682,7 +7699,9 @@ static void InitProgramConfig(char *command_filename) char *config_filename = getProgramConfigFilename(command_filename); char *userdata_basename = getBaseNameNoSuffix(command_filename); char *userdata_subdir; +#if defined(PLATFORM_UNIX) char *userdata_subdir_unix; +#endif // read default program config, if existing if (fileExists(config_filename)) @@ -7700,8 +7719,10 @@ static void InitProgramConfig(char *command_filename) LoadSetupFromFilename(config_filename); } +#if defined(PLATFORM_UNIX) // set user data directory for Linux/Unix (but not Mac OS X) userdata_subdir_unix = getStringCat2(".", userdata_basename); +#endif // set program title from potentially redefined program title if (setup.internal.program_title != NULL &&