X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fmisc.c;h=3fcf5af1ce6a38d7af105dd5eb6e89306c47bde7;hb=c6b89ec21b03182c40ae2eda40d861c09f179daf;hp=d0c62ab591b14d707931c43395f9c3dfca7dbb56;hpb=eb09b9aa5521e286723c668030825cd0e3470c3c;p=rocksndiamonds.git diff --git a/src/libgame/misc.c b/src/libgame/misc.c index d0c62ab5..3fcf5af1 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1824,6 +1824,10 @@ int get_parameter_value(char *value_raw, char *suffix, int type) if (string_has_parameter(value, "static_panel")) result |= ANIM_STATIC_PANEL; } + else if (strEqual(suffix, ".font")) + { + result = gfx.get_font_from_token_function(value); + } else /* generic parameter of type integer or boolean */ { result = (strEqual(value, ARG_UNDEFINED) ? ARG_UNDEFINED_VALUE : @@ -1837,6 +1841,35 @@ int get_parameter_value(char *value_raw, char *suffix, int type) return result; } +int get_token_parameter_value(char *token, char *value_raw) +{ + char *suffix; + + if (token == NULL || value_raw == NULL) + return ARG_UNDEFINED_VALUE; + + suffix = strrchr(token, '.'); + if (suffix == NULL) + suffix = token; + +#if 0 + if (strncmp(suffix, ".font", 5) == 0) + { + int i; + + /* !!! OPTIMIZE THIS BY USING HASH !!! */ + for (i = 0; i < NUM_FONTS; i++) + if (strEqual(value_raw, font_info[i].token_name)) + return i; + + /* if font not found, use reliable default value */ + return FONT_INITIAL_1; + } +#endif + + return get_parameter_value(value_raw, suffix, TYPE_INTEGER); +} + struct ScreenModeInfo *get_screen_mode_from_string(char *screen_mode_string) { static struct ScreenModeInfo screen_mode;