moved game controller base mappings file to new 'conf' sub-directory
[rocksndiamonds.git] / src / main.c
index 6f1559b5e3d6241cc6231957a8bf400caa7c750a..690296dded7266b0be70af083fe264a0f1588339 100644 (file)
 #include "events.h"
 #include "config.h"
 
-Bitmap                *bitmap_db_store;
-Bitmap                *bitmap_db_cross;
 Bitmap                *bitmap_db_field;
 Bitmap                *bitmap_db_panel;
 Bitmap                *bitmap_db_door_1;
 Bitmap                *bitmap_db_door_2;
-Bitmap                *bitmap_db_toons;
+Bitmap                *bitmap_db_store_1;
+Bitmap                *bitmap_db_store_2;
 DrawBuffer            *fieldbuffer;
 DrawBuffer            *drawto_field;
 
@@ -119,6 +118,7 @@ int                 ScrollStepSize;
 int                    ScreenMovDir = MV_NONE, ScreenMovPos = 0;
 int                    ScreenGfxPos = 0;
 int                    BorderElement = EL_STEELWALL;
+int                    MenuFrameDelay = MENU_FRAME_DELAY;
 int                    GameFrameDelay = GAME_FRAME_DELAY;
 int                    FfwdFrameDelay = FFWD_FRAME_DELAY;
 int                    BX1, BY1;
@@ -144,10 +144,24 @@ struct GlobalInfo global;
 struct BorderInfo      border;
 struct ViewportInfo    viewport;
 struct TitleFadingInfo fading;
+struct TitleFadingInfo title_initial_first_default;
 struct TitleFadingInfo title_initial_default;
+struct TitleFadingInfo title_first_default;
 struct TitleFadingInfo title_default;
+struct TitleMessageInfo        titlescreen_initial_first_default;
+struct TitleMessageInfo        titlescreen_initial_first[MAX_NUM_TITLE_IMAGES];
+struct TitleMessageInfo        titlescreen_initial_default;
+struct TitleMessageInfo        titlescreen_initial[MAX_NUM_TITLE_IMAGES];
+struct TitleMessageInfo        titlescreen_first_default;
+struct TitleMessageInfo        titlescreen_first[MAX_NUM_TITLE_IMAGES];
+struct TitleMessageInfo        titlescreen_default;
+struct TitleMessageInfo        titlescreen[MAX_NUM_TITLE_IMAGES];
+struct TitleMessageInfo        titlemessage_initial_first_default;
+struct TitleMessageInfo        titlemessage_initial_first[MAX_NUM_TITLE_MESSAGES];
 struct TitleMessageInfo        titlemessage_initial_default;
 struct TitleMessageInfo        titlemessage_initial[MAX_NUM_TITLE_MESSAGES];
+struct TitleMessageInfo        titlemessage_first_default;
+struct TitleMessageInfo        titlemessage_first[MAX_NUM_TITLE_MESSAGES];
 struct TitleMessageInfo        titlemessage_default;
 struct TitleMessageInfo        titlemessage[MAX_NUM_TITLE_MESSAGES];
 struct TitleMessageInfo        readme;
@@ -5432,6 +5446,38 @@ struct ElementActionInfo element_action_info[NUM_ACTIONS + 1 + 1] =
   { ".page[30]",               ACTION_PAGE_30,                 FALSE   },
   { ".page[31]",               ACTION_PAGE_31,                 FALSE   },
   { ".page[32]",               ACTION_PAGE_32,                 FALSE   },
+  { ".part_1",                 ACTION_PART_1,                  FALSE   },
+  { ".part_2",                 ACTION_PART_2,                  FALSE   },
+  { ".part_3",                 ACTION_PART_3,                  FALSE   },
+  { ".part_4",                 ACTION_PART_4,                  FALSE   },
+  { ".part_5",                 ACTION_PART_5,                  FALSE   },
+  { ".part_6",                 ACTION_PART_6,                  FALSE   },
+  { ".part_7",                 ACTION_PART_7,                  FALSE   },
+  { ".part_8",                 ACTION_PART_8,                  FALSE   },
+  { ".part_9",                 ACTION_PART_9,                  FALSE   },
+  { ".part_10",                        ACTION_PART_10,                 FALSE   },
+  { ".part_11",                        ACTION_PART_11,                 FALSE   },
+  { ".part_12",                        ACTION_PART_12,                 FALSE   },
+  { ".part_13",                        ACTION_PART_13,                 FALSE   },
+  { ".part_14",                        ACTION_PART_14,                 FALSE   },
+  { ".part_15",                        ACTION_PART_15,                 FALSE   },
+  { ".part_16",                        ACTION_PART_16,                 FALSE   },
+  { ".part_17",                        ACTION_PART_17,                 FALSE   },
+  { ".part_18",                        ACTION_PART_18,                 FALSE   },
+  { ".part_19",                        ACTION_PART_19,                 FALSE   },
+  { ".part_20",                        ACTION_PART_20,                 FALSE   },
+  { ".part_21",                        ACTION_PART_21,                 FALSE   },
+  { ".part_22",                        ACTION_PART_22,                 FALSE   },
+  { ".part_23",                        ACTION_PART_23,                 FALSE   },
+  { ".part_24",                        ACTION_PART_24,                 FALSE   },
+  { ".part_25",                        ACTION_PART_25,                 FALSE   },
+  { ".part_26",                        ACTION_PART_26,                 FALSE   },
+  { ".part_27",                        ACTION_PART_27,                 FALSE   },
+  { ".part_28",                        ACTION_PART_28,                 FALSE   },
+  { ".part_29",                        ACTION_PART_29,                 FALSE   },
+  { ".part_30",                        ACTION_PART_30,                 FALSE   },
+  { ".part_31",                        ACTION_PART_31,                 FALSE   },
+  { ".part_32",                        ACTION_PART_32,                 FALSE   },
   { ".other",                  ACTION_OTHER,                   FALSE   },
 
   /* empty suffix always matches -- check as last entry in InitSoundInfo() */
@@ -5459,7 +5505,17 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] =
   { ".[DEFAULT]",              GFX_SPECIAL_ARG_DEFAULT,                },
   { ".LOADING",                        GFX_SPECIAL_ARG_LOADING,                },
   { ".TITLE_INITIAL",          GFX_SPECIAL_ARG_TITLE_INITIAL,          },
+  { ".TITLE_INITIAL_1",                GFX_SPECIAL_ARG_TITLE_INITIAL_1,        },
+  { ".TITLE_INITIAL_2",                GFX_SPECIAL_ARG_TITLE_INITIAL_2,        },
+  { ".TITLE_INITIAL_3",                GFX_SPECIAL_ARG_TITLE_INITIAL_3,        },
+  { ".TITLE_INITIAL_4",                GFX_SPECIAL_ARG_TITLE_INITIAL_4,        },
+  { ".TITLE_INITIAL_5",                GFX_SPECIAL_ARG_TITLE_INITIAL_5,        },
   { ".TITLE",                  GFX_SPECIAL_ARG_TITLE,                  },
+  { ".TITLE_1",                        GFX_SPECIAL_ARG_TITLE_1,                },
+  { ".TITLE_2",                        GFX_SPECIAL_ARG_TITLE_2,                },
+  { ".TITLE_3",                        GFX_SPECIAL_ARG_TITLE_3,                },
+  { ".TITLE_4",                        GFX_SPECIAL_ARG_TITLE_4,                },
+  { ".TITLE_5",                        GFX_SPECIAL_ARG_TITLE_5,                },
   { ".MAIN",                   GFX_SPECIAL_ARG_MAIN,                   },
   { ".LEVELS",                 GFX_SPECIAL_ARG_LEVELS                  },
   { ".LEVELNR",                        GFX_SPECIAL_ARG_LEVELNR                 },
@@ -5473,6 +5529,15 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] =
   { ".PANEL",                  GFX_SPECIAL_ARG_PANEL,                  },
   { ".PREVIEW",                        GFX_SPECIAL_ARG_PREVIEW,                },
   { ".CRUMBLED",               GFX_SPECIAL_ARG_CRUMBLED,               },
+  { ".MAINONLY",               GFX_SPECIAL_ARG_MAINONLY,               },
+  { ".TYPENAME",               GFX_SPECIAL_ARG_TYPENAME,               },
+  { ".SUBMENU",                        GFX_SPECIAL_ARG_SUBMENU,                },
+  { ".MENU",                   GFX_SPECIAL_ARG_MENU,                   },
+  { ".TOONS",                  GFX_SPECIAL_ARG_TOONS,                  },
+  { ".SCORESOLD",              GFX_SPECIAL_ARG_SCORESOLD,              },
+  { ".SCORESNEW",              GFX_SPECIAL_ARG_SCORESNEW,              },
+  { ".FADING",                 GFX_SPECIAL_ARG_FADING,                 },
+  { ".QUIT",                   GFX_SPECIAL_ARG_QUIT,                   },
 
   /* empty suffix always matches -- check as last entry in InitMusicInfo() */
   { "",                                GFX_SPECIAL_ARG_DEFAULT,                },
@@ -5520,11 +5585,14 @@ struct FontInfo font_info[NUM_FONTS + 1] =
   { "font.input_2.active"      },
   { "font.input_1"             },
   { "font.input_2"             },
+  { "font.option_off_narrow"   },
   { "font.option_off"          },
+  { "font.option_on_narrow"    },
   { "font.option_on"           },
   { "font.value_1"             },
   { "font.value_2"             },
   { "font.value_old"           },
+  { "font.value_narrow"                },
   { "font.level_number.active" },
   { "font.level_number"                },
   { "font.tape_recorder"       },
@@ -5535,6 +5603,82 @@ struct FontInfo font_info[NUM_FONTS + 1] =
   { NULL                       }
 };
 
+struct GlobalAnimInfo global_anim_info[NUM_GLOBAL_ANIM_TOKENS + 1];
+
+/* this contains predefined structure elements to init "global_anim_info" */
+struct GlobalAnimNameInfo global_anim_name_info[NUM_GLOBAL_ANIM_TOKENS + 1] =
+{
+  /* (real) graphic definitions used to define animation graphics */
+  { "gfx.global.anim_1",       },
+  { "gfx.global.anim_2",       },
+  { "gfx.global.anim_3",       },
+  { "gfx.global.anim_4",       },
+  { "gfx.global.anim_5",       },
+  { "gfx.global.anim_6",       },
+  { "gfx.global.anim_7",       },
+  { "gfx.global.anim_8",       },
+  { "gfx.global.anim_9",       },
+  { "gfx.global.anim_10",      },
+  { "gfx.global.anim_11",      },
+  { "gfx.global.anim_12",      },
+  { "gfx.global.anim_13",      },
+  { "gfx.global.anim_14",      },
+  { "gfx.global.anim_15",      },
+  { "gfx.global.anim_16",      },
+  { "gfx.global.anim_17",      },
+  { "gfx.global.anim_18",      },
+  { "gfx.global.anim_19",      },
+  { "gfx.global.anim_20",      },
+  { "gfx.global.anim_21",      },
+  { "gfx.global.anim_22",      },
+  { "gfx.global.anim_23",      },
+  { "gfx.global.anim_24",      },
+  { "gfx.global.anim_25",      },
+  { "gfx.global.anim_26",      },
+  { "gfx.global.anim_27",      },
+  { "gfx.global.anim_28",      },
+  { "gfx.global.anim_29",      },
+  { "gfx.global.anim_30",      },
+  { "gfx.global.anim_31",      },
+  { "gfx.global.anim_32",      },
+
+  /* (dummy) graphic definitions used to define animation controls */
+  { "global.anim_1",           },
+  { "global.anim_2",           },
+  { "global.anim_3",           },
+  { "global.anim_4",           },
+  { "global.anim_5",           },
+  { "global.anim_6",           },
+  { "global.anim_7",           },
+  { "global.anim_8",           },
+  { "global.anim_9",           },
+  { "global.anim_10",          },
+  { "global.anim_11",          },
+  { "global.anim_12",          },
+  { "global.anim_13",          },
+  { "global.anim_14",          },
+  { "global.anim_15",          },
+  { "global.anim_16",          },
+  { "global.anim_17",          },
+  { "global.anim_18",          },
+  { "global.anim_19",          },
+  { "global.anim_20",          },
+  { "global.anim_21",          },
+  { "global.anim_22",          },
+  { "global.anim_23",          },
+  { "global.anim_24",          },
+  { "global.anim_25",          },
+  { "global.anim_26",          },
+  { "global.anim_27",          },
+  { "global.anim_28",          },
+  { "global.anim_29",          },
+  { "global.anim_30",          },
+  { "global.anim_31",          },
+  { "global.anim_32",          },
+
+  { NULL                       }
+};
+
 
 /* ------------------------------------------------------------------------- */
 /* music token prefix definitions                                            */
@@ -5558,12 +5702,12 @@ static void print_usage()
        "Usage: %s [OPTION]... [HOSTNAME [PORT]]\n"
        "\n"
        "Options:\n"
-       "  -d, --display HOSTNAME[:SCREEN]  specify X server display\n"
        "  -b, --basepath DIRECTORY         alternative base DIRECTORY\n"
        "  -l, --level DIRECTORY            alternative level DIRECTORY\n"
        "  -g, --graphics DIRECTORY         alternative graphics DIRECTORY\n"
        "  -s, --sounds DIRECTORY           alternative sounds DIRECTORY\n"
        "  -m, --music DIRECTORY            alternative music DIRECTORY\n"
+       "      --mytapes                    use private tapes for tape tests\n"
        "  -n, --network                    network multiplayer game\n"
        "      --serveronly                 only start network server\n"
        "  -v, --verbose                    verbose mode\n"
@@ -5583,6 +5727,7 @@ static void print_usage()
        "  \"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"
        "  \"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"
@@ -5592,12 +5737,13 @@ static void print_usage()
 
 static void print_version()
 {
-  Print("%s %d.%d.%d.%d\n",
+  Print("%s %d.%d.%d.%d%s\n",
        PROGRAM_TITLE_STRING,
        PROGRAM_VERSION_MAJOR,
        PROGRAM_VERSION_MINOR,
        PROGRAM_VERSION_PATCH,
-       PROGRAM_VERSION_BUILD);
+       PROGRAM_VERSION_BUILD,
+       PROGRAM_VERSION_EXTRA);
 
   if (options.debug)
   {
@@ -5645,7 +5791,7 @@ static void InitProgramConfig(char *command_filename)
     userdata_basename = getBaseName(config_filename);
 
     if (strSuffix(userdata_basename, ".conf"))
-      userdata_basename[strlen(userdata_basename) - 4] = '\0';
+      userdata_basename[strlen(userdata_basename) - 5] = '\0';
 
     LoadSetupFromFilename(config_filename);
   }
@@ -5671,6 +5817,14 @@ static void InitProgramConfig(char *command_filename)
   userdata_subdir = USERDATA_DIRECTORY_OTHER;
 #endif
 
+  // set default window size (only relevant on program startup)
+  if (setup.internal.default_window_width  != 0 &&
+      setup.internal.default_window_height != 0)
+  {
+    WIN_XSIZE = setup.internal.default_window_width;
+    WIN_YSIZE = setup.internal.default_window_height;
+  }
+
   InitProgramInfo(command_filename,
                  config_filename,
                  userdata_subdir,