diff --git a/code/ui/ui_atoms.c b/code/ui/ui_atoms.c index 2519876..f737c7a 100644 --- a/code/ui/ui_atoms.c +++ b/code/ui/ui_atoms.c @@ -2071,6 +2071,17 @@ void UI_LoadMenuText() menu_normal_text[MNT_BROWSER_MOD] = "MOD"; menu_normal_text[MNT_BROWSER_BOTS] = "BOTS"; menu_normal_text[MNT_BROWSER_SCAN_PROGRESS] = "Scanning %d of %d Servers..."; + menu_normal_text[MNT_VIDEO_LOW_QUALITY] = "LOW QUALITY"; + menu_normal_text[MNT_VIDEO_MEDIUM_QUALITY] = "MEDIUM QUALITY"; + menu_normal_text[MNT_VIDEO_HIGHEST_QUALITY] = "HIGHEST QUALITY"; + menu_normal_text[MNT_VIDEO_RENDERER_OPENGL1] = "OPENGL1"; + menu_normal_text[MNT_VIDEO_RENDERER_OPENGL2] = "OPENGL2"; + menu_normal_text[MNT_VIDEO_2X] = "2X"; + menu_normal_text[MNT_VIDEO_4X] = "4X"; + menu_normal_text[MNT_VIDEO_8X] = "8X"; + menu_normal_text[MNT_VIDEO_16X] = "16X"; + menu_normal_text[MNT_ALTSWAP_STANDARD] = "STANDARD"; + menu_normal_text[MNT_ALTSWAP_SWAPPED] = "SWAPPED"; menu_normal_text[MNT_ALTSWAP_AUTO] = "AUTO"; menu_normal_text[MNT_ALTSWAP_CUSTOM] = "CUSTOM"; @@ -2086,6 +2097,10 @@ void UI_LoadMenuText() menu_normal_text[MNT_BROWSER_BOTS_AND_HUMANS] = "BOTS ODER MENSCHEN"; menu_normal_text[MNT_BROWSER_MOD] = "MODIFIKATION"; menu_normal_text[MNT_BROWSER_SCAN_PROGRESS] = "Scannen von %d von %d Servern..."; + menu_normal_text[MNT_VIDEO_LOW_QUALITY] = "GERINGE QUALITÄT"; + menu_normal_text[MNT_VIDEO_MEDIUM_QUALITY] = "MITTLERE QUALITÄT"; + menu_normal_text[MNT_VIDEO_HIGHEST_QUALITY] = "HÖCHSTE QUALITÄT"; + menu_normal_text[MNT_ALTSWAP_SWAPPED] = "INVERTIERT"; menu_normal_text[MNT_ALTSWAP_AUTO] = "AUTOMATISCH"; menu_normal_text[MNT_ALTSWAP_CUSTOM] = "BENUTZER"; @@ -2117,6 +2132,11 @@ void UI_LoadMenuText() menu_normal_text[MNT_BROWSER_BOTS_AND_HUMANS] = "BOTS OU HUMAINS"; menu_normal_text[MNT_BROWSER_MOD] = "MODIF."; menu_normal_text[MNT_BROWSER_SCAN_PROGRESS] = "Analyse de %d des %d serveurs..."; + menu_normal_text[MNT_VIDEO_LOW_QUALITY] = "BASSE QUALITÉ"; + menu_normal_text[MNT_VIDEO_MEDIUM_QUALITY] = "QUALITÉ MOYENNE"; + menu_normal_text[MNT_VIDEO_HIGHEST_QUALITY] = "MEILLEURE QUALITÉ"; + menu_normal_text[MNT_ALTSWAP_STANDARD] = "LA NORME"; + menu_normal_text[MNT_ALTSWAP_SWAPPED] = "INVERSÉ"; menu_normal_text[MNT_ALTSWAP_AUTO] = "AUTO"; menu_normal_text[MNT_ALTSWAP_CUSTOM] = "SUR MESURE"; } @@ -2253,7 +2273,30 @@ void UI_LoadButtonText() menu_button_text[MBT_CENTERHUD][1] = "MOVE HUD TOWARDS CENTER OF SCREEN"; menu_button_text[MBT_BROWSER_PLAYERTYPE][0] = "PLAYER TYPE"; menu_button_text[MBT_BROWSER_PLAYERTYPE][1] = "FILTER BY AMOUNT OF PLAYERS ON SERVER"; - + menu_button_text[MBT_SOUND_OPENAL][0] = "OPENAL"; + menu_button_text[MBT_SOUND_OPENAL][1] = "OPENAL SOUND ON/OFF."; + menu_button_text[MBT_SOUND_OVERALL_VOLUME][0] = "OVERALL VOLUME"; + menu_button_text[MBT_SOUND_OVERALL_VOLUME][1] = "VOLUME FOR ALL IN-GAME AUDIO."; + menu_button_text[MBT_CONTROLS_RAW_MOUSE][0] = "RAW MOUSE"; + menu_button_text[MBT_CONTROLS_RAW_MOUSE][1] = "RAW MOUSE INPUT (ON/OFF)"; + menu_button_text[MBT_VIDEO_LIGHTING_LEVEL][0] = "LIGHTING LEVEL"; + menu_button_text[MBT_VIDEO_LIGHTING_LEVEL][1] = "ADJUST OVERALL LIGHTING INTENSITY"; + menu_button_text[MBT_VIDEO_LIGHTING_CONTRAST][0] = "LIGHTING CONTRAST"; + menu_button_text[MBT_VIDEO_LIGHTING_CONTRAST][1] = "ADJUST MAXIMUM LIGHTING INTENSITY"; + menu_button_text[MBT_VIDEO_LIGHTING_APPLY][0] = "APPLY"; + menu_button_text[MBT_VIDEO_LIGHTING_APPLY][1] = "APPLY LIGHTING CHANGES"; + menu_button_text[MBT_VIDEO_LIGHTING_RESET][0] = "RESET"; + menu_button_text[MBT_VIDEO_LIGHTING_RESET][1] = "RESET LIGHTING CHANGES"; + menu_button_text[MBT_VIDEO_RENDERER][0] = "RENDERER"; + menu_button_text[MBT_VIDEO_RENDERER][1] = "SELECT RENDERER VERSION"; + menu_button_text[MBT_VIDEO_WINDOW_SIZE][0] = "WINDOW SIZE"; + menu_button_text[MBT_VIDEO_WINDOW_SIZE][1] = "DISPLAY SIZE IN WINDOWED MODE"; + menu_button_text[MBT_VIDEO_ANISOTROPIC_LEVEL][0] = "ANISOTROPIC FILTERING"; + menu_button_text[MBT_VIDEO_ANISOTROPIC_LEVEL][1] = "ANISOTROPIC FILTERING LEVEL"; + menu_button_text[MBT_VIDEO_ANTI_ALIASING][0] = "ANTI ALIASING"; + menu_button_text[MBT_VIDEO_ANTI_ALIASING][1] = "MULTISAMPLE ANTI ALIASING LEVEL"; + menu_button_text[MBT_VIDEO_VERTICAL_SYNC][0] = "VERTICAL SYNC"; + menu_button_text[MBT_VIDEO_VERTICAL_SYNC][1] = "TURN VERTICAL SYNC ON OR OFF"; menu_button_text[MBT_ALTSWAP_CONTROL][0] = "ALT FIRE SWAPPING"; menu_button_text[MBT_ALTSWAP_CONTROL][1] = "SELECT ALT FIRE BUTTON SWAPPING MODE"; menu_button_text[MBT_ALTSWAP_EDIT][0] = "EDIT"; @@ -2297,7 +2340,28 @@ void UI_LoadButtonText() menu_button_text[MBT_CENTERHUD][1] = "HUD ZUR MITTE DES BILDSCHIRMS VERSCHIEBEN"; menu_button_text[MBT_BROWSER_PLAYERTYPE][0] = "SPIELERTYP"; menu_button_text[MBT_BROWSER_PLAYERTYPE][1] = "FILTER NACH ANZAHL DER SPIELER AUF DEM SERVER"; - + menu_button_text[MBT_SOUND_OPENAL][1] = "OPENAL-SOUND EIN/AUS"; + menu_button_text[MBT_SOUND_OVERALL_VOLUME][0] = "GESAMTLAUTSTÄRKE"; + menu_button_text[MBT_SOUND_OVERALL_VOLUME][1] = "LAUTSTÄRKE FÜR ALLE IN-GAME-AUDIO."; + menu_button_text[MBT_CONTROLS_RAW_MOUSE][0] = "ROHE MAUS"; + menu_button_text[MBT_CONTROLS_RAW_MOUSE][1] = "ROHE MAUSEINGABE (EIN/AUS)"; + menu_button_text[MBT_VIDEO_LIGHTING_LEVEL][0] = "BELEUCHTUNGSNIVEAU"; + menu_button_text[MBT_VIDEO_LIGHTING_LEVEL][1] = "GESAMTLICHTINTENSITÄT EINSTELLEN"; + menu_button_text[MBT_VIDEO_LIGHTING_CONTRAST][0] = "BELEUCHTUNGSKONTRAST"; + menu_button_text[MBT_VIDEO_LIGHTING_CONTRAST][1] = "MAXIMALE BELEUCHTUNGSINTENSITÄT EINSTELLEN"; + menu_button_text[MBT_VIDEO_LIGHTING_APPLY][0] = "ANWENDEN"; + menu_button_text[MBT_VIDEO_LIGHTING_APPLY][1] = "ÄNDERUNGEN DER BELEUCHTUNG ANWENDEN"; + menu_button_text[MBT_VIDEO_LIGHTING_RESET][0] = "ZURÜCKSETZEN"; + menu_button_text[MBT_VIDEO_LIGHTING_RESET][1] = "BELEUCHTUNGSÄNDERUNGEN ZURÜCKSETZEN"; + menu_button_text[MBT_VIDEO_RENDERER][1] = "RENDERER-VERSION AUSWÄHLEN"; + menu_button_text[MBT_VIDEO_WINDOW_SIZE][0] = "FENSTERGRÖSSE"; + menu_button_text[MBT_VIDEO_WINDOW_SIZE][1] = "ANZEIGEGRÖSSE IM FENSTERMODUS"; + menu_button_text[MBT_VIDEO_ANISOTROPIC_LEVEL][0] = "ANISOTROPIC-FILTER"; + menu_button_text[MBT_VIDEO_ANISOTROPIC_LEVEL][1] = "ANISOTROPISCHE FILTERUNGSSTUFE"; + menu_button_text[MBT_VIDEO_ANTI_ALIASING][0] = "ANTI ALIASING"; + menu_button_text[MBT_VIDEO_ANTI_ALIASING][1] = "MULTISAMPLE-ANTIALIASING-STUFE"; + menu_button_text[MBT_VIDEO_VERTICAL_SYNC][0] = "VERTIKALE SYNC"; + menu_button_text[MBT_VIDEO_VERTICAL_SYNC][1] = "VERTIKALE SYNCHRONISIERUNG EIN- ODER AUSSCHALTEN"; menu_button_text[MBT_ALTSWAP_CONTROL][0] = "ALT FEUER WECHSELN"; menu_button_text[MBT_ALTSWAP_CONTROL][1] = "MODUS FÜR DAS ALTERNATIVE FEUER AUSWÄHLEN"; menu_button_text[MBT_ALTSWAP_EDIT][0] = "BEARBEITEN"; @@ -2352,7 +2416,29 @@ void UI_LoadButtonText() menu_button_text[MBT_CENTERHUD][1] = "DÉPLACER LE HUD VERS LE CENTRE DE L'ÉCRAN"; menu_button_text[MBT_BROWSER_PLAYERTYPE][0] = "TYPE DE JOUEUR"; menu_button_text[MBT_BROWSER_PLAYERTYPE][1] = "FILTREZ PAR QUANTITÉ DE JOUEURS SUR SERVEUR"; - + menu_button_text[MBT_SOUND_OPENAL][1] = "SON OPENAL ON/OFF"; + menu_button_text[MBT_SOUND_OVERALL_VOLUME][0] = "VOLUME GLOBAL"; + menu_button_text[MBT_SOUND_OVERALL_VOLUME][1] = "VOLUME POUR TOUS LES AUDIO DU JEU."; + menu_button_text[MBT_CONTROLS_RAW_MOUSE][0] = "SOURIS RAW"; + menu_button_text[MBT_CONTROLS_RAW_MOUSE][1] = "ENTREE RAW SOURIS (ON/OFF)"; + menu_button_text[MBT_VIDEO_LIGHTING_LEVEL][0] = "NIVEAU D'ÉCLAIRAGE"; + menu_button_text[MBT_VIDEO_LIGHTING_LEVEL][1] = "AJUSTER L'INTENSITÉ DE L'ÉCLAIRAGE GÉNÉRAL"; + menu_button_text[MBT_VIDEO_LIGHTING_CONTRAST][0] = "CONTRASTE D'ÉCLAIRAGE"; + menu_button_text[MBT_VIDEO_LIGHTING_CONTRAST][1] = "AJUSTER L'INTENSITÉ MAXIMALE DE L'ÉCLAIRAGE"; + menu_button_text[MBT_VIDEO_LIGHTING_APPLY][0] = "APPLIQUER"; + menu_button_text[MBT_VIDEO_LIGHTING_APPLY][1] = "APPLIQUER DES CHANGEMENTS D'ÉCLAIRAGE"; + menu_button_text[MBT_VIDEO_LIGHTING_RESET][0] = "RÉINITIALISER"; + menu_button_text[MBT_VIDEO_LIGHTING_RESET][1] = "RÉINITIALISER LES CHANGEMENTS D'ÉCLAIRAGE"; + menu_button_text[MBT_VIDEO_RENDERER][0] = "RENDU"; + menu_button_text[MBT_VIDEO_RENDERER][1] = "SÉLECTIONNER LA VERSION DU RENDU"; + menu_button_text[MBT_VIDEO_WINDOW_SIZE][0] = "TAILLE DE LA FENÊTRE"; + menu_button_text[MBT_VIDEO_WINDOW_SIZE][1] = "TAILLE D'AFFICHAGE EN MODE FENÊTRE"; + menu_button_text[MBT_VIDEO_ANISOTROPIC_LEVEL][0] = "FILTRAGE ANISOTROPE"; + menu_button_text[MBT_VIDEO_ANISOTROPIC_LEVEL][1] = "NIVEAU DE FILTRAGE ANISOTROPE"; + menu_button_text[MBT_VIDEO_ANTI_ALIASING][0] = "ANTI CRÉNELAGE"; + menu_button_text[MBT_VIDEO_ANTI_ALIASING][1] = "NIVEAU D'ANTICRÉNELAGE MULTI-ÉCHANTILLONS"; + menu_button_text[MBT_VIDEO_VERTICAL_SYNC][0] = "SYNC VERTICAL"; + menu_button_text[MBT_VIDEO_VERTICAL_SYNC][1] = "ACTIVER OU DÉSACTIVER LA SYNCHRONISATION VERTICALE"; menu_button_text[MBT_ALTSWAP_CONTROL][0] = "ÉCHANGE DE FEU ALT"; menu_button_text[MBT_ALTSWAP_CONTROL][1] = "SÉLECTIONNER LE MODE D'ÉCHANGE DU BOUTON ALT FIRE"; menu_button_text[MBT_ALTSWAP_EDIT][0] = "ÉDITER"; diff --git a/code/ui/ui_controls2.c b/code/ui/ui_controls2.c index 288b8c7..258a4df 100644 --- a/code/ui/ui_controls2.c +++ b/code/ui/ui_controls2.c @@ -3,6 +3,39 @@ #include "ui_local.h" +typedef struct { + qboolean supportFreeLook; + qboolean supportRawMouse; + qboolean supportMouseStrafe; +} controlsEngineConfig_t; + +static controlsEngineConfig_t controlsEngineConfig; + +/* +================= +UI_InitControlsEngineConfig + +Load settings in the soundEngineConfig structure. +================= +*/ +static void UI_InitControlsEngineConfig( void ) { + memset( &controlsEngineConfig, 0, sizeof( controlsEngineConfig ) ); + + if ( !VMExt_GVCommandInt( "ui_suppress_cl_freelook", 0 ) || trap_Cvar_VariableValue( "cl_freelook" ) < 1.0f ) { + controlsEngineConfig.supportFreeLook = qtrue; + } + + // Currently only enable this if free look is suppressed, due to button space constraints. + if ( !controlsEngineConfig.supportFreeLook && VMExt_GVCommandInt( "ui_support_cmd_set_raw_mouse", 0 ) && + VMExt_GVCommandInt( "ui_support_cmd_get_raw_mouse", 0 ) ) { + controlsEngineConfig.supportRawMouse = qtrue; + } + + if ( !VMExt_GVCommandInt( "ui_skip_strafe", 0 ) ) { + controlsEngineConfig.supportMouseStrafe = qtrue; + } +} + /* ----------------------------------------------------------------------- */ // Alt Fire Button Swapping @@ -208,17 +241,17 @@ static struct { } altSwapCustomData; static int altSwapCustom_WeaponValueNames[] = { - MNT_OFF, + MNT_ALTSWAP_STANDARD, MNT_ALTSWAP_AUTO, - MNT_ON, + MNT_ALTSWAP_SWAPPED, MNT_NONE }; typedef enum { // Order must match altSwapCustom_WeaponValueNames - ALTSWAP_WEAPONBUTTON_OFF, + ALTSWAP_WEAPONBUTTON_STANDARD, ALTSWAP_WEAPONBUTTON_AUTO, - ALTSWAP_WEAPONBUTTON_ON, + ALTSWAP_WEAPONBUTTON_SWAPPED, } altSwapCustom_WeaponValueIds_t; /* @@ -269,9 +302,9 @@ static void AltSwapCustom_LoadButtonValues( void ) { if ( altSwapData.currentButtons[settingIndex] == 'a' ) { altSwapCustomData.weapons[i].curvalue = ALTSWAP_WEAPONBUTTON_AUTO; } else if ( altSwapData.currentButtons[settingIndex] == 's' ) { - altSwapCustomData.weapons[i].curvalue = ALTSWAP_WEAPONBUTTON_ON; + altSwapCustomData.weapons[i].curvalue = ALTSWAP_WEAPONBUTTON_SWAPPED; } else { - altSwapCustomData.weapons[i].curvalue = ALTSWAP_WEAPONBUTTON_OFF; + altSwapCustomData.weapons[i].curvalue = ALTSWAP_WEAPONBUTTON_STANDARD; } } } @@ -311,7 +344,7 @@ static void AltSwapCustom_Event( void *ptr, int event ) { if ( button->curvalue == ALTSWAP_WEAPONBUTTON_AUTO ) { altSwapData.currentButtons[settingIndex] = 'a'; - } else if ( button->curvalue == ALTSWAP_WEAPONBUTTON_ON ) { + } else if ( button->curvalue == ALTSWAP_WEAPONBUTTON_SWAPPED ) { altSwapData.currentButtons[settingIndex] = 's'; } else { altSwapData.currentButtons[settingIndex] = 'n'; @@ -839,6 +872,7 @@ typedef struct menuaction_s lookdown; menuaction_s mouselook; menulist_s freelook; + menulist_s rawmouse; menuaction_s centerview; menuaction_s zoomview; menuaction_s gesture; @@ -1528,6 +1562,9 @@ static void Controls_GetConfig( void ) s_controls.joyenable.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "in_joystick" ) ); s_controls.joythreshold.curvalue = UI_ClampCvar( 0.05, 0.75, Controls_GetCvarValue( "joy_threshold" ) ); s_controls.freelook.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cl_freelook" ) ); + if ( controlsEngineConfig.supportRawMouse ) { + s_controls.rawmouse.curvalue = VMExt_GVCommandInt( "cmd_get_raw_mouse", 0 ) > 0 ? 1 : 0; + } s_keyturnspeed_slider.curvalue = UI_ClampCvar( 1, 5, Controls_GetCvarValue( "cl_anglespeedkey" ) ); s_joyxbutton_box.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "joy_xbutton" ) ); s_joyybutton_box.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "joy_ybutton" ) ); @@ -1590,7 +1627,9 @@ static void Controls_SetConfig( void ) trap_Cvar_SetValue( "cg_autoswitch", s_controls.autoswitch.curvalue ); trap_Cvar_SetValue( "sensitivity", s_controls.sensitivity.curvalue ); trap_Cvar_SetValue( "joy_threshold", s_controls.joythreshold.curvalue ); - trap_Cvar_SetValue( "cl_freelook", s_controls.freelook.curvalue ); + if ( controlsEngineConfig.supportFreeLook ) { + trap_Cvar_SetValue( "cl_freelook", s_controls.freelook.curvalue ); + } trap_Cvar_SetValue( "cl_anglespeedkey", s_keyturnspeed_slider.curvalue ); trap_Cvar_SetValue( "joy_xbutton", s_joyxbutton_box.curvalue ); trap_Cvar_SetValue( "joy_ybutton", s_joyybutton_box.curvalue ); @@ -2408,6 +2447,14 @@ static void SetupActionButtons_Init(int section) break; } + if ( !controlsEngineConfig.supportFreeLook && g_section == C_LOOK && controlptr[i] == &s_look_mouselook_action ) { + continue; + } + + if ( !controlsEngineConfig.supportMouseStrafe && g_section == C_MOVE && controlptr[i] == &s_move_sidestep_action ) { + continue; + } + ((menuaction_s*)controlptr[i])->generic.x = current_menu->listX; ((menuaction_s*)controlptr[i])->generic.y = y; ((menuaction_s*)controlptr[i])->textX = 5; @@ -3161,7 +3208,9 @@ static void ControlsMove_MenuInit( void ) Menu_AddItem( &s_controlsmove_menu, ( void * )&s_move_run_action); Menu_AddItem( &s_controlsmove_menu, ( void * )&s_move_stepleft_action); Menu_AddItem( &s_controlsmove_menu, ( void * )&s_move_stepright_action); - Menu_AddItem( &s_controlsmove_menu, ( void * )&s_move_sidestep_action); + if ( controlsEngineConfig.supportMouseStrafe ) { + Menu_AddItem( &s_controlsmove_menu, ( void * )&s_move_sidestep_action); + } Menu_AddItem( &s_controlsmove_menu, ( void * )&s_move_moveup_action); Menu_AddItem( &s_controlsmove_menu, ( void * )&s_move_movedown_action); Menu_AddItem( &s_controlsmove_menu, ( void * )&s_attack_waiting_action); @@ -3245,6 +3294,8 @@ ControlsAttackLook_MenuInit */ static void ControlsAttackLook_MenuInit( void ) { + UI_InitControlsEngineConfig(); + s_controlslook_menu.nitems = 0; s_controlslook_menu.wrapAround = qtrue; s_controlslook_menu.draw = ControlsAttackLook_MenuDraw; @@ -3362,7 +3413,9 @@ static void ControlsAttackLook_MenuInit( void ) Menu_AddItem( &s_controlslook_menu, ( void * )&s_look_lookup_action); Menu_AddItem( &s_controlslook_menu, ( void * )&s_look_lookdown_action); - Menu_AddItem( &s_controlslook_menu, ( void * )&s_look_mouselook_action); + if ( controlsEngineConfig.supportFreeLook ) { + Menu_AddItem( &s_controlslook_menu, ( void * )&s_look_mouselook_action); + } Menu_AddItem( &s_controlslook_menu, ( void * )&s_look_centerview_action); Menu_AddItem( &s_controlslook_menu, ( void * )&s_zoomview_action); Menu_AddItem( &s_controlslook_menu, ( void * )&s_attack_waiting_action); @@ -3476,6 +3529,16 @@ void UI_ControlsMouseJoyStickMenu_Cache(void) s_joystick_mouse.mouse2 = trap_R_RegisterShaderNoMip(PIC_MOUSE2); } +/* +================= +Controls_RawMouseEvent +================= +*/ +static void Controls_RawMouseEvent (void* ptr, int event) +{ + VMExt_GVCommandInt( va( "cmd_set_raw_mouse %i", s_controls.rawmouse.curvalue ), 0 ); +} + /* ================= ControlsMouseJoyStick_MenuInit @@ -3485,6 +3548,8 @@ static void ControlsMouseJoyStick_MenuInit( void ) { int x,y; + UI_InitControlsEngineConfig(); + UI_ControlsMouseJoyStickMenu_Cache(); s_controlsmouse_menu.nitems = 0; @@ -3508,22 +3573,42 @@ static void ControlsMouseJoyStick_MenuInit( void ) s_controls_mouse.textcolor2 = CT_LTGOLD1; x = 250; - y = 193; - - s_controls.freelook.generic.type = MTYPE_SPINCONTROL; - s_controls.freelook.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_controls.freelook.generic.x = x; - s_controls.freelook.generic.y = y; - s_controls.freelook.generic.id = ID_FREELOOK; - s_controls.freelook.generic.callback = Controls_MenuEvent; - s_controls.freelook.textEnum = MBT_MOUSEFREELOOK; - s_controls.freelook.textcolor = CT_BLACK; - s_controls.freelook.textcolor2 = CT_WHITE; - s_controls.freelook.color = CT_DKPURPLE1; - s_controls.freelook.color2 = CT_LTPURPLE1; - s_controls.freelook.textX = MENU_BUTTON_TEXT_X; - s_controls.freelook.textY = MENU_BUTTON_TEXT_Y; - s_controls.freelook.listnames = s_OffOnNone_Names; + y = 171; + + if ( controlsEngineConfig.supportFreeLook ) { + y += 22; + s_controls.freelook.generic.type = MTYPE_SPINCONTROL; + s_controls.freelook.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_controls.freelook.generic.x = x; + s_controls.freelook.generic.y = y; + s_controls.freelook.generic.id = ID_FREELOOK; + s_controls.freelook.generic.callback = Controls_MenuEvent; + s_controls.freelook.textEnum = MBT_MOUSEFREELOOK; + s_controls.freelook.textcolor = CT_BLACK; + s_controls.freelook.textcolor2 = CT_WHITE; + s_controls.freelook.color = CT_DKPURPLE1; + s_controls.freelook.color2 = CT_LTPURPLE1; + s_controls.freelook.textX = MENU_BUTTON_TEXT_X; + s_controls.freelook.textY = MENU_BUTTON_TEXT_Y; + s_controls.freelook.listnames = s_OffOnNone_Names; + } + + if ( controlsEngineConfig.supportRawMouse ) { + y += 22; + s_controls.rawmouse.generic.type = MTYPE_SPINCONTROL; + s_controls.rawmouse.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_controls.rawmouse.generic.x = x; + s_controls.rawmouse.generic.y = y; + s_controls.rawmouse.generic.callback = Controls_RawMouseEvent; + s_controls.rawmouse.textEnum = MBT_CONTROLS_RAW_MOUSE; + s_controls.rawmouse.textcolor = CT_BLACK; + s_controls.rawmouse.textcolor2 = CT_WHITE; + s_controls.rawmouse.color = CT_DKPURPLE1; + s_controls.rawmouse.color2 = CT_LTPURPLE1; + s_controls.rawmouse.textX = MENU_BUTTON_TEXT_X; + s_controls.rawmouse.textY = MENU_BUTTON_TEXT_Y; + s_controls.rawmouse.listnames = s_OffOnNone_Names; + } y += 22; s_controls.sensitivity.generic.type = MTYPE_SLIDER; @@ -3690,7 +3775,12 @@ static void ControlsMouseJoyStick_MenuInit( void ) s_joyybutton_box.listnames = s_OffOnNone_Names; - Menu_AddItem( &s_controlsmouse_menu, ( void * )&s_controls.freelook); + if ( controlsEngineConfig.supportFreeLook ) { + Menu_AddItem( &s_controlsmouse_menu, ( void * )&s_controls.freelook); + } + if ( controlsEngineConfig.supportRawMouse ) { + Menu_AddItem( &s_controlsmouse_menu, ( void * )&s_controls.rawmouse); + } Menu_AddItem( &s_controlsmouse_menu, ( void * )&s_controls.sensitivity); Menu_AddItem( &s_controlsmouse_menu, ( void * )&s_controls.invertmouse); Menu_AddItem( &s_controlsmouse_menu, ( void * )&s_controls.smoothmouse); diff --git a/code/ui/ui_cvars.c b/code/ui/ui_cvars.c index 9b92dd6..6a41fc4 100644 --- a/code/ui/ui_cvars.c +++ b/code/ui/ui_cvars.c @@ -73,67 +73,6 @@ void GammaCallback( void *s, int notification ) } -/* -================= -IntensityCallback -================= -*/ -void IntensityCallback( void *s, int notification ) -{ - menuslider_s *slider = ( menuslider_s * ) s; - - if (notification != QM_ACTIVATED) - return; - - trap_Cvar_SetValue( "r_intensity", slider->curvalue / 10.0f ); -} - -/* -================= -FovCallback -================= -*/ -void FovCallback( void *s, int notification ) -{ - menuslider_s *slider = ( menuslider_s * ) s; - - if (notification != QM_ACTIVATED) - return; - - // Use asterisk notation to enable horizontal scaling. - trap_Cvar_Set( "cg_fov", va( "%f*", slider->curvalue ) ); -} - -/* -================= -ScreensizeCallback -================= -*/ -void ScreensizeCallback( void *s, int notification ) -{ - menuslider_s *slider = ( menuslider_s * ) s; - - if (notification != QM_ACTIVATED) - return; - - trap_Cvar_SetValue( "cg_viewsize", slider->curvalue); -} - -/* -================= -CenterHudCallback -================= -*/ -void CenterHudCallback( void *s, int notification ) -{ - menuslider_s *slider = ( menuslider_s * ) s; - - if (notification != QM_ACTIVATED) - return; - - trap_Cvar_SetValue( "cg_aspectCorrectCenterHud", slider->curvalue); -} - /* ================= AlwaysRunCallback @@ -165,42 +104,6 @@ void AutoswitchCallback( void *unused, int notification ) trap_Cvar_SetValue( "cg_autoswitch", s_autoswitch_box.curvalue ); } -void VideoData2_EnabledDisableCenterHudSlider( void ); -/* -================= -AspectCorrectionCallback -================= -*/ -void AspectCorrectionCallback( void *s, int notification ) -{ - menulist_s *aspectCorrection = ( menulist_s * ) s; - - if (notification != QM_ACTIVATED) - { - return; - } - - trap_Cvar_SetValue( "cg_aspectCorrect", aspectCorrection->curvalue ); - - VideoData2_EnabledDisableCenterHudSlider(); -} - -/* -================= -AnisotropicFilteringCallback -================= -*/ -void AnisotropicFilteringCallback( void *s, int notification ) -{ - menulist_s *anisotropicfiltering = ( menulist_s * ) s; - - if (notification != QM_ACTIVATED) - { - return; - } - - trap_Cvar_SetValue( "r_ext_texture_filter_anisotropic", anisotropicfiltering->curvalue ); -} /* ================= diff --git a/code/ui/ui_local.h b/code/ui/ui_local.h index bdd48fd..3738c5d 100644 --- a/code/ui/ui_local.h +++ b/code/ui/ui_local.h @@ -569,6 +569,17 @@ typedef enum MNT_BROWSER_MOD, MNT_BROWSER_BOTS, MNT_BROWSER_SCAN_PROGRESS, + MNT_VIDEO_LOW_QUALITY, + MNT_VIDEO_MEDIUM_QUALITY, + MNT_VIDEO_HIGHEST_QUALITY, + MNT_VIDEO_RENDERER_OPENGL1, + MNT_VIDEO_RENDERER_OPENGL2, + MNT_VIDEO_2X, + MNT_VIDEO_4X, + MNT_VIDEO_8X, + MNT_VIDEO_16X, + MNT_ALTSWAP_STANDARD, + MNT_ALTSWAP_SWAPPED, MNT_ALTSWAP_AUTO, MNT_ALTSWAP_CUSTOM, @@ -930,6 +941,18 @@ typedef enum MBT_ASPECTCORRECTION, MBT_CENTERHUD, MBT_BROWSER_PLAYERTYPE, + MBT_SOUND_OPENAL, + MBT_SOUND_OVERALL_VOLUME, + MBT_CONTROLS_RAW_MOUSE, + MBT_VIDEO_LIGHTING_LEVEL, + MBT_VIDEO_LIGHTING_CONTRAST, + MBT_VIDEO_LIGHTING_APPLY, + MBT_VIDEO_LIGHTING_RESET, + MBT_VIDEO_RENDERER, + MBT_VIDEO_WINDOW_SIZE, + MBT_VIDEO_ANISOTROPIC_LEVEL, + MBT_VIDEO_ANTI_ALIASING, + MBT_VIDEO_VERTICAL_SYNC, MBT_ALTSWAP_CONTROL, MBT_ALTSWAP_EDIT, MBT_ALTSWAP_ALL_STANDARD, @@ -1849,14 +1872,6 @@ void UI_SoundMenu_Cache(void); // void UI_FontsMenu( void); -// -// ui_cvars.c -// -extern void GammaCallback( void *s, int notification ); -extern void FovCallback( void *s, int notification ); -extern void ScreensizeCallback( void *s, int notification ); -void CenterHudCallback( void *s, int notification ); - // // ui_network.c // @@ -1914,8 +1929,7 @@ void UI_PrintMenuGraphics(menugraphics_s *menuGraphics,int maxI); extern void InvertMouseCallback(void *s, int notification); extern void MouseSpeedCallback( void *s, int notification ); extern void SmoothMouseCallback( void *s, int notification ); -extern void AspectCorrectionCallback( void *s, int notification ); -extern void AnisotropicFilteringCallback( void *s, int notification ); +extern void GammaCallback( void *s, int notification ); extern void JoyXButtonCallback( void *s, int notification ); extern void JoyYButtonCallback( void *s, int notification ); diff --git a/code/ui/ui_main.c b/code/ui/ui_main.c index 4b1a5a2..43715fb 100644 --- a/code/ui/ui_main.c +++ b/code/ui/ui_main.c @@ -141,6 +141,7 @@ vmCvar_t ui_browserPlayerType; vmCvar_t ui_drawCrosshair; vmCvar_t ui_drawCrosshairNames; vmCvar_t ui_marks; +vmCvar_t ui_fov; vmCvar_t ui_server1; vmCvar_t ui_server2; @@ -227,6 +228,7 @@ cvarTable_t cvarTable[] = { { &ui_drawCrosshair, "cg_drawCrosshair", "1", CVAR_ARCHIVE }, { &ui_drawCrosshairNames, "cg_drawCrosshairNames", "1", CVAR_ARCHIVE }, { &ui_marks, "cg_marks", "1", CVAR_ARCHIVE }, + { &ui_fov, "cg_fov", "80", CVAR_ARCHIVE }, { &ui_server1, "server1", "", CVAR_ARCHIVE }, { &ui_server2, "server2", "", CVAR_ARCHIVE }, diff --git a/code/ui/ui_preferences.c b/code/ui/ui_preferences.c index 153bde6..e3b92c4 100644 --- a/code/ui/ui_preferences.c +++ b/code/ui/ui_preferences.c @@ -15,6 +15,9 @@ GAME OPTIONS MENU #define NUM_CROSSHAIRS 12 #define PIC_BUTTON2 "menu/common/full_button2.tga" +#define CROSSHAIR_X 450 // originally 438 +#define CROSSHAIR_Y 230 // originally 270 + // Precache stuff for Game Options Menu static struct { @@ -36,25 +39,11 @@ static struct extern int s_OffOnNone_Names[]; -#define ID_LIGHTFLARES 129 -#define ID_LIGHTFLARES_VALUE 130 -#define ID_WALLMARKS_VALUE 133 -#define ID_DYNAMICLIGHTS_VALUE 135 -#define ID_IDENTIFYTARGET_VALUE 137 -#define ID_SYNCEVERYFRAME_VALUE 139 - - -#define PREFERENCES_X_POS 360 - #define ID_TEXTLANGUAGE 126 #define ID_CROSSHAIR 127 -#define ID_SIMPLEITEMS 128 #define ID_HIGHQUALITYSKY 129 #define ID_EJECTINGBRASS 130 -#define ID_WALLMARKS 131 -#define ID_DYNAMICLIGHTS 132 #define ID_IDENTIFYTARGET 133 -#define ID_SYNCEVERYFRAME 134 #define ID_FORCEMODEL 135 #define ID_DRAWTEAMOVERLAY 136 #define ID_ALLOWDOWNLOAD 137 @@ -69,15 +58,10 @@ typedef struct { menubitmap_s crosshair; menulist_s textlanguage; menulist_s voicelanguage; - menulist_s simpleitems; - menulist_s wallmarks; - menulist_s dynamiclights; menulist_s identifytarget; - menulist_s synceveryframe; menulist_s forcemodel; menulist_s drawteamoverlay; menulist_s allowdownload; - menulist_s flares; int currentcrosshair; qhandle_t crosshairShader[NUM_CROSSHAIRS]; @@ -115,18 +99,12 @@ static void Preferences_SetMenuItems( void ) int *language; s_preferences.currentcrosshair = (int)trap_Cvar_VariableValue( "cg_drawCrosshair" ) % NUM_CROSSHAIRS; - s_preferences.simpleitems.curvalue = trap_Cvar_VariableValue( "cg_simpleItems" ) != 0; - s_preferences.wallmarks.curvalue = trap_Cvar_VariableValue( "cg_marks" ) != 0; s_preferences.identifytarget.curvalue = trap_Cvar_VariableValue( "cg_drawCrosshairNames" ) != 0; - s_preferences.dynamiclights.curvalue = trap_Cvar_VariableValue( "r_dynamiclight" ) != 0; // s_preferences.highqualitysky.curvalue = trap_Cvar_VariableValue ( "r_fastsky" ) == 0; - s_preferences.synceveryframe.curvalue = trap_Cvar_VariableValue( "r_finish" ) != 0; s_preferences.forcemodel.curvalue = trap_Cvar_VariableValue( "cg_forcemodel" ) != 0; s_preferences.drawteamoverlay.curvalue = Com_Clamp( 0, 3, trap_Cvar_VariableValue( "cg_drawTeamOverlay" ) ); s_preferences.allowdownload.curvalue = trap_Cvar_VariableValue( "cl_allowDownload" ) != 0; - s_preferences.flares.curvalue = Com_Clamp( 0, 1, trap_Cvar_VariableValue( "r_flares" )); - trap_Cvar_VariableStringBuffer( "g_language", buffer, 32 ); language = s_textlanguage_Names; @@ -194,30 +172,10 @@ static void Preferences_Event( void* ptr, int notification ) } break; - case ID_SIMPLEITEMS: - trap_Cvar_SetValue( "cg_simpleItems", s_preferences.simpleitems.curvalue ); - break; - - case ID_LIGHTFLARES: - trap_Cvar_SetValue( "r_flares", s_preferences.flares.curvalue ); - break; - - case ID_WALLMARKS: - trap_Cvar_SetValue( "cg_marks", s_preferences.wallmarks.curvalue ); - break; - - case ID_DYNAMICLIGHTS: - trap_Cvar_SetValue( "r_dynamiclight", s_preferences.dynamiclights.curvalue ); - break; - case ID_IDENTIFYTARGET: trap_Cvar_SetValue( "cg_drawCrosshairNames", s_preferences.identifytarget.curvalue ); break; - case ID_SYNCEVERYFRAME: - trap_Cvar_SetValue( "r_finish", s_preferences.synceveryframe.curvalue ); - break; - case ID_FORCEMODEL: trap_Cvar_SetValue( "cg_forcemodel", s_preferences.forcemodel.curvalue ); break; @@ -306,7 +264,6 @@ GameOptions_MenuDraw */ static void GameOptions_MenuDraw( void ) { - int x; qhandle_t hShader; hShader = VMExt_GVCommandInt( "crosshair_get_current_shader", -1 ); @@ -334,25 +291,24 @@ static void GameOptions_MenuDraw( void ) UI_DrawHandlePic( 104, 408, 436, 12, uis.whiteShader); // Bottom */ trap_R_SetColor( colorTable[CT_DKBLUE1]); - UI_DrawHandlePic(387, 245, 8, 87, uis.whiteShader); // Lefthand side of CROSSHAIR box - UI_DrawHandlePic(513, 245, 8, 87, uis.whiteShader); // Righthand side of CROSSHAIR box - UI_DrawHandlePic(395, 335, 116, 3, uis.whiteShader); // Bottom of CROSSHAIR box - UI_DrawHandlePic( 387, 332, 16, 16,s_gameoptions.lswoop); // lower left hand swoop - UI_DrawHandlePic( 510, 332, 16, 16,s_gameoptions.lswoop2); // lower right hand swoop + UI_DrawHandlePic( CROSSHAIR_X - 51, CROSSHAIR_Y - 25, 8, 87, uis.whiteShader); // Lefthand side of CROSSHAIR box + UI_DrawHandlePic( CROSSHAIR_X + 75, CROSSHAIR_Y - 25, 8, 87, uis.whiteShader); // Righthand side of CROSSHAIR box + UI_DrawHandlePic( CROSSHAIR_X - 43, CROSSHAIR_Y + 65, 116, 3, uis.whiteShader); // Bottom of CROSSHAIR box + UI_DrawHandlePic( CROSSHAIR_X - 51, CROSSHAIR_Y + 62, 16, 16,s_gameoptions.lswoop); // lower left hand swoop + UI_DrawHandlePic( CROSSHAIR_X + 72, CROSSHAIR_Y + 62, 16, 16,s_gameoptions.lswoop2); // lower right hand swoop - UI_DrawHandlePic( 387, 224, 16, 32, s_gameoptions.tallswoop); // upper left hand swoop - UI_DrawHandlePic( 507, 224, 16, 32, s_gameoptions.tallswoop2); // upper right hand swoop + UI_DrawHandlePic( CROSSHAIR_X - 51, CROSSHAIR_Y - 46, 16, 32, s_gameoptions.tallswoop); // upper left hand swoop + UI_DrawHandlePic( CROSSHAIR_X + 69, CROSSHAIR_Y - 46, 16, 32, s_gameoptions.tallswoop2); // upper right hand swoop trap_R_SetColor( colorTable[CT_YELLOW]); - x = 438; if (hShader) { - UI_DrawHandlePic(x,270, 32, 32, hShader); // Draw crosshair + UI_DrawHandlePic(CROSSHAIR_X, CROSSHAIR_Y, 32, 32, hShader); // Draw crosshair } else { - UI_DrawProportionalString( 454, 275, menu_normal_text[MNT_CROSSHAIR_NONE],UI_CENTER|UI_SMALLFONT, colorTable[CT_LTGOLD1]); // No crosshair + UI_DrawProportionalString( CROSSHAIR_X + 16, CROSSHAIR_Y + 5, menu_normal_text[MNT_CROSSHAIR_NONE],UI_CENTER|UI_SMALLFONT, colorTable[CT_LTGOLD1]); // No crosshair } // Menu frame numbers @@ -437,57 +393,6 @@ static void GameOptions_MenuInit( void ) y = 170; width = 170; - s_preferences.flares.generic.type = MTYPE_SPINCONTROL; - s_preferences.flares.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_preferences.flares.generic.x = x; - s_preferences.flares.generic.y = y; - s_preferences.flares.generic.callback = Preferences_Event; - s_preferences.flares.generic.id = ID_LIGHTFLARES; - s_preferences.flares.textEnum = MBT_LIGHTFLARES; - s_preferences.flares.textcolor = CT_BLACK; - s_preferences.flares.textcolor2 = CT_WHITE; - s_preferences.flares.color = CT_DKPURPLE1; - s_preferences.flares.color2 = CT_LTPURPLE1; - s_preferences.flares.textX = MENU_BUTTON_TEXT_X; - s_preferences.flares.textY = MENU_BUTTON_TEXT_Y; - s_preferences.flares.listnames = s_OffOnNone_Names; - s_preferences.flares.width = width; - - y += inc; - s_preferences.wallmarks.generic.type = MTYPE_SPINCONTROL; - s_preferences.wallmarks.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_preferences.wallmarks.generic.x = x; - s_preferences.wallmarks.generic.y = y; - s_preferences.wallmarks.generic.callback = Preferences_Event; - s_preferences.wallmarks.generic.id = ID_WALLMARKS; - s_preferences.wallmarks.textEnum = MBT_WALLMARKS1; - s_preferences.wallmarks.textcolor = CT_BLACK; - s_preferences.wallmarks.textcolor2 = CT_WHITE; - s_preferences.wallmarks.color = CT_DKPURPLE1; - s_preferences.wallmarks.color2 = CT_LTPURPLE1; - s_preferences.wallmarks.textX = MENU_BUTTON_TEXT_X; - s_preferences.wallmarks.textY = MENU_BUTTON_TEXT_Y; - s_preferences.wallmarks.listnames = s_OffOnNone_Names; - s_preferences.wallmarks.width = width; - - y += inc; - s_preferences.dynamiclights.generic.type = MTYPE_SPINCONTROL; - s_preferences.dynamiclights.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_preferences.dynamiclights.generic.x = x; - s_preferences.dynamiclights.generic.y = y; - s_preferences.dynamiclights.generic.callback = Preferences_Event; - s_preferences.dynamiclights.generic.id = ID_DYNAMICLIGHTS; - s_preferences.dynamiclights.textEnum = MBT_DYNAMICLIGHTS1; - s_preferences.dynamiclights.textcolor = CT_BLACK; - s_preferences.dynamiclights.textcolor2 = CT_WHITE; - s_preferences.dynamiclights.color = CT_DKPURPLE1; - s_preferences.dynamiclights.color2 = CT_LTPURPLE1; - s_preferences.dynamiclights.textX = MENU_BUTTON_TEXT_X; - s_preferences.dynamiclights.textY = MENU_BUTTON_TEXT_Y; - s_preferences.dynamiclights.listnames = s_OffOnNone_Names; - s_preferences.dynamiclights.width = width; - - y += inc; s_preferences.identifytarget.generic.type = MTYPE_SPINCONTROL; s_preferences.identifytarget.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; s_preferences.identifytarget.generic.x = x; @@ -504,23 +409,6 @@ static void GameOptions_MenuInit( void ) s_preferences.identifytarget.listnames = s_OffOnNone_Names; s_preferences.identifytarget.width = width; - y += inc; - s_preferences.synceveryframe.generic.type = MTYPE_SPINCONTROL; - s_preferences.synceveryframe.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_preferences.synceveryframe.generic.x = x; - s_preferences.synceveryframe.generic.y = y; - s_preferences.synceveryframe.generic.callback = Preferences_Event; - s_preferences.synceveryframe.generic.id = ID_SYNCEVERYFRAME; - s_preferences.synceveryframe.textEnum = MBT_SYNCEVERYFRAME1; - s_preferences.synceveryframe.textcolor = CT_BLACK; - s_preferences.synceveryframe.textcolor2 = CT_WHITE; - s_preferences.synceveryframe.color = CT_DKPURPLE1; - s_preferences.synceveryframe.color2 = CT_LTPURPLE1; - s_preferences.synceveryframe.textX = MENU_BUTTON_TEXT_X; - s_preferences.synceveryframe.textY = MENU_BUTTON_TEXT_Y; - s_preferences.synceveryframe.listnames = s_OffOnNone_Names; - s_preferences.synceveryframe.width = width; - y += inc; s_preferences.forcemodel.generic.type = MTYPE_SPINCONTROL; s_preferences.forcemodel.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; @@ -572,23 +460,6 @@ static void GameOptions_MenuInit( void ) s_preferences.allowdownload.listnames = s_OffOnNone_Names; s_preferences.allowdownload.width = width; - y += inc; - s_preferences.simpleitems.generic.type = MTYPE_SPINCONTROL; - s_preferences.simpleitems.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_preferences.simpleitems.generic.x = x; - s_preferences.simpleitems.generic.y = y; - s_preferences.simpleitems.generic.callback = Preferences_Event; - s_preferences.simpleitems.generic.id = ID_SIMPLEITEMS; - s_preferences.simpleitems.textEnum = MBT_SIMPLEITEMS; - s_preferences.simpleitems.textcolor = CT_BLACK; - s_preferences.simpleitems.textcolor2 = CT_WHITE; - s_preferences.simpleitems.color = CT_DKPURPLE1; - s_preferences.simpleitems.color2 = CT_LTPURPLE1; - s_preferences.simpleitems.textX = MENU_BUTTON_TEXT_X; - s_preferences.simpleitems.textY = MENU_BUTTON_TEXT_Y; - s_preferences.simpleitems.listnames = s_OffOnNone_Names; - s_preferences.simpleitems.width = width; - y += inc; s_preferences.textlanguage.generic.type = MTYPE_SPINCONTROL; s_preferences.textlanguage.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; @@ -627,8 +498,8 @@ static void GameOptions_MenuInit( void ) s_preferences.crosshair.generic.type = MTYPE_BITMAP; s_preferences.crosshair.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_preferences.crosshair.generic.x = 404; - s_preferences.crosshair.generic.y = 224; + s_preferences.crosshair.generic.x = CROSSHAIR_X - 34; + s_preferences.crosshair.generic.y = CROSSHAIR_Y - 46; s_preferences.crosshair.generic.name = PIC_BUTTON2; s_preferences.crosshair.generic.id = ID_CROSSHAIR; s_preferences.crosshair.generic.callback = Preferences_Event; @@ -642,15 +513,10 @@ static void GameOptions_MenuInit( void ) s_preferences.crosshair.textcolor = CT_BLACK; s_preferences.crosshair.textcolor2 = CT_WHITE; - Menu_AddItem( &s_gameoptions.menu, &s_preferences.flares ); - Menu_AddItem( &s_gameoptions.menu, &s_preferences.wallmarks ); - Menu_AddItem( &s_gameoptions.menu, &s_preferences.dynamiclights ); Menu_AddItem( &s_gameoptions.menu, &s_preferences.identifytarget ); - Menu_AddItem( &s_gameoptions.menu, &s_preferences.synceveryframe ); Menu_AddItem( &s_gameoptions.menu, &s_preferences.forcemodel ); Menu_AddItem( &s_gameoptions.menu, &s_preferences.drawteamoverlay ); Menu_AddItem( &s_gameoptions.menu, &s_preferences.allowdownload ); - Menu_AddItem( &s_gameoptions.menu, &s_preferences.simpleitems ); Menu_AddItem( &s_gameoptions.menu, &s_preferences.textlanguage ); Menu_AddItem( &s_gameoptions.menu, &s_preferences.voicelanguage ); Menu_AddItem( &s_gameoptions.menu, &s_preferences.crosshair); diff --git a/code/ui/ui_sound.c b/code/ui/ui_sound.c index 0d41040..21fd141 100644 --- a/code/ui/ui_sound.c +++ b/code/ui/ui_sound.c @@ -2,6 +2,63 @@ // #include "ui_local.h" +typedef struct { + qboolean initialized; + qboolean global_s_volume; + qboolean support_s_khz; + qboolean support_a3d; + qboolean supportOpenAL; +} soundEngineConfig_t; + +static soundEngineConfig_t soundEngineConfig; + +/* +================= +UI_InitSoundEngineConfig + +Load settings in the soundEngineConfig structure. +================= +*/ +static void UI_InitSoundEngineConfig( void ) { + if ( !soundEngineConfig.initialized ) { + soundEngineConfig.initialized = qtrue; + soundEngineConfig.global_s_volume = VMExt_GVCommandInt( "ui_using_global_s_volume", 0 ) ? qtrue : qfalse; + soundEngineConfig.support_s_khz = !VMExt_GVCommandInt( "ui_skip_s_khz", 0 ) ? qtrue : qfalse; + + // determine if a3d is supported + { + int result = VMExt_GVCommandInt( "ui_no_a3d", -1 ); + if ( result == -1 ) { + // try to estimate support by testing whether cvar is non-empty + char buffer[256]; + trap_Cvar_VariableStringBuffer( "s_usingA3D", buffer, sizeof( buffer ) ); + if ( !*buffer ) { + result = 1; + } + } + if ( result <= 0 ) { + soundEngineConfig.support_a3d = qtrue; + } + } + + // only look for openAL support if there is no a3d support, because currently no client + // supports both and the way the menu is currently set up there is only space for one button + if ( !soundEngineConfig.support_a3d ) { + int result = VMExt_GVCommandInt( "ui_support_s_useOpenAL", -1 ); + if ( result == -1 ) { + // try to estimate support by testing whether cvar is non-empty + char buffer[256]; + trap_Cvar_VariableStringBuffer( "s_useOpenAL", buffer, sizeof( buffer ) ); + if ( *buffer ) { + result = 1; + } + } + if ( result > 0 ) { + soundEngineConfig.supportOpenAL = qtrue; + } + } + } +} extern int rate_items[]; @@ -11,6 +68,7 @@ extern int rate_items[]; #define ID_QUALITY 16 #define ID_A3D 17 #define ID_RATE 18 +#define ID_OPENAL 19 static int s_sndquality_Names[] = { @@ -44,6 +102,7 @@ typedef struct menuslider_s musicvolume; menulist_s quality; menulist_s a3d; + menulist_s openAL; menubitmap_s back; int holdSoundQuality; @@ -145,6 +204,11 @@ static void UI_SoundOptionsMenu_Event( void* ptr, int event ) soundOptionsInfo.a3d.curvalue = holdCurvalue; break; + + case ID_OPENAL: + trap_Cvar_Set( "s_useOpenAL", soundOptionsInfo.openAL.curvalue ? "1" : "0" ); + trap_Cmd_ExecuteText( EXEC_APPEND, "snd_restart\n" ); + break; } } @@ -266,6 +330,8 @@ void SoundMenu_Init(void) int x,y; int rate; + UI_InitSoundEngineConfig(); + UI_SoundMenu_Cache(); soundOptionsInfo.menu.nitems = 0; @@ -318,7 +384,7 @@ void SoundMenu_Init(void) soundOptionsInfo.sfxvolume.picY = y; soundOptionsInfo.sfxvolume.picWidth = MENU_BUTTON_MED_WIDTH; soundOptionsInfo.sfxvolume.picHeight = MENU_BUTTON_MED_HEIGHT; - soundOptionsInfo.sfxvolume.textEnum = MBT_EFFECTSVOLUME; + soundOptionsInfo.sfxvolume.textEnum = soundEngineConfig.global_s_volume ? MBT_SOUND_OVERALL_VOLUME : MBT_EFFECTSVOLUME; soundOptionsInfo.sfxvolume.textX = 5; soundOptionsInfo.sfxvolume.textY = 1; soundOptionsInfo.sfxvolume.textcolor = CT_BLACK; @@ -393,19 +459,49 @@ void SoundMenu_Init(void) soundOptionsInfo.a3d.textY = 2; soundOptionsInfo.a3d.listnames = s_OffOnNone_Names; + soundOptionsInfo.openAL.generic.type = MTYPE_SPINCONTROL; + soundOptionsInfo.openAL.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + soundOptionsInfo.openAL.generic.x = soundEngineConfig.support_s_khz ? 416 : 120; + soundOptionsInfo.openAL.generic.y = 322; + soundOptionsInfo.openAL.generic.callback = UI_SoundOptionsMenu_Event; + soundOptionsInfo.openAL.generic.id = ID_OPENAL; + soundOptionsInfo.openAL.textEnum = MBT_SOUND_OPENAL; + soundOptionsInfo.openAL.textcolor = CT_BLACK; + soundOptionsInfo.openAL.textcolor2 = CT_WHITE; + soundOptionsInfo.openAL.color = CT_DKPURPLE1; + soundOptionsInfo.openAL.color2 = CT_LTPURPLE1; + soundOptionsInfo.openAL.textX = 5; + soundOptionsInfo.openAL.textY = 2; + soundOptionsInfo.openAL.listnames = s_OffOnNone_Names; + SetupMenu_TopButtons(&soundOptionsInfo.menu,MENU_SOUND,NULL); Menu_AddItem( &soundOptionsInfo.menu, ( void * )&soundOptionsInfo.rate ); Menu_AddItem( &soundOptionsInfo.menu, ( void * )&soundOptionsInfo.sfxvolume); Menu_AddItem( &soundOptionsInfo.menu, ( void * )&soundOptionsInfo.musicvolume); - Menu_AddItem( &soundOptionsInfo.menu, ( void * )&soundOptionsInfo.quality); - Menu_AddItem( &soundOptionsInfo.menu, ( void * )&soundOptionsInfo.a3d); + if ( soundEngineConfig.support_s_khz ) { + Menu_AddItem( &soundOptionsInfo.menu, ( void * )&soundOptionsInfo.quality); + } + if ( soundEngineConfig.support_a3d ) { + Menu_AddItem( &soundOptionsInfo.menu, ( void * )&soundOptionsInfo.a3d); + } + if ( soundEngineConfig.supportOpenAL ) { + // Currently this is just a basic enable/disable toggle, not the full device + // selection capability from the original ioEF implementation. Hopefully this + // will correctly use the default device and be adequate for now. + Menu_AddItem( &soundOptionsInfo.menu, ( void * )&soundOptionsInfo.openAL); + } soundOptionsInfo.sfxvolume.curvalue = trap_Cvar_VariableValue( "s_volume" ) * 10; soundOptionsInfo.musicvolume.curvalue = trap_Cvar_VariableValue( "s_musicvolume" ) * 10; soundOptionsInfo.quality.curvalue = trap_Cvar_VariableValue( "s_khz" ) != 11; soundOptionsInfo.holdSoundQuality = soundOptionsInfo.quality.curvalue; - soundOptionsInfo.a3d.curvalue = (int)trap_Cvar_VariableValue( "s_usingA3D" ); + if ( soundEngineConfig.support_a3d ) { + soundOptionsInfo.a3d.curvalue = trap_Cvar_VariableValue( "s_usingA3D" ) ? 1 : 0; + } + if ( soundEngineConfig.supportOpenAL ) { + soundOptionsInfo.openAL.curvalue = trap_Cvar_VariableValue( "s_useOpenAL" ) ? 1 : 0; + } soundOptionsInfo.menu.initialized = qtrue; diff --git a/code/ui/ui_video.c b/code/ui/ui_video.c index 5f2d96a..c3563a8 100644 --- a/code/ui/ui_video.c +++ b/code/ui/ui_video.c @@ -2,6 +2,152 @@ // #include "ui_local.h" +typedef struct { + qboolean initialized; + + // r_mode cvar only applies to windowed mode, not fullscreen + qboolean windowed_r_mode; + + // use updated template set + qboolean modern_templates; + + // if enabled, anisotropic filtering option is in video menu, otherwise in video additional + // this is needed because their sometimes isn't space in video menu... + qboolean anisotropicFilteringVideoMenu; + + // normally enabled options, but can be disabled by engine + qboolean supportGlDriver; + qboolean supportAllowExtensions; + qboolean supportColorDepth; + qboolean supportTextureBits; + qboolean supportSimpleShaders; + + // new additional options + qboolean supportRendererSelect; + qboolean supportMultisample; + qboolean supportVSync; + qboolean supportMaxAnisotropy; +} videoEngineConfig_t; + +static videoEngineConfig_t videoEngineConfig; + +/* +================= +UI_InitVideoEngineConfig + +Load settings in the videoEngineConfig structure. +================= +*/ +static void UI_InitVideoEngineConfig( void ) { + if ( !videoEngineConfig.initialized ) { + int freeSlots = 0; + + videoEngineConfig.initialized = qtrue; + videoEngineConfig.windowed_r_mode = VMExt_GVCommandInt( "ui_using_windowed_r_mode", 0 ) ? qtrue : qfalse; + videoEngineConfig.modern_templates = VMExt_GVCommandInt( "ui_modern_video_templates", 0 ) ? qtrue : qfalse; + videoEngineConfig.supportMaxAnisotropy = VMExt_GVCommandInt( "ui_support_r_ext_max_anisotropy", 0 ) ? qtrue : qfalse; + + if ( !VMExt_GVCommandInt( "ui_skip_r_glDriver", 0 ) ) { + videoEngineConfig.supportGlDriver = qtrue; + } else { + ++freeSlots; + } + + if ( !VMExt_GVCommandInt( "ui_skip_r_allowExtensions", 0 ) ) { + videoEngineConfig.supportAllowExtensions = qtrue; + } else { + ++freeSlots; + } + + if ( !( VMExt_GVCommandInt( "ui_skip_r_colorbits", 0 ) && VMExt_GVCommandInt( "ui_skip_r_depthbits", 0 ) && + VMExt_GVCommandInt( "ui_skip_r_stencilbits", 0 ) ) ) { + videoEngineConfig.supportColorDepth = qtrue; + } else { + ++freeSlots; + } + + if ( !VMExt_GVCommandInt( "ui_skip_r_texturebits", 0 ) ) { + videoEngineConfig.supportTextureBits = qtrue; + } else { + ++freeSlots; + } + + if ( !VMExt_GVCommandInt( "ui_skip_r_lowEndVideo", 0 ) ) { + videoEngineConfig.supportSimpleShaders = qtrue; + } else { + ++freeSlots; + } + + if ( freeSlots > 0 && VMExt_GVCommandInt( "ui_support_cl_renderer_opengl1", 0 ) && + VMExt_GVCommandInt( "ui_support_cl_renderer_opengl2", 0 ) ) { + videoEngineConfig.supportRendererSelect = qtrue; + --freeSlots; + } + + if ( freeSlots > 0 && VMExt_GVCommandInt( "ui_support_cmd_set_multisample", 0 ) && + VMExt_GVCommandInt( "ui_support_cmd_get_multisample", 0 ) ) { + videoEngineConfig.supportMultisample = qtrue; + --freeSlots; + } + + if ( freeSlots > 0 && VMExt_GVCommandInt( "ui_support_r_swapInterval", 0 ) ) { + videoEngineConfig.supportVSync = qtrue; + --freeSlots; + } + + if ( freeSlots > 0 ) { + videoEngineConfig.anisotropicFilteringVideoMenu = qtrue; + --freeSlots; + } + } +} + +/* +================= +UI_SetAnisotropyLevel + +Sets anisotropic filtering level on scale from 0 (disabled) to 4 (16x). + +UI_InitVideoEngineConfig should already be called. +================= +*/ +static void UI_SetAnisotropyLevel( int level ) { + if ( level > 0 ) { + trap_Cvar_Set( "r_ext_texture_filter_anisotropic", "1" ); + if ( videoEngineConfig.supportMaxAnisotropy ) { + trap_Cvar_Set( "r_ext_max_anisotropy", va( "%i", 1 << level ) ); + } + } else { + trap_Cvar_Set( "r_ext_texture_filter_anisotropic", "0" ); + } +} + +/* +================= +UI_GetAnisotropyLevel + +Retrieves current anisotropic filtering level on scale from 0 (disabled) to 4 (16x), +or from 0 (disabled) to 1 (enabled) if videoEngineConfig.supportMaxAnisotropy is false. + +UI_InitVideoEngineConfig should already be called. +================= +*/ +static int UI_GetAnisotropyLevel( void ) { + if ( trap_Cvar_VariableValue( "r_ext_texture_filter_anisotropic" ) ) { + if ( videoEngineConfig.supportMaxAnisotropy ) { + float level = trap_Cvar_VariableValue( "r_ext_max_anisotropy" ); + if ( level >= 16.0f ) + return 4; + else if ( level >= 8.0f ) + return 3; + else if ( level >= 4.0f ) + return 2; + } + return 1; + } + + return 0; +} void UI_VideoDriverMenu( void ); void VideoDriver_Lines(int increment); @@ -45,23 +191,26 @@ typedef struct { menuframework_s menu; - menuslider_s gamma_slider; + menulist_s aspectCorrection; + menuslider_s centerHud_slider; menuslider_s fov_slider; menuslider_s screensize_slider; - menuslider_s centerHud_slider; - menulist_s aspectCorrection; - menulist_s anisotropicfiltering; - menuaction_s apply_action2; + menulist_s flares; + menulist_s wallmarks; + menulist_s dynamiclights; + menulist_s simpleitems; + menulist_s synceveryframe; + menulist_s anisotropic; - qhandle_t gamma; qhandle_t top; } videodata2_t; static videodata2_t s_videodata2; +#define NUM_VIDEO_TEMPLATES 4 -static int s_graphics_options_Names[] = +static int s_graphics_options_Names[NUM_VIDEO_TEMPLATES + 2] = { MNT_VIDEO_HIGH_QUALITY, MNT_VIDEO_NORMAL, @@ -71,6 +220,16 @@ static int s_graphics_options_Names[] = MNT_NONE }; +static int s_graphics_options_modern_Names[NUM_VIDEO_TEMPLATES + 2] = +{ + MNT_VIDEO_LOW_QUALITY, + MNT_VIDEO_MEDIUM_QUALITY, + MNT_VIDEO_HIGH_QUALITY, + MNT_VIDEO_HIGHEST_QUALITY, + MNT_VIDEO_CUSTOM, + MNT_NONE +}; + static int s_driver_Names[] = { MNT_VIDEO_DRIVER_DEFAULT, @@ -78,6 +237,21 @@ static int s_driver_Names[] = MNT_NONE }; +static int s_renderer_Names[] = +{ + MNT_VIDEO_RENDERER_OPENGL1, + MNT_VIDEO_RENDERER_OPENGL2, + MNT_NONE +}; + +static int s_renderer_NamesUnknown[] = +{ + MNT_VIDEO_RENDERER_OPENGL1, + MNT_VIDEO_RENDERER_OPENGL2, + MNT_VIDEO_CUSTOM, + MNT_NONE +}; + extern int s_OffOnNone_Names[]; static int s_resolutions[] = @@ -94,9 +268,12 @@ static int s_resolutions[] = MNT_1600X1200, MNT_2048X1536, MNT_856x480WIDE, + MNT_VIDEO_CUSTOM, MNT_NONE }; +#define NUM_RESOLUTIONS ( ( sizeof ( s_resolutions ) / sizeof ( *s_resolutions ) ) - 2 ) + static int s_colordepth_Names[] = { MNT_DEFAULT, @@ -144,11 +321,29 @@ static int s_filter_Names[] = MNT_NONE }; +static int s_anisotropic_Names[] = +{ + MNT_OFF, + MNT_VIDEO_2X, + MNT_VIDEO_4X, + MNT_VIDEO_8X, + MNT_VIDEO_16X, + MNT_NONE +}; + +static int s_multisample_Names[] = +{ + MNT_OFF, + MNT_VIDEO_2X, + MNT_VIDEO_4X, + MNT_NONE +}; static menubitmap_s s_video_drivers; static menubitmap_s s_video_data; static menubitmap_s s_video_data2; +static menubitmap_s s_video_brightness; #define ID_MAINMENU 100 #define ID_CONTROLS 101 @@ -162,6 +357,7 @@ static menubitmap_s s_video_data2; #define ID_ARROWDWN 113 #define ID_ARROWUP 114 #define ID_INGAMEMENU 115 +#define ID_VIDEOBRIGHTNESS 116 // Precache stuff for Video Driver #define MAX_VID_DRIVERS 128 @@ -239,17 +435,468 @@ static void* g_videolines[] = NULL, }; -int video_sidebuttons[3][2] = +int video_sidebuttons[4][2] = { - 30, 250, // Video Data Button - 30, 250 + 6 + (MENU_BUTTON_MED_HEIGHT * 1.5), // Video Drivers Button - 30, 250 + (2 * (6 + (MENU_BUTTON_MED_HEIGHT * 1.5))), // Video Drivers Button + 30, 240, // Video Data Button + 30, 240 + 6 + 24, // Brightness Button + 30, 240 + (2 * (6 + 24)), // Additional Button + 30, 240 + (3 * (6 + 24)), // Video Drivers Button }; void Video_SideButtons(menuframework_s *menu,int menuType); static void GraphicsOptions_ApplyChanges( void *unused, int notification ); + +/* +======================================================================= + +BRIGHTNESS MENU + +======================================================================= +*/ + +struct +{ + menuframework_s menu; + qboolean supportMapLightingOptions; + + menuslider_s gamma_slider; + menuaction_s gamma_apply; + + qboolean defaults_active; // current running settings equal defaults + menuslider_s lighting_gamma_slider; + menuslider_s lighting_overbright_slider; + menubitmap_s lighting_reset; + menuaction_s lighting_apply; + + qhandle_t gamma; + qhandle_t top; +} s_brightness; + +/* +================= +UI_BrightnessMenu_MenuDraw +================= +*/ +static void UI_BrightnessMenu_MenuDraw (void) +{ + int y; + + UI_MenuFrame(&s_brightness.menu); + + UI_DrawProportionalString( 74, 66, "815",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString( 74, 84, "9047",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString( 74, 188, "1596",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString( 74, 206, "7088",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString( 74, 395, "2-9831",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); + + UI_Setup_MenuButtons(); + + y = 191; + if ( s_brightness.supportMapLightingOptions ) + { + y -= 10; + } + if (uis.glconfig.deviceSupportsGamma) + { + trap_R_SetColor( colorTable[CT_DKGREY]); + UI_DrawHandlePic( 178, y, 68, 68, uis.whiteShader); // + trap_R_SetColor( colorTable[CT_WHITE]); + UI_DrawHandlePic( 180, y+2, 64, 64, s_brightness.gamma); // Starfleet graphic + + UI_DrawProportionalString( 256, y + 5, menu_normal_text[MNT_GAMMA_LINE1],UI_SMALLFONT, colorTable[CT_LTGOLD1]); + UI_DrawProportionalString( 256, y + 25, menu_normal_text[MNT_GAMMA_LINE2],UI_SMALLFONT, colorTable[CT_LTGOLD1]); + UI_DrawProportionalString( 256, y + 45, menu_normal_text[MNT_GAMMA_LINE3],UI_SMALLFONT,colorTable[CT_LTGOLD1]); + } + else + { + UI_DrawProportionalString( 178, y + 5, menu_normal_text[MNT_GAMMA2_LINE1],UI_SMALLFONT, colorTable[CT_LTGOLD1]); + UI_DrawProportionalString( 178, y + 25,menu_normal_text[MNT_GAMMA2_LINE2],UI_SMALLFONT, colorTable[CT_LTGOLD1]); + } + + + if ( s_brightness.supportMapLightingOptions ) { + int y, h; + y = 163; + h = 233; + + // Brackets around gamma + h = 100; + trap_R_SetColor( colorTable[CT_LTPURPLE1]); + UI_DrawHandlePic(158,y, 16, 16, uis.graphicBracket1CornerLU); + UI_DrawHandlePic(158,y + 16, 8, h, uis.whiteShader); + UI_DrawHandlePic(158,y + h + 16, 16, -16, uis.graphicBracket1CornerLU); //LD + + UI_DrawHandlePic(174,y, 408, 8, uis.whiteShader); // Top line + UI_DrawHandlePic(579,y, 32, 16, s_brightness.top); // Corner, UR + UI_DrawHandlePic(581,y + 16, 30, h, uis.whiteShader); // Right column + UI_DrawHandlePic(579,y + h + 16, 32, -16, s_brightness.top); // Corner, LR + UI_DrawHandlePic(174,y + h + 24, 408, 8, uis.whiteShader); // Bottom line + + // Brackets around map lighting options + y = 300; + h = 96; + trap_R_SetColor( colorTable[CT_LTPURPLE1]); + UI_DrawHandlePic(158,y, 16, 16, uis.graphicBracket1CornerLU); + UI_DrawHandlePic(158,y + 16, 8, h, uis.whiteShader); + UI_DrawHandlePic(158,y + h + 16, 16, -16, uis.graphicBracket1CornerLU); //LD + + UI_DrawHandlePic(174,y, 408, 8, uis.whiteShader); // Top line + UI_DrawHandlePic(579,y, 32, 16, s_brightness.top); // Corner, UR + UI_DrawHandlePic(581,y + 16, 30, h, uis.whiteShader); // Right column + UI_DrawHandlePic(579,y + h + 16, 32, -16, s_brightness.top); // Corner, LR + UI_DrawHandlePic(174,y + h + 24, 408, 8, uis.whiteShader); // Bottom line + + UI_DrawProportionalString( 190, 325, "Map Lighting Options", UI_SMALLFONT, colorTable[CT_LTGOLD1]); + } else { + // Brackets around gamma + trap_R_SetColor( colorTable[CT_LTPURPLE1]); + UI_DrawHandlePic(158,163, 16, 16, uis.graphicBracket1CornerLU); + UI_DrawHandlePic(158,179, 8, 233, uis.whiteShader); + UI_DrawHandlePic(158,412, 16, -16, uis.graphicBracket1CornerLU); //LD + + UI_DrawHandlePic(174,163, 408, 8, uis.whiteShader); // Top line + + UI_DrawHandlePic(579,163, 32, 16, s_brightness.top); // Corner, UR + UI_DrawHandlePic(581,179, 30, 121, uis.whiteShader); // Top right column + UI_DrawHandlePic(581,303, 30, 109, uis.whiteShader); // Bottom right column + UI_DrawHandlePic(579,412, 32, -16, s_brightness.top); // Corner, LR + + UI_DrawHandlePic(174,420, 408, 8, uis.whiteShader); // Bottom line + } + + Menu_Draw( &s_brightness.menu ); +} + +/* +================= +UI_BrightnessMenu_SetLightingResetButtonEnabled + +Enable or disable the lighting reset button. +================= +*/ +static void UI_BrightnessMenu_SetLightingResetButtonEnabled( qboolean enable ) { + if ( enable ) { + s_brightness.lighting_reset.textcolor = CT_BLACK; + s_brightness.lighting_reset.textcolor2 = CT_WHITE; + s_brightness.lighting_reset.color = CT_DKORANGE; + s_brightness.lighting_reset.color2 = CT_LTORANGE; + s_brightness.lighting_reset.generic.flags &= ~QMF_INACTIVE; + } else { + s_brightness.lighting_reset.textcolor = CT_WHITE; + s_brightness.lighting_reset.textcolor2 = CT_WHITE; + s_brightness.lighting_reset.color = CT_DKGREY; + s_brightness.lighting_reset.color2 = CT_DKGREY; + s_brightness.lighting_reset.generic.flags |= QMF_INACTIVE; + } +} + +/* +================= +UI_BrightnessMenu_SetLightingApplyButtonEnabled + +Enable or disable the lighting apply button. +================= +*/ +static void UI_BrightnessMenu_SetLightingApplyButtonEnabled( qboolean enable ) { + if ( enable ) { + s_brightness.lighting_apply.generic.flags &= ~QMF_GRAYED; + s_brightness.lighting_apply.generic.flags |= QMF_BLINK; + } else { + s_brightness.lighting_apply.generic.flags |= QMF_GRAYED; + s_brightness.lighting_apply.generic.flags &= ~QMF_BLINK; + } +} + +/* +================= +UI_BrightnessCallback +================= +*/ +static void UI_BrightnessCallback( void *s, int notification ) +{ + if (notification != QM_ACTIVATED) + return; + + if ( s == &s_brightness.gamma_apply ) { + trap_Cvar_SetValue( "r_gamma", s_brightness.gamma_slider.curvalue / 10.0f ); + trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" ); + + } else if ( s == &s_brightness.gamma_slider ) { + if ( uis.glconfig.deviceSupportsGamma ) { + // Update gamma in real time + trap_Cvar_SetValue( "r_gamma", s_brightness.gamma_slider.curvalue / 10.0f ); + } else { + // Blink the apply button + s_brightness.gamma_apply.generic.flags &= ~QMF_GRAYED; + s_brightness.gamma_apply.generic.flags |= QMF_BLINK; + } + + } else if ( s == &s_brightness.lighting_apply ) { + { + // Convert slider value to actual setting value + float mlg = s_brightness.lighting_gamma_slider.curvalue / 10.0f; + mlg = mlg < 1.0f ? sqrt( mlg ) : ( mlg > 1.5f ? ( mlg - 0.5f ) * ( mlg - 0.5f ) + 0.5f : mlg ); + trap_Cvar_SetValue( "r_mapLightingGamma", mlg ); + } + trap_Cvar_SetValue( "r_overBrightFactor", s_brightness.lighting_overbright_slider.curvalue / 10.0f ); + + // Reset other brightness settings to avoid stacking + trap_Cvar_Set( "r_ignorehwgamma", "0" ); + trap_Cvar_Set( "r_intensity", "1" ); + trap_Cvar_Set( "r_textureGamma", "1" ); + trap_Cvar_Set( "r_mapLightingFactor", "2" ); + + trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" ); + + } else if ( s == &s_brightness.lighting_reset ) { + s_brightness.lighting_gamma_slider.curvalue = 10.0f; + s_brightness.lighting_overbright_slider.curvalue = 15.0f; + UI_BrightnessMenu_SetLightingApplyButtonEnabled( !s_brightness.defaults_active ); + UI_BrightnessMenu_SetLightingResetButtonEnabled( qfalse ); + + } else if ( s == &s_brightness.lighting_gamma_slider || s == &s_brightness.lighting_overbright_slider ) { + UI_BrightnessMenu_SetLightingApplyButtonEnabled( qtrue ); + UI_BrightnessMenu_SetLightingResetButtonEnabled( qtrue ); + } +} + +/* +================= +UI_BrightnessMenu_Init +================= +*/ +void UI_BrightnessMenu_Init( void ) +{ + int x, y; + + memset( &s_brightness, 0, sizeof( s_brightness ) ); + + // Determine engine support for map lighting options + s_brightness.supportMapLightingOptions = VMExt_GVCommandInt( "ui_support_r_ext_mapLightingGamma", 0 ) && + VMExt_GVCommandInt( "ui_support_r_ext_overBrightFactor", 0 ); + + s_brightness.top = trap_R_RegisterShaderNoMip("menu/common/corner_ur_8_30.tga"); + s_brightness.gamma = trap_R_RegisterShaderNoMip("menu/special/gamma_test.tga"); + + // Menu Data + s_brightness.menu.wrapAround = qtrue; + s_brightness.menu.draw = UI_BrightnessMenu_MenuDraw; + s_brightness.menu.fullscreen = qtrue; + s_brightness.menu.descX = MENU_DESC_X; + s_brightness.menu.descY = MENU_DESC_Y; + s_brightness.menu.listX = 230; + s_brightness.menu.listY = 188; + s_brightness.menu.titleX = MENU_TITLE_X; + s_brightness.menu.titleY = MENU_TITLE_Y; + s_brightness.menu.titleI = MNT_CONTROLSMENU_TITLE; + s_brightness.menu.footNoteEnum = MNT_VIDEOSETUP; + + SetupMenu_TopButtons(&s_brightness.menu,MENU_VIDEO,NULL); + + Video_SideButtons(&s_brightness.menu,ID_VIDEOBRIGHTNESS); + + x = 180; + y = s_brightness.supportMapLightingOptions ? 267 - 10 : 267; + s_brightness.gamma_slider.generic.type = MTYPE_SLIDER; + s_brightness.gamma_slider.generic.x = x + 162; + s_brightness.gamma_slider.generic.y = y; + s_brightness.gamma_slider.generic.flags = QMF_SMALLFONT; + s_brightness.gamma_slider.generic.callback = UI_BrightnessCallback; + s_brightness.gamma_slider.minvalue = 5; + s_brightness.gamma_slider.maxvalue = 30; + s_brightness.gamma_slider.color = CT_DKPURPLE1; + s_brightness.gamma_slider.color2 = CT_LTPURPLE1; + s_brightness.gamma_slider.generic.name = PIC_MONBAR2; + s_brightness.gamma_slider.width = 256; + s_brightness.gamma_slider.height = 32; + s_brightness.gamma_slider.focusWidth = 145; + s_brightness.gamma_slider.focusHeight = 18; + s_brightness.gamma_slider.picName = GRAPHIC_SQUARE; + s_brightness.gamma_slider.picX = x; + s_brightness.gamma_slider.picY = y; + s_brightness.gamma_slider.picWidth = MENU_BUTTON_MED_WIDTH + 21; + s_brightness.gamma_slider.picHeight = MENU_BUTTON_MED_HEIGHT; + s_brightness.gamma_slider.textX = MENU_BUTTON_TEXT_X; + s_brightness.gamma_slider.textY = MENU_BUTTON_TEXT_Y; + s_brightness.gamma_slider.textEnum = MBT_BRIGHTNESS; + s_brightness.gamma_slider.textcolor = CT_BLACK; + s_brightness.gamma_slider.textcolor2 = CT_WHITE; + s_brightness.gamma_slider.thumbName = PIC_SLIDER; + s_brightness.gamma_slider.thumbHeight = 32; + s_brightness.gamma_slider.thumbWidth = 16; + s_brightness.gamma_slider.thumbGraphicWidth = 9; + s_brightness.gamma_slider.thumbColor = CT_DKBLUE1; + s_brightness.gamma_slider.thumbColor2 = CT_LTBLUE1; + + s_brightness.gamma_apply.generic.type = MTYPE_ACTION; + s_brightness.gamma_apply.generic.flags = QMF_HIGHLIGHT_IF_FOCUS|QMF_GRAYED; + s_brightness.gamma_apply.generic.x = 490; + s_brightness.gamma_apply.generic.y = s_brightness.supportMapLightingOptions ? 191 - 10 : 191; + s_brightness.gamma_apply.generic.callback = UI_BrightnessCallback; + s_brightness.gamma_apply.textEnum = MBT_ACCEPT; + s_brightness.gamma_apply.textcolor = CT_BLACK; + s_brightness.gamma_apply.textcolor2 = CT_WHITE; + s_brightness.gamma_apply.textcolor3 = CT_LTGREY; + s_brightness.gamma_apply.color = CT_DKPURPLE1; + s_brightness.gamma_apply.color2 = CT_LTPURPLE1; + s_brightness.gamma_apply.color3 = CT_DKGREY; + s_brightness.gamma_apply.textX = 5; + s_brightness.gamma_apply.textY = 30; + s_brightness.gamma_apply.width = 82; + s_brightness.gamma_apply.height = 70; + + y = 350; + s_brightness.lighting_gamma_slider.generic.type = MTYPE_SLIDER; + s_brightness.lighting_gamma_slider.generic.x = x + 162; + s_brightness.lighting_gamma_slider.generic.y = y; + s_brightness.lighting_gamma_slider.generic.flags = QMF_SMALLFONT; + s_brightness.lighting_gamma_slider.generic.callback = UI_BrightnessCallback; + s_brightness.lighting_gamma_slider.minvalue = 5; + s_brightness.lighting_gamma_slider.maxvalue = 25; + s_brightness.lighting_gamma_slider.color = CT_DKPURPLE1; + s_brightness.lighting_gamma_slider.color2 = CT_LTPURPLE1; + s_brightness.lighting_gamma_slider.generic.name = PIC_MONBAR2; + s_brightness.lighting_gamma_slider.width = 256; + s_brightness.lighting_gamma_slider.height = 32; + s_brightness.lighting_gamma_slider.focusWidth = 145; + s_brightness.lighting_gamma_slider.focusHeight = 18; + s_brightness.lighting_gamma_slider.picName = GRAPHIC_SQUARE; + s_brightness.lighting_gamma_slider.picX = x; + s_brightness.lighting_gamma_slider.picY = y; + s_brightness.lighting_gamma_slider.picWidth = MENU_BUTTON_MED_WIDTH + 21; + s_brightness.lighting_gamma_slider.picHeight = MENU_BUTTON_MED_HEIGHT; + s_brightness.lighting_gamma_slider.textX = MENU_BUTTON_TEXT_X; + s_brightness.lighting_gamma_slider.textY = MENU_BUTTON_TEXT_Y; + s_brightness.lighting_gamma_slider.textEnum = MBT_VIDEO_LIGHTING_LEVEL; + s_brightness.lighting_gamma_slider.textcolor = CT_BLACK; + s_brightness.lighting_gamma_slider.textcolor2 = CT_WHITE; + s_brightness.lighting_gamma_slider.thumbName = PIC_SLIDER; + s_brightness.lighting_gamma_slider.thumbHeight = 32; + s_brightness.lighting_gamma_slider.thumbWidth = 16; + s_brightness.lighting_gamma_slider.thumbGraphicWidth = 9; + s_brightness.lighting_gamma_slider.thumbColor = CT_DKBLUE1; + s_brightness.lighting_gamma_slider.thumbColor2 = CT_LTBLUE1; + + y += 25; + s_brightness.lighting_overbright_slider.generic.type = MTYPE_SLIDER; + s_brightness.lighting_overbright_slider.generic.x = x + 162; + s_brightness.lighting_overbright_slider.generic.y = y; + s_brightness.lighting_overbright_slider.generic.flags = QMF_SMALLFONT; + s_brightness.lighting_overbright_slider.generic.callback = UI_BrightnessCallback; + s_brightness.lighting_overbright_slider.minvalue = 10; + s_brightness.lighting_overbright_slider.maxvalue = 20; + s_brightness.lighting_overbright_slider.color = CT_DKPURPLE1; + s_brightness.lighting_overbright_slider.color2 = CT_LTPURPLE1; + s_brightness.lighting_overbright_slider.generic.name = PIC_MONBAR2; + s_brightness.lighting_overbright_slider.width = 256; + s_brightness.lighting_overbright_slider.height = 32; + s_brightness.lighting_overbright_slider.focusWidth = 145; + s_brightness.lighting_overbright_slider.focusHeight = 18; + s_brightness.lighting_overbright_slider.picName = GRAPHIC_SQUARE; + s_brightness.lighting_overbright_slider.picX = x; + s_brightness.lighting_overbright_slider.picY = y; + s_brightness.lighting_overbright_slider.picWidth = MENU_BUTTON_MED_WIDTH + 21; + s_brightness.lighting_overbright_slider.picHeight = MENU_BUTTON_MED_HEIGHT; + s_brightness.lighting_overbright_slider.textX = MENU_BUTTON_TEXT_X; + s_brightness.lighting_overbright_slider.textY = MENU_BUTTON_TEXT_Y; + s_brightness.lighting_overbright_slider.textEnum = MBT_VIDEO_LIGHTING_CONTRAST; + s_brightness.lighting_overbright_slider.textcolor = CT_BLACK; + s_brightness.lighting_overbright_slider.textcolor2 = CT_WHITE; + s_brightness.lighting_overbright_slider.thumbName = PIC_SLIDER; + s_brightness.lighting_overbright_slider.thumbHeight = 32; + s_brightness.lighting_overbright_slider.thumbWidth = 16; + s_brightness.lighting_overbright_slider.thumbGraphicWidth = 9; + s_brightness.lighting_overbright_slider.thumbColor = CT_DKBLUE1; + s_brightness.lighting_overbright_slider.thumbColor2 = CT_LTBLUE1; + + s_brightness.lighting_apply.generic.type = MTYPE_ACTION; + s_brightness.lighting_apply.generic.flags = QMF_HIGHLIGHT_IF_FOCUS|QMF_GRAYED; + s_brightness.lighting_apply.generic.x = 510; + s_brightness.lighting_apply.generic.y = 320; + s_brightness.lighting_apply.generic.callback = UI_BrightnessCallback; + s_brightness.lighting_apply.textEnum = MBT_VIDEO_LIGHTING_APPLY; + s_brightness.lighting_apply.textcolor = CT_BLACK; + s_brightness.lighting_apply.textcolor2 = CT_WHITE; + s_brightness.lighting_apply.textcolor3 = CT_LTGREY; + s_brightness.lighting_apply.color = CT_DKPURPLE1; + s_brightness.lighting_apply.color2 = CT_LTPURPLE1; + s_brightness.lighting_apply.color3 = CT_DKGREY; + s_brightness.lighting_apply.textX = 5; + s_brightness.lighting_apply.textY = 5; + s_brightness.lighting_apply.width = 60; + s_brightness.lighting_apply.height = 40; + + s_brightness.lighting_reset.generic.type = MTYPE_BITMAP; + s_brightness.lighting_reset.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_brightness.lighting_reset.generic.x = 510; + s_brightness.lighting_reset.generic.y = 365; + s_brightness.lighting_reset.generic.name = GRAPHIC_SQUARE; + s_brightness.lighting_reset.generic.callback = UI_BrightnessCallback; + s_brightness.lighting_reset.textEnum = MBT_VIDEO_LIGHTING_RESET; + s_brightness.lighting_reset.textcolor = CT_BLACK; + s_brightness.lighting_reset.textcolor2 = CT_WHITE; + s_brightness.lighting_reset.color = CT_DKORANGE; + s_brightness.lighting_reset.color2 = CT_LTORANGE; + s_brightness.lighting_reset.textX = 5; + s_brightness.lighting_reset.textY = 5; + s_brightness.lighting_reset.width = 60; + s_brightness.lighting_reset.height = 40; + + Menu_AddItem( &s_brightness.menu, ( void * )&s_brightness.gamma_slider); + if (!uis.glconfig.deviceSupportsGamma) + { + Menu_AddItem( &s_brightness.menu, ( void * )&s_brightness.gamma_apply); + } + s_brightness.gamma_slider.curvalue = trap_Cvar_VariableValue( "r_gamma" ) * 10.0f; + + if ( s_brightness.supportMapLightingOptions ) + { + { + // The slider value has some conversions applied to make the scaling correspond to + // the visual results more naturally. + float mlg = trap_Cvar_VariableValue( "r_mapLightingGamma" ); + mlg = mlg < 1.0f ? mlg * mlg : ( mlg > 1.5f ? (float)sqrt( mlg - 0.5f ) + 0.5f : mlg ); + if ( mlg < 0.5f ) { + mlg = 0.5f; + } + if ( mlg > 2.5f ) { + mlg = 2.5f; + } + s_brightness.lighting_gamma_slider.curvalue = mlg * 10.0f; + } + + { + float obf = trap_Cvar_VariableValue( "r_overBrightFactor" ); + if ( obf < 1.0f ) { + obf = 1.0f; + } + if ( obf > 2.0f ) { + obf = 2.0f; + } + s_brightness.lighting_overbright_slider.curvalue = obf * 10.0f; + } + + // Check if all the lighting settings are already at the defaults + s_brightness.defaults_active = s_brightness.lighting_gamma_slider.curvalue == 10.0f && + s_brightness.lighting_overbright_slider.curvalue == 15.0f && + trap_Cvar_VariableValue( "r_ignoreHWGamma" ) == 0.0f && + trap_Cvar_VariableValue( "r_intensity" ) == 1.0f && + trap_Cvar_VariableValue( "r_textureGamma" ) == 1.0f && + trap_Cvar_VariableValue( "r_mapLightingFactor" ) == 2.0f; + + UI_BrightnessMenu_SetLightingResetButtonEnabled( !s_brightness.defaults_active ); + + Menu_AddItem( &s_brightness.menu, ( void * )&s_brightness.lighting_gamma_slider); + Menu_AddItem( &s_brightness.menu, ( void * )&s_brightness.lighting_overbright_slider); + Menu_AddItem( &s_brightness.menu, ( void * )&s_brightness.lighting_apply); + Menu_AddItem( &s_brightness.menu, ( void * )&s_brightness.lighting_reset); + } + + UI_PushMenu( &s_brightness.menu ); +} + /* ======================================================================= @@ -436,18 +1083,10 @@ static const char *s_drivers[] = typedef struct { menuframework_s menu; - menutext_s banner; - menubitmap_s framel; - menubitmap_s framer; - - menutext_s graphics; - menutext_s display; - menutext_s sound; - menutext_s network; - menulist_s list; menulist_s mode; menulist_s driver; + menulist_s renderer; menulist_s tq; menulist_s fs; menulist_s lighting; @@ -459,6 +1098,9 @@ typedef struct { menutext_s driverinfo; menulist_s simpleshaders; menulist_s compresstextures; + menulist_s anisotropic; + menulist_s multisample; + menulist_s vsync; menuaction_s apply; @@ -479,12 +1121,16 @@ typedef struct qboolean extensions; int simpleshaders; int compresstextures; + int anisotropic; + int multisample; + int renderer; + int vsync; } InitialVideoOptions_s; static InitialVideoOptions_s s_ivo; static graphicsoptions_t s_graphicsoptions; -static InitialVideoOptions_s s_ivo_templates[] = +static InitialVideoOptions_s s_ivo_templates[NUM_VIDEO_TEMPLATES] = { { 2, qtrue, 3, 0, 2, 2, 2, 1, 0, qtrue, 0, 0, // JDC: this was tq 3 @@ -498,12 +1144,29 @@ static InitialVideoOptions_s s_ivo_templates[] = { 0, qtrue, 1, 1, 1, 0, 0, 0, 0, qtrue, 1, 0, }, + //{ + // 1, qtrue, 1, 0, 0, 0, 1, 0, 0, qtrue, 0, 0, + //} +}; + +static InitialVideoOptions_s s_ivo_modern_templates[NUM_VIDEO_TEMPLATES] = +{ + { + 0, qtrue, 1, 0, 1, 0, 1, 0, 0, qtrue, 0, 0, 0, 0, + }, { - 1, qtrue, 1, 0, 0, 0, 1, 0, 0, qtrue, 0, 0, - } + 1, qtrue, 2, 0, 0, 0, 2, 1, 0, qtrue, 0, 0, 2, 0, + }, + { + 2, qtrue, 3, 0, 2, 2, 2, 1, 0, qtrue, 0, 0, 4, 0, + }, + { + 2, qtrue, 3, 0, 2, 2, 2, 1, 0, qtrue, 0, 0, 4, 2, + }, }; -#define NUM_IVO_TEMPLATES ( sizeof( s_ivo_templates ) / sizeof( s_ivo_templates[0] ) ) +// If max anisotropy is unsupported, convert template anisotropy levels to 1 or 0. +#define ANISOTROPIC_TEMPLATE_VALUE( value ) ( videoEngineConfig.supportMaxAnisotropy ? value : ( value ? 1 : 0 ) ) /* ================= @@ -524,8 +1187,87 @@ static void GraphicsOptions_GetInitialVideo( void ) s_ivo.texturebits = s_graphicsoptions.texturebits.curvalue; s_ivo.simpleshaders = s_graphicsoptions.simpleshaders.curvalue; s_ivo.compresstextures = s_graphicsoptions.compresstextures.curvalue; + s_ivo.renderer = s_graphicsoptions.renderer.curvalue; + s_ivo.anisotropic = s_graphicsoptions.anisotropic.curvalue; + s_ivo.multisample = s_graphicsoptions.multisample.curvalue; + s_ivo.vsync = s_graphicsoptions.vsync.curvalue; +} + +/* +================= +GraphicsOptions_CompareTemplate + +Returns qtrue if the config matches the current button configuration. +================= +*/ +static qboolean GraphicsOptions_CompareTemplate( InitialVideoOptions_s template ) { + // Apply some forced values from GraphicsOptions_UpdateMenuItems to template ahead of comparison + // Otherwise in some cases template will never match and template button will get stuck + if ( videoEngineConfig.supportGlDriver && s_graphicsoptions.driver.curvalue == 1 ) { + template.fullscreen = 1; + } + if ( s_graphicsoptions.fs.curvalue == 0 || ( videoEngineConfig.supportGlDriver && s_graphicsoptions.driver.curvalue == 1 ) ) { + template.colordepth = 0; + } + if ( videoEngineConfig.supportAllowExtensions && s_graphicsoptions.allow_extensions.curvalue == 0 ) + { + if ( template.texturebits == 0 ) + { + template.texturebits = 1; + } + } + + if ( !videoEngineConfig.modern_templates && template.mode != s_graphicsoptions.mode.curvalue ) + return qfalse; + if ( !videoEngineConfig.modern_templates && template.fullscreen != s_graphicsoptions.fs.curvalue ) + return qfalse; + if ( template.tq != s_graphicsoptions.tq.curvalue ) + return qfalse; + if ( videoEngineConfig.supportColorDepth && template.colordepth != s_graphicsoptions.colordepth.curvalue ) + return qfalse; + if ( videoEngineConfig.supportTextureBits && template.texturebits != s_graphicsoptions.texturebits.curvalue ) + return qfalse; + if ( template.geometry != s_graphicsoptions.geometry.curvalue ) + return qfalse; + if ( template.filter != s_graphicsoptions.filter.curvalue ) + return qfalse; + if ( videoEngineConfig.supportSimpleShaders && template.simpleshaders != s_graphicsoptions.simpleshaders.curvalue ) + return qfalse; + if ( template.compresstextures != s_graphicsoptions.compresstextures.curvalue ) + return qfalse; + if ( videoEngineConfig.anisotropicFilteringVideoMenu && videoEngineConfig.modern_templates && + ANISOTROPIC_TEMPLATE_VALUE( template.anisotropic ) != s_graphicsoptions.anisotropic.curvalue ) + return qfalse; + if ( videoEngineConfig.supportMultisample && videoEngineConfig.modern_templates && + template.multisample != s_graphicsoptions.multisample.curvalue ) + return qfalse; + return qtrue; } +/* +================= +GraphicsOptions_ApplyTemplate + +Copies values from template to current button configuration. +================= +*/ +static void GraphicsOptions_ApplyTemplate( const InitialVideoOptions_s *template ) { + if ( !videoEngineConfig.modern_templates ) + s_graphicsoptions.mode.curvalue = template->mode; + if ( !videoEngineConfig.modern_templates ) + s_graphicsoptions.fs.curvalue = template->fullscreen; + s_graphicsoptions.tq.curvalue = template->tq; + s_graphicsoptions.colordepth.curvalue = template->colordepth; + s_graphicsoptions.texturebits.curvalue = template->texturebits; + s_graphicsoptions.geometry.curvalue = template->geometry; + s_graphicsoptions.filter.curvalue = template->filter; + s_graphicsoptions.simpleshaders.curvalue = template->simpleshaders; + s_graphicsoptions.compresstextures.curvalue = template->compresstextures; + if ( videoEngineConfig.modern_templates ) + s_graphicsoptions.anisotropic.curvalue = ANISOTROPIC_TEMPLATE_VALUE( template->anisotropic ); + if ( videoEngineConfig.modern_templates ) + s_graphicsoptions.multisample.curvalue = template->multisample; +} /* ================= @@ -535,36 +1277,16 @@ GraphicsOptions_CheckConfig static void GraphicsOptions_CheckConfig( void ) { int i; + const InitialVideoOptions_s *template = videoEngineConfig.modern_templates ? s_ivo_modern_templates : s_ivo_templates; - for ( i = 0; i < NUM_IVO_TEMPLATES; i++ ) - { - if ( s_ivo_templates[i].colordepth != s_graphicsoptions.colordepth.curvalue ) - continue; - if ( s_ivo_templates[i].driver != s_graphicsoptions.driver.curvalue ) - continue; - if ( s_ivo_templates[i].mode != s_graphicsoptions.mode.curvalue ) - continue; - if ( s_ivo_templates[i].fullscreen != s_graphicsoptions.fs.curvalue ) - continue; - if ( s_ivo_templates[i].tq != s_graphicsoptions.tq.curvalue ) - continue; -// if ( s_ivo_templates[i].lighting != s_graphicsoptions.lighting.curvalue ) -// continue; - if ( s_ivo_templates[i].geometry != s_graphicsoptions.geometry.curvalue ) - continue; - if ( s_ivo_templates[i].filter != s_graphicsoptions.filter.curvalue ) - continue; - if ( s_ivo_templates[i].simpleshaders != s_graphicsoptions.simpleshaders.curvalue ) - continue; -// if ( s_ivo_templates[i].compresstextures != s_graphicsoptions.compresstextures.curvalue ) -// continue; - -// if ( s_ivo_templates[i].texturebits != s_graphicsoptions.texturebits.curvalue ) -// continue; - s_graphicsoptions.list.curvalue = i; - return; + for ( i = NUM_VIDEO_TEMPLATES - 1; i >= 0; i-- ) + { + if ( GraphicsOptions_CompareTemplate( template[i] ) ) { + s_graphicsoptions.list.curvalue = i; + return; + } } - s_graphicsoptions.list.curvalue = 4; + s_graphicsoptions.list.curvalue = NUM_VIDEO_TEMPLATES; } /* @@ -574,7 +1296,12 @@ GraphicsOptions_UpdateMenuItems */ static void GraphicsOptions_UpdateMenuItems( void ) { - if ( s_graphicsoptions.driver.curvalue == 1 ) + if ( s_graphicsoptions.mode.curvalue == NUM_RESOLUTIONS && s_ivo.mode != NUM_RESOLUTIONS ) { + // skip custom resolution if initial resolution wasn't custom + s_graphicsoptions.mode.curvalue = 0; + } + + if ( videoEngineConfig.supportGlDriver && s_graphicsoptions.driver.curvalue == 1 ) { s_graphicsoptions.fs.curvalue = 1; s_graphicsoptions.fs.generic.flags |= QMF_GRAYED; @@ -585,7 +1312,7 @@ static void GraphicsOptions_UpdateMenuItems( void ) s_graphicsoptions.fs.generic.flags &= ~QMF_GRAYED; } - if ( s_graphicsoptions.fs.curvalue == 0 || s_graphicsoptions.driver.curvalue == 1 ) + if ( s_graphicsoptions.fs.curvalue == 0 || ( videoEngineConfig.supportGlDriver && s_graphicsoptions.driver.curvalue == 1 ) ) { s_graphicsoptions.colordepth.curvalue = 0; s_graphicsoptions.colordepth.generic.flags |= QMF_GRAYED; @@ -595,7 +1322,7 @@ static void GraphicsOptions_UpdateMenuItems( void ) s_graphicsoptions.colordepth.generic.flags &= ~QMF_GRAYED; } - if ( s_graphicsoptions.allow_extensions.curvalue == 0 ) + if ( videoEngineConfig.supportAllowExtensions && s_graphicsoptions.allow_extensions.curvalue == 0 ) { if ( s_graphicsoptions.texturebits.curvalue == 0 ) { @@ -618,7 +1345,7 @@ static void GraphicsOptions_UpdateMenuItems( void ) s_graphicsoptions.apply.generic.flags |= QMF_BLINK; } - if ( s_ivo.extensions != s_graphicsoptions.allow_extensions.curvalue ) + if ( videoEngineConfig.supportAllowExtensions && s_ivo.extensions != s_graphicsoptions.allow_extensions.curvalue ) { s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; s_graphicsoptions.apply.generic.flags |= QMF_BLINK; @@ -635,42 +1362,65 @@ static void GraphicsOptions_UpdateMenuItems( void ) s_graphicsoptions.apply.generic.flags |= QMF_BLINK; } */ - if ( s_ivo.colordepth != s_graphicsoptions.colordepth.curvalue ) + if ( videoEngineConfig.supportColorDepth && s_ivo.colordepth != s_graphicsoptions.colordepth.curvalue ) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + + if ( videoEngineConfig.supportGlDriver && s_ivo.driver != s_graphicsoptions.driver.curvalue ) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + if ( videoEngineConfig.supportRendererSelect && s_ivo.renderer != s_graphicsoptions.renderer.curvalue ) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + if ( videoEngineConfig.supportTextureBits && s_ivo.texturebits != s_graphicsoptions.texturebits.curvalue ) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + + if ( videoEngineConfig.supportSimpleShaders && s_ivo.simpleshaders != s_graphicsoptions.simpleshaders.curvalue ) { s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; s_graphicsoptions.apply.generic.flags |= QMF_BLINK; } - if ( s_ivo.driver != s_graphicsoptions.driver.curvalue ) + if ( s_ivo.compresstextures != s_graphicsoptions.compresstextures.curvalue ) { s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; s_graphicsoptions.apply.generic.flags |= QMF_BLINK; } - if ( s_ivo.texturebits != s_graphicsoptions.texturebits.curvalue ) + + if ( s_ivo.geometry != s_graphicsoptions.geometry.curvalue ) { s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; s_graphicsoptions.apply.generic.flags |= QMF_BLINK; } - if ( s_ivo.simpleshaders != s_graphicsoptions.simpleshaders.curvalue ) + if ( s_ivo.filter != s_graphicsoptions.filter.curvalue ) { s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; s_graphicsoptions.apply.generic.flags |= QMF_BLINK; } - if ( s_ivo.compresstextures != s_graphicsoptions.compresstextures.curvalue ) + if ( videoEngineConfig.anisotropicFilteringVideoMenu && s_ivo.anisotropic != s_graphicsoptions.anisotropic.curvalue ) { s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; s_graphicsoptions.apply.generic.flags |= QMF_BLINK; } - if ( s_ivo.geometry != s_graphicsoptions.geometry.curvalue ) + if ( videoEngineConfig.supportMultisample && s_ivo.multisample != s_graphicsoptions.multisample.curvalue ) { s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; s_graphicsoptions.apply.generic.flags |= QMF_BLINK; } - if ( s_ivo.filter != s_graphicsoptions.filter.curvalue ) + if ( videoEngineConfig.supportVSync && s_ivo.vsync != s_graphicsoptions.vsync.curvalue ) { s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; s_graphicsoptions.apply.generic.flags |= QMF_BLINK; @@ -701,44 +1451,63 @@ static void GraphicsOptions_ApplyChanges( void *unused, int notification ) if (notification != QM_ACTIVATED) return; - switch ( s_graphicsoptions.texturebits.curvalue ) - { - case 0: - trap_Cvar_SetValue( "r_texturebits", 0 ); - break; - case 1: - trap_Cvar_SetValue( "r_texturebits", 16 ); - break; - case 2: - trap_Cvar_SetValue( "r_texturebits", 32 ); - break; + if ( videoEngineConfig.supportTextureBits ) { + switch ( s_graphicsoptions.texturebits.curvalue ) + { + case 0: + trap_Cvar_SetValue( "r_texturebits", 0 ); + break; + case 1: + trap_Cvar_SetValue( "r_texturebits", 16 ); + break; + case 2: + trap_Cvar_SetValue( "r_texturebits", 32 ); + break; + } } trap_Cvar_SetValue( "r_picmip", 3 - s_graphicsoptions.tq.curvalue ); - trap_Cvar_SetValue( "r_allowExtensions", s_graphicsoptions.allow_extensions.curvalue ); - trap_Cvar_SetValue( "r_mode", (s_graphicsoptions.mode.curvalue + 2) ); + if ( videoEngineConfig.supportAllowExtensions ) { + trap_Cvar_SetValue( "r_allowExtensions", s_graphicsoptions.allow_extensions.curvalue ); + } + if ( s_graphicsoptions.mode.curvalue >= 0 && s_graphicsoptions.mode.curvalue < NUM_RESOLUTIONS ) { + trap_Cvar_SetValue( "r_mode", (s_graphicsoptions.mode.curvalue + 2) ); + } trap_Cvar_SetValue( "r_fullscreen", s_graphicsoptions.fs.curvalue ); - trap_Cvar_Set( "r_glDriver", ( char * ) s_drivers[s_graphicsoptions.driver.curvalue] ); + if ( videoEngineConfig.supportGlDriver ) { + trap_Cvar_Set( "r_glDriver", ( char * ) s_drivers[s_graphicsoptions.driver.curvalue] ); + } + if ( videoEngineConfig.supportRendererSelect ) { + if ( s_graphicsoptions.renderer.curvalue == 0 ) { + trap_Cvar_Set( "cl_renderer", "opengl1" ); + } else if ( s_graphicsoptions.renderer.curvalue == 1 ) { + trap_Cvar_Set( "cl_renderer", "opengl2" ); + } + } - trap_Cvar_SetValue( "r_lowEndVideo", s_graphicsoptions.simpleshaders.curvalue ); + if ( videoEngineConfig.supportSimpleShaders ) { + trap_Cvar_SetValue( "r_lowEndVideo", s_graphicsoptions.simpleshaders.curvalue ); + } trap_Cvar_SetValue( "r_ext_compress_textures", s_graphicsoptions.compresstextures.curvalue ); - switch ( s_graphicsoptions.colordepth.curvalue ) - { - case 0: - trap_Cvar_SetValue( "r_colorbits", 0 ); - trap_Cvar_SetValue( "r_depthbits", 0 ); - trap_Cvar_SetValue( "r_stencilbits", 0 ); - break; - case 1: - trap_Cvar_SetValue( "r_colorbits", 16 ); - trap_Cvar_SetValue( "r_depthbits", 16 ); - trap_Cvar_SetValue( "r_stencilbits", 0 ); - break; - case 2: - trap_Cvar_SetValue( "r_colorbits", 32 ); - trap_Cvar_SetValue( "r_depthbits", 24 ); - break; + if ( videoEngineConfig.supportColorDepth ) { + switch ( s_graphicsoptions.colordepth.curvalue ) + { + case 0: + trap_Cvar_SetValue( "r_colorbits", 0 ); + trap_Cvar_SetValue( "r_depthbits", 0 ); + trap_Cvar_SetValue( "r_stencilbits", 0 ); + break; + case 1: + trap_Cvar_SetValue( "r_colorbits", 16 ); + trap_Cvar_SetValue( "r_depthbits", 16 ); + trap_Cvar_SetValue( "r_stencilbits", 0 ); + break; + case 2: + trap_Cvar_SetValue( "r_colorbits", 32 ); + trap_Cvar_SetValue( "r_depthbits", 24 ); + break; + } } // trap_Cvar_SetValue( "r_vertexLight", s_graphicsoptions.lighting.curvalue ); @@ -767,6 +1536,19 @@ static void GraphicsOptions_ApplyChanges( void *unused, int notification ) trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_NEAREST" ); } + if ( videoEngineConfig.anisotropicFilteringVideoMenu ) { + UI_SetAnisotropyLevel( s_graphicsoptions.anisotropic.curvalue ); + } + + if ( videoEngineConfig.supportMultisample ) { + int value = s_graphicsoptions.multisample.curvalue > 0 ? 1 << s_graphicsoptions.multisample.curvalue : 0; + VMExt_GVCommandInt( va( "cmd_set_multisample %i", value ), 0 ); + } + + if ( videoEngineConfig.supportVSync ) { + trap_Cvar_Set( "r_swapInterval", s_graphicsoptions.vsync.curvalue ? "1" : "0" ); + } + trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" ); } @@ -777,8 +1559,6 @@ GraphicsOptions_Event */ static void GraphicsOptions_Event( void* ptr, int event ) { - InitialVideoOptions_s *ivo; - if( event != QM_ACTIVATED ) { return; } @@ -796,20 +1576,23 @@ static void GraphicsOptions_Event( void* ptr, int event ) break; case ID_LIST: - ivo = &s_ivo_templates[s_graphicsoptions.list.curvalue]; - - s_graphicsoptions.mode.curvalue = ivo->mode; - s_graphicsoptions.tq.curvalue = ivo->tq; -// s_graphicsoptions.lighting.curvalue = ivo->lighting; - s_graphicsoptions.colordepth.curvalue = ivo->colordepth; - s_graphicsoptions.texturebits.curvalue = ivo->texturebits; - s_graphicsoptions.geometry.curvalue = ivo->geometry; - s_graphicsoptions.filter.curvalue = ivo->filter; - s_graphicsoptions.fs.curvalue = ivo->fullscreen; - s_graphicsoptions.simpleshaders.curvalue = ivo->simpleshaders; - s_graphicsoptions.compresstextures.curvalue = ivo->compresstextures; - - break; + { + const InitialVideoOptions_s *template = videoEngineConfig.modern_templates ? s_ivo_modern_templates : s_ivo_templates; + if ( s_graphicsoptions.list.curvalue >= NUM_VIDEO_TEMPLATES ) { + // Trying to set "custom" - revert to original settings + GraphicsOptions_ApplyTemplate( &s_ivo ); + + // If original settings match one of the other templates, go to the first template instead + GraphicsOptions_CheckConfig(); + if ( s_graphicsoptions.list.curvalue < NUM_VIDEO_TEMPLATES ) { + s_graphicsoptions.list.curvalue = 0; + GraphicsOptions_ApplyTemplate( &template[0] ); + } + } else { + GraphicsOptions_ApplyTemplate( &template[s_graphicsoptions.list.curvalue] ); + } + break; + } case ID_DRIVERINFO: UI_DriverInfo_Menu(); @@ -862,15 +1645,14 @@ GraphicsOptions_SetMenuItems static void GraphicsOptions_SetMenuItems( void ) { s_graphicsoptions.mode.curvalue = (trap_Cvar_VariableValue( "r_mode" ) - 2); - if ( s_graphicsoptions.mode.curvalue < 0 || - s_graphicsoptions.mode.curvalue >= ( sizeof ( s_resolutions ) / sizeof ( *s_resolutions ) ) ) + if ( s_graphicsoptions.mode.curvalue < 0 || s_graphicsoptions.mode.curvalue >= NUM_RESOLUTIONS ) { - s_graphicsoptions.mode.curvalue = 1; + s_graphicsoptions.mode.curvalue = NUM_RESOLUTIONS; // custom } - s_graphicsoptions.fs.curvalue = trap_Cvar_VariableValue("r_fullscreen"); - s_graphicsoptions.allow_extensions.curvalue = trap_Cvar_VariableValue("r_allowExtensions"); - s_graphicsoptions.simpleshaders.curvalue = trap_Cvar_VariableValue("r_lowEndVideo"); - s_graphicsoptions.compresstextures.curvalue = trap_Cvar_VariableValue("r_ext_compress_textures"); + s_graphicsoptions.fs.curvalue = trap_Cvar_VariableValue("r_fullscreen") ? 1 : 0; + s_graphicsoptions.allow_extensions.curvalue = trap_Cvar_VariableValue("r_allowExtensions") ? 1 : 0; + s_graphicsoptions.simpleshaders.curvalue = trap_Cvar_VariableValue("r_lowEndVideo") ? 1 : 0; + s_graphicsoptions.compresstextures.curvalue = trap_Cvar_VariableValue("r_ext_compress_textures") ? 1 : 0; s_graphicsoptions.tq.curvalue = 3-trap_Cvar_VariableValue( "r_picmip"); if ( s_graphicsoptions.tq.curvalue < 0 ) @@ -936,6 +1718,40 @@ static void GraphicsOptions_SetMenuItems( void ) break; } + if ( videoEngineConfig.supportRendererSelect ) { + char buffer[256]; + trap_Cvar_VariableStringBuffer( "cl_renderer", buffer, sizeof( buffer ) ); + if ( !Q_stricmp( buffer, "opengl1" ) ) { + s_graphicsoptions.renderer.listnames = s_renderer_Names; + s_graphicsoptions.renderer.curvalue = 0; + } else if ( !Q_stricmp( buffer, "opengl2" ) ) { + s_graphicsoptions.renderer.listnames = s_renderer_Names; + s_graphicsoptions.renderer.curvalue = 1; + } else { + // set button to "custom", meaning to leave the existing value unchanged + s_graphicsoptions.renderer.listnames = s_renderer_NamesUnknown; + s_graphicsoptions.renderer.curvalue = 2; + } + } + + if ( videoEngineConfig.anisotropicFilteringVideoMenu ) { + s_graphicsoptions.anisotropic.curvalue = UI_GetAnisotropyLevel(); + } + + if ( videoEngineConfig.supportMultisample ) { + int level = VMExt_GVCommandInt( "cmd_get_multisample", 0 ); + if ( level >= 4 ) + s_graphicsoptions.multisample.curvalue = 2; + else if ( level >= 2 ) + s_graphicsoptions.multisample.curvalue = 1; + else + s_graphicsoptions.multisample.curvalue = 0; + } + + if ( videoEngineConfig.supportVSync ) { + s_graphicsoptions.vsync.curvalue = trap_Cvar_VariableValue( "r_swapInterval" ) ? 1 : 0; + } + if ( s_graphicsoptions.fs.curvalue == 0 ) { s_graphicsoptions.colordepth.curvalue = 0; @@ -1031,6 +1847,14 @@ static void Video_MenuEvent (void* ptr, int event) } break; + case ID_VIDEOBRIGHTNESS: + if (m != &s_brightness.menu) // Not already in menu? + { + UI_PopMenu(); // Get rid of whatever is ontop + UI_BrightnessMenu_Init(); // Move to the Brightness Menu + } + break; + case ID_CONTROLS: UI_PopMenu(); // Get rid of whatever is ontop // UI_SetupWeaponsMenu(); // Move to the Controls Menu @@ -1139,6 +1963,8 @@ static void VideoData_MenuInit( void ) { int x,y,width,inc; + UI_InitVideoEngineConfig(); + UI_VideoDataMenu_Cache(); // Menu Data @@ -1172,40 +1998,63 @@ static void VideoData_MenuInit( void ) s_graphicsoptions.list.color2 = CT_LTPURPLE1; s_graphicsoptions.list.textX = 5; s_graphicsoptions.list.textY = 2; - s_graphicsoptions.list.listnames = s_graphics_options_Names; + s_graphicsoptions.list.listnames = + videoEngineConfig.modern_templates ? s_graphics_options_modern_Names : s_graphics_options_Names; s_graphicsoptions.list.width = width; inc = 20; - y += inc; - s_graphicsoptions.driver.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.driver.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.driver.generic.x = x; - s_graphicsoptions.driver.generic.y = y; - s_graphicsoptions.driver.textEnum = MBT_VIDEODRIVER; - s_graphicsoptions.driver.textcolor = CT_BLACK; - s_graphicsoptions.driver.textcolor2 = CT_WHITE; - s_graphicsoptions.driver.color = CT_DKPURPLE1; - s_graphicsoptions.driver.color2 = CT_LTPURPLE1; - s_graphicsoptions.driver.textX = 5; - s_graphicsoptions.driver.textY = 2; - s_graphicsoptions.driver.listnames = s_driver_Names; - s_graphicsoptions.driver.curvalue = (uis.glconfig.driverType == GLDRV_VOODOO); - s_graphicsoptions.driver.width = width; - y += inc; - s_graphicsoptions.allow_extensions.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.allow_extensions.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.allow_extensions.generic.x = x; - s_graphicsoptions.allow_extensions.generic.y = y; - s_graphicsoptions.allow_extensions.textEnum = MBT_VIDEOGLEXTENTIONS; - s_graphicsoptions.allow_extensions.textcolor = CT_BLACK; - s_graphicsoptions.allow_extensions.textcolor2 = CT_WHITE; - s_graphicsoptions.allow_extensions.color = CT_DKPURPLE1; - s_graphicsoptions.allow_extensions.color2 = CT_LTPURPLE1; - s_graphicsoptions.allow_extensions.textX = 5; - s_graphicsoptions.allow_extensions.textY = 2; - s_graphicsoptions.allow_extensions.listnames = s_OffOnNone_Names; - s_graphicsoptions.allow_extensions.width = width; + if ( videoEngineConfig.supportGlDriver ) { + y += inc; + s_graphicsoptions.driver.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.driver.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.driver.generic.x = x; + s_graphicsoptions.driver.generic.y = y; + s_graphicsoptions.driver.textEnum = MBT_VIDEODRIVER; + s_graphicsoptions.driver.textcolor = CT_BLACK; + s_graphicsoptions.driver.textcolor2 = CT_WHITE; + s_graphicsoptions.driver.color = CT_DKPURPLE1; + s_graphicsoptions.driver.color2 = CT_LTPURPLE1; + s_graphicsoptions.driver.textX = 5; + s_graphicsoptions.driver.textY = 2; + s_graphicsoptions.driver.listnames = s_driver_Names; + s_graphicsoptions.driver.curvalue = (uis.glconfig.driverType == GLDRV_VOODOO); + s_graphicsoptions.driver.width = width; + } + + if ( videoEngineConfig.supportRendererSelect ) { + y += inc; + s_graphicsoptions.renderer.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.renderer.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.renderer.generic.x = x; + s_graphicsoptions.renderer.generic.y = y; + s_graphicsoptions.renderer.textEnum = MBT_VIDEO_RENDERER; + s_graphicsoptions.renderer.textcolor = CT_BLACK; + s_graphicsoptions.renderer.textcolor2 = CT_WHITE; + s_graphicsoptions.renderer.color = CT_DKPURPLE1; + s_graphicsoptions.renderer.color2 = CT_LTPURPLE1; + s_graphicsoptions.renderer.textX = 5; + s_graphicsoptions.renderer.textY = 2; + s_graphicsoptions.renderer.listnames = s_renderer_Names; + s_graphicsoptions.renderer.width = width; + } + + if ( videoEngineConfig.supportAllowExtensions ) { + y += inc; + s_graphicsoptions.allow_extensions.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.allow_extensions.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.allow_extensions.generic.x = x; + s_graphicsoptions.allow_extensions.generic.y = y; + s_graphicsoptions.allow_extensions.textEnum = MBT_VIDEOGLEXTENTIONS; + s_graphicsoptions.allow_extensions.textcolor = CT_BLACK; + s_graphicsoptions.allow_extensions.textcolor2 = CT_WHITE; + s_graphicsoptions.allow_extensions.color = CT_DKPURPLE1; + s_graphicsoptions.allow_extensions.color2 = CT_LTPURPLE1; + s_graphicsoptions.allow_extensions.textX = 5; + s_graphicsoptions.allow_extensions.textY = 2; + s_graphicsoptions.allow_extensions.listnames = s_OffOnNone_Names; + s_graphicsoptions.allow_extensions.width = width; + } y += inc; // references/modifies "r_mode" @@ -1214,7 +2063,8 @@ static void VideoData_MenuInit( void ) s_graphicsoptions.mode.generic.x = x; s_graphicsoptions.mode.generic.y = y; s_graphicsoptions.mode.generic.callback = GraphicsOptions_Event; - s_graphicsoptions.mode.textEnum = MBT_VIDEOMODE; + s_graphicsoptions.mode.textEnum = + videoEngineConfig.windowed_r_mode ? MBT_VIDEO_WINDOW_SIZE : MBT_VIDEOMODE; s_graphicsoptions.mode.textcolor = CT_BLACK; s_graphicsoptions.mode.textcolor2 = CT_WHITE; s_graphicsoptions.mode.color = CT_DKPURPLE1; @@ -1224,20 +2074,22 @@ static void VideoData_MenuInit( void ) s_graphicsoptions.mode.listnames = s_resolutions; s_graphicsoptions.mode.width = width; - y += inc; - s_graphicsoptions.colordepth.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.colordepth.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.colordepth.generic.x = x; - s_graphicsoptions.colordepth.generic.y = y; - s_graphicsoptions.colordepth.textEnum = MBT_VIDEOCOLORDEPTH; - s_graphicsoptions.colordepth.textcolor = CT_BLACK; - s_graphicsoptions.colordepth.textcolor2 = CT_WHITE; - s_graphicsoptions.colordepth.color = CT_DKPURPLE1; - s_graphicsoptions.colordepth.color2 = CT_LTPURPLE1; - s_graphicsoptions.colordepth.textX = 5; - s_graphicsoptions.colordepth.textY = 2; - s_graphicsoptions.colordepth.listnames = s_colordepth_Names; - s_graphicsoptions.colordepth.width = width; + if ( videoEngineConfig.supportColorDepth ) { + y += inc; + s_graphicsoptions.colordepth.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.colordepth.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.colordepth.generic.x = x; + s_graphicsoptions.colordepth.generic.y = y; + s_graphicsoptions.colordepth.textEnum = MBT_VIDEOCOLORDEPTH; + s_graphicsoptions.colordepth.textcolor = CT_BLACK; + s_graphicsoptions.colordepth.textcolor2 = CT_WHITE; + s_graphicsoptions.colordepth.color = CT_DKPURPLE1; + s_graphicsoptions.colordepth.color2 = CT_LTPURPLE1; + s_graphicsoptions.colordepth.textX = 5; + s_graphicsoptions.colordepth.textY = 2; + s_graphicsoptions.colordepth.listnames = s_colordepth_Names; + s_graphicsoptions.colordepth.width = width; + } y += inc; s_graphicsoptions.fs.generic.type = MTYPE_SPINCONTROL; @@ -1300,21 +2152,23 @@ static void VideoData_MenuInit( void ) s_graphicsoptions.tq.listnames = s_4quality_Names; s_graphicsoptions.tq.width = width; - y += inc; - // references/modifies "r_textureBits" - s_graphicsoptions.texturebits.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.texturebits.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.texturebits.generic.x = x; - s_graphicsoptions.texturebits.generic.y = y; - s_graphicsoptions.texturebits.textEnum = MBT_VIDEOTEXTUREBITS; - s_graphicsoptions.texturebits.textcolor = CT_BLACK; - s_graphicsoptions.texturebits.textcolor2 = CT_WHITE; - s_graphicsoptions.texturebits.color = CT_DKPURPLE1; - s_graphicsoptions.texturebits.color2 = CT_LTPURPLE1; - s_graphicsoptions.texturebits.textX = 5; - s_graphicsoptions.texturebits.textY = 2; - s_graphicsoptions.texturebits.listnames = s_tqbits_Names; - s_graphicsoptions.texturebits.width = width; + if ( videoEngineConfig.supportTextureBits ) { + y += inc; + // references/modifies "r_textureBits" + s_graphicsoptions.texturebits.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.texturebits.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.texturebits.generic.x = x; + s_graphicsoptions.texturebits.generic.y = y; + s_graphicsoptions.texturebits.textEnum = MBT_VIDEOTEXTUREBITS; + s_graphicsoptions.texturebits.textcolor = CT_BLACK; + s_graphicsoptions.texturebits.textcolor2 = CT_WHITE; + s_graphicsoptions.texturebits.color = CT_DKPURPLE1; + s_graphicsoptions.texturebits.color2 = CT_LTPURPLE1; + s_graphicsoptions.texturebits.textX = 5; + s_graphicsoptions.texturebits.textY = 2; + s_graphicsoptions.texturebits.listnames = s_tqbits_Names; + s_graphicsoptions.texturebits.width = width; + } y += inc; // references/modifies "r_textureMode" @@ -1332,21 +2186,23 @@ static void VideoData_MenuInit( void ) s_graphicsoptions.filter.listnames = s_filter_Names; s_graphicsoptions.filter.width = width; - y += inc; - // references/modifies "r_lowEndVideo" - s_graphicsoptions.simpleshaders.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.simpleshaders.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.simpleshaders.generic.x = x; - s_graphicsoptions.simpleshaders.generic.y = y; - s_graphicsoptions.simpleshaders.textEnum = MBT_SIMPLESHADER; - s_graphicsoptions.simpleshaders.textcolor = CT_BLACK; - s_graphicsoptions.simpleshaders.textcolor2 = CT_WHITE; - s_graphicsoptions.simpleshaders.color = CT_DKPURPLE1; - s_graphicsoptions.simpleshaders.color2 = CT_LTPURPLE1; - s_graphicsoptions.simpleshaders.textX = 5; - s_graphicsoptions.simpleshaders.textY = 2; - s_graphicsoptions.simpleshaders.listnames = s_OffOnNone_Names; - s_graphicsoptions.simpleshaders.width = width; + if ( videoEngineConfig.supportSimpleShaders ) { + y += inc; + // references/modifies "r_lowEndVideo" + s_graphicsoptions.simpleshaders.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.simpleshaders.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.simpleshaders.generic.x = x; + s_graphicsoptions.simpleshaders.generic.y = y; + s_graphicsoptions.simpleshaders.textEnum = MBT_SIMPLESHADER; + s_graphicsoptions.simpleshaders.textcolor = CT_BLACK; + s_graphicsoptions.simpleshaders.textcolor2 = CT_WHITE; + s_graphicsoptions.simpleshaders.color = CT_DKPURPLE1; + s_graphicsoptions.simpleshaders.color2 = CT_LTPURPLE1; + s_graphicsoptions.simpleshaders.textX = 5; + s_graphicsoptions.simpleshaders.textY = 2; + s_graphicsoptions.simpleshaders.listnames = s_OffOnNone_Names; + s_graphicsoptions.simpleshaders.width = width; + } y += inc; // references/modifies "r_ext_compress_textures" @@ -1364,6 +2220,57 @@ static void VideoData_MenuInit( void ) s_graphicsoptions.compresstextures.listnames = s_OffOnNone_Names; s_graphicsoptions.compresstextures.width = width; + if ( videoEngineConfig.anisotropicFilteringVideoMenu ) { + y += inc; + s_graphicsoptions.anisotropic.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.anisotropic.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.anisotropic.generic.x = x; + s_graphicsoptions.anisotropic.generic.y = y; + s_graphicsoptions.anisotropic.textEnum = MBT_VIDEO_ANISOTROPIC_LEVEL; + s_graphicsoptions.anisotropic.textcolor = CT_BLACK; + s_graphicsoptions.anisotropic.textcolor2 = CT_WHITE; + s_graphicsoptions.anisotropic.color = CT_DKPURPLE1; + s_graphicsoptions.anisotropic.color2 = CT_LTPURPLE1; + s_graphicsoptions.anisotropic.textX = 5; + s_graphicsoptions.anisotropic.textY = 2; + s_graphicsoptions.anisotropic.listnames = videoEngineConfig.supportMaxAnisotropy ? s_anisotropic_Names : s_OffOnNone_Names; + s_graphicsoptions.anisotropic.width = width; + } + + if ( videoEngineConfig.supportMultisample ) { + y += inc; + s_graphicsoptions.multisample.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.multisample.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.multisample.generic.x = x; + s_graphicsoptions.multisample.generic.y = y; + s_graphicsoptions.multisample.textEnum = MBT_VIDEO_ANTI_ALIASING; + s_graphicsoptions.multisample.textcolor = CT_BLACK; + s_graphicsoptions.multisample.textcolor2 = CT_WHITE; + s_graphicsoptions.multisample.color = CT_DKPURPLE1; + s_graphicsoptions.multisample.color2 = CT_LTPURPLE1; + s_graphicsoptions.multisample.textX = 5; + s_graphicsoptions.multisample.textY = 2; + s_graphicsoptions.multisample.listnames = s_multisample_Names; + s_graphicsoptions.multisample.width = width; + } + + if ( videoEngineConfig.supportVSync ) { + y += inc; + s_graphicsoptions.vsync.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.vsync.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.vsync.generic.x = x; + s_graphicsoptions.vsync.generic.y = y; + s_graphicsoptions.vsync.textEnum = MBT_VIDEO_VERTICAL_SYNC; + s_graphicsoptions.vsync.textcolor = CT_BLACK; + s_graphicsoptions.vsync.textcolor2 = CT_WHITE; + s_graphicsoptions.vsync.color = CT_DKPURPLE1; + s_graphicsoptions.vsync.color2 = CT_LTPURPLE1; + s_graphicsoptions.vsync.textX = 5; + s_graphicsoptions.vsync.textY = 2; + s_graphicsoptions.vsync.listnames = s_OffOnNone_Names; + s_graphicsoptions.vsync.width = width; + } + s_graphicsoptions.apply.generic.type = MTYPE_ACTION; s_graphicsoptions.apply.generic.flags = QMF_HIGHLIGHT_IF_FOCUS|QMF_GRAYED; s_graphicsoptions.apply.generic.x = 501; @@ -1381,29 +2288,51 @@ static void VideoData_MenuInit( void ) s_graphicsoptions.apply.width = 110; s_graphicsoptions.apply.height = 100; + GraphicsOptions_SetMenuItems(); + GraphicsOptions_GetInitialVideo(); + SetupMenu_TopButtons(&s_videodata.menu,MENU_VIDEODATA,&s_graphicsoptions.apply); Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.list); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.driver); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.allow_extensions); + if ( videoEngineConfig.supportGlDriver ) { + Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.driver); + } + if ( videoEngineConfig.supportRendererSelect ) { + Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.renderer); + } + if ( videoEngineConfig.supportAllowExtensions ) { + Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.allow_extensions); + } Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.mode); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.colordepth); + if ( videoEngineConfig.supportColorDepth ) { + Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.colordepth); + } Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.fs); // Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.lighting); Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.geometry); Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.tq); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.texturebits); + if ( videoEngineConfig.supportTextureBits ) { + Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.texturebits); + } Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.filter); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.simpleshaders); + if ( videoEngineConfig.supportSimpleShaders ) { + Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.simpleshaders); + } Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.compresstextures); + if ( videoEngineConfig.anisotropicFilteringVideoMenu ) { + Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.anisotropic); + } + if ( videoEngineConfig.supportMultisample ) { + Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.multisample); + } + if ( videoEngineConfig.supportVSync ) { + Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.vsync); + } Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.apply); Video_SideButtons(&s_videodata.menu,ID_VIDEODATA); - GraphicsOptions_SetMenuItems(); - GraphicsOptions_GetInitialVideo(); - if ( uis.glconfig.driverType == GLDRV_ICD && uis.glconfig.hardwareType == GLHW_3DFX_2D3D ) { @@ -1501,10 +2430,45 @@ void Video_SideButtons(menuframework_s *menu,int menuType) s_video_data2.textcolor2 = CT_WHITE; } + s_video_brightness.generic.type = MTYPE_BITMAP; + s_video_brightness.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_video_brightness.generic.x = video_sidebuttons[2][0]; + s_video_brightness.generic.y = video_sidebuttons[2][1]; + s_video_brightness.generic.name = GRAPHIC_SQUARE; + s_video_brightness.generic.id = ID_VIDEOBRIGHTNESS; + if (menuType == ID_VIDEODATA) + { + s_video_brightness.generic.callback = VideoSideButtons_MenuEvent; + } + else + { + s_video_brightness.generic.callback = Video_MenuEvent; + } + s_video_brightness.width = MENU_BUTTON_MED_WIDTH - 10; + s_video_brightness.height = MENU_BUTTON_MED_HEIGHT; + s_video_brightness.color = CT_DKPURPLE1; + s_video_brightness.color2 = CT_LTPURPLE1; + s_video_brightness.textX = 5; + s_video_brightness.textY = 2; + s_video_brightness.textEnum = MBT_BRIGHTNESS; + s_video_brightness.textcolor = CT_WHITE; + s_video_brightness.textcolor2 = CT_WHITE; + if (menuType == ID_VIDEOBRIGHTNESS) + { + s_video_brightness.textcolor = CT_WHITE; + s_video_brightness.textcolor2 = CT_WHITE; + s_video_brightness.generic.flags = QMF_GRAYED; + } + else + { + s_video_brightness.textcolor = CT_BLACK; + s_video_brightness.textcolor2 = CT_WHITE; + } + s_video_drivers.generic.type = MTYPE_BITMAP; s_video_drivers.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_video_drivers.generic.x = video_sidebuttons[2][0]; - s_video_drivers.generic.y = video_sidebuttons[2][1]; + s_video_drivers.generic.x = video_sidebuttons[3][0]; + s_video_drivers.generic.y = video_sidebuttons[3][1]; s_video_drivers.generic.name = GRAPHIC_SQUARE; s_video_drivers.generic.id = ID_VIDEODRIVERS; if (menuType == ID_VIDEODATA) @@ -1536,6 +2500,7 @@ void Video_SideButtons(menuframework_s *menu,int menuType) Menu_AddItem( menu, ( void * )&s_video_data); Menu_AddItem( menu, ( void * )&s_video_data2); + Menu_AddItem( menu, ( void * )&s_video_brightness); Menu_AddItem( menu, ( void * )&s_video_drivers); } @@ -1916,23 +2881,6 @@ void UI_VideoDriverMenu( void ) UI_PushMenu( &s_videodriver.menu ); } -/* -================= -GammaCallback2 -================= -*/ -void GammaCallback2( void *s, int notification ) -{ - if (notification != QM_ACTIVATED) - return; - - s_videodata2.apply_action2.generic.flags &= ~QMF_GRAYED; - s_videodata2.apply_action2.generic.flags |= QMF_BLINK; - - GammaCallback(s,notification ); - -} - /* ================= @@ -1941,8 +2889,6 @@ M_VideoData2Menu_Graphics */ void M_VideoData2Menu_Graphics (void) { - int y; - UI_MenuFrame(&s_videodata2.menu); UI_DrawProportionalString( 74, 66, "925",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); @@ -1953,25 +2899,6 @@ void M_VideoData2Menu_Graphics (void) UI_Setup_MenuButtons(); - y = 191; - if (uis.glconfig.deviceSupportsGamma) - { - trap_R_SetColor( colorTable[CT_DKGREY]); - UI_DrawHandlePic( 178, y, 68, 68, uis.whiteShader); // - trap_R_SetColor( colorTable[CT_WHITE]); - UI_DrawHandlePic( 180, y+2, 64, 64, s_videodata2.gamma); // Starfleet graphic - - UI_DrawProportionalString( 256, y + 5, menu_normal_text[MNT_GAMMA_LINE1],UI_SMALLFONT, colorTable[CT_LTGOLD1]); - UI_DrawProportionalString( 256, y + 25, menu_normal_text[MNT_GAMMA_LINE2],UI_SMALLFONT, colorTable[CT_LTGOLD1]); - UI_DrawProportionalString( 256, y + 45, menu_normal_text[MNT_GAMMA_LINE3],UI_SMALLFONT,colorTable[CT_LTGOLD1]); - } - else - { - UI_DrawProportionalString( 178, y + 5, menu_normal_text[MNT_GAMMA2_LINE1],UI_SMALLFONT, colorTable[CT_LTGOLD1]); - UI_DrawProportionalString( 178, y + 25,menu_normal_text[MNT_GAMMA2_LINE2],UI_SMALLFONT, colorTable[CT_LTGOLD1]); - } - - // Brackets around Video Data trap_R_SetColor( colorTable[CT_LTPURPLE1]); UI_DrawHandlePic(158,163, 16, 16, uis.graphicBracket1CornerLU); @@ -2010,7 +2937,6 @@ UI_VideoData2Menu_Cache void UI_VideoData2Menu_Cache(void) { s_videodata2.top = trap_R_RegisterShaderNoMip("menu/common/corner_ur_8_30.tga"); - s_videodata2.gamma = trap_R_RegisterShaderNoMip("menu/special/gamma_test.tga"); trap_R_RegisterShaderNoMip(PIC_MONBAR2); trap_R_RegisterShaderNoMip(PIC_SLIDER); } @@ -2030,6 +2956,61 @@ void VideoData2_EnabledDisableCenterHudSlider( void ) { } } +/* +================= +VideoData2_Event +================= +*/ +static void VideoData2_Event( void* ptr, int notification ) +{ + if( notification != QM_ACTIVATED ) + { + return; + } + + if ( ptr == &s_videodata2.aspectCorrection ) { + trap_Cvar_SetValue( "cg_aspectCorrect", s_videodata2.aspectCorrection.curvalue ); + VideoData2_EnabledDisableCenterHudSlider(); + } + + else if ( ptr == &s_videodata2.centerHud_slider ) { + trap_Cvar_SetValue( "cg_aspectCorrectCenterHud", s_videodata2.centerHud_slider.curvalue / 10.0f ); + } + + else if ( ptr == &s_videodata2.fov_slider ) { + // Use asterisk notation to enable horizontal scaling. + trap_Cvar_Set( "cg_fov", va( "%f*", s_videodata2.fov_slider.curvalue ) ); + } + + else if ( ptr == &s_videodata2.screensize_slider ) { + trap_Cvar_SetValue( "cg_viewsize", s_videodata2.screensize_slider.curvalue ); + } + + else if ( ptr == &s_videodata2.flares ) { + trap_Cvar_SetValue( "r_flares", s_videodata2.flares.curvalue ); + } + + else if ( ptr == &s_videodata2.wallmarks ) { + trap_Cvar_SetValue( "cg_marks", s_videodata2.wallmarks.curvalue ); + } + + else if ( ptr == &s_videodata2.dynamiclights ) { + trap_Cvar_SetValue( "r_dynamiclight", s_videodata2.dynamiclights.curvalue ); + } + + else if ( ptr == &s_videodata2.simpleitems ) { + trap_Cvar_SetValue( "cg_simpleItems", s_videodata2.simpleitems.curvalue ); + } + + else if ( ptr == &s_videodata2.synceveryframe ) { + trap_Cvar_SetValue( "r_finish", s_videodata2.synceveryframe.curvalue ); + } + + else if ( ptr == &s_videodata2.anisotropic ) { + UI_SetAnisotropyLevel( s_videodata2.anisotropic.curvalue ); + } +} + /* ================= VideoData2_MenuInit @@ -2038,6 +3019,11 @@ VideoData2_MenuInit static void VideoData2_MenuInit( void ) { int x,y; + int inc = 22; + qboolean suppressViewSize = VMExt_GVCommandInt( "ui_suppress_cg_viewsize", 0 ) + && trap_Cvar_VariableValue( "cg_viewsize" ) >= 100.0f ? qtrue : qfalse; + + UI_InitVideoEngineConfig(); UI_VideoData2Menu_Cache(); @@ -2061,144 +3047,31 @@ static void VideoData2_MenuInit( void ) Video_SideButtons(&s_videodata2.menu,ID_VIDEODATA2); - x = 180; - y = 267; - s_videodata2.gamma_slider.generic.type = MTYPE_SLIDER; - s_videodata2.gamma_slider.generic.x = x + 162; - s_videodata2.gamma_slider.generic.y = y; - s_videodata2.gamma_slider.generic.flags = QMF_SMALLFONT; - s_videodata2.gamma_slider.generic.callback = GammaCallback2; - s_videodata2.gamma_slider.minvalue = 5; - s_videodata2.gamma_slider.maxvalue = 30; - s_videodata2.gamma_slider.color = CT_DKPURPLE1; - s_videodata2.gamma_slider.color2 = CT_LTPURPLE1; - s_videodata2.gamma_slider.generic.name = PIC_MONBAR2; - s_videodata2.gamma_slider.width = 256; - s_videodata2.gamma_slider.height = 32; - s_videodata2.gamma_slider.focusWidth = 145; - s_videodata2.gamma_slider.focusHeight = 18; - s_videodata2.gamma_slider.picName = GRAPHIC_SQUARE; - s_videodata2.gamma_slider.picX = x; - s_videodata2.gamma_slider.picY = y; - s_videodata2.gamma_slider.picWidth = MENU_BUTTON_MED_WIDTH + 21; - s_videodata2.gamma_slider.picHeight = MENU_BUTTON_MED_HEIGHT; - s_videodata2.gamma_slider.textX = MENU_BUTTON_TEXT_X; - s_videodata2.gamma_slider.textY = MENU_BUTTON_TEXT_Y; - s_videodata2.gamma_slider.textEnum = MBT_BRIGHTNESS; - s_videodata2.gamma_slider.textcolor = CT_BLACK; - s_videodata2.gamma_slider.textcolor2 = CT_WHITE; - s_videodata2.gamma_slider.thumbName = PIC_SLIDER; - s_videodata2.gamma_slider.thumbHeight = 32; - s_videodata2.gamma_slider.thumbWidth = 16; - s_videodata2.gamma_slider.thumbGraphicWidth = 9; - s_videodata2.gamma_slider.thumbColor = CT_DKBLUE1; - s_videodata2.gamma_slider.thumbColor2 = CT_LTBLUE1; - - s_videodata2.apply_action2.generic.type = MTYPE_ACTION; - s_videodata2.apply_action2.generic.flags = QMF_HIGHLIGHT_IF_FOCUS|QMF_GRAYED; - s_videodata2.apply_action2.generic.x = 490; - s_videodata2.apply_action2.generic.y = 191; - s_videodata2.apply_action2.generic.callback = ApplyChanges2; - s_videodata2.apply_action2.textEnum = MBT_ACCEPT; - s_videodata2.apply_action2.textcolor = CT_BLACK; - s_videodata2.apply_action2.textcolor2 = CT_WHITE; - s_videodata2.apply_action2.textcolor3 = CT_LTGREY; - s_videodata2.apply_action2.color = CT_DKPURPLE1; - s_videodata2.apply_action2.color2 = CT_LTPURPLE1; - s_videodata2.apply_action2.color3 = CT_DKGREY; - s_videodata2.apply_action2.textX = 5; - s_videodata2.apply_action2.textY = 30; - s_videodata2.apply_action2.width = 82; - s_videodata2.apply_action2.height = 70; - - y += 25; - s_videodata2.fov_slider.generic.type = MTYPE_SLIDER; - s_videodata2.fov_slider.generic.x = x + 162; - s_videodata2.fov_slider.generic.y = y; - s_videodata2.fov_slider.generic.flags = QMF_SMALLFONT; - s_videodata2.fov_slider.generic.callback = FovCallback; - s_videodata2.fov_slider.minvalue = 60; - s_videodata2.fov_slider.maxvalue = 120; - s_videodata2.fov_slider.color = CT_DKPURPLE1; - s_videodata2.fov_slider.color2 = CT_LTPURPLE1; - s_videodata2.fov_slider.generic.name = PIC_MONBAR2; - s_videodata2.fov_slider.width = 256; - s_videodata2.fov_slider.height = 32; - s_videodata2.fov_slider.focusWidth = 145; - s_videodata2.fov_slider.focusHeight = 18; - s_videodata2.fov_slider.picName = GRAPHIC_SQUARE; - s_videodata2.fov_slider.picX = x; - s_videodata2.fov_slider.picY = y; - s_videodata2.fov_slider.picWidth = MENU_BUTTON_MED_WIDTH + 21; - s_videodata2.fov_slider.picHeight = MENU_BUTTON_MED_HEIGHT; - s_videodata2.fov_slider.textX = MENU_BUTTON_TEXT_X; - s_videodata2.fov_slider.textY = MENU_BUTTON_TEXT_Y; - s_videodata2.fov_slider.textEnum = MBT_FOV; - s_videodata2.fov_slider.textcolor = CT_BLACK; - s_videodata2.fov_slider.textcolor2 = CT_WHITE; - s_videodata2.fov_slider.thumbName = PIC_SLIDER; - s_videodata2.fov_slider.thumbHeight = 32; - s_videodata2.fov_slider.thumbWidth = 16; - s_videodata2.fov_slider.thumbGraphicWidth = 9; - s_videodata2.fov_slider.thumbColor = CT_DKBLUE1; - s_videodata2.fov_slider.thumbColor2 = CT_LTBLUE1; - - y += 25; - s_videodata2.screensize_slider.generic.type = MTYPE_SLIDER; - s_videodata2.screensize_slider.generic.x = x + 162; - s_videodata2.screensize_slider.generic.y = y; - s_videodata2.screensize_slider.generic.flags = QMF_SMALLFONT; - s_videodata2.screensize_slider.generic.callback = ScreensizeCallback; - s_videodata2.screensize_slider.minvalue = 30; - s_videodata2.screensize_slider.maxvalue = 100; - s_videodata2.screensize_slider.color = CT_DKPURPLE1; - s_videodata2.screensize_slider.color2 = CT_LTPURPLE1; - s_videodata2.screensize_slider.generic.name = PIC_MONBAR2; - s_videodata2.screensize_slider.width = 256; - s_videodata2.screensize_slider.height = 32; - s_videodata2.screensize_slider.focusWidth = 145; - s_videodata2.screensize_slider.focusHeight = 18; - s_videodata2.screensize_slider.picName = GRAPHIC_SQUARE; - s_videodata2.screensize_slider.picX = x; - s_videodata2.screensize_slider.picY = y; - s_videodata2.screensize_slider.picWidth = MENU_BUTTON_MED_WIDTH + 21; - s_videodata2.screensize_slider.picHeight = MENU_BUTTON_MED_HEIGHT; - s_videodata2.screensize_slider.textX = MENU_BUTTON_TEXT_X; - s_videodata2.screensize_slider.textY = MENU_BUTTON_TEXT_Y; - s_videodata2.screensize_slider.textEnum = MBT_SCREENSIZE; - s_videodata2.screensize_slider.textcolor = CT_BLACK; - s_videodata2.screensize_slider.textcolor2 = CT_WHITE; - s_videodata2.screensize_slider.thumbName = PIC_SLIDER; - s_videodata2.screensize_slider.thumbHeight = 32; - s_videodata2.screensize_slider.thumbWidth = 16; - s_videodata2.screensize_slider.thumbGraphicWidth= 9; - s_videodata2.screensize_slider.thumbColor = CT_DKBLUE1; - s_videodata2.screensize_slider.thumbColor2 = CT_LTBLUE1; - - y += 25; + x = 175; + y = 183; s_videodata2.aspectCorrection.generic.type = MTYPE_SPINCONTROL; s_videodata2.aspectCorrection.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; s_videodata2.aspectCorrection.generic.x = x; s_videodata2.aspectCorrection.generic.y = y; s_videodata2.aspectCorrection.generic.name = GRAPHIC_BUTTONRIGHT; - s_videodata2.aspectCorrection.generic.callback = AspectCorrectionCallback; + s_videodata2.aspectCorrection.generic.callback = VideoData2_Event; s_videodata2.aspectCorrection.color = CT_DKPURPLE1; - s_videodata2.aspectCorrection.color2 = CT_LTPURPLE1; + s_videodata2.aspectCorrection.color2 = CT_LTPURPLE1; s_videodata2.aspectCorrection.textX = MENU_BUTTON_TEXT_X; s_videodata2.aspectCorrection.textY = MENU_BUTTON_TEXT_Y; s_videodata2.aspectCorrection.textEnum = MBT_ASPECTCORRECTION; s_videodata2.aspectCorrection.textcolor = CT_BLACK; - s_videodata2.aspectCorrection.textcolor2 = CT_WHITE; + s_videodata2.aspectCorrection.textcolor2 = CT_WHITE; s_videodata2.aspectCorrection.listnames = s_OffOnNone_Names; - y += 25; + y += inc; s_videodata2.centerHud_slider.generic.type = MTYPE_SLIDER; s_videodata2.centerHud_slider.generic.x = x + 162; s_videodata2.centerHud_slider.generic.y = y; s_videodata2.centerHud_slider.generic.flags = QMF_SMALLFONT; - s_videodata2.centerHud_slider.generic.callback = CenterHudCallback; + s_videodata2.centerHud_slider.generic.callback = VideoData2_Event; s_videodata2.centerHud_slider.minvalue = 0; - s_videodata2.centerHud_slider.maxvalue = 1; + s_videodata2.centerHud_slider.maxvalue = 10; s_videodata2.centerHud_slider.color = CT_DKPURPLE1; s_videodata2.centerHud_slider.color2 = CT_LTPURPLE1; s_videodata2.centerHud_slider.generic.name = PIC_MONBAR2; @@ -2223,33 +3096,185 @@ static void VideoData2_MenuInit( void ) s_videodata2.centerHud_slider.thumbColor = CT_DKBLUE1; s_videodata2.centerHud_slider.thumbColor2 = CT_LTBLUE1; - y += 25; - s_videodata2.anisotropicfiltering.generic.type = MTYPE_SPINCONTROL; - s_videodata2.anisotropicfiltering.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_videodata2.anisotropicfiltering.generic.x = x; - s_videodata2.anisotropicfiltering.generic.y = y; - s_videodata2.anisotropicfiltering.generic.name = GRAPHIC_BUTTONRIGHT; - s_videodata2.anisotropicfiltering.generic.callback = AnisotropicFilteringCallback; - s_videodata2.anisotropicfiltering.color = CT_DKPURPLE1; - s_videodata2.anisotropicfiltering.color2 = CT_LTPURPLE1; - s_videodata2.anisotropicfiltering.textX = MENU_BUTTON_TEXT_X; - s_videodata2.anisotropicfiltering.textY = MENU_BUTTON_TEXT_Y; - s_videodata2.anisotropicfiltering.textEnum = MBT_ANISOTROPICFILTERING; - s_videodata2.anisotropicfiltering.textcolor = CT_BLACK; - s_videodata2.anisotropicfiltering.textcolor2 = CT_WHITE; - s_videodata2.anisotropicfiltering.listnames = s_OffOnNone_Names; - - - Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.gamma_slider); - if (!uis.glconfig.deviceSupportsGamma) - { - Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.apply_action2); + y += inc; + s_videodata2.fov_slider.generic.type = MTYPE_SLIDER; + s_videodata2.fov_slider.generic.x = x + 162; + s_videodata2.fov_slider.generic.y = y; + s_videodata2.fov_slider.generic.flags = QMF_SMALLFONT; + s_videodata2.fov_slider.generic.callback = VideoData2_Event; + s_videodata2.fov_slider.minvalue = 60; + s_videodata2.fov_slider.maxvalue = 120; + s_videodata2.fov_slider.color = CT_DKPURPLE1; + s_videodata2.fov_slider.color2 = CT_LTPURPLE1; + s_videodata2.fov_slider.generic.name = PIC_MONBAR2; + s_videodata2.fov_slider.width = 256; + s_videodata2.fov_slider.height = 32; + s_videodata2.fov_slider.focusWidth = 145; + s_videodata2.fov_slider.focusHeight = 18; + s_videodata2.fov_slider.picName = GRAPHIC_SQUARE; + s_videodata2.fov_slider.picX = x; + s_videodata2.fov_slider.picY = y; + s_videodata2.fov_slider.picWidth = MENU_BUTTON_MED_WIDTH + 21; + s_videodata2.fov_slider.picHeight = MENU_BUTTON_MED_HEIGHT; + s_videodata2.fov_slider.textX = MENU_BUTTON_TEXT_X; + s_videodata2.fov_slider.textY = MENU_BUTTON_TEXT_Y; + s_videodata2.fov_slider.textEnum = MBT_FOV; + s_videodata2.fov_slider.textcolor = CT_BLACK; + s_videodata2.fov_slider.textcolor2 = CT_WHITE; + s_videodata2.fov_slider.thumbName = PIC_SLIDER; + s_videodata2.fov_slider.thumbHeight = 32; + s_videodata2.fov_slider.thumbWidth = 16; + s_videodata2.fov_slider.thumbGraphicWidth = 9; + s_videodata2.fov_slider.thumbColor = CT_DKBLUE1; + s_videodata2.fov_slider.thumbColor2 = CT_LTBLUE1; + + if ( !suppressViewSize ) { + y += inc; + s_videodata2.screensize_slider.generic.type = MTYPE_SLIDER; + s_videodata2.screensize_slider.generic.x = x + 162; + s_videodata2.screensize_slider.generic.y = y; + s_videodata2.screensize_slider.generic.flags = QMF_SMALLFONT; + s_videodata2.screensize_slider.generic.callback = VideoData2_Event; + s_videodata2.screensize_slider.minvalue = 30; + s_videodata2.screensize_slider.maxvalue = 100; + s_videodata2.screensize_slider.color = CT_DKPURPLE1; + s_videodata2.screensize_slider.color2 = CT_LTPURPLE1; + s_videodata2.screensize_slider.generic.name = PIC_MONBAR2; + s_videodata2.screensize_slider.width = 256; + s_videodata2.screensize_slider.height = 32; + s_videodata2.screensize_slider.focusWidth = 145; + s_videodata2.screensize_slider.focusHeight = 18; + s_videodata2.screensize_slider.picName = GRAPHIC_SQUARE; + s_videodata2.screensize_slider.picX = x; + s_videodata2.screensize_slider.picY = y; + s_videodata2.screensize_slider.picWidth = MENU_BUTTON_MED_WIDTH + 21; + s_videodata2.screensize_slider.picHeight = MENU_BUTTON_MED_HEIGHT; + s_videodata2.screensize_slider.textX = MENU_BUTTON_TEXT_X; + s_videodata2.screensize_slider.textY = MENU_BUTTON_TEXT_Y; + s_videodata2.screensize_slider.textEnum = MBT_SCREENSIZE; + s_videodata2.screensize_slider.textcolor = CT_BLACK; + s_videodata2.screensize_slider.textcolor2 = CT_WHITE; + s_videodata2.screensize_slider.thumbName = PIC_SLIDER; + s_videodata2.screensize_slider.thumbHeight = 32; + s_videodata2.screensize_slider.thumbWidth = 16; + s_videodata2.screensize_slider.thumbGraphicWidth= 9; + s_videodata2.screensize_slider.thumbColor = CT_DKBLUE1; + s_videodata2.screensize_slider.thumbColor2 = CT_LTBLUE1; } - Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.fov_slider); - Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.screensize_slider); - Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.centerHud_slider); - Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.anisotropicfiltering); + + y += inc; + s_videodata2.flares.generic.type = MTYPE_SPINCONTROL; + s_videodata2.flares.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_videodata2.flares.generic.x = x; + s_videodata2.flares.generic.y = y; + s_videodata2.flares.generic.name = GRAPHIC_BUTTONRIGHT; + s_videodata2.flares.generic.callback = VideoData2_Event; + s_videodata2.flares.color = CT_DKPURPLE1; + s_videodata2.flares.color2 = CT_LTPURPLE1; + s_videodata2.flares.textX = MENU_BUTTON_TEXT_X; + s_videodata2.flares.textY = MENU_BUTTON_TEXT_Y; + s_videodata2.flares.textEnum = MBT_LIGHTFLARES; + s_videodata2.flares.textcolor = CT_BLACK; + s_videodata2.flares.textcolor2 = CT_WHITE; + s_videodata2.flares.listnames = s_OffOnNone_Names; + + y += inc; + s_videodata2.wallmarks.generic.type = MTYPE_SPINCONTROL; + s_videodata2.wallmarks.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_videodata2.wallmarks.generic.x = x; + s_videodata2.wallmarks.generic.y = y; + s_videodata2.wallmarks.generic.name = GRAPHIC_BUTTONRIGHT; + s_videodata2.wallmarks.generic.callback = VideoData2_Event; + s_videodata2.wallmarks.color = CT_DKPURPLE1; + s_videodata2.wallmarks.color2 = CT_LTPURPLE1; + s_videodata2.wallmarks.textX = MENU_BUTTON_TEXT_X; + s_videodata2.wallmarks.textY = MENU_BUTTON_TEXT_Y; + s_videodata2.wallmarks.textEnum = MBT_WALLMARKS1; + s_videodata2.wallmarks.textcolor = CT_BLACK; + s_videodata2.wallmarks.textcolor2 = CT_WHITE; + s_videodata2.wallmarks.listnames = s_OffOnNone_Names; + + y += inc; + s_videodata2.dynamiclights.generic.type = MTYPE_SPINCONTROL; + s_videodata2.dynamiclights.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_videodata2.dynamiclights.generic.x = x; + s_videodata2.dynamiclights.generic.y = y; + s_videodata2.dynamiclights.generic.name = GRAPHIC_BUTTONRIGHT; + s_videodata2.dynamiclights.generic.callback = VideoData2_Event; + s_videodata2.dynamiclights.color = CT_DKPURPLE1; + s_videodata2.dynamiclights.color2 = CT_LTPURPLE1; + s_videodata2.dynamiclights.textX = MENU_BUTTON_TEXT_X; + s_videodata2.dynamiclights.textY = MENU_BUTTON_TEXT_Y; + s_videodata2.dynamiclights.textEnum = MBT_DYNAMICLIGHTS1; + s_videodata2.dynamiclights.textcolor = CT_BLACK; + s_videodata2.dynamiclights.textcolor2 = CT_WHITE; + s_videodata2.dynamiclights.listnames = s_OffOnNone_Names; + + y += inc; + s_videodata2.simpleitems.generic.type = MTYPE_SPINCONTROL; + s_videodata2.simpleitems.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_videodata2.simpleitems.generic.x = x; + s_videodata2.simpleitems.generic.y = y; + s_videodata2.simpleitems.generic.name = GRAPHIC_BUTTONRIGHT; + s_videodata2.simpleitems.generic.callback = VideoData2_Event; + s_videodata2.simpleitems.color = CT_DKPURPLE1; + s_videodata2.simpleitems.color2 = CT_LTPURPLE1; + s_videodata2.simpleitems.textX = MENU_BUTTON_TEXT_X; + s_videodata2.simpleitems.textY = MENU_BUTTON_TEXT_Y; + s_videodata2.simpleitems.textEnum = MBT_SIMPLEITEMS; + s_videodata2.simpleitems.textcolor = CT_BLACK; + s_videodata2.simpleitems.textcolor2 = CT_WHITE; + s_videodata2.simpleitems.listnames = s_OffOnNone_Names; + + y += inc; + s_videodata2.synceveryframe.generic.type = MTYPE_SPINCONTROL; + s_videodata2.synceveryframe.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_videodata2.synceveryframe.generic.x = x; + s_videodata2.synceveryframe.generic.y = y; + s_videodata2.synceveryframe.generic.name = GRAPHIC_BUTTONRIGHT; + s_videodata2.synceveryframe.generic.callback = VideoData2_Event; + s_videodata2.synceveryframe.color = CT_DKPURPLE1; + s_videodata2.synceveryframe.color2 = CT_LTPURPLE1; + s_videodata2.synceveryframe.textX = MENU_BUTTON_TEXT_X; + s_videodata2.synceveryframe.textY = MENU_BUTTON_TEXT_Y; + s_videodata2.synceveryframe.textEnum = MBT_SYNCEVERYFRAME1; + s_videodata2.synceveryframe.textcolor = CT_BLACK; + s_videodata2.synceveryframe.textcolor2 = CT_WHITE; + s_videodata2.synceveryframe.listnames = s_OffOnNone_Names; + + if ( !videoEngineConfig.anisotropicFilteringVideoMenu ) { + y += inc; + s_videodata2.anisotropic.generic.type = MTYPE_SPINCONTROL; + s_videodata2.anisotropic.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_videodata2.anisotropic.generic.x = x; + s_videodata2.anisotropic.generic.y = y; + s_videodata2.anisotropic.generic.name = GRAPHIC_BUTTONRIGHT; + s_videodata2.anisotropic.generic.callback = VideoData2_Event; + s_videodata2.anisotropic.color = CT_DKPURPLE1; + s_videodata2.anisotropic.color2 = CT_LTPURPLE1; + s_videodata2.anisotropic.textX = MENU_BUTTON_TEXT_X; + s_videodata2.anisotropic.textY = MENU_BUTTON_TEXT_Y; + s_videodata2.anisotropic.textEnum = MBT_VIDEO_ANISOTROPIC_LEVEL; + s_videodata2.anisotropic.textcolor = CT_BLACK; + s_videodata2.anisotropic.textcolor2 = CT_WHITE; + s_videodata2.anisotropic.listnames = videoEngineConfig.supportMaxAnisotropy ? s_anisotropic_Names : s_OffOnNone_Names; + } + + Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.aspectCorrection); + Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.centerHud_slider); + Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.fov_slider); + if ( !suppressViewSize ) { + Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.screensize_slider); + } + Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.flares); + Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.wallmarks); + Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.dynamiclights); + Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.simpleitems); + Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.synceveryframe); + if ( !videoEngineConfig.anisotropicFilteringVideoMenu ) { + Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.anisotropic); + } } @@ -2323,12 +3348,16 @@ UI_VideoData2SettingsGetCvars */ static void UI_VideoData2SettingsGetCvars() { - s_videodata2.gamma_slider.curvalue = trap_Cvar_VariableValue( "r_gamma" ) * 10.0f; + s_videodata2.aspectCorrection.curvalue = trap_Cvar_VariableValue( "cg_aspectCorrect" ) ? 1 : 0; + s_videodata2.centerHud_slider.curvalue = UI_VideoData2SettingsGetCurrentCenterHud() * 10.0f; s_videodata2.fov_slider.curvalue = UI_VideoData2SettingsGetCurrentFov(); s_videodata2.screensize_slider.curvalue = trap_Cvar_VariableValue( "cg_viewsize" ); - s_videodata2.aspectCorrection.curvalue = trap_Cvar_VariableValue( "cg_aspectCorrect" ) ? 1 : 0; - s_videodata2.centerHud_slider.curvalue = UI_VideoData2SettingsGetCurrentCenterHud(); - s_videodata2.anisotropicfiltering.curvalue = trap_Cvar_VariableValue( "r_ext_texture_filter_anisotropic" ); + s_videodata2.flares.curvalue = trap_Cvar_VariableValue( "r_flares" ) ? 1 : 0; + s_videodata2.wallmarks.curvalue = trap_Cvar_VariableValue( "cg_marks" ) ? 1 : 0; + s_videodata2.dynamiclights.curvalue = trap_Cvar_VariableValue( "r_dynamiclight" ) ? 1 : 0; + s_videodata2.simpleitems.curvalue = trap_Cvar_VariableValue( "cg_simpleItems" ) ? 1 : 0; + s_videodata2.synceveryframe.curvalue = trap_Cvar_VariableValue( "r_finish" ) ? 1 : 0; + s_videodata2.anisotropic.curvalue = UI_GetAnisotropyLevel(); } /*