CreateImageTextures(texture_graphics[i]);
}
-static int getFontBitmapID(int font_nr)
+static int getFontSpecialSuffix(void)
{
int special = -1;
else if (game_status == GAME_MODE_PSEUDO_TYPENAMES)
special = GFX_SPECIAL_ARG_NAMES;
+ return special;
+}
+
+static int getFontBitmapID(int font_nr)
+{
+ int special = getFontSpecialSuffix();
+
if (special != -1)
return font_info[font_nr].special_bitmap_id[special];
else
return FONT_INITIAL_1;
}
+static char *getTokenFromFont(int font_nr)
+{
+ static char *token = NULL;
+ int special = getFontSpecialSuffix();
+
+ checked_free(token);
+
+ if (special != -1)
+ token = getStringCat2(font_info[font_nr].token_name,
+ special_suffix_info[special].suffix);
+ else
+ token = getStringCopy(font_info[font_nr].token_name);
+
+ return token;
+}
+
static void InitFontGraphicInfo(void)
{
static struct FontBitmapInfo *font_bitmap_info = NULL;
if (graphic_info == NULL) // still at startup phase
{
InitFontInfo(font_initial, NUM_INITIAL_FONTS,
- getFontBitmapID, getFontFromToken);
+ getFontBitmapID, getFontFromToken, getTokenFromFont);
return;
}
}
InitFontInfo(font_bitmap_info, num_font_bitmaps,
- getFontBitmapID, getFontFromToken);
+ getFontBitmapID, getFontFromToken, getTokenFromFont);
}
static void InitGlobalAnimGraphicInfo(void)
void InitFontInfo(struct FontBitmapInfo *font_bitmap_info, int num_fonts,
int (*select_font_function)(int),
- int (*get_font_from_token_function)(char *))
+ int (*get_font_from_token_function)(char *),
+ char * (*get_token_from_font_function)(int))
{
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;
+ gfx.get_token_from_font_function = get_token_from_font_function;
}
void FreeFontInfo(struct FontBitmapInfo *font_bitmap_info)
int src_x, src_y;
char *text_ptr = text;
+#if DEBUG
+ Debug("font:token", "'%s' / '%s'",
+ gfx.get_token_from_font_function(font_nr), text);
+#endif
+
if (font->bitmap == NULL)
return;
// font structure definitions
void InitFontInfo(struct FontBitmapInfo *, int,
- int (*function1)(int), int (*function2)(char *));
+ int (*function1)(int),
+ int (*function2)(char *),
+ char * (*function3)(int));
void FreeFontInfo(struct FontBitmapInfo *);
struct FontBitmapInfo *getFontBitmapInfo(int);