rnd-20030223-3-src
authorHolger Schemel <info@artsoft.org>
Sun, 23 Feb 2003 20:05:21 +0000 (21:05 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:40:31 +0000 (10:40 +0200)
src/conf_fnt.c
src/conf_gfx.c
src/conf_gfx.h
src/conftime.h
src/init.c
src/libgame/image.c
src/libgame/system.h
src/libgame/text.c
src/libgame/text.h
src/main.c
src/main.h

index d94f047dac566f18cee14315e06d12dfe999475d..2ec5e1be27c3ab5eeff1cd6b3dc41403e8d09ac3 100644 (file)
@@ -91,10 +91,6 @@ font_to_graphic[] =
     FONT_SMALL_4,                              -1,
     IMG_FONT_SMALL_4
   },
-  {
-    FONT_SMALL_3,                              GFX_SPECIAL_ARG_EDITOR,
-    IMG_FONT_SMALL_3
-  },
   {
     FONT_TAPE,                                 -1,
     IMG_FONT_TAPE
index 58cd51b690a9202ea1c606003c8f3738755c44b5..d73f922a3bb44f38080aa7ff671b5e42a2df032f 100644 (file)
@@ -2984,12 +2984,6 @@ struct ConfigInfo image_config[] =
   { "font.small_4.width",                      "14"                    },
   { "font.small_4.height",                     "14"                    },
 
-  { "font.small_3.EDITOR",                     "RocksFontSmall.pcx"    },
-  { "font.small_3.EDITOR.x",                   "0"                     },
-  { "font.small_3.EDITOR.y",                   "0"                     },
-  { "font.small_3.EDITOR.width",               "14"                    },
-  { "font.small_3.EDITOR.height",              "14"                    },
-
   { "font.tape",                               "RocksFontSmall.pcx"    },
   { "font.tape.x",                             "0"                     },
   { "font.tape.y",                             "224"                   },
index de87a85d176fe83e445b4037b2b7af6dda681dae..7341822655b9b8dc2faec168b66e431cf7d54435 100644 (file)
 #define IMG_FONT_SMALL_2                               799
 #define IMG_FONT_SMALL_3                               800
 #define IMG_FONT_SMALL_4                               801
-#define IMG_FONT_SMALL_3_EDITOR                                802
-#define IMG_FONT_TAPE                                  803
-#define IMG_FONT_GAME                                  804
-#define IMG_FONT_NARROW                                        805
-#define IMG_GLOBAL_BORDER                              806
-#define IMG_GLOBAL_DOOR                                        807
-#define IMG_BACKGROUND                                 808
-#define IMG_BACKGROUND_MAIN                            809
-#define IMG_BACKGROUND_LEVELS                          810
-#define IMG_BACKGROUND_SCORES                          811
-#define IMG_BACKGROUND_EDITOR                          812
-#define IMG_BACKGROUND_INFO                            813
-#define IMG_BACKGROUND_SETUP                           814
-#define IMG_BACKGROUND_DOOR                            815
-#define IMG_INFO_FONT_EM_1                             816
-#define IMG_INFO_FONT_EM_2                             817
-#define IMG_INFO_FONT_EM_3                             818
-#define IMG_INFO_FONT_EM_4                             819
-#define IMG_INFO_FONT_EM_5                             820
+#define IMG_FONT_TAPE                                  802
+#define IMG_FONT_GAME                                  803
+#define IMG_FONT_NARROW                                        804
+#define IMG_GLOBAL_BORDER                              805
+#define IMG_GLOBAL_DOOR                                        806
+#define IMG_BACKGROUND                                 807
+#define IMG_BACKGROUND_MAIN                            808
+#define IMG_BACKGROUND_LEVELS                          809
+#define IMG_BACKGROUND_SCORES                          810
+#define IMG_BACKGROUND_EDITOR                          811
+#define IMG_BACKGROUND_INFO                            812
+#define IMG_BACKGROUND_SETUP                           813
+#define IMG_BACKGROUND_DOOR                            814
+#define IMG_INFO_FONT_EM_1                             815
+#define IMG_INFO_FONT_EM_2                             816
+#define IMG_INFO_FONT_EM_3                             817
+#define IMG_INFO_FONT_EM_4                             818
+#define IMG_INFO_FONT_EM_5                             819
 
-#define NUM_IMAGE_FILES                                        821
+#define NUM_IMAGE_FILES                                        820
 
 #endif /* CONF_GFX_H */
index 349eb876c239c9e75497967ce2217880db37d8fc..200c6135dbc8299d7cab70f6fc7e514b285e2e3f 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-02-23 18:48]"
+#define COMPILE_DATE_STRING "[2003-02-23 21:04]"
index 3d1ef64f55a53f53d45c9302377e09b4de2f3bd7..8026ab9d510a6d1cc898a446c4dcde3d1e44314b 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "conf_e2g.c"  /* include auto-generated data structure definitions */
 #include "conf_esg.c"  /* include auto-generated data structure definitions */
+#include "conf_fnt.c"  /* include auto-generated data structure definitions */
 
 #define CONFIG_TOKEN_FONT_INITIAL              "font.initial"
 
@@ -163,11 +164,11 @@ static void InitArtworkInfo()
 
 static void InitArtworkConfig()
 {
-  static char *element_prefix[MAX_NUM_ELEMENTS + 1];
-  static char *sound_class_prefix[MAX_NUM_ELEMENTS + 1];
-  static char *action_suffix[NUM_ACTIONS + 1];
-  static char *direction_suffix[NUM_DIRECTIONS + 1];
-  static char *special_suffix[NUM_SPECIAL_GFX_ARGS + 1];
+  static char *image_id_prefix[MAX_NUM_ELEMENTS + NUM_FONTS + 1];
+  static char *sound_id_prefix[MAX_NUM_ELEMENTS + 1];
+  static char *action_id_suffix[NUM_ACTIONS + 1];
+  static char *direction_id_suffix[NUM_DIRECTIONS + 1];
+  static char *special_id_suffix[NUM_SPECIAL_GFX_ARGS + 1];
   static char *dummy[1] = { NULL };
   static char *ignore_image_tokens[] =
   {
@@ -185,22 +186,28 @@ static void InitArtworkConfig()
   };
   int i;
 
+  for (i=0; i<MAX_NUM_ELEMENTS; i++)
+    image_id_prefix[i] = element_info[i].token_name;
+  for (i=0; i<NUM_FONTS + 1; i++)
+    image_id_prefix[MAX_NUM_ELEMENTS + i] = font_info[i].token_name;
+
   for (i=0; i<MAX_NUM_ELEMENTS + 1; i++)
-    element_prefix[i] = element_info[i].token_name;
-  for (i=0; i<MAX_NUM_ELEMENTS + 1; i++)
-    sound_class_prefix[i] = element_info[i].sound_class_name;
+    sound_id_prefix[i] = element_info[i].sound_class_name;
+
   for (i=0; i<NUM_ACTIONS + 1; i++)
-    action_suffix[i] = element_action_info[i].suffix;
+    action_id_suffix[i] = element_action_info[i].suffix;
+
   for (i=0; i<NUM_DIRECTIONS + 1; i++)
-    direction_suffix[i] = element_direction_info[i].suffix;
+    direction_id_suffix[i] = element_direction_info[i].suffix;
+
   for (i=0; i<NUM_SPECIAL_GFX_ARGS + 1; i++)
-    special_suffix[i] = special_suffix_info[i].suffix;
+    special_id_suffix[i] = special_suffix_info[i].suffix;
 
   InitImageList(image_config, NUM_IMAGE_FILES, image_config_suffix,
-               element_prefix, action_suffix, direction_suffix,
-               special_suffix, ignore_image_tokens);
+               image_id_prefix, action_id_suffix, direction_id_suffix,
+               special_id_suffix, ignore_image_tokens);
   InitSoundList(sound_config, NUM_SOUND_FILES, sound_config_suffix,
-               sound_class_prefix, action_suffix, dummy,
+               sound_id_prefix, action_id_suffix, dummy,
                dummy, ignore_sound_tokens);
 }
 
@@ -722,39 +729,132 @@ void InitElementSmallImages()
   for (i=0; element_to_special_graphic[i].element > -1; i++)
     CreateImageWithSmallImages(element_to_special_graphic[i].graphic);
 
-  /* !!! CHECK FOR ELEMENT-ONLY GRAPHICS !!! */
   /* initialize images from dynamic configuration */
   for (i=0; i < num_property_mappings; i++)
-    CreateImageWithSmallImages(property_mapping[i].artwork_index);
+    if (property_mapping[i].artwork_index < MAX_NUM_ELEMENTS)
+      CreateImageWithSmallImages(property_mapping[i].artwork_index);
+}
+
+static int getFontBitmapID(int font_nr)
+{
+  if (game_status == LEVELED)
+    return font_info[font_nr].special_bitmap_id[GFX_SPECIAL_ARG_EDITOR];
+  else
+    return font_nr;
 }
 
 void InitFontGraphicInfo()
 {
-  static struct FontBitmapInfo font_bitmap_info[NUM_IMG_FONTS];
-  int num_fonts = NUM_IMG_FONTS;
-  int i;
+  static struct FontBitmapInfo *font_bitmap_info = NULL;
+  struct PropertyMapping *property_mapping = getImageListPropertyMapping();
+  int num_property_mappings = getImageListPropertyMappingSize();
+  int num_font_bitmaps = NUM_FONTS;
+  int i, j;
 
   if (graphic_info == NULL)            /* still at startup phase */
-    num_fonts = NUM_INITIAL_FONTS;
+  {
+    InitFontInfo(font_initial, NUM_INITIAL_FONTS, getFontBitmapID);
+
+    return;
+  }
+
+  /* ---------- initialize font graphic definitions ---------- */
+
+  /* always start with reliable default values (normal font graphics) */
+  for (i=0; i < NUM_FONTS; i++)
+    font_info[i].graphic = FONT_INITIAL_1;
+
+  /* initialize normal font/graphic mapping from static configuration */
+  for (i=0; font_to_graphic[i].font_nr > -1; i++)
+  {
+    int font_nr = font_to_graphic[i].font_nr;
+    int special = font_to_graphic[i].special;
+    int graphic = font_to_graphic[i].graphic;
+
+    if (special != -1)
+      continue;
+
+    font_info[font_nr].graphic = graphic;
+  }
+
+  /* always start with reliable default values (special font graphics) */
+  for (i=0; i < NUM_FONTS; i++)
+  {
+    for (j=0; j < NUM_SPECIAL_GFX_ARGS; j++)
+    {
+      font_info[i].special_graphic[j] = font_info[i].graphic;
+      font_info[i].special_bitmap_id[j] = i;
+    }
+  }
+
+  /* initialize special font/graphic mapping from static configuration */
+  for (i=0; font_to_graphic[i].font_nr > -1; i++)
+  {
+    int font_nr = font_to_graphic[i].font_nr;
+    int special = font_to_graphic[i].special;
+    int graphic = font_to_graphic[i].graphic;
+
+    if (special >= 0 && special < NUM_SPECIAL_GFX_ARGS)
+    {
+      font_info[font_nr].special_graphic[special] = graphic;
+      font_info[font_nr].special_bitmap_id[special] = num_font_bitmaps;
+      num_font_bitmaps++;
+    }
+  }
+
+  /* initialize special element/graphic mapping from dynamic configuration */
+  for (i=0; i < num_property_mappings; i++)
+  {
+    int font_nr = property_mapping[i].base_index - MAX_NUM_ELEMENTS;
+    int special = property_mapping[i].ext3_index;
+    int graphic = property_mapping[i].artwork_index;
+
+    if (font_nr < 0)
+      continue;
+
+    if (special >= 0 && special < NUM_SPECIAL_GFX_ARGS)
+    {
+      font_info[font_nr].special_graphic[special] = graphic;
+      font_info[font_nr].special_bitmap_id[special] = num_font_bitmaps;
+      num_font_bitmaps++;
+    }
+  }
+
+  /* ---------- initialize font bitmap array ---------- */
 
-  for (i=0; i < num_fonts; i++)
+  if (font_bitmap_info != NULL)
+    free(font_bitmap_info);
+
+  font_bitmap_info =
+    checked_calloc(num_font_bitmaps * sizeof(struct FontBitmapInfo));
+
+  /* ---------- initialize font bitmap definitions ---------- */
+
+  for (i=0; i < NUM_FONTS; i++)
   {
     if (i < NUM_INITIAL_FONTS)
+    {
       font_bitmap_info[i] = font_initial[i];
-    else
+      continue;
+    }
+
+    for (j=0; j < NUM_SPECIAL_GFX_ARGS; j++)
     {
+      int font_bitmap_id = font_info[i].special_bitmap_id[j];
+      int graphic = font_info[i].special_graphic[j];
+
       /* copy font relevant information from graphics information */
-      font_bitmap_info[i].bitmap = graphic_info[FIRST_IMG_FONT + i].bitmap;
-      font_bitmap_info[i].src_x  = graphic_info[FIRST_IMG_FONT + i].src_x;
-      font_bitmap_info[i].src_y  = graphic_info[FIRST_IMG_FONT + i].src_y;
-      font_bitmap_info[i].width  = graphic_info[FIRST_IMG_FONT + i].width;
-      font_bitmap_info[i].height = graphic_info[FIRST_IMG_FONT + i].height;
-      font_bitmap_info[i].draw_x = graphic_info[FIRST_IMG_FONT + i].draw_x;
-      font_bitmap_info[i].draw_y = graphic_info[FIRST_IMG_FONT + i].draw_y;
+      font_bitmap_info[font_bitmap_id].bitmap = graphic_info[graphic].bitmap;
+      font_bitmap_info[font_bitmap_id].src_x  = graphic_info[graphic].src_x;
+      font_bitmap_info[font_bitmap_id].src_y  = graphic_info[graphic].src_y;
+      font_bitmap_info[font_bitmap_id].width  = graphic_info[graphic].width;
+      font_bitmap_info[font_bitmap_id].height = graphic_info[graphic].height;
+      font_bitmap_info[font_bitmap_id].draw_x = graphic_info[graphic].draw_x;
+      font_bitmap_info[font_bitmap_id].draw_y = graphic_info[graphic].draw_y;
     }
   }
 
-  InitFontInfo(font_bitmap_info, num_fonts);
+  InitFontInfo(font_bitmap_info, num_font_bitmaps, getFontBitmapID);
 }
 
 void InitElementGraphicInfo()
@@ -775,16 +875,6 @@ void InitElementGraphicInfo()
     }
   }
 
-#if 0
-  for (i=EL_CHAR_START; i<=EL_CHAR_END; i++)
-    element_info[i].graphic[ACTION_DEFAULT] =
-      IMG_CHAR_START + (i - EL_CHAR_START);
-
-  for (i=EL_CUSTOM_START; i<=EL_CUSTOM_END; i++)
-    element_info[i].graphic[ACTION_DEFAULT] =
-      IMG_CUSTOM_START + (i - EL_CUSTOM_START);
-#endif
-
   /* initialize normal element/graphic mapping from static configuration */
   for (i=0; element_to_graphic[i].element > -1; i++)
   {
@@ -811,7 +901,7 @@ void InitElementGraphicInfo()
     int special   = property_mapping[i].ext3_index;
     int graphic   = property_mapping[i].artwork_index;
 
-    if (special != -1)
+    if (element >= MAX_NUM_ELEMENTS || special != -1)
       continue;
 
     if (action < 0)
@@ -910,6 +1000,9 @@ void InitElementSpecialGraphicInfo()
     int special = property_mapping[i].ext3_index;
     int graphic = property_mapping[i].artwork_index;
 
+    if (element >= MAX_NUM_ELEMENTS)
+      continue;
+
     if (special >= 0 && special < NUM_SPECIAL_GFX_ARGS)
       element_info[element].special_graphic[special] = graphic;
   }
index b7634e85366b6e06b6b1ed177a9302c777cf1473..a1cc38651d10dbc7d90a8d42b7b55509f9f51a09 100644 (file)
@@ -915,6 +915,10 @@ void CreateImageWithSmallImages(int pos)
   CreateBitmapWithSmallBitmaps(img_info->bitmap);
 
   img_info->contains_small_images = TRUE;
+
+#if 0
+  printf("CreateImageWithSmallImages: '%s' done\n", img_info->source_filename);
+#endif
 }
 
 void FreeAllImages()
index bce82b93821f67623f326e0c96fb33603f0624c2..d9cd579a5b8824218d0d88bd8fa45e9a8446e46e 100644 (file)
@@ -325,7 +325,8 @@ struct GfxInfo
   boolean menu_main_hide_static_text;
 
   int num_fonts;
-  struct FontBitmapInfo *font;
+  struct FontBitmapInfo *font_bitmap_info;
+  int (*select_font_function)(int);
 
   int anim_random_frame;
 };
index 2e4262d0985763b8f82db350353ef17ba60198b6..d00151646f6c51d96b6c8abe29b0f1995ec04549 100644 (file)
@@ -35,25 +35,25 @@ static void InitFontClipmasks()
   GC copy_clipmask_gc;
   int i, j;
 
-  if (gfx.num_fonts == 0 || gfx.font[0].bitmap == NULL)
+  if (gfx.num_fonts == 0 || gfx.font_bitmap_info[0].bitmap == NULL)
     return;
 
   if (!clipmasks_initialized)
   {
     for (i=0; i < gfx.num_fonts; i++)
-      gfx.font[i].clip_mask = NULL;
+      gfx.font_bitmap_info[i].clip_mask = NULL;
 
     clipmasks_initialized = TRUE;
   }
 
   for (i=0; i < gfx.num_fonts; i++)
   {
-    if (gfx.font[i].clip_mask)
+    if (gfx.font_bitmap_info[i].clip_mask)
       for (j=0; j < NUM_FONT_CHARS; j++)
-       XFreePixmap(display, gfx.font[i].clip_mask[j]);
-    free(gfx.font[i].clip_mask);
+       XFreePixmap(display, gfx.font_bitmap_info[i].clip_mask[j]);
+    free(gfx.font_bitmap_info[i].clip_mask);
 
-    gfx.font[i].clip_mask = NULL;
+    gfx.font_bitmap_info[i].clip_mask = NULL;
   }
 
   if (font_clip_gc)
@@ -73,32 +73,34 @@ static void InitFontClipmasks()
   /* create graphic context structures needed for clipping */
   clip_gc_values.graphics_exposures = False;
   clip_gc_valuemask = GCGraphicsExposures;
-  copy_clipmask_gc = XCreateGC(display, gfx.font[0].bitmap->clip_mask,
+  copy_clipmask_gc = XCreateGC(display,
+                              gfx.font_bitmap_info[0].bitmap->clip_mask,
                               clip_gc_valuemask, &clip_gc_values);
 
   /* create only those clipping Pixmaps we really need */
   for (i=0; i < gfx.num_fonts; i++)
   {
-    if (gfx.font[i].bitmap == NULL)
+    if (gfx.font_bitmap_info[i].bitmap == NULL)
       continue;
 
-    gfx.font[i].clip_mask = checked_calloc(NUM_FONT_CHARS * sizeof(Pixmap));
+    gfx.font_bitmap_info[i].clip_mask =
+      checked_calloc(NUM_FONT_CHARS * sizeof(Pixmap));
 
     for (j=0; j < NUM_FONT_CHARS; j++)
     {
-      Bitmap *src_bitmap = gfx.font[i].bitmap;
+      Bitmap *src_bitmap = gfx.font_bitmap_info[i].bitmap;
       Pixmap src_pixmap = src_bitmap->clip_mask;
       int xpos = j % FONT_CHARS_PER_LINE;
       int ypos = j / FONT_CHARS_PER_LINE;
-      int width  = gfx.font[i].width;
-      int height = gfx.font[i].height;
-      int src_x = gfx.font[i].src_x + xpos * width;
-      int src_y = gfx.font[i].src_y + ypos * height;
+      int width  = gfx.font_bitmap_info[i].width;
+      int height = gfx.font_bitmap_info[i].height;
+      int src_x = gfx.font_bitmap_info[i].src_x + xpos * width;
+      int src_y = gfx.font_bitmap_info[i].src_y + ypos * height;
 
-      gfx.font[i].clip_mask[j] =
+      gfx.font_bitmap_info[i].clip_mask[j] =
        XCreatePixmap(display, window->drawable, width, height, 1);
 
-      XCopyArea(display, src_pixmap, gfx.font[i].clip_mask[j],
+      XCopyArea(display, src_pixmap, gfx.font_bitmap_info[i].clip_mask[j],
                copy_clipmask_gc, src_x, src_y, width, height, 0, 0);
     }
   }
@@ -107,10 +109,12 @@ static void InitFontClipmasks()
 }
 #endif /* TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND */
 
-void InitFontInfo(struct FontBitmapInfo *font_info, int num_fonts)
+void InitFontInfo(struct FontBitmapInfo *font_bitmap_info, int num_fonts,
+                 int (*select_font_function)(int))
 {
   gfx.num_fonts = num_fonts;
-  gfx.font = font_info;
+  gfx.font_bitmap_info = font_bitmap_info;
+  gfx.select_font_function = select_font_function;
 
 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
   InitFontClipmasks();
@@ -119,28 +123,30 @@ void InitFontInfo(struct FontBitmapInfo *font_info, int num_fonts)
 
 int getFontWidth(int font_nr)
 {
-  return gfx.font[font_nr].width;
+  return gfx.font_bitmap_info[font_nr].width;
 }
 
 int getFontHeight(int font_nr)
 {
-  return gfx.font[font_nr].height;
+  return gfx.font_bitmap_info[font_nr].height;
 }
 
 void DrawInitText(char *text, int ypos, int font_nr)
 {
-  if (window && gfx.num_fonts > 0 && gfx.font[font_nr].bitmap != NULL)
+  if (window &&
+      gfx.num_fonts > 0 &&
+      gfx.font_bitmap_info[font_nr].bitmap != NULL)
   {
-    int text_width = strlen(text) * gfx.font[font_nr].width;
+    int text_width = strlen(text) * getFontWidth(font_nr);
 
-    ClearRectangle(window, 0, ypos, video.width, gfx.font[font_nr].height);
+    ClearRectangle(window, 0, ypos, video.width, getFontHeight(font_nr));
     DrawTextExt(window, (video.width - text_width) / 2, ypos, text, font_nr,
                FONT_OPAQUE);
     FlushDisplay();
   }
 }
 
-void DrawTextFCentered(int y, int font, char *format, ...)
+void DrawTextFCentered(int y, int font_nr, char *format, ...)
 {
   char buffer[MAX_OUTPUT_LINESIZE + 1];
   va_list ap;
@@ -152,11 +158,11 @@ void DrawTextFCentered(int y, int font, char *format, ...)
   if (strlen(buffer) > MAX_OUTPUT_LINESIZE)
     Error(ERR_EXIT, "string too long in DrawTextFCentered() -- aborting");
 
-  DrawText(gfx.sx + (gfx.sxsize - strlen(buffer) * gfx.font[font].width) / 2,
-          gfx.sy + y, buffer, font);
+  DrawText(gfx.sx + (gfx.sxsize - strlen(buffer) * getFontWidth(font_nr)) / 2,
+          gfx.sy + y, buffer, font_nr);
 }
 
-void DrawTextF(int x, int y, int font, char *format, ...)
+void DrawTextF(int x, int y, int font_nr, char *format, ...)
 {
   char buffer[MAX_OUTPUT_LINESIZE + 1];
   va_list ap;
@@ -168,17 +174,17 @@ void DrawTextF(int x, int y, int font, char *format, ...)
   if (strlen(buffer) > MAX_OUTPUT_LINESIZE)
     Error(ERR_EXIT, "string too long in DrawTextF() -- aborting");
 
-  DrawText(gfx.sx + x, gfx.sy + y, buffer, font);
+  DrawText(gfx.sx + x, gfx.sy + y, buffer, font_nr);
 }
 
-void DrawText(int x, int y, char *text, int font)
+void DrawText(int x, int y, char *text, int font_nr)
 {
   int mask_mode = FONT_OPAQUE;
 
   if (DrawingOnBackground(x, y))
     mask_mode = FONT_MASKED;
 
-  DrawTextExt(drawto, x, y, text, font, mask_mode);
+  DrawTextExt(drawto, x, y, text, font_nr, mask_mode);
 
   if (x < gfx.dx)
     redraw_mask |= REDRAW_FIELD;
@@ -189,7 +195,8 @@ void DrawText(int x, int y, char *text, int font)
 void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text,
                 int font_nr, int mask_mode)
 {
-  struct FontBitmapInfo *font = &gfx.font[font_nr];
+  int font_bitmap_id = gfx.select_font_function(font_nr);
+  struct FontBitmapInfo *font = &gfx.font_bitmap_info[font_bitmap_id];
   boolean print_inverse = FALSE;
 
   if (font->bitmap == NULL)
index 18dd2ba4d5195453d5bfbc6b5ffcfec16a39d4a6..5f8fb21d9b823ec8e324f5bf2c8ee68a52cd8cb9 100644 (file)
@@ -62,7 +62,8 @@
 
 /* font structure definitions */
 
-void InitFontInfo(struct FontBitmapInfo *, int);
+void InitFontInfo(struct FontBitmapInfo *, int,
+                 int (*select_font_function)(int));
 int getFontWidth(int);
 int getFontHeight(int);
 void DrawInitText(char *, int, int);
index 1ef7deebc96fbb15883d1d83482e9747901f8e3d..7c91f3a9db1a5ae728489537c79fafbb33de43f7 100644 (file)
@@ -2978,6 +2978,33 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1] =
   { NULL,              0,                              }
 };
 
+/* ------------------------------------------------------------------------- */
+/* font definitions                                                          */
+/* ------------------------------------------------------------------------- */
+
+struct FontInfo font_info[NUM_FONTS + 1] =
+{
+  { "font.initial_1"   },
+  { "font.initial_2"   },
+  { "font.initial_3"   },
+  { "font.initial_4"   },
+  { "font.big_1"       },
+  { "font.big_2"       },
+  { "font.big_3"       },
+  { "font.big_4"       },
+  { "font.medium_1"    },
+  { "font.medium_2"    },
+  { "font.medium_3"    },
+  { "font.medium_4"    },
+  { "font.small_1"     },
+  { "font.small_2"     },
+  { "font.small_3"     },
+  { "font.small_4"     },
+  { "font.tape"                },
+  { "font.game"                },
+  { "font.narrow"      },
+};
+
 
 /* ========================================================================= */
 /* main()                                                                    */
index 281fc47e57e6f0eb48bb5d975004da7206ac5818..b4589dcca77e45f8e3594e5f77c7e515493ba685 100644 (file)
@@ -1049,34 +1049,30 @@ struct GlobalInfo
 
 struct ElementInfo
 {
-  char *token_name;            /* element token prefix used in config files */
+  char *token_name;            /* element token used in config files */
   char *sound_class_name;      /* classification for custom sound effects */
   char *editor_description;    /* short description for level editor */
   char *custom_description;    /* custom description for level editor */
 
   int graphic[NUM_ACTIONS];    /* default graphics for several actions */
-
   int direction_graphic[NUM_ACTIONS][NUM_DIRECTIONS];
                                /* special graphics for left/right/up/down */
-
   int special_graphic[NUM_SPECIAL_GFX_ARGS];
                                /* special graphics for certain screens */
 
-  int editor_graphic;          /* graphic displayed in level editor */
-  int preview_graphic;         /* graphic displayed in level preview */
-
   int sound[NUM_ACTIONS];      /* default sounds for several actions */
 };
 
-#if 0
 struct FontInfo
 {
-  int graphic;                 /* default graphic for this font */
+  char *token_name;            /* font token used in config files */
 
+  int graphic;                 /* default graphic for this font */
   int special_graphic[NUM_SPECIAL_GFX_ARGS];
                                /* special graphics for certain screens */
+  int special_bitmap_id[NUM_SPECIAL_GFX_ARGS];
+                               /* internal bitmap ID for special graphics */
 };
-#endif
 
 struct GraphicInfo
 {
@@ -1202,6 +1198,7 @@ extern struct ElementInfo element_info[];
 extern struct ElementActionInfo        element_action_info[];
 extern struct ElementDirectionInfo element_direction_info[];
 extern struct SpecialSuffixInfo special_suffix_info[];
+extern struct FontInfo         font_info[];
 extern struct GraphicInfo      *graphic_info;
 extern struct SoundInfo               *sound_info;
 extern struct ConfigInfo       image_config[], sound_config[];