rnd-20070312-1-src
authorHolger Schemel <info@artsoft.org>
Mon, 12 Mar 2007 01:04:21 +0000 (02:04 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:54:47 +0000 (10:54 +0200)
src/conf_fnt.c
src/conf_gfx.c
src/conf_gfx.h
src/conftime.h
src/init.c
src/tools.c

index 0940497f9d8ab745cda9ed023ef37a5530fc8736..8eb96e51dd5e83690e2545ff4ead423344976c6b 100644 (file)
@@ -71,6 +71,10 @@ font_to_graphic[] =
     FONT_TEXT_1,                               -1,
     IMG_FONT_TEXT_1
   },
+  {
+    FONT_TEXT_1,                               GFX_SPECIAL_ARG_MAIN,
+    IMG_FONT_TEXT_1_MAIN
+  },
   {
     FONT_TEXT_1,                               GFX_SPECIAL_ARG_LEVELS,
     IMG_FONT_TEXT_1_LEVELS
@@ -99,6 +103,10 @@ font_to_graphic[] =
     FONT_TEXT_2,                               -1,
     IMG_FONT_TEXT_2
   },
+  {
+    FONT_TEXT_2,                               GFX_SPECIAL_ARG_MAIN,
+    IMG_FONT_TEXT_2_MAIN
+  },
   {
     FONT_TEXT_2,                               GFX_SPECIAL_ARG_LEVELS,
     IMG_FONT_TEXT_2_LEVELS
@@ -139,6 +147,10 @@ font_to_graphic[] =
     FONT_TEXT_4,                               -1,
     IMG_FONT_TEXT_4
   },
+  {
+    FONT_TEXT_4,                               GFX_SPECIAL_ARG_MAIN,
+    IMG_FONT_TEXT_4_MAIN
+  },
   {
     FONT_TEXT_4,                               GFX_SPECIAL_ARG_LEVELS,
     IMG_FONT_TEXT_4_LEVELS
index 20a24667b4a92e121ea83719e761d159843bef07..461d426388a04ce645d80ed7a1621785b5bd8680 100644 (file)
@@ -4666,6 +4666,8 @@ struct ConfigInfo image_config[] =
   { "font.text_1.y",                           "140"                   },
   { "font.text_1.width",                       "14"                    },
   { "font.text_1.height",                      "14"                    },
+  { "font.text_1.MAIN",                                UNDEFINED_FILENAME      },
+  { "font.text_1.MAIN.clone_from",             "font.text_1.PREVIEW"   },
   { "font.text_1.LEVELS",                      "RocksFontMedium.pcx"   },
   { "font.text_1.LEVELS.x",                    "0"                     },
   { "font.text_1.LEVELS.y",                    "0"                     },
@@ -4695,6 +4697,8 @@ struct ConfigInfo image_config[] =
   { "font.text_2.y",                           "210"                   },
   { "font.text_2.width",                       "14"                    },
   { "font.text_2.height",                      "14"                    },
+  { "font.text_2.MAIN",                                UNDEFINED_FILENAME      },
+  { "font.text_2.MAIN.clone_from",             "font.text_2.PREVIEW"   },
   { "font.text_2.LEVELS",                      "RocksFontMedium.pcx"   },
   { "font.text_2.LEVELS.x",                    "0"                     },
   { "font.text_2.LEVELS.y",                    "160"                   },
@@ -4745,6 +4749,8 @@ struct ConfigInfo image_config[] =
   { "font.text_4.y",                           "70"                    },
   { "font.text_4.width",                       "14"                    },
   { "font.text_4.height",                      "14"                    },
+  { "font.text_4.MAIN",                                UNDEFINED_FILENAME      },
+  { "font.text_4.MAIN.clone_from",             "font.text_3.PREVIEW"   },
   { "font.text_4.LEVELS",                      "RocksFontMedium.pcx"   },
   { "font.text_4.LEVELS.x",                    "0"                     },
   { "font.text_4.LEVELS.y",                    "480"                   },
@@ -5231,7 +5237,7 @@ struct ConfigInfo image_config[] =
   { "main.text.level_info_2.align",            "center"                },
   { "main.text.level_info_2.chars",            "-1"                    },
   { "main.text.level_info_2.font",             "font.text_2"           },
-  { "main.text.level_info_2.font_header",      "font.text_3"           },
+  { "main.text.level_info_2.font_header",      "font.text_4"           },
   { "main.text.level_name.x",                  "-1"                    },
   { "main.text.level_name.y",                  "-1"                    },
   { "main.text.level_name.align",              "left"                  },
index 04787c51c550634a428ef684d1aeb75fc0811544..74d371b16fad2e4bbe18959d7c2012dd2fbd84a1 100644 (file)
 #define IMG_FONT_MENU_2                                        1658
 #define IMG_FONT_MENU_2_ACTIVE                         1659
 #define IMG_FONT_TEXT_1                                        1660
-#define IMG_FONT_TEXT_1_LEVELS                         1661
-#define IMG_FONT_TEXT_1_PREVIEW                                1662
-#define IMG_FONT_TEXT_1_SCORES                         1663
-#define IMG_FONT_TEXT_1_ACTIVE_SCORES                  1664
-#define IMG_FONT_TEXT_1_PLAYING                                1665
-#define IMG_FONT_TEXT_1_DOOR                           1666
-#define IMG_FONT_TEXT_2                                        1667
-#define IMG_FONT_TEXT_2_LEVELS                         1668
-#define IMG_FONT_TEXT_2_PREVIEW                                1669
-#define IMG_FONT_TEXT_2_SCORES                         1670
-#define IMG_FONT_TEXT_2_ACTIVE_SCORES                  1671
-#define IMG_FONT_TEXT_3                                        1672
-#define IMG_FONT_TEXT_3_LEVELS                         1673
-#define IMG_FONT_TEXT_3_PREVIEW                                1674
-#define IMG_FONT_TEXT_3_SCORES                         1675
-#define IMG_FONT_TEXT_3_ACTIVE_SCORES                  1676
-#define IMG_FONT_TEXT_4                                        1677
-#define IMG_FONT_TEXT_4_LEVELS                         1678
-#define IMG_FONT_TEXT_4_SCORES                         1679
-#define IMG_FONT_TEXT_4_ACTIVE_SCORES                  1680
-#define IMG_FONT_ENVELOPE_1                            1681
-#define IMG_FONT_ENVELOPE_2                            1682
-#define IMG_FONT_ENVELOPE_3                            1683
-#define IMG_FONT_ENVELOPE_4                            1684
-#define IMG_FONT_INPUT_1                               1685
-#define IMG_FONT_INPUT_1_MAIN                          1686
-#define IMG_FONT_INPUT_1_ACTIVE                                1687
-#define IMG_FONT_INPUT_1_ACTIVE_MAIN                   1688
-#define IMG_FONT_INPUT_1_ACTIVE_SETUP                  1689
-#define IMG_FONT_INPUT_2                               1690
-#define IMG_FONT_INPUT_2_ACTIVE                                1691
-#define IMG_FONT_OPTION_OFF                            1692
-#define IMG_FONT_OPTION_ON                             1693
-#define IMG_FONT_VALUE_1                               1694
-#define IMG_FONT_VALUE_2                               1695
-#define IMG_FONT_VALUE_OLD                             1696
-#define IMG_FONT_LEVEL_NUMBER                          1697
-#define IMG_FONT_LEVEL_NUMBER_ACTIVE                   1698
-#define IMG_FONT_TAPE_RECORDER                         1699
-#define IMG_FONT_GAME_INFO                             1700
-#define IMG_FONT_INFO_ELEMENTS                         1701
-#define IMG_FONT_INFO_LEVELSET                         1702
-#define IMG_GLOBAL_BORDER                              1703
-#define IMG_GLOBAL_DOOR                                        1704
-#define IMG_EDITOR_ELEMENT_BORDER                      1705
-#define IMG_EDITOR_ELEMENT_BORDER_INPUT                        1706
-#define IMG_EDITOR_CASCADE_LIST                                1707
-#define IMG_EDITOR_CASCADE_LIST_ACTIVE                 1708
-#define IMG_BACKGROUND_ENVELOPE_1                      1709
-#define IMG_BACKGROUND_ENVELOPE_2                      1710
-#define IMG_BACKGROUND_ENVELOPE_3                      1711
-#define IMG_BACKGROUND_ENVELOPE_4                      1712
-#define IMG_BACKGROUND                                 1713
-#define IMG_BACKGROUND_TITLE                           1714
-#define IMG_BACKGROUND_MESSAGE                         1715
-#define IMG_BACKGROUND_MAIN                            1716
-#define IMG_BACKGROUND_LEVELS                          1717
-#define IMG_BACKGROUND_SCORES                          1718
-#define IMG_BACKGROUND_EDITOR                          1719
-#define IMG_BACKGROUND_INFO                            1720
-#define IMG_BACKGROUND_INFO_ELEMENTS                   1721
-#define IMG_BACKGROUND_INFO_MUSIC                      1722
-#define IMG_BACKGROUND_INFO_CREDITS                    1723
-#define IMG_BACKGROUND_INFO_PROGRAM                    1724
-#define IMG_BACKGROUND_INFO_VERSION                    1725
-#define IMG_BACKGROUND_INFO_LEVELSET                   1726
-#define IMG_BACKGROUND_SETUP                           1727
-#define IMG_BACKGROUND_DOOR                            1728
-#define IMG_TITLESCREEN_INITIAL_1                      1729
-#define IMG_TITLESCREEN_INITIAL_2                      1730
-#define IMG_TITLESCREEN_INITIAL_3                      1731
-#define IMG_TITLESCREEN_INITIAL_4                      1732
-#define IMG_TITLESCREEN_INITIAL_5                      1733
-#define IMG_TITLESCREEN_1                              1734
-#define IMG_TITLESCREEN_2                              1735
-#define IMG_TITLESCREEN_3                              1736
-#define IMG_TITLESCREEN_4                              1737
-#define IMG_TITLESCREEN_5                              1738
+#define IMG_FONT_TEXT_1_MAIN                           1661
+#define IMG_FONT_TEXT_1_LEVELS                         1662
+#define IMG_FONT_TEXT_1_PREVIEW                                1663
+#define IMG_FONT_TEXT_1_SCORES                         1664
+#define IMG_FONT_TEXT_1_ACTIVE_SCORES                  1665
+#define IMG_FONT_TEXT_1_PLAYING                                1666
+#define IMG_FONT_TEXT_1_DOOR                           1667
+#define IMG_FONT_TEXT_2                                        1668
+#define IMG_FONT_TEXT_2_MAIN                           1669
+#define IMG_FONT_TEXT_2_LEVELS                         1670
+#define IMG_FONT_TEXT_2_PREVIEW                                1671
+#define IMG_FONT_TEXT_2_SCORES                         1672
+#define IMG_FONT_TEXT_2_ACTIVE_SCORES                  1673
+#define IMG_FONT_TEXT_3                                        1674
+#define IMG_FONT_TEXT_3_LEVELS                         1675
+#define IMG_FONT_TEXT_3_PREVIEW                                1676
+#define IMG_FONT_TEXT_3_SCORES                         1677
+#define IMG_FONT_TEXT_3_ACTIVE_SCORES                  1678
+#define IMG_FONT_TEXT_4                                        1679
+#define IMG_FONT_TEXT_4_MAIN                           1680
+#define IMG_FONT_TEXT_4_LEVELS                         1681
+#define IMG_FONT_TEXT_4_SCORES                         1682
+#define IMG_FONT_TEXT_4_ACTIVE_SCORES                  1683
+#define IMG_FONT_ENVELOPE_1                            1684
+#define IMG_FONT_ENVELOPE_2                            1685
+#define IMG_FONT_ENVELOPE_3                            1686
+#define IMG_FONT_ENVELOPE_4                            1687
+#define IMG_FONT_INPUT_1                               1688
+#define IMG_FONT_INPUT_1_MAIN                          1689
+#define IMG_FONT_INPUT_1_ACTIVE                                1690
+#define IMG_FONT_INPUT_1_ACTIVE_MAIN                   1691
+#define IMG_FONT_INPUT_1_ACTIVE_SETUP                  1692
+#define IMG_FONT_INPUT_2                               1693
+#define IMG_FONT_INPUT_2_ACTIVE                                1694
+#define IMG_FONT_OPTION_OFF                            1695
+#define IMG_FONT_OPTION_ON                             1696
+#define IMG_FONT_VALUE_1                               1697
+#define IMG_FONT_VALUE_2                               1698
+#define IMG_FONT_VALUE_OLD                             1699
+#define IMG_FONT_LEVEL_NUMBER                          1700
+#define IMG_FONT_LEVEL_NUMBER_ACTIVE                   1701
+#define IMG_FONT_TAPE_RECORDER                         1702
+#define IMG_FONT_GAME_INFO                             1703
+#define IMG_FONT_INFO_ELEMENTS                         1704
+#define IMG_FONT_INFO_LEVELSET                         1705
+#define IMG_GLOBAL_BORDER                              1706
+#define IMG_GLOBAL_DOOR                                        1707
+#define IMG_EDITOR_ELEMENT_BORDER                      1708
+#define IMG_EDITOR_ELEMENT_BORDER_INPUT                        1709
+#define IMG_EDITOR_CASCADE_LIST                                1710
+#define IMG_EDITOR_CASCADE_LIST_ACTIVE                 1711
+#define IMG_BACKGROUND_ENVELOPE_1                      1712
+#define IMG_BACKGROUND_ENVELOPE_2                      1713
+#define IMG_BACKGROUND_ENVELOPE_3                      1714
+#define IMG_BACKGROUND_ENVELOPE_4                      1715
+#define IMG_BACKGROUND                                 1716
+#define IMG_BACKGROUND_TITLE                           1717
+#define IMG_BACKGROUND_MESSAGE                         1718
+#define IMG_BACKGROUND_MAIN                            1719
+#define IMG_BACKGROUND_LEVELS                          1720
+#define IMG_BACKGROUND_SCORES                          1721
+#define IMG_BACKGROUND_EDITOR                          1722
+#define IMG_BACKGROUND_INFO                            1723
+#define IMG_BACKGROUND_INFO_ELEMENTS                   1724
+#define IMG_BACKGROUND_INFO_MUSIC                      1725
+#define IMG_BACKGROUND_INFO_CREDITS                    1726
+#define IMG_BACKGROUND_INFO_PROGRAM                    1727
+#define IMG_BACKGROUND_INFO_VERSION                    1728
+#define IMG_BACKGROUND_INFO_LEVELSET                   1729
+#define IMG_BACKGROUND_SETUP                           1730
+#define IMG_BACKGROUND_DOOR                            1731
+#define IMG_TITLESCREEN_INITIAL_1                      1732
+#define IMG_TITLESCREEN_INITIAL_2                      1733
+#define IMG_TITLESCREEN_INITIAL_3                      1734
+#define IMG_TITLESCREEN_INITIAL_4                      1735
+#define IMG_TITLESCREEN_INITIAL_5                      1736
+#define IMG_TITLESCREEN_1                              1737
+#define IMG_TITLESCREEN_2                              1738
+#define IMG_TITLESCREEN_3                              1739
+#define IMG_TITLESCREEN_4                              1740
+#define IMG_TITLESCREEN_5                              1741
 
-#define NUM_IMAGE_FILES                                        1739
+#define NUM_IMAGE_FILES                                        1742
 
 #endif /* CONF_GFX_H */
index 810acf7a42a1e47e0df8e03078ec0ac9b7660c98..17253cfdbf29381bc04c24c0b6aa05ffce43148e 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-03-10 17:42"
+#define COMPILE_DATE_STRING "2007-03-12 02:02"
index 9b9497f4172af42590ced741f1a9cc589cf1a90b..57c03bd0ab3060a5160435c13259012377558537 100644 (file)
@@ -238,12 +238,25 @@ void InitFontGraphicInfo()
        getImageListEntryFromImageID(base_graphic)->redefined;
       boolean special_redefined =
        getImageListEntryFromImageID(graphic)->redefined;
+      boolean special_cloned = (graphic_info[graphic].clone_from != -1);
+
+#if 0
+      printf("::: %d, %d, %d / %d, %d, %d\n",
+            font_nr, special, graphic,
+            base_redefined, special_redefined, special_cloned);
+#endif
+
+#if 0
+      // special_cloned = 0;
+#endif
 
       /* if the base font ("font.title_1", for example) has been redefined,
         but not the special font ("font.title_1.LEVELS", for example), do not
         use an existing (in this case considered obsolete) special font
         anymore, but use the automatically determined default font */
-      if (base_redefined && !special_redefined)
+      /* special case: cloned special fonts must be explicitly redefined,
+        but are not automatically redefined by redefining base font */
+      if (base_redefined && !special_redefined && !special_cloned)
        continue;
 
       font_info[font_nr].special_graphic[special] = graphic;
@@ -270,6 +283,87 @@ void InitFontGraphicInfo()
     }
   }
 
+#if 0
+  printf("-0- T3.P: %d, %d\n",
+        font_info[FONT_TEXT_3].special_graphic[GFX_SPECIAL_ARG_PREVIEW],
+        font_info[FONT_TEXT_3].special_bitmap_id[GFX_SPECIAL_ARG_PREVIEW]);
+
+  printf("-0- T4.M: %d, %d\n",
+        font_info[FONT_TEXT_4].special_graphic[GFX_SPECIAL_ARG_MAIN],
+        font_info[FONT_TEXT_4].special_bitmap_id[GFX_SPECIAL_ARG_MAIN]);
+#endif
+
+#if 1
+  /* correct special font/graphic mapping for cloned fonts
+     (per definition only needed for 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 0
+    int base_graphic = font2baseimg(font_nr);
+#endif
+
+    if (special >= 0 && special < NUM_SPECIAL_GFX_ARGS)
+    {
+#if 0
+      boolean base_redefined =
+       getImageListEntryFromImageID(base_graphic)->redefined;
+#endif
+      boolean special_redefined =
+       getImageListEntryFromImageID(graphic)->redefined;
+      boolean special_cloned = (graphic_info[graphic].clone_from != -1);
+
+      if (special_cloned && !special_redefined)
+      {
+       int j;
+
+#if 0
+       printf(":2: %d, %d, %d / %d, %d, %d\n",
+              font_nr, special, graphic,
+              base_redefined, special_redefined, special_cloned);
+#endif
+
+       for (j = 0; font_to_graphic[j].font_nr > -1; j++)
+       {
+         int font_nr2      = font_to_graphic[j].font_nr;
+         int special2      = font_to_graphic[j].special;
+         int graphic2      = font_to_graphic[j].graphic;
+#if 0
+         int base_graphic2 = font2baseimg(font_nr2);
+#endif
+
+         if (graphic2 == graphic_info[graphic].clone_from)
+         {
+#if 0
+           printf(":2.1: %d, %d, %d, %d\n",
+                  font_nr2, special2, graphic2, base_graphic2);
+#endif
+
+#if 1
+           font_info[font_nr].special_graphic[special] =
+             font_info[font_nr2].special_graphic[special2];
+           font_info[font_nr].special_bitmap_id[special] =
+             font_info[font_nr2].special_bitmap_id[special2];
+#else
+#if 1
+           font_info[font_nr].special_graphic[special] = graphic2;
+           font_info[font_nr].special_bitmap_id[special] =
+             font_info[font_nr2].special_bitmap_id[special2];
+#else
+           font_info[font_nr].special_graphic[special] = graphic2;
+           font_info[font_nr].special_bitmap_id[special] = num_font_bitmaps;
+           num_font_bitmaps++;
+#endif
+#endif
+         }
+       }
+      }
+    }
+  }
+#endif
+
   /* reset non-redefined ".active" font graphics if normal font is redefined */
   /* (this different treatment is needed because normal and active fonts are
      independently defined ("active" is not a property of font definitions!) */
@@ -318,6 +412,24 @@ void InitFontGraphicInfo()
     }
   }
 
+#if 0
+  printf("-1- T4.M: %d, %d\n",
+        font_info[FONT_TEXT_4].special_graphic[GFX_SPECIAL_ARG_MAIN],
+        font_info[FONT_TEXT_4].special_bitmap_id[GFX_SPECIAL_ARG_MAIN]);
+
+  font_info[FONT_TEXT_4].special_graphic[GFX_SPECIAL_ARG_MAIN] =
+    IMG_FONT_TEXT_3;
+  font_info[FONT_TEXT_4].special_bitmap_id[GFX_SPECIAL_ARG_MAIN] =
+    FONT_TEXT_3;
+
+#if 0
+  font_info[FONT_TEXT_4].special_graphic[GFX_SPECIAL_ARG_MAIN] =
+    IMG_FONT_TEXT_3_PREVIEW;
+  font_info[FONT_TEXT_4].special_bitmap_id[GFX_SPECIAL_ARG_MAIN] =
+    FONT_TEXT_3;
+#endif
+#endif
+
   /* ---------- initialize font bitmap array ---------- */
 
   if (font_bitmap_info != NULL)
@@ -368,6 +480,16 @@ void InitFontGraphicInfo()
   }
 
   InitFontInfo(font_bitmap_info, num_font_bitmaps, getFontBitmapID);
+
+#if 0
+  printf("-X- T3.P: %d, %d\n",
+        font_info[FONT_TEXT_3].special_graphic[GFX_SPECIAL_ARG_PREVIEW],
+        font_info[FONT_TEXT_3].special_bitmap_id[GFX_SPECIAL_ARG_PREVIEW]);
+
+  printf("-4- T4.M: %d, %d\n",
+        font_info[FONT_TEXT_4].special_graphic[GFX_SPECIAL_ARG_MAIN],
+        font_info[FONT_TEXT_4].special_bitmap_id[GFX_SPECIAL_ARG_MAIN]);
+#endif
 }
 
 void InitElementGraphicInfo()
index 3f9b7f26bdc436ee1e899dd8020eb7b3e67f5b62..bf4e262bfc9d4fa8aad1ac12dea5d04175e06260 100644 (file)
@@ -1820,6 +1820,15 @@ static void DrawPreviewLevelLabelExt(int mode)
   struct TextPosInfo *pos = &menu.main.text.level_info_2;
   char label_text[MAX_OUTPUT_LINESIZE + 1];
   int max_len_label_text;
+#if 1
+  int font_nr = pos->font;
+  int i;
+
+  if (mode == MICROLABEL_LEVEL_AUTHOR_HEAD ||
+      mode == MICROLABEL_IMPORTED_FROM_HEAD ||
+      mode == MICROLABEL_IMPORTED_BY_HEAD)
+    font_nr = pos->font_alt;
+#else
   int font_nr = FONT_TEXT_2;
   int i;
 
@@ -1827,6 +1836,11 @@ static void DrawPreviewLevelLabelExt(int mode)
       mode == MICROLABEL_IMPORTED_FROM_HEAD ||
       mode == MICROLABEL_IMPORTED_BY_HEAD)
     font_nr = FONT_TEXT_3;
+#endif
+
+#if 0
+  printf("??? %d, %d\n", game_status, font_nr);
+#endif
 
 #if 1
   max_len_label_text = getMaxTextLength(pos, font_nr);
@@ -1893,8 +1907,14 @@ void DrawPreviewLevel(boolean restart)
   int level_ysize = lev_fieldy + (show_level_border ? 2 : 0);
   int last_game_status = game_status;          /* save current game status */
 
+#if 0
+#if 1
+  game_status = GAME_MODE_MAIN;
+#else
   /* force PREVIEW font on preview level */
   game_status = GAME_MODE_PSEUDO_PREVIEW;
+#endif
+#endif
 
   if (restart)
   {
@@ -1927,7 +1947,11 @@ void DrawPreviewLevel(boolean restart)
     {
       struct TextPosInfo *pos = &menu.main.text.level_info_1;
       char label_text[MAX_OUTPUT_LINESIZE + 1];
+#if 1
+      int font_nr = pos->font;
+#else
       int font_nr = FONT_TEXT_1;
+#endif
 #if 1
       int max_len_label_text = getMaxTextLength(pos, font_nr);
 #else