static void Performance_Init( void ) { menucommon_t *menuitem; int yoffset = 0; char custom_resolution[64]; static char **resolutions; static char *colordepth_names[] = { "desktop", "16 bits", "32 bits", 0 }; static char *plighting_names[] = { "vertex (fast)", "lightmaps (normal)", "per pixel (quality)", "per pixel (no specular)", 0 }; static char **texfilter_names; int anisotropic, spinindex; #ifndef PREDEFINES_PROFILES if( !gfx_profiles ) { int i = 0, num, total, len; char *current, buffer[1024]; total = trap_FS_GetFileList( "profiles", ".cfg", NULL, 0, 0, 0 ); if( total ) gfx_profiles = UI_Malloc( sizeof( char * ) * ( total + 1 ) ); while( i < total ) { if( ( num = trap_FS_GetFileList( "profiles", ".cfg", buffer, sizeof( buffer ), i, total ) ) == 0 ) { i++; // can happen if the filename is too long to fit into the buffer or we're done continue; } // add profiles to profiles list for( current = buffer ; num ; i++, num--, current += len ) { len = strlen( current ) + 1; if( strncmp( current, "gfx_", 4 ) ) continue; COM_StripExtension( current ); gfx_profiles[i] = UI_Malloc( strlen( current + 4 ) + 1 ); strcpy( gfx_profiles[i], current + 4 ); } } } #endif if( !resolutions ) { // count video modes int i, width, height; qboolean wideScreen; for( i = 0; trap_VID_GetModeInfo( &width, &height, &wideScreen, i - 1 ); i++ ) ; resolutions = (char **)UI_Malloc( sizeof( char * ) * ( i + 1 ) ); for( i = 0; trap_VID_GetModeInfo( &width, &height, &wideScreen, i - 1 ); i++ ) { Q_snprintfz( custom_resolution, sizeof( custom_resolution ), "%s%s%i x %i", i ? "" : "custom: ", ( wideScreen ? "W " : "" ), width, height ); resolutions[i] = UI_CopyString( custom_resolution ); } resolutions[i] = NULL; } if( !texfilter_names ) { int i, count; for( count = 0; ; count++ ) { if( trap_Cvar_Value( "gl_ext_texture_filter_anisotropic_max" ) <= (1<<count) ) break; } texfilter_names = (char **)UI_Malloc( sizeof( char * ) * ( count + 1 + 1 ) ); texfilter_names[0] = UI_CopyString( "bilinear" ); for( i = 0; i < count; i++ ) texfilter_names[i+1] = UI_CopyString( va( "trilinear %ixAF", (1<<i) ) ); texfilter_names[i+1] = NULL; } menuitem = UI_InitMenuItem( "m_performance_title1", "GRAPHICS OPTIONS", 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL ); Menu_AddItem( &s_performance_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_performance_profile", "profile", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_performance_menu, menuitem ); UI_SetupSpinControl( menuitem, gfx_profiles, trap_Cvar_Value( "ui_gfxprofile" ) ); yoffset += trap_SCR_strHeight( menuitem->font ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_performance_applyprofile", "apply profile", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, ApplyProfileButton ); Menu_AddItem( &s_performance_menu, menuitem ); yoffset += 1.5 * UI_SetupButton( menuitem, qtrue ); menuitem = UI_InitMenuItem( "m_performance_resolution", "resolution", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_performance_menu, menuitem ); UI_SetupSpinControl( menuitem, resolutions, max( trap_Cvar_Value( "r_mode" ), -1 ) + 1 ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_performance_fullscreen", "fullscreen", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_performance_menu, menuitem ); UI_SetupSpinControl( menuitem, noyes_names, trap_Cvar_Value( "vid_fullscreen" ) != 0 ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_performance_swapinterval", "vertical sync", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_performance_menu, menuitem ); UI_SetupSpinControl( menuitem, noyes_names, trap_Cvar_Value( "r_swapinterval" ) ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_performance_gamma", "brightness", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_performance_menu, menuitem ); UI_SetupSlider( menuitem, 12, bound( (int)( trap_Cvar_Value( "r_gamma" ) * 10.0f ), 5, 13 ), 5, 13 ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_performance_colorbits", "color quality", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_performance_menu, menuitem ); if( !Q_stricmp( trap_Cvar_String( "r_colorbits" ), "16" ) ) UI_SetupSpinControl( menuitem, colordepth_names, 1 ); else if( !Q_stricmp( trap_Cvar_String( "r_colorbits" ), "32" ) ) UI_SetupSpinControl( menuitem, colordepth_names, 2 ); else UI_SetupSpinControl( menuitem, colordepth_names, 0 ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_performance_picmip", "texture quality", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_performance_menu, menuitem ); UI_SetupSlider( menuitem, 12, 6-trap_Cvar_Value( "r_picmip" ), 0, 6 ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_performance_filter", "texture filter", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_performance_menu, menuitem ); anisotropic = trap_Cvar_Value( "r_texturefilter" ); if( anisotropic >= 2 ) spinindex = NEARESTEXPOF2( anisotropic ) + 1; else if( !Q_stricmp( trap_Cvar_String( "r_texturemode" ), "GL_LINEAR_MIPMAP_NEAREST" ) ) spinindex = 0; else spinindex = 1; UI_SetupSpinControl( menuitem, texfilter_names, spinindex ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_performance_skymip", "sky quality", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_performance_menu, menuitem ); UI_SetupSlider( menuitem, 12, (trap_Cvar_Value( "r_fastsky" ) ? 0 : 4-trap_Cvar_Value( "r_skymip" )), 0, 4 ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_performance_LOD_slider", "geometry level of detail", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_performance_menu, menuitem ); UI_SetupSlider( menuitem, 12, 4-max( trap_Cvar_Value( "r_lodbias" ), NEARESTEXPOF2( trap_Cvar_Value( "r_subdivisions" ) ) ), 0, 4 ); yoffset += trap_SCR_strHeight( menuitem->font ); #if 0 menuitem = UI_InitMenuItem( "m_performance_glsl", "opengl shaders", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_performance_menu, menuitem ); UI_SetupSpinControl( menuitem, offon_names, trap_Cvar_Value( "gl_ext_GLSL" ) ); yoffset += trap_SCR_strHeight( menuitem->font ); #endif if( trap_Cvar_Value( "r_lighting_vertexlight" ) ) spinindex = 0; else if( !trap_Cvar_Value( "r_lighting_deluxemapping" ) ) spinindex = 1; else if( trap_Cvar_Value( "r_lighting_specular" ) ) spinindex = 2; else spinindex = 3; menuitem = UI_InitMenuItem( "m_performance_pplighting", "lighting", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_performance_menu, menuitem ); UI_SetupSpinControl( menuitem, plighting_names, spinindex ); yoffset += trap_SCR_strHeight( menuitem->font ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_performance_back", "back", -16, yoffset, MTYPE_ACTION, ALIGN_RIGHT_TOP, uis.fontSystemBig, M_genericBackFunc ); Menu_AddItem( &s_performance_menu, menuitem ); UI_SetupButton( menuitem, qtrue ); menuitem = UI_InitMenuItem( "m_performance_apply", "apply", 16, yoffset, MTYPE_ACTION, ALIGN_LEFT_TOP, uis.fontSystemBig, ApplyButton ); Menu_AddItem( &s_performance_menu, menuitem ); yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;; yoffset += trap_SCR_strHeight( uis.fontSystemSmall ); menuitem = UI_InitMenuItem( "m_performance_advanced", "advanced options", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, AdvancedButton ); Menu_AddItem( &s_performance_menu, menuitem ); UI_SetupButton( menuitem, qtrue ); Menu_Center( &s_performance_menu ); Menu_Init( &s_performance_menu, qfalse ); }
//================= //TeamConfig_MenuInit //================= static qboolean TeamConfig_MenuInit( void ) { menucommon_t *menuitem; m_listitem_t *item; playermodelinfo_s *playermodel; int yoffset = 0; static char *team_names[] = { "PLAYERS", "ALPHA", "BETA", 0 }; if( playermodelsItemsList.numItems == 0 ) return qfalse; s_team_config_menu.nitems = 0; currentTEAM = TEAM_ALPHA; UpdateTeamCvars(); // title menuitem = UI_InitMenuItem( "m_TeamConfig_title1", "TEAM ASPECT SETUP", 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL ); Menu_AddItem( &s_team_config_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); yoffset += trap_SCR_strHeight( menuitem->font ); // team menuitem = UI_InitMenuItem( "m_TeamConfig_team", "team", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, ChangeTeamCallback ); UI_SetupSpinControl( menuitem, team_names, TEAM_ALPHA - TEAM_PLAYERS ); Menu_AddItem( &s_team_config_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); // padding yoffset += trap_SCR_strHeight( menuitem->font ); // model menuitem = UI_InitMenuItem( "m_TeamConfig_forcemodel", "force a team model", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_ApplyChanges ); UI_SetupSpinControl( menuitem, noyes_names, ( model->string[0] != 0 ) ); Menu_AddItem( &s_team_config_menu, menuitem ); hasForcedModelMenuItem = menuitem; yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_TeamConfig_model", "model", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, TeamModelCallback ); UI_SetupSpinControl( menuitem, playermodelsItemsList.item_names, 0 ); Menu_AddItem( &s_team_config_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); item = UI_FindItemInScrollListWithId( &playermodelsItemsList, 0 ); playermodel = (playermodelinfo_s *)item->data; menuitem = UI_InitMenuItem( "m_TeamConfig_skin", "skin", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_ApplyChanges ); UI_SetupSpinControl( menuitem, playermodel->skinnames, 0 ); Menu_AddItem( &s_team_config_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); M_GetTeamModel(); // padding yoffset += trap_SCR_strHeight( menuitem->font ); // color menuitem = UI_InitMenuItem( "m_TeamConfig_forcecolor", "force a team color", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, ForceAColorCallback ); UI_SetupSpinControl( menuitem, noyes_names, ( color->string[0] != 0 ) ); Menu_AddItem( &s_team_config_menu, menuitem ); hasForcedColorMenuItem = menuitem; yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_TeamConfig_colorred", "red", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_ColorRedCallback ); Menu_AddItem( &s_team_config_menu, menuitem ); UI_SetupSlider( menuitem, 12, playerColor[0], 0, 255 ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_TeamConfig_colorgreen", "green", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_ColorGreenCallback ); Menu_AddItem( &s_team_config_menu, menuitem ); UI_SetupSlider( menuitem, 12, playerColor[1], 0, 255 ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_TeamConfig_colorblue", "blue", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_ColorBlueCallback ); Menu_AddItem( &s_team_config_menu, menuitem ); UI_SetupSlider( menuitem, 12, playerColor[2], 0, 255 ); M_GetTeamColor(); yoffset += trap_SCR_strHeight( menuitem->font ); // padding yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_TeamConfig_MyTeamAlpha", "switch my team to show as team ALPHA", 60, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_MyTeamAlpha ); UI_SetupSpinControl( menuitem, noyes_names, ( trap_Cvar_Value( "cg_forceMyTeamAlpha" ) ) ); Menu_AddItem( &s_team_config_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_TeamConfig_TeamPlayersTeamBeta", "show teamless players as team BETA players", 60, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_TeamPlayersTeamBeta ); UI_SetupSpinControl( menuitem, noyes_names, ( trap_Cvar_Value( "cg_forceTeamPlayersTeamBeta" ) ) ); Menu_AddItem( &s_team_config_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); // padding yoffset += trap_SCR_strHeight( menuitem->font ); // help menuitem = UI_InitMenuItem( "m_TeamConfig_HelpText", "If you want to always force your teammates and your enemies to a specific look,", 10, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_team_config_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); menuitem = UI_InitMenuItem( "m_TeamConfig_HelpText2", "set both of the above options and configure ALPHA and BETA teams", 10, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemSmall, NULL ); Menu_AddItem( &s_team_config_menu, menuitem ); yoffset += trap_SCR_strHeight( menuitem->font ); // padding yoffset += trap_SCR_strHeight( menuitem->font ); // back menuitem = UI_InitMenuItem( "m_TeamConfig_back", "back", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_TeamConfig_SaveAndClose ); Menu_AddItem( &s_team_config_menu, menuitem ); UI_SetupButton( menuitem, qtrue ); Menu_Center( &s_team_config_menu ); Menu_Init( &s_team_config_menu, qfalse ); return qtrue; }