X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=a8017155d78226cad43a2891794f528a7bc913b6;hb=884012f34f9f3c22bf75d1468e4ed57d7795a24b;hp=cb5e0661f67ca81ba7436e657e8b7ef9d2c3f4bd;hpb=eb09b9aa5521e286723c668030825cd0e3470c3c;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index cb5e0661..a8017155 100644 --- a/src/init.c +++ b/src/init.c @@ -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() @@ -5096,6 +5111,8 @@ void ReloadCustomArtwork(int force_reload) /* force redraw of (open or closed) door graphics */ SetDoorState(DOOR_OPEN_ALL); CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY); + + fading = fading_none; } } @@ -5180,6 +5197,8 @@ void OpenAll() return; } + fading = fading_none; + game_status = GAME_MODE_MAIN; DrawMainMenu();