Skip to content

Commit

Permalink
Show "(spectator)" tag after player names in score board for spectators.
Browse files Browse the repository at this point in the history
  • Loading branch information
LevShisterov committed Jul 6, 2013
1 parent e150687 commit 508b7fc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 0 additions & 2 deletions cl_dll/hud_spectator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ extern vec3_t v_sim_org; // last sim origin

void SpectatorMode(void)
{


if ( gEngfuncs.Cmd_Argc() <= 1 )
{
gEngfuncs.Con_Printf( "usage: spec_mode <Main Mode> [<Inset Mode>]\n" );
Expand Down
14 changes: 14 additions & 0 deletions cl_dll/vgui_ScorePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ void ScorePanel::Initialize( void )
m_iNumTeams = 0;
memset(g_PlayerExtraInfo, 0, sizeof(g_PlayerExtraInfo));
memset(g_TeamInfo, 0, sizeof(g_TeamInfo));
memset(g_IsSpectator, 0, sizeof(g_IsSpectator));
memset(g_PlayerSteamId, 0, sizeof(g_PlayerSteamId));
m_PlayerList.SetScrollPos(0);
m_iStatusRequestState = STATUS_REQUEST_IDLE;
Expand Down Expand Up @@ -357,6 +358,12 @@ void ScorePanel::Update()
m_iRows = 0;
gViewPort->GetAllPlayersInfo();

// Transfer spectator state
for (int i = 1; i <= MAX_PLAYERS; i++)
{
g_PlayerInfoList[i].spectator = g_IsSpectator[i];
}

// Check SteamIds
for (int i = 1; i <= MAX_PLAYERS; i++)
{
Expand Down Expand Up @@ -856,6 +863,13 @@ void ScorePanel::FillGrid()
break;
case COLUMN_NAME:
sprintf(sz, "%s", pl_info->name);

// Append spectator label
if (pl_info->spectator)
{
pLabel->setText2("(spectator)");
pLabel->setFont2(smallfont);
}
break;
case COLUMN_STEAMID:
if (gHUD.m_pCvarShowSteamId->value)
Expand Down
4 changes: 1 addition & 3 deletions cl_dll/vgui_SpectatorPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,13 @@ void SpectatorPanel::ActionSignal(int cmd)

case SPECTATOR_PANEL_CMD_CAMERA : gViewPort->ShowCommandMenu( gViewPort->m_SpectatorCameraMenu );
break;

case SPECTATOR_PANEL_CMD_TOGGLE_INSET : gHUD.m_Spectator.SetModes( -1,
gHUD.m_Spectator.ToggleInset(false) );
break;


default : gEngfuncs.Con_DPrintf("Unknown SpectatorPanel ActionSingal %i.\n",cmd); break;
}

}


Expand Down
3 changes: 1 addition & 2 deletions engine/cdll_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ typedef struct hud_player_info_s
short ping;
byte thisplayer; // TRUE if this is the calling player

// stuff that's unused at the moment, but should be done
byte spectator;
byte spectator; // set via Spectator user messages, so work only on server with them
byte packetloss;

char *model;
Expand Down

0 comments on commit 508b7fc

Please sign in to comment.