/* Copyright (C) 1997-2001 Id Software, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // ui_options_interface.c -- the interface options menu #include #ifdef _WIN32 #include #endif #include "../client/client.h" #include "ui_local.h" /* ======================================================================= INTERFACE MENU ======================================================================= */ // interface static menuframework_s s_options_interface_menu; static menuseparator_s s_options_interface_header; static menuslider_s s_options_interface_conalpha_slider; //static menuslider_s s_options_interface_conheight_slider; static menuslider_s s_options_interface_menumouse_slider; static menuslider_s s_options_interface_menualpha_slider; static menulist_s s_options_interface_font_box; static menuslider_s s_options_interface_fontsize_slider; static menulist_s s_options_interface_alt_text_color_box; static menulist_s s_options_interface_noalttab_box; static menuaction_s s_options_interface_defaults_action; static menuaction_s s_options_interface_back_action; static void MouseMenuFunc( void *unused ) { Cvar_SetValue( "menu_sensitivity", s_options_interface_menumouse_slider.curvalue / 4.0F ); } // menu alpha option static void MenuAlphaFunc( void *unused ) { Cvar_SetValue( "menu_alpha", s_options_interface_menualpha_slider.curvalue / 20.0F); } static void AltTextColorFunc( void *unused ) { Cvar_SetValue( "alt_text_color", s_options_interface_alt_text_color_box.curvalue); } // Psychospaz's transparent console static void ConAlphaFunc( void *unused ) { Cvar_SetValue( "con_alpha", s_options_interface_conalpha_slider.curvalue * 0.05 ); } // variable console height /*static void ConHeightFunc( void *unused ) { Cvar_SetValue( "con_height", 0.25 + (s_options_interface_conheight_slider.curvalue * 0.05) ); }*/ static void NoAltTabFunc( void *unused ) { Cvar_SetValue( "win_noalttab", s_options_interface_noalttab_box.curvalue ); } /* ======================================================================= Font loading ======================================================================= */ cvar_t *con_font; #define MAX_FONTS 32 char **font_names; int numfonts; static void FontSizeFunc( void *unused ) { Cvar_SetValue( "con_font_size", s_options_interface_fontsize_slider.curvalue * 4 ); } static void FontFunc( void *unused ) { Cvar_Set( "con_font", font_names[s_options_interface_font_box.curvalue] ); } void SetFontCursor (void) { int i; s_options_interface_font_box.curvalue = 0; if (!con_font) con_font = Cvar_Get ("con_font", "default", CVAR_ARCHIVE); if (numfonts>1) for (i=0; font_names[i]; i++) { if (!Q_strcasecmp(con_font->string, font_names[i])) { s_options_interface_font_box.curvalue = i; return; } } } void insertFont (char **list, char *insert, int len ) { int i, j; if (!list) return; //i=1 so default stays first! for (i=1; ii ;j--) list[j] = list[j-1]; list[i] = strdup(insert); return; } } list[len] = strdup(insert); } char **SetFontNames (void) { char *curFont; char **list = 0, *p;//, *s; char findname[1024]; int nfonts = 0, nfontnames; char **fontfiles; char *path = NULL; int i;//, j; list = malloc( sizeof( char * ) * MAX_FONTS ); memset( list, 0, sizeof( char * ) * MAX_FONTS ); list[0] = strdup("default"); nfontnames = 1; path = FS_NextPath( path ); while (path) { Com_sprintf( findname, sizeof(findname), "%s/fonts/*.*", path ); fontfiles = FS_ListFiles( findname, &nfonts, 0, SFF_SUBDIR | SFF_HIDDEN | SFF_SYSTEM ); for (i=0;i