X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=dcef9e26dc253956421beea98ab050e15eb7f55d;hb=c6b89ec21b03182c40ae2eda40d861c09f179daf;hp=c78a3420b3563908b39400bd958f299dbd429889;hpb=9f7cd608c28ded86b2c2e649c776220ae27df038;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index c78a3420..dcef9e26 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() @@ -1290,8 +1305,6 @@ static void InitGraphicInfo() IMG_BACKGROUND, IMG_BACKGROUND_TITLE_INITIAL, IMG_BACKGROUND_TITLE, - IMG_BACKGROUND_MESSAGE_INITIAL, - IMG_BACKGROUND_MESSAGE, IMG_BACKGROUND_MAIN, IMG_BACKGROUND_LEVELS, IMG_BACKGROUND_SCORES, @@ -1640,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()