X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=dcef9e26dc253956421beea98ab050e15eb7f55d;hb=c6b89ec21b03182c40ae2eda40d861c09f179daf;hp=67c612d5519aecbd75c414f87169496dafab814c;hpb=a14c03ea017046106c3e37e3c59910edcd0a1d73;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 67c612d5..dcef9e26 100644 --- a/src/init.c +++ b/src/init.c @@ -167,7 +167,8 @@ static int getFontBitmapID(int font_nr) { int special = -1; - if (game_status >= GAME_MODE_TITLE && game_status <= GAME_MODE_PSEUDO_PREVIEW) + if (game_status >= GAME_MODE_TITLE_INITIAL && + game_status <= GAME_MODE_PSEUDO_PREVIEW) special = game_status; else if (game_status == GAME_MODE_PSEUDO_TYPENAME) special = GFX_SPECIAL_ARG_MAIN; @@ -182,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; @@ -192,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; } @@ -411,7 +426,8 @@ void InitFontGraphicInfo() } } - InitFontInfo(font_bitmap_info, num_font_bitmaps, getFontBitmapID); + InitFontInfo(font_bitmap_info, num_font_bitmaps, + getFontBitmapID, getFontFromToken); } void InitElementGraphicInfo() @@ -1020,6 +1036,7 @@ static void set_graphic_parameters(int graphic) graphic_info[graphic].post_delay = -1; graphic_info[graphic].auto_delay = -1; graphic_info[graphic].align = ALIGN_CENTER; /* default for title screens */ + graphic_info[graphic].valign = VALIGN_MIDDLE; /* default for title screens */ graphic_info[graphic].sort_priority = 0; /* default for title screens */ #if 1 @@ -1215,6 +1232,8 @@ static void set_graphic_parameters(int graphic) graphic_info[graphic].auto_delay = parameter[GFX_ARG_AUTO_DELAY]; if (parameter[GFX_ARG_ALIGN] != ARG_UNDEFINED_VALUE) graphic_info[graphic].align = parameter[GFX_ARG_ALIGN]; + if (parameter[GFX_ARG_VALIGN] != ARG_UNDEFINED_VALUE) + graphic_info[graphic].valign = parameter[GFX_ARG_VALIGN]; if (parameter[GFX_ARG_SORT_PRIORITY] != ARG_UNDEFINED_VALUE) graphic_info[graphic].sort_priority = parameter[GFX_ARG_SORT_PRIORITY]; } @@ -1284,8 +1303,8 @@ static void InitGraphicInfo() IMG_BACKGROUND_ENVELOPE_4, IMG_BACKGROUND, + IMG_BACKGROUND_TITLE_INITIAL, IMG_BACKGROUND_TITLE, - IMG_BACKGROUND_MESSAGE, IMG_BACKGROUND_MAIN, IMG_BACKGROUND_LEVELS, IMG_BACKGROUND_SCORES, @@ -1634,7 +1653,7 @@ static void set_sound_parameters(int sound, char **parameter_raw) sound_info[sound].volume = parameter[SND_ARG_VOLUME]; /* sound priority to give certain sounds a higher or lower priority */ - sound_info[sound].volume = parameter[SND_ARG_VOLUME]; + sound_info[sound].priority = parameter[SND_ARG_PRIORITY]; } static void InitSoundInfo()