@@ -31,6 +31,12 @@ char g_szPrelocalisedMenuString[MAX_MENU_STRING];
3131// memdbgon must be the last include file in a .cpp file!!!
3232#include " tier0/memdbgon.h"
3333
34+ #ifdef MAPBASE
35+ ConVar hud_menu_voice_use_item_color ( " hud_menu_voice_use_item_color" , " 0" , FCVAR_ARCHIVE , " Whether or not the voice command menu should use the menu UI's item color instead of its title color." );
36+ ConVar hud_menu_voice_use_item_font ( " hud_menu_voice_use_item_font" , " 0" , FCVAR_ARCHIVE , " Whether or not the voice command menu should use the menu UI's item font instead of its title font." );
37+ ConVar hud_menu_voice_use_item_anim ( " hud_menu_voice_use_item_anim" , " 0" , FCVAR_ARCHIVE , " Whether or not the voice command menu should play a pulse animation when an option is selected." );
38+ #endif
39+
3440//
3541// -----------------------------------------------------
3642//
@@ -95,7 +101,7 @@ void CHudMenu::LevelInit()
95101 CHudElement::LevelInit ();
96102
97103#ifdef MAPBASE
98- if (m_bMapDefinedMenu )
104+ if (IsMenuMapDefined () )
99105 {
100106 // Fixes menu retaining on level change/reload
101107 // TODO: Would non-map menus benefit from this as well?
@@ -139,7 +145,7 @@ void CHudMenu::OnThink()
139145
140146 // If we've been open for a while without input, hide
141147#ifdef MAPBASE
142- if ( m_bMenuDisplayed && ( gpGlobals->curtime - m_flSelectionTime > flSelectionTimeout && !m_bMapDefinedMenu ) )
148+ if ( m_bMenuDisplayed && ( gpGlobals->curtime - m_flSelectionTime > flSelectionTimeout && !IsMenuMapDefined () ) )
143149#else
144150 if ( m_bMenuDisplayed && ( gpGlobals->curtime - m_flSelectionTime > flSelectionTimeout ) )
145151#endif
@@ -161,7 +167,7 @@ bool CHudMenu::ShouldDraw( void )
161167 if ( m_flShutoffTime > 0 )
162168 {
163169#ifdef MAPBASE
164- if ( m_bMapDefinedMenu && !m_bPlayingFadeout && (m_flShutoffTime - m_flOpenCloseTime) <= GetMenuTime () )
170+ if ( IsMenuMapDefined () && !m_bPlayingFadeout && (m_flShutoffTime - m_flOpenCloseTime) <= GetMenuTime () )
165171 {
166172 // Begin closing the menu
167173 g_pClientMode->GetViewportAnimationController ()->StartAnimationSequence ( " MenuClose" );
@@ -236,7 +242,7 @@ void CHudMenu::Paint()
236242
237243#ifdef MAPBASE
238244 bool isItem = true ;
239- if (line->menuitem == 0 && line->startchar < (MAX_MENU_STRING -1 ) && g_szMenuString[ line->startchar ] != L' 0' && g_szMenuString[ line->startchar +1 ] != L' .' )
245+ if (IsMenuMapDefined () && line->menuitem == 0 && line->startchar < (MAX_MENU_STRING -1 ) && g_szMenuString[ line->startchar ] != L' 0' && g_szMenuString[ line->startchar +1 ] != L' .' )
240246 {
241247 // Can't use 0 directly because it gets conflated with the cancel item
242248 isItem = false ;
@@ -246,6 +252,7 @@ void CHudMenu::Paint()
246252#endif
247253
248254 Color clr = isItem ? itemColor : menuColor;
255+ vgui::HFont font = isItem ? m_hItemFont : m_hTextFont;
249256
250257 bool canblur = false ;
251258 if ( line->menuitem != 0 &&
@@ -254,6 +261,21 @@ void CHudMenu::Paint()
254261 {
255262 canblur = true ;
256263 }
264+
265+ #ifdef MAPBASE
266+ if ( IsVoiceMenu () )
267+ {
268+ if ( !hud_menu_voice_use_item_color.GetBool () )
269+ clr = menuColor;
270+ if ( !hud_menu_voice_use_item_font.GetBool () )
271+ font = m_hTextFont;
272+ if ( !hud_menu_voice_use_item_anim.GetBool () )
273+ {
274+ isItem = false ;
275+ canblur = false ;
276+ }
277+ }
278+ #endif
257279
258280 vgui::surface ()->DrawSetTextColor ( clr );
259281
@@ -263,7 +285,7 @@ void CHudMenu::Paint()
263285 drawLen *= m_flTextScan;
264286 }
265287
266- vgui::surface ()->DrawSetTextFont ( isItem ? m_hItemFont : m_hTextFont );
288+ vgui::surface ()->DrawSetTextFont ( font );
267289
268290 PaintString ( &g_szMenuString[ line->startchar ], drawLen,
269291 isItem ? m_hItemFont : m_hTextFont, x, y );
@@ -458,7 +480,7 @@ void CHudMenu::ShowMenu( const char * menuName, int validSlots )
458480 m_fWaitingForMore = 0 ;
459481 m_nBorder = 20 ;
460482#ifdef MAPBASE
461- m_bMapDefinedMenu = false ;
483+ m_iMenuType = MENU_TYPE_GENERIC ;
462484 m_bPlayingFadeout = false ;
463485#endif
464486
@@ -490,7 +512,7 @@ void CHudMenu::ShowMenu_KeyValueItems( KeyValues *pKV )
490512 m_bitsValidSlots = 0 ;
491513 m_nBorder = 20 ;
492514#ifdef MAPBASE
493- m_bMapDefinedMenu = false ;
515+ m_iMenuType = MENU_TYPE_KEYVALUES ;
494516 m_bPlayingFadeout = false ;
495517#endif
496518
@@ -605,14 +627,22 @@ void CHudMenu::MsgFunc_ShowMenu( bf_read &msg)
605627 m_fWaitingForMore = NeedMore;
606628 m_nBorder = 20 ;
607629#ifdef MAPBASE
608- m_bMapDefinedMenu = false ;
630+ m_iMenuType = MENU_TYPE_GENERIC ;
609631 m_bPlayingFadeout = false ;
610632#endif
611633}
612634
613635#ifdef MAPBASE
614636ConVar hud_menu_complex_border ( " hud_menu_complex_border" , " 30" );
615637
638+ #ifdef TF_CLIENT_DLL // TODO: Better criteria for whether voice_menu.cpp is implemented
639+ #define VOICE_MENU_IMPLEMENTED 1
640+ #endif
641+
642+ #ifdef VOICE_MENU_IMPLEMENTED
643+ extern void OverrideActiveVoiceMenu ();
644+ #endif
645+
616646// -----------------------------------------------------------------------------
617647// Purpose: Message handler for ShowMenu message with more options for game_menu
618648// takes four values:
@@ -628,8 +658,16 @@ void CHudMenu::MsgFunc_ShowMenuComplex( bf_read &msg)
628658 float DisplayTime = msg.ReadFloat ();
629659 int NeedMore = msg.ReadByte ();
630660
661+ #ifdef VOICE_MENU_IMPLEMENTED
662+ if ( m_iMenuType == MENU_TYPE_KEYVALUES )
663+ {
664+ // Ensure voice menu doesn't interfere
665+ OverrideActiveVoiceMenu ();
666+ }
667+ #endif
668+
631669 m_nBorder = hud_menu_complex_border.GetInt ();
632- m_bMapDefinedMenu = true ;
670+ m_iMenuType = MENU_TYPE_MAP_DEFINED ;
633671 m_bPlayingFadeout = false ;
634672
635673 if ( DisplayTime > 0 )
0 commit comments