Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Novgui voice chat support #491

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions cl_dll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ set (CLDLL_SOURCES
tri.cpp
util.cpp
view.cpp
voice_status.cpp
../game_shared/voice_banmgr.cpp
../game_shared/vcs_info.cpp
)

Expand All @@ -140,15 +142,13 @@ if (USE_VGUI)
vgui_TeamFortressViewport.cpp
vgui_SpectatorPanel.cpp
vgui_teammenu.cpp
voice_status.cpp
../game_shared/vgui_checkbutton2.cpp
../game_shared/vgui_grid.cpp
../game_shared/vgui_helpers.cpp
../game_shared/vgui_listbox.cpp
../game_shared/vgui_loadtga.cpp
../game_shared/vgui_scrollbar2.cpp
../game_shared/vgui_slider2.cpp
../game_shared/voice_banmgr.cpp
)
if (USE_NOVGUI_MOTD)
list(APPEND CLDLL_SOURCES MOTD.cpp)
Expand Down
6 changes: 2 additions & 4 deletions cl_dll/cdll_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ Called by engine every frame that client .dll is loaded

void DLLEXPORT HUD_Frame( double time )
{
#if USE_VGUI
GetClientVoiceMgr()->Frame(time);
#elif USE_FAKE_VGUI

#if USE_FAKE_VGUI
if (!gViewPort)
gEngfuncs.VGui_ViewportPaintBackground(HUD_GetRect());
#else
Expand All @@ -374,9 +374,7 @@ Called when a player starts or stops talking.

void DLLEXPORT HUD_VoiceStatus( int entindex, qboolean bTalking )
{
#if USE_VGUI
GetClientVoiceMgr()->UpdateSpeakerStatus(entindex, bTalking);
#endif
}

/*
Expand Down
2 changes: 0 additions & 2 deletions cl_dll/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,7 @@ void DLLEXPORT HUD_CreateEntities( void )
// Add in any game specific objects
Game_AddObjects();

#if USE_VGUI
GetClientVoiceMgr()->CreateEntities();
#endif
}

/*
Expand Down
21 changes: 18 additions & 3 deletions cl_dll/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ int g_iUser3 = 0;

#if USE_VGUI
#include "vgui_ScorePanel.h"
#endif

// Team Colors
int iNumberOfTeamColors = 5;
int iTeamColors[5][3] =
{
{ 255, 170, 0 }, // HL orange (default)
{ 125, 165, 210 }, // Blue
{ 200, 90, 70 }, // Red
{ 225, 205, 45 }, // Yellow
{ 145, 215, 140 }, // Green
};

class CHLVoiceStatusHelper : public IVoiceStatusHelper
{
Expand All @@ -68,26 +80,29 @@ class CHLVoiceStatusHelper : public IVoiceStatusHelper
}
}

#if USE_VGUI
virtual void UpdateCursorState()
{
gViewPort->UpdateCursorState();
}
#endif

virtual int GetAckIconHeight()
{
return ScreenHeight - gHUD.m_iFontHeight*3 - 6;
}

#if USE_VGUI
virtual bool CanShowSpeakerLabels()
{
if( gViewPort && gViewPort->m_pScoreBoard )
return !gViewPort->m_pScoreBoard->isVisible();
else
return false;
}
#endif
};
static CHLVoiceStatusHelper g_VoiceStatusHelper;
#endif

cvar_t *hud_textmode;
float g_hud_text_color[3];
Expand Down Expand Up @@ -417,6 +432,8 @@ void CHud::Init( void )
m_StatusIcons.Init();
#if USE_VGUI
GetClientVoiceMgr()->Init(&g_VoiceStatusHelper, (vgui::Panel**)&gViewPort);
#else
GetClientVoiceMgr()->Init(&g_VoiceStatusHelper);
#endif

#if !USE_VGUI || USE_NOVGUI_MOTD
Expand Down Expand Up @@ -618,9 +635,7 @@ void CHud::VidInit( void )
m_AmmoSecondary.VidInit();
m_TextMessage.VidInit();
m_StatusIcons.VidInit();
#if USE_VGUI
GetClientVoiceMgr()->VidInit();
#endif
#if !USE_VGUI || USE_NOVGUI_MOTD
m_MOTD.VidInit();
#endif
Expand Down
2 changes: 0 additions & 2 deletions cl_dll/hud.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ struct HUDLIST

//
//-----------------------------------------------------
#if USE_VGUI
#include "voice_status.h" // base voice handling class
#endif
#include "hud_spectator.h"

//
Expand Down
4 changes: 4 additions & 0 deletions cl_dll/scoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ We have a minimum width of 1-320 - we could have the field widths scale with it?
#define PING_RANGE_MAX 295
#define PL_RANGE_MIN 315
#define PL_RANGE_MAX 375
#define SPEAKER_POS 40

int SCOREBOARD_WIDTH = 320;

Expand Down Expand Up @@ -426,6 +427,9 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
FillRGBA( xpos - 5, ypos, FAR_RIGHT, ROW_GAP, 0, 0, 255, 70 );
}

// draw speaker icon
GetClientVoiceMgr()->DrawNoVguiSpeakerIcon( xpos - SPEAKER_POS, ypos - 5, best_player);

// draw their name (left to right)
DrawUtfString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b );

Expand Down
11 changes: 2 additions & 9 deletions cl_dll/vgui_TeamFortressViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,8 @@ extern float *GetClientColor( int clientIndex );
using namespace vgui;

// Team Colors
int iNumberOfTeamColors = 5;
int iTeamColors[5][3] =
{
{ 255, 170, 0 }, // HL orange (default)
{ 125, 165, 210 }, // Blue
{ 200, 90, 70 }, // Red
{ 225, 205, 45 }, // Yellow
{ 145, 215, 140 }, // Green
};
extern int iNumberOfTeamColors;
extern int iTeamColors[5][3];

// Used for Class specific buttons
const char *sTFClasses[] =
Expand Down
Loading