rnd-20070318-3-src
authorHolger Schemel <info@artsoft.org>
Sun, 18 Mar 2007 21:54:35 +0000 (22:54 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:54:59 +0000 (10:54 +0200)
13 files changed:
ChangeLog
src/conf_gfx.c
src/conf_var.c
src/conftime.h
src/files.c
src/init.c
src/libgame/misc.c
src/libgame/misc.h
src/libgame/system.h
src/libgame/text.c
src/libgame/text.h
src/main.h
src/screens.c

index 5a20b4ec7f345aaf7feb1b68ac2379fd45ce4cd6..ca6007bf07a4945a231ccc413149ecae3a0eb26a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,37 +1,82 @@
 2007-03-18
-       * added configurability of graphics, sounds and music for title screens
+       * added configurability of graphics, sounds and music for title screens,
+         which are separated into initial title screens (only shown once at
+         program startup) and title screens shown for a given level set; these
+         title screens can be composed of up to five title images and up to
+         five title text messages (each drawn using an optional background
+         image), also using background music and/or sounds; aspects like
+         background images, sounds and music of title screens can either be
+         defined generally (valid for all title screens) or specifically (and
+         therefore differently for each title screen) using these directives:
+
+         to define a background image, sound or music file for all screens:
+         - background.TITLE_INITIAL (for all title screens for game startup)
+         - background.TITLE         (for all title screens for level sets)
+
+         to define a background image, sound or music file for a single screen:
+         - background.titlescreen_initial_x  (with x in 1,2,3,4,5)
+         - background.titlescreen_x          (with x in 1,2,3,4,5)
+         - background.titlemessage_initial_x (with x in 1,2,3,4,5)
+         - background.titlemessage_x         (with x in 1,2,3,4,5)
+
+         to define the title screen images:
+         - titlescreen_initial_x             (with x in 1,2,3,4,5)
+         - titlescreen_x                     (with x in 1,2,3,4,5)
+
+         to define the title text messages, place text files into the level set
+         directory that have the following file names:
+         - titlemessage_initial_x.txt        (with x in 1,2,3,4,5)
+         - titlemessage_x.txt                (with x in 1,2,3,4,5)
+
+         to define the properties of the text messages, either use directives
+         that affect all text messages:
+         - [titlemessage_initial].<suffix>
+         - [titlemessage].<suffix>
+         or use directives affect single text messages:
+         - titlemessage_initial_x.<suffix>   (with x in 1,2,3,4,5)
+         - titlemessage_x.<suffix>           (with x in 1,2,3,4,5)
+
+         valid values for <suffix> are the same as for readme.<suffix> below;
+         use ".sort_priority" (default: 0) to define an arbitrary order for
+         title images and title messages (which can therefore be mixed)
 
 2007-03-14
        * added full configurability of "readme.txt" screen appearance:
-         - readme.x:             <left position used with alignment>
-         - readme.y:             <top position>
-         - readme.width:         <maximim text width in pixels>
-         - readme.height:        <maximum text height in pixels>
-         - readme.chars:         <maximum number of chars per line>
-         - readme.lines:         <maximum number of lines displayed>
-         - readme.align:         left,center,right (default: center)
-         - readme.font:          font name
-         - readme.autowrap:      true,false (default: true)
-         - readme.centered:      true,false (default: false)
-         - readme.skip_comments: true,false (default: true)
-         - readme.sort_priority: (currently not used)
+         - readme.x:              <left position used with alignment>
+         - readme.y:              <top position>
+         - readme.width:          <maximim text width in pixels>
+         - readme.height:         <maximum text height in pixels>
+         - readme.chars:          <maximum number of chars per line>
+         - readme.lines:          <maximum number of lines displayed>
+         - readme.align:          left,center,right (default: center)
+         - readme.top:            top,middle,bottom (default: top)
+         - readme.font:           font name
+         - readme.autowrap:       true,false (default: true)
+         - readme.centered:       true,false (default: false)
+         - readme.parse_comments: true,false (default: true)
+         - readme.sort_priority:  (not used here, but only for title screens)
          when "readme.chars" and/or "readme.lines" is set to "-1" (this is the
          default), they are automatically determined from "readme.width" and
          "readme.height" accordingly; when they are not "-1", they have
          precedence over "readme.width" and "readme.height"
        * added internal ad-hoc config settings for displaying text files like
          title messages or "readme.txt" style level set info files:
-         - .autowrap:      true,false (default: value of readme.autowrap)
-         - .centered:      true,false (default: value of readme.autowrap)
-         - .skip_comments: true,false (default: value of readme.autowrap)
+         - .font:           font name  (default: readme.font)
+         - .autowrap:       true,false (default: readme.autowrap)
+         - .centered:       true,false (default: readme.centered)
+         - .parse_comments: true,false (default: readme.parse_comments)
          (the leading '.' and the separating ':' are mandatory here); to use
          these ad-hoc settings, they have to be written inside a comment, like
          "# .autowrap: false" or "# .centered: true"; these settings then
          override the above global settings (they can even be used more than
          once, like "# .centered: true", then some text that should be drawn
          centered, then "# .centered: false" to go back to non-centered text;
-         only ".skip_comments" can not be used after a ".skip_comments: false"
-         again, as this generally disables detecting comments at all)
+         important note: after using "# .parse_comments: false", or when using
+         "readme.parse_comments: false", detecting and parsing comments inside
+         the file is disabled and comments are just printed like normal text;
+         also be aware that all automatic text size calculations are done with
+         the font defined in "readme.font", while using different fonts using
+         "# .font: <font>" inside the text file may cause unexpected results
 
 2007-03-08
        * changed some numerical limits in the level editor from 255 to 999
index 2782ed7dd69b084d0540383ca89afae308655542..dc30739e3c2c16f750e572da0840cf62ac52531c 100644 (file)
@@ -4991,7 +4991,7 @@ struct ConfigInfo image_config[] =
   { "[titlemessage_initial].font",             "font.text_1"           },
   { "[titlemessage_initial].autowrap",         "false"                 },
   { "[titlemessage_initial].centered",         "false"                 },
-  { "[titlemessage_initial].skip_comments",    "false"                 },
+  { "[titlemessage_initial].parse_comments",   "false"                 },
   { "[titlemessage_initial].sort_priority",    "0"                     },
   { "[titlemessage].x",                                "336"                   },
   { "[titlemessage].y",                                "280"                   },
@@ -5004,7 +5004,7 @@ struct ConfigInfo image_config[] =
   { "[titlemessage].font",                     "font.text_1"           },
   { "[titlemessage].autowrap",                 "false"                 },
   { "[titlemessage].centered",                 "false"                 },
-  { "[titlemessage].skip_comments",            "false"                 },
+  { "[titlemessage].parse_comments",           "false"                 },
   { "[titlemessage].sort_priority",            "0"                     },
 
   { "titlemessage_initial_1.x",                        "336"                   },
@@ -5018,7 +5018,7 @@ struct ConfigInfo image_config[] =
   { "titlemessage_initial_1.font",             "font.text_1"           },
   { "titlemessage_initial_1.autowrap",         "false"                 },
   { "titlemessage_initial_1.centered",         "false"                 },
-  { "titlemessage_initial_1.skip_comments",    "false"                 },
+  { "titlemessage_initial_1.parse_comments",   "false"                 },
   { "titlemessage_initial_1.sort_priority",    "0"                     },
   { "titlemessage_initial_2.x",                        "336"                   },
   { "titlemessage_initial_2.y",                        "280"                   },
@@ -5031,7 +5031,7 @@ struct ConfigInfo image_config[] =
   { "titlemessage_initial_2.font",             "font.text_1"           },
   { "titlemessage_initial_2.autowrap",         "false"                 },
   { "titlemessage_initial_2.centered",         "false"                 },
-  { "titlemessage_initial_2.skip_comments",    "false"                 },
+  { "titlemessage_initial_2.parse_comments",   "false"                 },
   { "titlemessage_initial_2.sort_priority",    "0"                     },
   { "titlemessage_initial_3.x",                        "336"                   },
   { "titlemessage_initial_3.y",                        "280"                   },
@@ -5044,7 +5044,7 @@ struct ConfigInfo image_config[] =
   { "titlemessage_initial_3.font",             "font.text_1"           },
   { "titlemessage_initial_3.autowrap",         "false"                 },
   { "titlemessage_initial_3.centered",         "false"                 },
-  { "titlemessage_initial_3.skip_comments",    "false"                 },
+  { "titlemessage_initial_3.parse_comments",   "false"                 },
   { "titlemessage_initial_3.sort_priority",    "0"                     },
   { "titlemessage_initial_4.x",                        "336"                   },
   { "titlemessage_initial_4.y",                        "280"                   },
@@ -5057,7 +5057,7 @@ struct ConfigInfo image_config[] =
   { "titlemessage_initial_4.font",             "font.text_1"           },
   { "titlemessage_initial_4.autowrap",         "false"                 },
   { "titlemessage_initial_4.centered",         "false"                 },
-  { "titlemessage_initial_4.skip_comments",    "false"                 },
+  { "titlemessage_initial_4.parse_comments",   "false"                 },
   { "titlemessage_initial_4.sort_priority",    "0"                     },
   { "titlemessage_initial_5.x",                        "336"                   },
   { "titlemessage_initial_5.y",                        "280"                   },
@@ -5070,7 +5070,7 @@ struct ConfigInfo image_config[] =
   { "titlemessage_initial_5.font",             "font.text_1"           },
   { "titlemessage_initial_5.autowrap",         "false"                 },
   { "titlemessage_initial_5.centered",         "false"                 },
-  { "titlemessage_initial_5.skip_comments",    "false"                 },
+  { "titlemessage_initial_5.parse_comments",   "false"                 },
   { "titlemessage_initial_5.sort_priority",    "0"                     },
   { "titlemessage_1.x",                                "336"                   },
   { "titlemessage_1.y",                                "280"                   },
@@ -5083,7 +5083,7 @@ struct ConfigInfo image_config[] =
   { "titlemessage_1.font",                     "font.text_1"           },
   { "titlemessage_1.autowrap",                 "false"                 },
   { "titlemessage_1.centered",                 "false"                 },
-  { "titlemessage_1.skip_comments",            "false"                 },
+  { "titlemessage_1.parse_comments",           "false"                 },
   { "titlemessage_1.sort_priority",            "0"                     },
   { "titlemessage_2.x",                                "336"                   },
   { "titlemessage_2.y",                                "280"                   },
@@ -5096,7 +5096,7 @@ struct ConfigInfo image_config[] =
   { "titlemessage_2.font",                     "font.text_1"           },
   { "titlemessage_2.autowrap",                 "false"                 },
   { "titlemessage_2.centered",                 "false"                 },
-  { "titlemessage_2.skip_comments",            "false"                 },
+  { "titlemessage_2.parse_comments",           "false"                 },
   { "titlemessage_2.sort_priority",            "0"                     },
   { "titlemessage_3.x",                                "336"                   },
   { "titlemessage_3.y",                                "280"                   },
@@ -5109,7 +5109,7 @@ struct ConfigInfo image_config[] =
   { "titlemessage_3.font",                     "font.text_1"           },
   { "titlemessage_3.autowrap",                 "false"                 },
   { "titlemessage_3.centered",                 "false"                 },
-  { "titlemessage_3.skip_comments",            "false"                 },
+  { "titlemessage_3.parse_comments",           "false"                 },
   { "titlemessage_3.sort_priority",            "0"                     },
   { "titlemessage_4.x",                                "336"                   },
   { "titlemessage_4.y",                                "280"                   },
@@ -5122,7 +5122,7 @@ struct ConfigInfo image_config[] =
   { "titlemessage_4.font",                     "font.text_1"           },
   { "titlemessage_4.autowrap",                 "false"                 },
   { "titlemessage_4.centered",                 "false"                 },
-  { "titlemessage_4.skip_comments",            "false"                 },
+  { "titlemessage_4.parse_comments",           "false"                 },
   { "titlemessage_4.sort_priority",            "0"                     },
   { "titlemessage_5.x",                                "336"                   },
   { "titlemessage_5.y",                                "280"                   },
@@ -5135,7 +5135,7 @@ struct ConfigInfo image_config[] =
   { "titlemessage_5.font",                     "font.text_1"           },
   { "titlemessage_5.autowrap",                 "false"                 },
   { "titlemessage_5.centered",                 "false"                 },
-  { "titlemessage_5.skip_comments",            "false"                 },
+  { "titlemessage_5.parse_comments",           "false"                 },
   { "titlemessage_5.sort_priority",            "0"                     },
 
   { "readme.x",                                        "272"                   },
@@ -5149,7 +5149,7 @@ struct ConfigInfo image_config[] =
   { "readme.font",                             "font.info.levelset"    },
   { "readme.autowrap",                         "true"                  },
   { "readme.centered",                         "false"                 },
-  { "readme.skip_comments",                    "true"                  },
+  { "readme.parse_comments",                   "true"                  },
   { "readme.sort_priority",                    "0"                     },
 
   { "global.num_toons",                                "20"                    },
index ed053adf921a61b9ee875b667f51c35072b95f5c..ae8fefb71e43a3d9bf7407b948af55531951b539 100644 (file)
@@ -65,8 +65,8 @@ struct TokenIntPtrInfo image_config_vars[] =
     &titlemessage_initial_default.centered
   },
   {
-    "[titlemessage_initial].skip_comments",
-    &titlemessage_initial_default.skip_comments
+    "[titlemessage_initial].parse_comments",
+    &titlemessage_initial_default.parse_comments
   },
   {
     "[titlemessage_initial].sort_priority",
@@ -117,8 +117,8 @@ struct TokenIntPtrInfo image_config_vars[] =
     &titlemessage_default.centered
   },
   {
-    "[titlemessage].skip_comments",
-    &titlemessage_default.skip_comments
+    "[titlemessage].parse_comments",
+    &titlemessage_default.parse_comments
   },
   {
     "[titlemessage].sort_priority",
@@ -169,8 +169,8 @@ struct TokenIntPtrInfo image_config_vars[] =
     &titlemessage_initial[0].centered
   },
   {
-    "titlemessage_initial_1.skip_comments",
-    &titlemessage_initial[0].skip_comments
+    "titlemessage_initial_1.parse_comments",
+    &titlemessage_initial[0].parse_comments
   },
   {
     "titlemessage_initial_1.sort_priority",
@@ -221,8 +221,8 @@ struct TokenIntPtrInfo image_config_vars[] =
     &titlemessage_initial[1].centered
   },
   {
-    "titlemessage_initial_2.skip_comments",
-    &titlemessage_initial[1].skip_comments
+    "titlemessage_initial_2.parse_comments",
+    &titlemessage_initial[1].parse_comments
   },
   {
     "titlemessage_initial_2.sort_priority",
@@ -273,8 +273,8 @@ struct TokenIntPtrInfo image_config_vars[] =
     &titlemessage_initial[2].centered
   },
   {
-    "titlemessage_initial_3.skip_comments",
-    &titlemessage_initial[2].skip_comments
+    "titlemessage_initial_3.parse_comments",
+    &titlemessage_initial[2].parse_comments
   },
   {
     "titlemessage_initial_3.sort_priority",
@@ -325,8 +325,8 @@ struct TokenIntPtrInfo image_config_vars[] =
     &titlemessage_initial[3].centered
   },
   {
-    "titlemessage_initial_4.skip_comments",
-    &titlemessage_initial[3].skip_comments
+    "titlemessage_initial_4.parse_comments",
+    &titlemessage_initial[3].parse_comments
   },
   {
     "titlemessage_initial_4.sort_priority",
@@ -377,8 +377,8 @@ struct TokenIntPtrInfo image_config_vars[] =
     &titlemessage_initial[4].centered
   },
   {
-    "titlemessage_initial_5.skip_comments",
-    &titlemessage_initial[4].skip_comments
+    "titlemessage_initial_5.parse_comments",
+    &titlemessage_initial[4].parse_comments
   },
   {
     "titlemessage_initial_5.sort_priority",
@@ -429,8 +429,8 @@ struct TokenIntPtrInfo image_config_vars[] =
     &titlemessage[0].centered
   },
   {
-    "titlemessage_1.skip_comments",
-    &titlemessage[0].skip_comments
+    "titlemessage_1.parse_comments",
+    &titlemessage[0].parse_comments
   },
   {
     "titlemessage_1.sort_priority",
@@ -481,8 +481,8 @@ struct TokenIntPtrInfo image_config_vars[] =
     &titlemessage[1].centered
   },
   {
-    "titlemessage_2.skip_comments",
-    &titlemessage[1].skip_comments
+    "titlemessage_2.parse_comments",
+    &titlemessage[1].parse_comments
   },
   {
     "titlemessage_2.sort_priority",
@@ -533,8 +533,8 @@ struct TokenIntPtrInfo image_config_vars[] =
     &titlemessage[2].centered
   },
   {
-    "titlemessage_3.skip_comments",
-    &titlemessage[2].skip_comments
+    "titlemessage_3.parse_comments",
+    &titlemessage[2].parse_comments
   },
   {
     "titlemessage_3.sort_priority",
@@ -585,8 +585,8 @@ struct TokenIntPtrInfo image_config_vars[] =
     &titlemessage[3].centered
   },
   {
-    "titlemessage_4.skip_comments",
-    &titlemessage[3].skip_comments
+    "titlemessage_4.parse_comments",
+    &titlemessage[3].parse_comments
   },
   {
     "titlemessage_4.sort_priority",
@@ -637,8 +637,8 @@ struct TokenIntPtrInfo image_config_vars[] =
     &titlemessage[4].centered
   },
   {
-    "titlemessage_5.skip_comments",
-    &titlemessage[4].skip_comments
+    "titlemessage_5.parse_comments",
+    &titlemessage[4].parse_comments
   },
   {
     "titlemessage_5.sort_priority",
@@ -689,8 +689,8 @@ struct TokenIntPtrInfo image_config_vars[] =
     &readme.centered
   },
   {
-    "readme.skip_comments",
-    &readme.skip_comments
+    "readme.parse_comments",
+    &readme.parse_comments
   },
   {
     "readme.sort_priority",
index ad38c00e6c564ee49ac8cf86af45fa6a32a6c0ce..fa7ec707eca62fcac775c7ce9bf77df9a85f9b33 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-03-18 20:13"
+#define COMPILE_DATE_STRING "2007-03-18 22:44"
index a0389f4353bec975aedd718cb059a7f718bca2e5..51cc63176394c365514aa12b554446e0bacbc7e4 100644 (file)
@@ -8321,33 +8321,6 @@ void LoadCustomElementDescriptions()
   freeSetupFileHash(setup_file_hash);
 }
 
-static int get_token_parameter_value(char *token, char *value_raw)
-{
-  char *suffix;
-
-  if (token == NULL || value_raw == NULL)
-    return ARG_UNDEFINED_VALUE;
-
-  suffix = strrchr(token, '.');
-  if (suffix == NULL)
-    suffix = token;
-
-  if (strncmp(suffix, ".font", 5) == 0)
-  {
-    int i;
-
-    /* !!! OPTIMIZE THIS BY USING HASH !!! */
-    for (i = 0; i < NUM_FONTS; i++)
-      if (strEqual(value_raw, font_info[i].token_name))
-       return i;
-
-    /* if font not found, use reliable default value */
-    return FONT_INITIAL_1;
-  }
-
-  return get_parameter_value(value_raw, suffix, TYPE_INTEGER);
-}
-
 static void LoadSpecialMenuDesignSettingsFromFilename(char *filename)
 {
   static struct TitleMessageInfo tmi;
@@ -8364,7 +8337,7 @@ static void LoadSpecialMenuDesignSettingsFromFilename(char *filename)
     { TYPE_INTEGER,    &tmi.font,              ".font"                 },
     { TYPE_BOOLEAN,    &tmi.autowrap,          ".autowrap"             },
     { TYPE_BOOLEAN,    &tmi.centered,          ".centered"             },
-    { TYPE_BOOLEAN,    &tmi.skip_comments,     ".skip_comments"        },
+    { TYPE_BOOLEAN,    &tmi.parse_comments,    ".parse_comments"       },
     { TYPE_INTEGER,    &tmi.sort_priority,     ".sort_priority"        },
 
     { -1,              NULL,                   NULL                    }
index cb5e0661f67ca81ba7436e657e8b7ef9d2c3f4bd..dcef9e26dc253956421beea98ab050e15eb7f55d 100644 (file)
@@ -183,6 +183,19 @@ static int getFontBitmapID(int font_nr)
     return font_nr;
 }
 
+static int getFontFromToken(char *token)
+{
+  int i;
+
+  /* !!! OPTIMIZE THIS BY USING HASH !!! */
+  for (i = 0; i < NUM_FONTS; i++)
+    if (strEqual(token, font_info[i].token_name))
+      return i;
+
+  /* if font not found, use reliable default value */
+  return FONT_INITIAL_1;
+}
+
 void InitFontGraphicInfo()
 {
   static struct FontBitmapInfo *font_bitmap_info = NULL;
@@ -193,7 +206,8 @@ void InitFontGraphicInfo()
 
   if (graphic_info == NULL)            /* still at startup phase */
   {
-    InitFontInfo(font_initial, NUM_INITIAL_FONTS, getFontBitmapID);
+    InitFontInfo(font_initial, NUM_INITIAL_FONTS,
+                getFontBitmapID, getFontFromToken);
 
     return;
   }
@@ -412,7 +426,8 @@ void InitFontGraphicInfo()
     }
   }
 
-  InitFontInfo(font_bitmap_info, num_font_bitmaps, getFontBitmapID);
+  InitFontInfo(font_bitmap_info, num_font_bitmaps,
+              getFontBitmapID, getFontFromToken);
 }
 
 void InitElementGraphicInfo()
index d0c62ab591b14d707931c43395f9c3dfca7dbb56..3fcf5af1ce6a38d7af105dd5eb6e89306c47bde7 100644 (file)
@@ -1824,6 +1824,10 @@ int get_parameter_value(char *value_raw, char *suffix, int type)
     if (string_has_parameter(value, "static_panel"))
       result |= ANIM_STATIC_PANEL;
   }
+  else if (strEqual(suffix, ".font"))
+  {
+    result = gfx.get_font_from_token_function(value);
+  }
   else         /* generic parameter of type integer or boolean */
   {
     result = (strEqual(value, ARG_UNDEFINED) ? ARG_UNDEFINED_VALUE :
@@ -1837,6 +1841,35 @@ int get_parameter_value(char *value_raw, char *suffix, int type)
   return result;
 }
 
+int get_token_parameter_value(char *token, char *value_raw)
+{
+  char *suffix;
+
+  if (token == NULL || value_raw == NULL)
+    return ARG_UNDEFINED_VALUE;
+
+  suffix = strrchr(token, '.');
+  if (suffix == NULL)
+    suffix = token;
+
+#if 0
+  if (strncmp(suffix, ".font", 5) == 0)
+  {
+    int i;
+
+    /* !!! OPTIMIZE THIS BY USING HASH !!! */
+    for (i = 0; i < NUM_FONTS; i++)
+      if (strEqual(value_raw, font_info[i].token_name))
+       return i;
+
+    /* if font not found, use reliable default value */
+    return FONT_INITIAL_1;
+  }
+#endif
+
+  return get_parameter_value(value_raw, suffix, TYPE_INTEGER);
+}
+
 struct ScreenModeInfo *get_screen_mode_from_string(char *screen_mode_string)
 {
   static struct ScreenModeInfo screen_mode;
index 7cf5df63c65747946a3f0ada5a535c50e909fcb7..4b9ead4ffbece22431baadfe2d069d84090c7e3e 100644 (file)
@@ -180,6 +180,7 @@ boolean FileIsArtworkType(char *, int);
 char *get_mapped_token(char *);
 
 int get_parameter_value(char *, char *, int);
+int get_token_parameter_value(char *, char *);
 
 struct ScreenModeInfo *get_screen_mode_from_string(char *);
 void get_aspect_ratio_from_screen_mode(struct ScreenModeInfo *, int *x, int *y);
index 331522ac7e398d2365c69513173a581c579211e7..a2b75b1415420a136e7c3166515b26d8c41bdba2 100644 (file)
@@ -692,6 +692,7 @@ struct GfxInfo
   int num_fonts;
   struct FontBitmapInfo *font_bitmap_info;
   int (*select_font_function)(int);
+  int (*get_font_from_token_function)(char *);
 
   int anim_random_frame;
 };
index c8cc667dd98db66e2ce72fbe702965c1bb3c8051..d5d67cda8bbc95cb76af0256851912018ca2456a 100644 (file)
@@ -107,11 +107,13 @@ static void FreeFontClipmasks()
 #endif /* TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND */
 
 void InitFontInfo(struct FontBitmapInfo *font_bitmap_info, int num_fonts,
-                 int (*select_font_function)(int))
+                 int (*select_font_function)(int),
+                 int (*get_font_from_token_function)(char *))
 {
   gfx.num_fonts = num_fonts;
   gfx.font_bitmap_info = font_bitmap_info;
   gfx.select_font_function = select_font_function;
+  gfx.get_font_from_token_function = get_font_from_token_function;
 
 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
   InitFontClipmasks();
@@ -731,7 +733,7 @@ static void DrawTextBuffer_Flush(int x, int y, char *buffer, int font_nr,
 int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr,
                   int line_length, int cut_length, int max_lines,
                   int mask_mode, boolean autowrap, boolean centered,
-                  boolean skip_comments)
+                  boolean parse_comments)
 {
 #if 0
   int font_width = getFontWidth(font_nr);
@@ -776,7 +778,7 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr,
       text_buffer++;
 
     /* skip comments (lines directly beginning with '#') */
-    if (line[0] == '#' && skip_comments)
+    if (line[0] == '#' && parse_comments)
     {
       char *token, *value;
 
@@ -795,12 +797,14 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr,
          buffer_len = 0;
        }
 
-       if (strEqual(token, ".autowrap"))
+       if (strEqual(token, ".font"))
+         font_nr = gfx.get_font_from_token_function(value);
+       else if (strEqual(token, ".autowrap"))
          autowrap = get_boolean_from_string(value);
        else if (strEqual(token, ".centered"))
          centered = get_boolean_from_string(value);
-       else if (strEqual(token, ".skip_comments"))
-         skip_comments = get_boolean_from_string(value);
+       else if (strEqual(token, ".parse_comments"))
+         parse_comments = get_boolean_from_string(value);
       }
 
       continue;
@@ -910,13 +914,13 @@ int DrawTextBuffer(int x, int y, char *text_buffer, int font_nr,
 int DrawTextFile(int x, int y, char *filename, int font_nr,
                 int line_length, int cut_length, int max_lines,
                 int mask_mode, boolean autowrap, boolean centered,
-                boolean skip_comments)
+                boolean parse_comments)
 {
   char *text_buffer = GetTextBufferFromFile(filename, MAX_LINES_FROM_FILE);
   int num_lines_printed = DrawTextBuffer(x, y, text_buffer, font_nr,
                                         line_length, cut_length, max_lines,
                                         mask_mode, autowrap, centered,
-                                        skip_comments);
+                                        parse_comments);
   checked_free(text_buffer);
 
   return num_lines_printed;
index 46614de52e1b638bdbc58e404d5191455d21ca03..0f770ba7971b8137b343288794b14d15aae9408c 100644 (file)
@@ -61,7 +61,8 @@
 
 /* font structure definitions */
 
-void InitFontInfo(struct FontBitmapInfo *, int, int (*function)(int));
+void InitFontInfo(struct FontBitmapInfo *, int,
+                 int (*function1)(int), int (*function2)(char *));
 void FreeFontInfo(struct FontBitmapInfo *);
 
 struct FontBitmapInfo *getFontBitmapInfo(int);
index a0aec463f55aa7f2b4f6bf8114562811a859b113..ea9c3345d4a6fc49389aeb17024fd0e3b79cc54a 100644 (file)
@@ -2067,7 +2067,7 @@ struct TitleMessageInfo
   int font;
   boolean autowrap;
   boolean centered;
-  boolean skip_comments;
+  boolean parse_comments;
   int sort_priority;
 };
 
index 5c8baa818d64dc46dadc2dff2881631266a40bc2..16f8a580f0f126213715c269d0eb3263daaa5ebd 100644 (file)
@@ -1106,11 +1106,11 @@ void DrawTitleScreenMessage(int nr, boolean initial)
 #if 1
   DrawTextFile(ALIGNED_TEXT_XPOS(tmi), ALIGNED_TEXT_YPOS(tmi),
               filename, tmi->font, tmi->chars, -1, tmi->lines, -1,
-              tmi->autowrap, tmi->centered, tmi->skip_comments);
+              tmi->autowrap, tmi->centered, tmi->parse_comments);
 #else
   DrawTextFile(sx, sy, filename, font_nr, max_chars_per_line, -1,
               max_lines_per_screen, -1, tmi->autowrap, tmi->centered,
-              tmi->skip_comments);
+              tmi->parse_comments);
 #endif
 
   game_status = last_game_status;      /* restore current game status */
@@ -3277,7 +3277,7 @@ void DrawInfoScreen_LevelSet()
   if (filename != NULL)
     DrawTextFile(mSX + ALIGNED_TEXT_XPOS(tmi), mSY + ALIGNED_TEXT_YPOS(tmi),
                 filename, tmi->font, tmi->chars, -1, tmi->lines, -1,
-                tmi->autowrap, tmi->centered, tmi->skip_comments);
+                tmi->autowrap, tmi->centered, tmi->parse_comments);
   else
     DrawTextCentered(mSY + ALIGNED_TEXT_YPOS(tmi), FONT_TEXT_2,
                     "No information for this level set.");