Skip to content

Commit

Permalink
Update voice_status
Browse files Browse the repository at this point in the history
  • Loading branch information
Elinsrc committed Nov 30, 2024
1 parent 4cc4525 commit c1096e2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
11 changes: 2 additions & 9 deletions cl_dll/ui/VGUI/vgui_TeamFortressViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,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
2 changes: 0 additions & 2 deletions cl_dll/ui/hud/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ int g_iUser1 = 0;
int g_iUser2 = 0;
int g_iUser3 = 0;

#if !USE_VGUI
// Team Colors
int iNumberOfTeamColors = 5;
int iTeamColors[5][3] =
Expand All @@ -53,7 +52,6 @@ int iTeamColors[5][3] =
{ 225, 205, 45 }, // Yellow
{ 145, 215, 140 }, // Green
};
#endif

#if USE_VGUI
#include "vgui_ScorePanel.h"
Expand Down
21 changes: 14 additions & 7 deletions cl_dll/ui/voice_status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,18 @@ void CVoiceStatus::CreateEntities()
#if !USE_VGUI
void CVoiceStatus::DrawNoVguiSpeakerIcon(int xpos, int ypos, int playerIndex)
{
int r, g, b;
bool isSpeaking = IsPlayerSpeaking(playerIndex);
r = g = b = isSpeaking ? 255 : 80;

int iColor = static_cast<int>((sin(gEngfuncs.GetClientTime() * 6) * 127) + 128);

wrect_t rc;
SPR_Set(m_VoiceHeadModel, r, g, b);
SPR_DrawAdditive(0, xpos, ypos, &rc);

if (isSpeaking)
{
SPR_Set(m_VoiceHeadModel, 0, iColor, 0);
SPR_DrawAdditive(0, xpos, ypos, &rc);
}

}

int CVoiceStatus::Draw(float time)
Expand All @@ -410,10 +415,12 @@ int CVoiceStatus::Draw(float time)
int voiceHeight = 30;
wrect_t rc;

int iColor = static_cast<int>((sin(time * 6) * 127) + 128);

if(IsPlayerSpeaking(localPlayer->index))
{
SPR_Set(m_VoiceHeadModel, 200, 200, 200);
SPR_DrawAdditive(0, ScreenWidth - 60, ScreenHeight - 100, &rc);
SPR_Set(m_VoiceHeadModel, 0, iColor, 0 );
SPR_DrawAdditive(0, ScreenWidth - 60, ScreenHeight - gHUD.m_iFontHeight * 3 - 40, &rc);
}

gHUD.GetAllPlayersInfo();
Expand All @@ -438,7 +445,7 @@ int CVoiceStatus::Draw(float time)
gHUD.DrawDarkRectangle( xpos - 5, ypos, xpos + x + 40, voiceHeight );
gHUD.DrawHudStringWithColorTags(xpos , ypos + 6, str, 255, 140, 0);

SPR_Set(m_VoiceHeadModel, 255, 255, 255);
SPR_Set(m_VoiceHeadModel, 0, iColor, 0);
SPR_DrawAdditive(0, xpos + x + 10, ypos, &rc);

ypos += voiceHeight;
Expand Down

0 comments on commit c1096e2

Please sign in to comment.