Ejemplo n.º 1
0
float GetPitchdown()
{
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	if (pPlayer && (pPlayer->GetTeamNumber() == TEAM_HOME || pPlayer->GetTeamNumber() == TEAM_AWAY) && !(in_zoom.state & 1))
		return mp_pitchdown.GetFloat();
	else
		return cl_pitchdown.GetFloat();
}
Ejemplo n.º 2
0
void CPlayerTeamProxy::OnBind( void *pC_BaseEntity )
{	
	C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();
	if (!pPlayer)
		return;

	if(pPlayer->GetTeamNumber() == TEAM_PINK)
		m_pResult->SetIntValue(1);
	else if(pPlayer->GetTeamNumber() == TEAM_GREEN)
		m_pResult->SetIntValue(2);
	else
		m_pResult->SetIntValue(0);
}
Ejemplo n.º 3
0
// rules that define if you can see a player on the overview or not
bool CSDKMapOverview::CanPlayerBeSeen( MapPlayer_t *player )
{
	C_BasePlayer *localPlayer = C_BasePlayer::GetLocalPlayer();

	if (!localPlayer || !player )
		return false;

	//Tony; if local player is spectating, just check base.
	if (localPlayer->GetTeamNumber() == TEAM_SPECTATOR )
		return BaseClass::CanPlayerBeSeen(player);

	SDKMapPlayer_t *sdkPlayer = GetSDKInfoForPlayer(player);
		
	if ( !sdkPlayer )
		return false;

	if( player->health <= 0 )
	{
		// Have to be under the overriden icon time to draw when dead.
		if ( sdkPlayer->overrideExpirationTime == -1  ||  sdkPlayer->overrideExpirationTime <= gpGlobals->curtime )
			return false;
	}
	
	return BaseClass::CanPlayerBeSeen(player);
}
Ejemplo n.º 4
0
//-----------------------------------------------------------------------------
// Draws the panel using a 3D transform...
//-----------------------------------------------------------------------------
int	C_VGuiScreen::DrawModel( int flags )
{
	vgui::Panel *pPanel = m_PanelWrapper.GetPanel();
	if (!pPanel || !IsActive())
		return 0;

	// Don't bother drawing stuff not visible to me...
	C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();
	if (!pLocalPlayer || !IsVisibleToTeam(pLocalPlayer->GetTeamNumber()) )
		return 0;

	if ( !IsVisibleToPlayer( pLocalPlayer ) )
	{
		return 0;
	}
	
	// Backface cull the entire panel here...
	if (IsBackfacing(CurrentViewOrigin()))
		return 0;

	// Recompute the panel-to-world center
	// FIXME: Can this be cached off?
	ComputePanelToWorld();

	/*if( m_fScreenFlags & VGUI_SCREEN_ATTACHED_TO_VIEWMODEL )
	{
		Msg("Rendering to view model \n ");

		CMatRenderContextPtr pRenderContext( materials );
		pRenderContext->MatrixMode( MATERIAL_PROJECTION );
		pRenderContext->PushMatrix();
		CViewSetup vmView( *view->GetPlayerViewSetup() );
		vmView.zNear = vmView.zNearViewmodel;
		vmView.zFar  = vmView.zFarViewmodel;
		vmView.fov   = vmView.fovViewmodel;
		render->Push3DView( vmView, 0, NULL, view->GetFrustum() );
		pRenderContext->DepthRange( 0.0f, 0.1f );
		pRenderContext.SafeRelease();
	}*/
	

	g_pMatSystemSurface->DrawPanelIn3DSpace( pPanel->GetVPanel(), m_PanelToWorld, 
		m_nPixelWidth, m_nPixelHeight, m_flWidth, m_flHeight );

	// Finally, a pass to set the z buffer...
	DrawScreenOverlay();

	
	/*if( m_fScreenFlags & VGUI_SCREEN_ATTACHED_TO_VIEWMODEL )
	{
		CMatRenderContextPtr pRenderContext( materials );
		pRenderContext->DepthRange( 0.0, 1.0 );
		render->PopView( view->GetFrustum() );
		pRenderContext->MatrixMode( MATERIAL_PROJECTION );
		pRenderContext->PopMatrix();
		pRenderContext.SafeRelease();
	}*/

	return 1;
}
Ejemplo n.º 5
0
//=========================================================
//=========================================================
C_BasePlayer * C_GameInstructor::GetLocalPlayer()
{
	C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();
 
	// If we're not a developer, don't do the special spectator hook ups
	if ( !developer.GetBool() )
		return pLocalPlayer;
 
	// If there is no local player and we're not spectating, just return that
	if ( !pLocalPlayer || pLocalPlayer->GetTeamNumber() != TEAM_SPECTATOR )
		return pLocalPlayer;
 
	// We're purely a spectator let's get lessons of the person we're spectating
	C_BasePlayer *pSpectatedPlayer = NULL;
 
	if ( pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE || pLocalPlayer->GetObserverMode() == OBS_MODE_CHASE )
		pSpectatedPlayer = ToBasePlayer( pLocalPlayer->GetObserverTarget() );
 
	if ( m_hLastSpectatedPlayer != pSpectatedPlayer )
	{
		// We're spectating someone new! Close all the stale lessons!
		m_bSpectatedPlayerChanged = true;
		m_hLastSpectatedPlayer = pSpectatedPlayer;
	}
 
	return pSpectatedPlayer;
}
Ejemplo n.º 6
0
//-----------------------------------------------------------------------------
// Draws the panel using a 3D transform...
//-----------------------------------------------------------------------------
int	C_VGuiScreen::DrawModel( int flags )
{
	vgui::Panel *pPanel = m_PanelWrapper.GetPanel();
	if (!pPanel || !IsActive())
		return 0;
	
	// Don't bother drawing stuff not visible to me...
	C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();
	if (!pLocalPlayer || !IsVisibleToTeam(pLocalPlayer->GetTeamNumber()) )
		return 0;
	
	// Backface cull the entire panel here...
	if (IsBackfacing(CurrentViewOrigin()))
		return 0;

	// Recompute the panel-to-world center
	// FIXME: Can this be cached off?
	ComputePanelToWorld();

	g_pMatSystemSurface->DrawPanelIn3DSpace( pPanel->GetVPanel(), m_PanelToWorld, 
		m_nPixelWidth, m_nPixelHeight, m_flWidth, m_flHeight );

	// Finally, a pass to set the z buffer...
	DrawScreenOverlay();

	return 1;
}
Ejemplo n.º 7
0
int GetLocalPlayerTeam( void ) 
{ 
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	
	if ( pPlayer )
		return pPlayer->GetTeamNumber(); 
	else
		return TEAM_UNASSIGNED;
}
//-----------------------------------------------------------------------------
// called when we're ticked...
//-----------------------------------------------------------------------------
void CEntityImageHealthPanel::OnTick()
{
	// tick the entity panel
	BaseClass::OnTick();

	C_BaseEntity* pBaseEntity = GetEntity();
	if (!pBaseEntity)
		return;
	// Don't draw if I'm not visible in the tactical map
	if ( MapData().IsEntityVisibleToTactical( pBaseEntity ) == false )
		return;

	if ( m_CommanderHealthBar )
		m_CommanderHealthBar->SetHealth( (float)pBaseEntity->GetHealth() / (float)pBaseEntity->GetMaxHealth() );
	if ( m_NormalHealthBar )
		m_NormalHealthBar->SetHealth( (float)pBaseEntity->GetHealth() / (float)pBaseEntity->GetMaxHealth() );

	// Hide the health bar we don't want to see
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();

	if ( pPlayer && (pBaseEntity->GetTeamNumber() != pPlayer->GetTeamNumber()) )
	{
		if ( m_CommanderHealthBar )
			m_CommanderHealthBar->SetVisible( false );
		if ( m_NormalHealthBar ) 
			m_NormalHealthBar->SetVisible( false );
		if ( m_ResourceLevelBar )
			m_ResourceLevelBar->SetVisible( false );
		if ( m_pImagePanel )
			m_pImagePanel->SetVisible( false );
	}
	else if ( IsLocalPlayerInTactical() )
	{
		if ( m_CommanderHealthBar )
			m_CommanderHealthBar->SetVisible( true );
		if ( m_NormalHealthBar ) 
			m_NormalHealthBar->SetVisible( false );
		if ( m_ResourceLevelBar )
			m_ResourceLevelBar->SetVisible( true );
		if ( m_pImagePanel )
			m_pImagePanel->SetVisible( true );
	}
	else
	{
		if ( m_CommanderHealthBar )
			m_CommanderHealthBar->SetVisible( false );
		if ( m_NormalHealthBar ) 
			m_NormalHealthBar->SetVisible( true );
		if ( m_ResourceLevelBar )
			m_ResourceLevelBar->SetVisible( true );
		if ( m_pImagePanel )
			m_pImagePanel->SetVisible( false );
	}
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CControlPointProgressBar::SetupForPoint( CControlPointIcon *pIcon )
{
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	if ( !pPlayer )
		return;

	m_pAttachedToIcon = pIcon;

	bool bInWinState = TeamplayRoundBasedRules() ? TeamplayRoundBasedRules()->RoundHasBeenWon() : false;

	if ( m_pAttachedToIcon && !bInWinState )
	{
		SetVisible( true );

		int iCP = m_pAttachedToIcon->GetCapIndex();
		int iCappingTeam = ObjectiveResource()->GetCappingTeam( iCP );
		int iOwnerTeam = ObjectiveResource()->GetOwningTeam( iCP );
		int iPlayerTeam = pPlayer->GetTeamNumber();
		bool bCapBlocked = ObjectiveResource()->CapIsBlocked( iCP );

		if ( !bCapBlocked && iCappingTeam != TEAM_UNASSIGNED && iCappingTeam != iOwnerTeam && iCappingTeam == iPlayerTeam )
		{
			m_pBar->SetBgImage( ObjectiveResource()->GetGameSpecificCPBarBG( iCP, iCappingTeam ) );
			m_pBar->SetFgImage( ObjectiveResource()->GetGameSpecificCPBarFG( iCP, iOwnerTeam ) );
			m_pBar->SetVisible( true );
			m_pBlocked->SetVisible( false );
			m_pBarText->SetVisible( false );
		}
		else
		{
			m_pBar->SetVisible( false );
			m_pBlocked->SetVisible( true );
			
			UpdateBarText();
		}

		InvalidateLayout();
	}
	else
	{
		SetVisible( false );
	}
}
Ejemplo n.º 10
0
void C_HLTVCamera::SpecNamedPlayer( const char *szPlayerName )
{
	for ( int index = 1; index <= gpGlobals->maxClients; ++index )
	{
		C_BasePlayer *pPlayer =	UTIL_PlayerByIndex( index );

		if ( !pPlayer )
			continue;

		if ( !FStrEq( szPlayerName, pPlayer->GetPlayerName() ) )
			continue;

		// only follow living players or dedicated spectators
		if ( pPlayer->IsObserver() && pPlayer->GetTeamNumber() != TEAM_SPECTATOR )
			continue;

		SetPrimaryTarget( index );
		return;
	}
}
Ejemplo n.º 11
0
void C_TFObjectiveResource::SetCappingTeam( int index, int team )
{
	//Display warning that someone is capping our point.
	//Only do this at the start of a cap and if WE own the point.
	//Also don't warn on a point that will do a "Last Point cap" warning.
	if ( GetNumControlPoints() > 0 && GetCapWarningLevel( index ) == CP_WARN_NORMAL && GetCPCapPercentage( index ) == 0.0f && team != TEAM_UNASSIGNED && GetOwningTeam( index ) != TEAM_UNASSIGNED )
	{
		C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();
		if ( pLocalPlayer )
		{
			int iLocalTeam = pLocalPlayer->GetTeamNumber();

			if ( iLocalTeam != team )
			{
				CLocalPlayerFilter filter;
				C_BaseEntity::EmitSound( filter, -1, "Announcer.ControlPointContested" );
			}
		}
	}

	BaseClass::SetCappingTeam( index, team );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_VoteController::FireGameEvent( IGameEvent *event )
{
	CHudVote *pHudVote = GET_HUDELEMENT( CHudVote );
	if ( pHudVote && pHudVote->IsVisible() )
	{
		const char *eventName = event->GetName();
		if ( !eventName )
			return;

		C_BasePlayer *pLocalPlayer = C_BasePlayer::GetLocalPlayer();
		if ( !pLocalPlayer )
			return;

		int team = event->GetInt( "team", TEAM_UNASSIGNED );
		if ( team > TEAM_UNASSIGNED && team != pLocalPlayer->GetTeamNumber() )
			return;

		if ( FStrEq( eventName, "vote_cast" ) )
		{
			if ( m_bIsYesNoVote )
			{
				int vote_option = event->GetInt( "vote_option", TEAM_UNASSIGNED );
				if( vote_option == VOTE_OPTION2 )
				{
					pLocalPlayer->EmitSound( "Vote.Cast.No" );
				}
				else if( vote_option == VOTE_OPTION1 )
				{
					pLocalPlayer->EmitSound( "Vote.Cast.Yes" );
				}
			}
			else
			{
				pLocalPlayer->EmitSound( "Vote.Cast.Yes" );
			}
		}
	}
}
Ejemplo n.º 13
0
//-----------------------------------------------------------------------------
void CSDKMapOverview::Update( void )
{
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();

	if ( !pPlayer )
		return;

	int team = pPlayer->GetTeamNumber();

	// if dead with fadetoblack on, we can't show anything
	if ( mp_fadetoblack.GetBool() && team > TEAM_SPECTATOR && !pPlayer->IsAlive() )
	{
		SetMode( MAP_MODE_OFF );
		return;
	}

	BaseClass::Update();

	if ( GetSpectatorMode() == OBS_MODE_CHASE )
	{
		// Follow the local player in chase cam, so the map rotates using the local player's angles
		SetFollowEntity( pPlayer->entindex() );
	}
}
Ejemplo n.º 14
0
//==============================================
// CHudFlags's Paint
// errr... paints the panel
//==============================================
void CHudFlags::Paint()
{
	int m_iFlagCount = g_Flags.Count();

	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();

	if( !pPlayer )
		return;

	char text[512];
	int i;// = 0;
	int x_offset = 5;
	int y_offset = 5;
	Color ColourWhite( 255, 255, 255, 255 );
	Color ColourRed( 255, 0, 0, 255 );
	Color ColourBlue( 0, 0, 255, 255 );
	switch (cl_flagstatus.GetInt())
	{
	case 0: // not display anything
		for( i = 0; i < MAX_FLAGS; i++ )
		{
			m_pLabelFlag[i]->SetVisible(false);
		}
		break;
	case 1: // display flag status as text 
		for( i = 0; i < MAX_FLAGS; i++ )
		{
			m_pLabelFlag[i]->SetVisible(false);
		}

		for( i = 0; i < m_iFlagCount && i < 12; i++ )
		{
			if( !g_Flags[i] )
			{
				break;
			}
			//BG2 - Tjoppen - obey HUDSlot
			if( g_Flags[i]->m_iHUDSlot < 0 )
			{
				m_pLabelFlag[i]->SetVisible( false );
				continue;
			}
			//

			float iTimeToCap = g_Flags[i]->m_flNextCapture - gpGlobals->curtime;

			const char *pOLString = NULL;	//describes overload status - "Overloaded", "Not overloaded", empty string of not applicable

			//empty string if..
			if( g_Flags[i]->GetTeamNumber() == TEAM_UNASSIGNED ||				//flag not held by any team
					g_Flags[i]->m_bNotUncappable ||								//flag can't be uncapped
					!g_Flags[i]->m_bUncapOnDeath ||								//flag doesn't uncap when overloaders die
					g_Flags[i]->GetTeamNumber() != pPlayer->GetTeamNumber() )	//flag held by other team
			{
				pOLString = "";
			}
			else if( g_Flags[i]->m_pOverloading[pPlayer->GetClientIndex()] )
			{
				//player has overloading this flag
				if( cl_flagstatusdetail.GetInt() <= 1 )
					pOLString = "- OL:ed";
				else
					pOLString = "- Overloaded";
				
			}
			else
			{
				//player has not overloaded this flag yet
				if( cl_flagstatusdetail.GetInt() <= 1 )
					pOLString = "- Not OL:ed";
				else
					pOLString = "- Not overloaded";
			}

			//team specific flag?
			switch( g_Flags[i]->m_iForTeam )
			{
				case 0:
					//flag can be taken by any team
					Q_snprintf( text, sizeof(text), "%s", g_Flags[i]->m_sFlagName);

					switch (cl_flagstatusdetail.GetInt())
					{
						case 0: // No Details
							if( iTimeToCap > 0.1f )
							{
								char text_add[128];
								Q_snprintf( text_add, sizeof(text_add), "- %i", (int)iTimeToCap);
								strcat(	text, text_add);
							}
							break;
						case 1: // Compact Details
							if( iTimeToCap > 0 )
							{
								char text_add[128];
								Q_snprintf( text_add, sizeof(text_add), " - %i/%i - %i", g_Flags[i]->m_iNearbyPlayers, 
									g_Flags[i]->m_iCapturePlayers, (int)iTimeToCap );

								strcat(	text, text_add);
							}
							else
							{
								char text_add[128];
								Q_snprintf( text_add, sizeof(text_add), " - %i/%i %s", g_Flags[i]->m_iNearbyPlayers, 
									g_Flags[i]->m_iCapturePlayers, pOLString );

								strcat(	text, text_add);
							}
							break;
						case 2: // Full Details
							if( iTimeToCap > 0 )
							{
								char text_add[128];
								Q_snprintf( text_add, sizeof(text_add), " - %i/%i Players - Time %i", 
									g_Flags[i]->m_iNearbyPlayers, g_Flags[i]->m_iCapturePlayers, (int)iTimeToCap );

								strcat(	text, text_add);
							}
							else
							{
								char text_add[128];
								Q_snprintf( text_add, sizeof(text_add), " - %i/%i Players %s", 
									g_Flags[i]->m_iNearbyPlayers, g_Flags[i]->m_iCapturePlayers, pOLString );

								strcat(	text, text_add);
							}
							break;
					}
					break;

				case 1:
					//flag can only be taken by the americans
					if( iTimeToCap > 0 )
					{
						Q_snprintf( text, sizeof(text), "%s - American Only Target - %i/%i Players - Time %i", 
							g_Flags[i]->m_sFlagName, g_Flags[i]->m_iNearbyPlayers, g_Flags[i]->m_iCapturePlayers, 
							(int)iTimeToCap );
					}
					else
					{
						Q_snprintf( text, sizeof(text), "%s - American Only Target - %i/%i Players %s", 
							g_Flags[i]->m_sFlagName, g_Flags[i]->m_iNearbyPlayers, g_Flags[i]->m_iCapturePlayers,
							pOLString );
					}
					break;

				case 2:
					//flag can only be taken by the british
					if( iTimeToCap > 0 )
					{
						Q_snprintf( text, sizeof(text), "%s - British Only Target - %i/%i Players - Time %i", 
							g_Flags[i]->m_sFlagName, g_Flags[i]->m_iNearbyPlayers, g_Flags[i]->m_iCapturePlayers, 
							(int)iTimeToCap );
					}
					else
					{
						Q_snprintf( text, sizeof(text), "%s - British Only Target - %i/%i Players %s", 
							g_Flags[i]->m_sFlagName, g_Flags[i]->m_iNearbyPlayers, g_Flags[i]->m_iCapturePlayers, 
							pOLString );
					}
					break;
			}

			//figure out which colors to use
			float r = 0;
			float g = 0;
			float b = 0;

			/*if( !g_Flags[i]->m_bActive ) //Tweaked. See flag.cpp in server project. -HairyPotter
			{
				//BG2 - Tjoppen - inactive flags simply have grey text for now
				r = g = b = 96;
			}
			else*/
				switch( g_Flags[i]->m_iLastTeam )
				{
					case TEAM_AMERICANS:
						r = 66;
						g = 115;
						b = 247;
						r += 188 * (sin(iTimeToCap*4) + 1)/2;
						g += 139 * (sin(iTimeToCap*4) + 1)/2;
						b += 7 * (sin(iTimeToCap*4) + 1)/2;
						break;
					case TEAM_BRITISH:
						r = 255;
						g = 16;
						b = 16;
						g += 238 * (sin(iTimeToCap*4) + 1)/2;
						b += 238 * (sin(iTimeToCap*4) + 1)/2;
						break;
					default:
					case TEAM_UNASSIGNED:
						switch (g_Flags[i]->GetTeamNumber())
						{
							case TEAM_AMERICANS:
								r = 66;
								g = 115;
								b = 247;
								break;
							case TEAM_BRITISH:
								r = 255;
								g = 16;
								b = 16;
								break;
							case TEAM_UNASSIGNED:
								switch (g_Flags[i]->m_iRequestingCappers)
								{
									case TEAM_BRITISH:
										r = 255;
										g = 16;
										b = 16;
										g += 238 * (int)((sin(iTimeToCap*8) + 2.7f)/2);
										b += 238 * (int)((sin(iTimeToCap*8) + 2.7f)/2);
										break;
									case TEAM_AMERICANS:
										r = 66;
										g = 115;
										b = 247;
										r += 188 * (int)((sin(iTimeToCap*8) + 2.7f)/2);
										g += 139 * (int)((sin(iTimeToCap*8) + 2.7f)/2);
										b += 7 * (int)((sin(iTimeToCap*8) + 2.7f)/2);
										break;
									case TEAM_UNASSIGNED:
										switch( g_Flags[i]->m_iForTeam )
										{
										case 0:
											r = 255;
											g = 255;
											b = 255;
											break;
										case 1:
											r = 255;
											g = 16;
											b = 16;
											break;
										case 2:
											r = 66;
											g = 115;
											b = 247;
											break;
										}
										break;
								}
								break;
						}
						break;
				}
			m_pLabelFlag[i]->SetFgColor(Color(r,g,b,255));
			m_pLabelFlag[i]->SetText( text );
			m_pLabelFlag[i]->SizeToContents();
			
			//BP hack to widen the label so no cropping can occur
			m_pLabelFlag[i]->SetWide(m_pLabelFlag[i]->GetWide() + 5);

			m_pLabelFlag[i]->SetVisible( true );

			//BG2 - Tjoppen - obey HUDSlot
			if( g_Flags[i]->m_iHUDSlot == 0 )
			{
				m_pLabelFlag[i]->SetPos(x_offset,y_offset);
				y_offset += 20;
			}
			else
			{
				m_pLabelFlag[i]->SetPos(x_offset, 20*(g_Flags[i]->m_iHUDSlot - 1) + 5 );
			}
			//
		}
		break;
	case 2: // Display Flag status as Icons
		i = 0;
		while (i < MAX_FLAGS)
		{
			m_pLabelFlag[i]->SetVisible(false);
			i++;
		}
		int xinc = 0;	//incremental x.. for old flags
		for( i = 0; i < m_iFlagCount; i++ )
		{
			int x_offset;
			if( g_Flags[i]->m_iHUDSlot < 0 )
			{
				m_pLabelFlag[i]->SetVisible( false );
				continue;
			}
			else if( g_Flags[i]->m_iHUDSlot == 0 )
			{
				x_offset = xinc;
				xinc += 80;
			}
			else
				x_offset = (g_Flags[i]->m_iHUDSlot - 1) * 80;

			//BG2 - Tjoppen - first draw the color of the team holding the flag, then progress bar of capture
			float fTimeToCap = g_Flags[i]->m_flNextCapture - gpGlobals->curtime;
			int iTimeToCap = (int)fTimeToCap;
			//switch( g_Flags[i]->m_iLastTeam )
			switch( g_Flags[i]->GetTeamNumber() )
			{
			case TEAM_UNASSIGNED:
				switch( g_Flags[i]->m_iForTeam )
				{
				case 0:
					m_pIconBlank->DrawSelf( x_offset, 0, ColourWhite );
					break;
				case 1:
					m_pIconRed->DrawSelf( x_offset, 0, ColourWhite );
					break;
				case 2:
					m_pIconBlue->DrawSelf( x_offset, 0, ColourWhite );
					break;
				}
				break;
			case TEAM_AMERICANS:
				m_pIconBlue->DrawSelf( x_offset, 0, ColourWhite );
				break;
			case TEAM_BRITISH:
				m_pIconRed->DrawSelf( x_offset, 0, ColourWhite );
				break;
			}
			
			if( iTimeToCap >= 0 )
			{
				//stepwise transition
				//int coverw = (64 * (iTimeToCap+1)) / (int)(g_Flags[i]->m_flCaptureTime + 1);

				//dod:s style smooth transition
				int coverw = (int)(64.f * (fTimeToCap + 1) / (g_Flags[i]->m_flCaptureTime + 1));

				if( coverw < 0 )
					coverw = 0;

				switch( g_Flags[i]->m_iLastTeam )
				{
				case TEAM_UNASSIGNED:
					//is this needed? unassigned can't capture flags..
					//m_IconCover[i]->DrawSelfCropped(x_offset, 0, x_offset, 0, 32 - coverw, 32, ColourWhite);
					m_pIconBlank->DrawSelfCropped(x_offset, 0, 0, 0, 64 - coverw, 64, ColourWhite);
					break;
				case TEAM_BRITISH:
					//m_IconCover[i]->DrawSelfCropped(x_offset, 0, x_offset, 0, 32 - coverw, 32, ColourRed);
					m_pIconRed->DrawSelfCropped(x_offset, 0, 0, 0, 64 - coverw, 64, ColourWhite);
					break;
				case TEAM_AMERICANS:
					//m_IconCover[i]->DrawSelfCropped(x_offset, 0, x_offset, 0, 32 - coverw, 32, ColourBlue);
					m_pIconBlue->DrawSelfCropped(x_offset, 0, 0, 0, 64 - coverw, 64, ColourWhite);
					break;
				}
			}

            int r=0,g=0,b=0;
			switch( g_Flags[i]->m_iLastTeam )
			{
				case TEAM_AMERICANS:
					r = 66;
					g = 115;
					b = 247;
					r += 188 * (sin(fTimeToCap*4) + 1)/2;
					g += 139 * (sin(fTimeToCap*4) + 1)/2;
					b += 7 * (sin(fTimeToCap*4) + 1)/2;
					break;
				case TEAM_BRITISH:
					r = 255;
					g = 16;
					b = 16;
					g += 238 * (sin(fTimeToCap*4) + 1)/2;
					b += 238 * (sin(fTimeToCap*4) + 1)/2;
					break;
				default:
				case TEAM_UNASSIGNED:
					switch (g_Flags[i]->GetTeamNumber())
					{
						case TEAM_AMERICANS:
							r = 66;
							g = 115;
							b = 247;
							break;
						case TEAM_BRITISH:
							r = 255;
							g = 16;
							b = 16;
							break;
						case TEAM_UNASSIGNED:
							switch (g_Flags[i]->m_iRequestingCappers)
							{
								case TEAM_BRITISH:
									r = 255;
									g = 16;
									b = 16;
									g += 238 * (int)((sin(fTimeToCap*8) + 2.7f)/2);
									b += 238 * (int)((sin(fTimeToCap*8) + 2.7f)/2);
									break;
								case TEAM_AMERICANS:
									r = 66;
									g = 115;
									b = 247;
									r += 188 * (int)((sin(fTimeToCap*8) + 2.7f)/2);
									g += 139 * (int)((sin(fTimeToCap*8) + 2.7f)/2);
									b += 7 * (int)((sin(fTimeToCap*8) + 2.7f)/2);
									break;
								case TEAM_UNASSIGNED:
									switch( g_Flags[i]->m_iForTeam )
									{
									case 0:
										r = 255;
										g = 255;
										b = 255;
										break;
									case 1:
										r = 255;
										g = 16;
										b = 16;
										break;
									case 2:
										r = 66;
										g = 115;
										b = 247;
										break;
									}
									break;
							}
							break;
					}
					break;
			}

			Q_snprintf( text, 512, "%i/%i", g_Flags[i]->m_iNearbyPlayers, g_Flags[i]->m_iCapturePlayers );
			m_pLabelFlag[i]->SetText( text );
			m_pLabelFlag[i]->SizeToContents();
			//m_pLabelFlag[i]->SetVisible( true );

			//m_pLabelFlag[i]->SetPos( (x_offset + 32), 64 );
			//center on icon
			int w,h;
			m_pLabelFlag[i]->GetSize( w, h );
			m_pLabelFlag[i]->SetPos( (x_offset + 32) - w/2, 32 - h/2 );

			m_pLabelFlag[i]->SetFgColor( Color(r,g,b,255) );
			m_pLabelFlag[i]->SetVisible(true);

			//x_offset += 80;
		}
		break;
	}
}
Ejemplo n.º 15
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFSpectatorGUI::UpdateKeyLabels( void )
{
	// get the desired player class
	int iClass = TF_CLASS_UNDEFINED;
	bool bIsHLTV = engine->IsHLTV();

	C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
	if ( pPlayer )
	{
		iClass = pPlayer->m_Shared.GetDesiredPlayerClassIndex();
	}

	// if it's time to change the tip, or the player has changed desired class, update the tip
	if ( ( gpGlobals->curtime >= m_flNextTipChangeTime ) || ( iClass != m_iTipClass ) )
	{
		if ( bIsHLTV )
		{
			const wchar_t *wzTip = g_pVGuiLocalize->Find( "#Tip_HLTV" );

			if ( wzTip )
			{
				SetDialogVariable( "tip", wzTip );
			}
		}
		else
		{
			wchar_t wzTipLabel[512]=L"";
			const wchar_t *wzTip = g_TFTips.GetNextClassTip( iClass );
			Assert( wzTip && wzTip[0] );
			g_pVGuiLocalize->ConstructString( wzTipLabel, sizeof( wzTipLabel ), g_pVGuiLocalize->Find( "#Tip_Fmt" ), 1, wzTip );
			SetDialogVariable( "tip", wzTipLabel );
		}
		
		m_flNextTipChangeTime = gpGlobals->curtime + 10.0f;
		m_iTipClass = iClass;
	}

	if ( m_pClassOrTeamLabel )
	{
		C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
		if ( pPlayer )
		{
			static wchar_t wzFinal[512] = L"";
			const wchar_t *wzTemp = NULL;

			if ( bIsHLTV )
			{
				wzTemp = g_pVGuiLocalize->Find( "#TF_Spectator_AutoDirector" );
			}
			else if ( pPlayer->GetTeamNumber() == TEAM_SPECTATOR )
			{
				wzTemp = g_pVGuiLocalize->Find( "#TF_Spectator_ChangeTeam" );
			}
			else
			{
				wzTemp = g_pVGuiLocalize->Find( "#TF_Spectator_ChangeClass" );
			}

			if ( wzTemp )
			{
				UTIL_ReplaceKeyBindings( wzTemp, 0, wzFinal, sizeof( wzFinal ) );
				m_pClassOrTeamLabel->SetText( wzFinal );
			}
		}
	}

	if ( m_pSwitchCamModeKeyLabel )
	{
		if ( ( pPlayer && pPlayer->GetTeamNumber() > TEAM_SPECTATOR ) && ( ( mp_forcecamera.GetInt() == OBS_ALLOW_TEAM ) || ( mp_forcecamera.GetInt() == OBS_ALLOW_NONE ) || mp_fadetoblack.GetBool() ) )
		{
			if ( m_pSwitchCamModeKeyLabel->IsVisible() )
			{
				m_pSwitchCamModeKeyLabel->SetVisible( false );

				Label *pLabel = dynamic_cast<Label *>( FindChildByName( "SwitchCamModeLabel" ) );
				if ( pLabel )
				{
					pLabel->SetVisible( false );
				}
			}
		}
		else
		{
			if ( !m_pSwitchCamModeKeyLabel->IsVisible() )
			{
				m_pSwitchCamModeKeyLabel->SetVisible( true );

				Label *pLabel = dynamic_cast<Label *>( FindChildByName( "SwitchCamModeLabel" ) );
				if ( pLabel )
				{
					pLabel->SetVisible( true );
				}
			}

			wchar_t wLabel[256] = L"";
			const wchar_t *wzTemp = g_pVGuiLocalize->Find( "#TF_Spectator_SwitchCamModeKey" );
			UTIL_ReplaceKeyBindings( wzTemp, 0, wLabel, sizeof( wLabel ) );
			m_pSwitchCamModeKeyLabel->SetText( wLabel );
		}
	}

	if ( m_pCycleTargetFwdKeyLabel )
	{
		if ( ( pPlayer && pPlayer->GetTeamNumber() > TEAM_SPECTATOR ) && ( mp_fadetoblack.GetBool() || ( mp_forcecamera.GetInt() == OBS_ALLOW_NONE ) ) )
		{
			if ( m_pCycleTargetFwdKeyLabel->IsVisible() )
			{
				m_pCycleTargetFwdKeyLabel->SetVisible( false );

				Label *pLabel = dynamic_cast<Label *>( FindChildByName( "CycleTargetFwdLabel" ) );
				if ( pLabel )
				{
					pLabel->SetVisible( false );
				}
			}
		}
		else
		{
			if ( !m_pCycleTargetFwdKeyLabel->IsVisible() )
			{
				m_pCycleTargetFwdKeyLabel->SetVisible( true );

				Label *pLabel = dynamic_cast<Label *>( FindChildByName( "CycleTargetFwdLabel" ) );
				if ( pLabel )
				{
					pLabel->SetVisible( true );
				}
			}

			wchar_t wLabel[256] = L"";
			const wchar_t *wzTemp = g_pVGuiLocalize->Find( "#TF_Spectator_CycleTargetFwdKey" );
			UTIL_ReplaceKeyBindings( wzTemp, 0, wLabel, sizeof( wLabel ) );
			m_pCycleTargetFwdKeyLabel->SetText( wLabel );
		}
	}

	if ( m_pCycleTargetRevKeyLabel )
	{
		if ( ( pPlayer && pPlayer->GetTeamNumber() > TEAM_SPECTATOR ) && ( mp_fadetoblack.GetBool() || ( mp_forcecamera.GetInt() == OBS_ALLOW_NONE ) ) )
		{
			if ( m_pCycleTargetRevKeyLabel->IsVisible() )
			{
				m_pCycleTargetRevKeyLabel->SetVisible( false );

				Label *pLabel = dynamic_cast<Label *>( FindChildByName( "CycleTargetRevLabel" ) );
				if ( pLabel )
				{
					pLabel->SetVisible( false );
				}
			}
		}
		else
		{
			if ( !m_pCycleTargetRevKeyLabel->IsVisible() )
			{
				m_pCycleTargetRevKeyLabel->SetVisible( true );

				Label *pLabel = dynamic_cast<Label *>( FindChildByName( "CycleTargetRevLabel" ) );
				if ( pLabel )
				{
					pLabel->SetVisible( true );
				}
			}

			wchar_t wLabel[256] = L"";
			const wchar_t *wzTemp = g_pVGuiLocalize->Find( "#TF_Spectator_CycleTargetRevKey" );
			UTIL_ReplaceKeyBindings( wzTemp, 0, wLabel, sizeof( wLabel ) );
			m_pCycleTargetRevKeyLabel->SetText( wLabel );
		}
	}

	if ( m_pMapLabel )
	{
		wchar_t wMapName[16];
		wchar_t wLabel[256];
		char szMapName[16];

		char tempname[128];
		Q_FileBase( engine->GetLevelName(), tempname, sizeof( tempname ) );
		Q_strlower( tempname );

		if ( IsX360() )
		{
			char *pExt = Q_stristr( tempname, ".360" );
			if ( pExt )
			{
				*pExt = '\0';
			}
		}

		Q_strncpy( szMapName, GetMapDisplayName( tempname ), sizeof( szMapName ) );

		g_pVGuiLocalize->ConvertANSIToUnicode( szMapName, wMapName, sizeof(wMapName));
		g_pVGuiLocalize->ConstructString( wLabel, sizeof( wLabel ), g_pVGuiLocalize->Find( "#Spec_Map" ), 1, wMapName );

		m_pMapLabel->SetText( wLabel ); 
	}
}
Ejemplo n.º 16
0
void CMumbleSystem::PostRender()
{
#ifndef NO_STEAM
	if ( !g_pMumbleMemory || !sv_mumble_positionalaudio.GetBool() )
		return;

	if ( g_pMumbleMemory->uiVersion != 2 )
	{
		V_wcscpy_safe( g_pMumbleMemory->name, L"Source engine: " );
		wchar_t wcsGameDir[MAX_PATH];
		Q_UTF8ToUnicode( COM_GetModDirectory(), wcsGameDir, sizeof(wcsGameDir) );
		V_wcscat_safe( g_pMumbleMemory->name, wcsGameDir );

		V_wcscpy_safe( g_pMumbleMemory->description, L"Links Source engine games to Mumble." );
		g_pMumbleMemory->uiVersion = 2;
	}

	g_pMumbleMemory->uiTick++;

	Vector vecOriginPlayer, vecOriginCamera = MainViewOrigin();
	QAngle anglesPlayer, anglesCamera = MainViewAngles();

	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	if ( pPlayer )
	{
		vecOriginPlayer = pPlayer->EyePosition();
		anglesPlayer = pPlayer->GetAbsAngles();
	}
	else
	{
		vecOriginPlayer = vecOriginCamera;
		anglesPlayer = anglesCamera;
	}

	anglesPlayer.x = 0;

	Vector vecPlayerForward, vecPlayerUp, vecCameraForward, vecCameraUp;
	AngleVectors( anglesPlayer, &vecPlayerForward, NULL, &vecPlayerUp );
	AngleVectors( anglesCamera, &vecCameraForward, NULL, &vecCameraUp );

	// 1 Source unit is about one inch
	// 1 mumble unit = 1 meter
	vecOriginPlayer *= METERS_PER_INCH;
	vecOriginCamera *= METERS_PER_INCH;

	VectorToMumbleFloatArray( vecPlayerForward, g_pMumbleMemory->fAvatarFront );
	VectorToMumbleFloatArray( vecPlayerUp, g_pMumbleMemory->fAvatarTop );
	VectorToMumbleFloatArray( vecOriginPlayer, g_pMumbleMemory->fAvatarPosition );

	VectorToMumbleFloatArray( vecCameraForward, g_pMumbleMemory->fCameraFront );
	VectorToMumbleFloatArray( vecCameraUp, g_pMumbleMemory->fCameraTop );
	VectorToMumbleFloatArray( vecOriginCamera, g_pMumbleMemory->fCameraPosition );

	if ( pPlayer && m_bHasSetPlayerUniqueId && m_nTeamSetInUniqueId != pPlayer->GetTeamNumber() )
	{
		// Player changed team since we set the unique ID. Set it again.
		m_bHasSetPlayerUniqueId = false;
	}

	if ( !m_bHasSetPlayerUniqueId && steamapicontext && steamapicontext->SteamUser() )
	{
		CSteamID steamid = steamapicontext->SteamUser()->GetSteamID();
		if ( steamid.IsValid() )
		{
			int unTeam = pPlayer ? pPlayer->GetTeamNumber() : 0;
			char szSteamId[256];
			V_sprintf_safe( szSteamId, "universe:%u;account_type:%u;id:%u;instance:%u;team:%d", steamid.GetEUniverse(), steamid.GetEAccountType(), steamid.GetAccountID(), steamid.GetUnAccountInstance(), unTeam );

			wchar_t wcsSteamId[256];
			Q_UTF8ToUnicode( szSteamId, wcsSteamId, sizeof(wcsSteamId) );

			// Identifier which uniquely identifies a certain player in a context.
			V_wcscpy_safe( g_pMumbleMemory->identity, wcsSteamId );

			m_bHasSetPlayerUniqueId = true;
			m_nTeamSetInUniqueId = unTeam;
		}
	}

	// Context should be equal for players which should be able to hear each other positional and
	// differ for those who shouldn't (e.g. it could contain the server+port and team)
	memcpy( g_pMumbleMemory->context, &m_szSteamIDCurrentServer, m_cubSteamIDCurrentServer );
	g_pMumbleMemory->context_len = m_cubSteamIDCurrentServer;
#endif // NO_STEAM
}
Ejemplo n.º 17
0
//-----------------------------------------------------------------------------
// Purpose: resets the scoreboard team info
//-----------------------------------------------------------------------------
void CHL2MPClientScoreBoardDialog::UpdateTeamInfo()
{
	if ( g_PR == NULL )
		return;

	int iNumPlayersInGame = 0;

	for ( int j = 1; j <= gpGlobals->maxClients; j++ )
	{	
		if ( g_PR->IsConnected( j ) )
		{
			iNumPlayersInGame++;
		}
	}

	//BG2 - Get the total team damage points. -HairyPotter
	iAmericanDmg = 0;
	iBritishDmg = 0;
	iSpecDmg = 0;

	for ( int j = 1; j <= gpGlobals->maxClients; j++ )
	{	
		C_BasePlayer *pPlayer = UTIL_PlayerByIndex( j );
		if ( pPlayer )
		{
			switch ( pPlayer->GetTeamNumber() )
			{
			case TEAM_AMERICANS:
				iAmericanDmg += g_PR->GetDeaths( j );
				break;
			case TEAM_BRITISH:
				iBritishDmg += g_PR->GetDeaths( j );
				break;
			case TEAM_SPECTATOR:
				iSpecDmg += g_PR->GetDeaths( j );
			break;
			}
		}
	}
	//

	// update the team sections in the scoreboard
	for ( int i = TEAM_SPECTATOR; i < TEAM_MAXCOUNT; i++ )
	{
		wchar_t *teamName = NULL;
		int sectionID = 0;
		C_Team *team = GetGlobalTeam(i);

		if ( team )
		{
			sectionID = GetSectionFromTeamNumber( i );

			// update team name
			wchar_t name[64];
			wchar_t string1[1024];
			wchar_t wNumPlayers[6];

			_snwprintf(wNumPlayers, 6, L"%i", team->Get_Number_Players());

			if (!teamName && team)
			{
				g_pVGuiLocalize->ConvertANSIToUnicode(team->Get_Name(), name, sizeof(name));
				teamName = name;
			}

			if (team->Get_Number_Players() == 1)
			{
				g_pVGuiLocalize->ConstructString( string1, sizeof(string1), g_pVGuiLocalize->Find("#ScoreBoard_Player"), 2, teamName, wNumPlayers );
			}
			else
			{
				g_pVGuiLocalize->ConstructString( string1, sizeof(string1), g_pVGuiLocalize->Find("#ScoreBoard_Players"), 2, teamName, wNumPlayers );
			}

			// update stats
			wchar_t deaths[8];
			wchar_t val[6];
			swprintf(val, L"%d", team->Get_Score());

			switch( i )
			{
				case TEAM_AMERICANS:	
					swprintf(deaths, L"%d", iAmericanDmg);
					break;
				case TEAM_BRITISH:	
					swprintf(deaths, L"%d", iBritishDmg);
					break;
				case TEAM_SPECTATOR:	
					swprintf(deaths, L"%d", iSpecDmg);
					break;
			}

			if ( cl_scoreboard.GetInt() == 1 ) //Old scoreboard.
			{
				m_pPlayerList->ModifyColumn(sectionID, "deaths", deaths);
				m_pPlayerList->ModifyColumn(sectionID, "frags", val);
				if (team->Get_Ping() < 1)
				{
					m_pPlayerList->ModifyColumn(sectionID, "ping", L"");
				}
				else
				{
					swprintf(val, L"%d", team->Get_Ping());
					m_pPlayerList->ModifyColumn(sectionID, "ping", val);
				}
				m_pPlayerList->ModifyColumn(sectionID, "name", string1);
			}
			else //New Scoreboard.
			{
				switch( i )
				{
					case TEAM_BRITISH:	//British is always "sectionID" 1 in new scoreboard, because the british team has their own section.
						//swprintf(deaths, L"%d", iBritishDmg);
						m_pBritishPlayerList->ModifyColumn(1, "deaths", deaths);
						m_pBritishPlayerList->ModifyColumn(1, "frags", val);
						if (team->Get_Ping() < 1)
						{
							m_pBritishPlayerList->ModifyColumn(1, "ping", L"");
						}
						else
						{
							swprintf(val, L"%d", team->Get_Ping());
							m_pBritishPlayerList->ModifyColumn(1, "ping", val);
						}
						m_pBritishPlayerList->ModifyColumn(1, "name", string1);
						break;
					default: //If it's not British just stick everything in the "default" (American) section.
						m_pPlayerList->ModifyColumn(sectionID, "deaths", deaths);
						m_pPlayerList->ModifyColumn(sectionID, "frags", val);
						if (team->Get_Ping() < 1)
						{
							m_pPlayerList->ModifyColumn(sectionID, "ping", L"");
						}
						else
						{
							swprintf(val, L"%d", team->Get_Ping());
							m_pPlayerList->ModifyColumn(sectionID, "ping", val);
						}
						m_pPlayerList->ModifyColumn(sectionID, "name", string1);
						break;
				}
			}
		}
	}
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CControlPointProgressBar::UpdateBarText( void )
{
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	if ( !pPlayer || !m_pBarText || !m_pAttachedToIcon )
		return;

	m_pBarText->SetVisible( true );

	int iCP = m_pAttachedToIcon->GetCapIndex();
	int iCappingTeam = ObjectiveResource()->GetCappingTeam( iCP );
	int iPlayerTeam = pPlayer->GetTeamNumber();
	int iOwnerTeam = ObjectiveResource()->GetOwningTeam( iCP );

	m_pBarText->SetPos( XRES(25), YRES(20) );

	if ( !TeamplayGameRules()->PointsMayBeCaptured() )
	{
		m_pBarText->SetText( "#Team_Capture_NotNow" );
		return;
	}

	if ( mp_blockstyle.GetInt() == 1 && iCappingTeam != TEAM_UNASSIGNED && iCappingTeam != iPlayerTeam )
	{
		if ( ObjectiveResource()->IsCPBlocked(iCP) )
		{
			m_pBarText->SetText( "#Team_Blocking_Capture" );
			return;
		}
		else if ( iOwnerTeam == TEAM_UNASSIGNED )
		{
			m_pBarText->SetText( "#Team_Reverting_Capture" );
			return;
		}
	}

	if ( ObjectiveResource()->GetOwningTeam(iCP) == iPlayerTeam )
	{
		// If the opponents can never recapture this point back, we use a different string
		if ( iPlayerTeam != TEAM_UNASSIGNED )
		{
			int iEnemyTeam = ( iPlayerTeam == TF_TEAM_RED ) ? TF_TEAM_BLUE : TF_TEAM_RED;
			if ( !ObjectiveResource()->TeamCanCapPoint( iCP, iEnemyTeam ) )
			{
				m_pBarText->SetText( "#Team_Capture_Owned" );
				return;
			}
		}

		m_pBarText->SetText( "#Team_Capture_OwnPoint" );
		m_pBarText->SetPos( XRES(30), YRES(20) );
		return;
	}

	if ( !TeamplayGameRules()->TeamMayCapturePoint( iPlayerTeam, iCP ) )
	{
		if ( TeamplayRoundBasedRules() && TeamplayRoundBasedRules()->IsInArenaMode() == true )
		{
			m_pBarText->SetText( "#Team_Capture_NotNow" );
		}
		else
		{
			m_pBarText->SetText( "#Team_Capture_Linear" );
		}

		return;
	}

	char szReason[256];
	if ( !TeamplayGameRules()->PlayerMayCapturePoint( pPlayer, iCP, szReason, sizeof(szReason) ) )
	{
		m_pBarText->SetText( szReason );
		return;
	}

	bool bHaveRequiredPlayers = true;

	// In Capstyle 1, more players simply cap faster, no required amounts.
	if ( mp_capstyle.GetInt() != 1 )
	{
		int nNumTeammates = ObjectiveResource()->GetNumPlayersInArea( iCP, iPlayerTeam );
		int nRequiredTeammates = ObjectiveResource()->GetRequiredCappers( iCP, iPlayerTeam );
		bHaveRequiredPlayers = (nNumTeammates >= nRequiredTeammates);
	}

	if ( iCappingTeam == iPlayerTeam && bHaveRequiredPlayers )
	{
		m_pBarText->SetText( "#Team_Capture_Blocked" );
		return;
	}

	if ( !ObjectiveResource()->TeamCanCapPoint( iCP, iPlayerTeam ) )
	{
		m_pBarText->SetText( "#Team_Cannot_Capture" );
		return;
	}

	m_pBarText->SetText( "#Team_Waiting_for_teammate" );
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CControlPointIcon::UpdateCapImage( void )
{
	C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
	if ( !pPlayer )
		return;

	if ( m_pCapImage )
	{
		int iCappingTeam = ObjectiveResource()->GetCappingTeam( m_iCPIndex );
		int iOwningTeam = ObjectiveResource()->GetOwningTeam( m_iCPIndex );

		if ( iCappingTeam != TEAM_UNASSIGNED && iCappingTeam != iOwningTeam )
		{
			const char *pszCapSwipe = ObjectiveResource()->GetGameSpecificCPCappingSwipe( m_iCPIndex, iCappingTeam );
			if ( m_bSwipeUp )
			{
				m_pCapImage->SetImage( VarArgs("%s_up",pszCapSwipe)  );
			}
			else
			{
				m_pCapImage->SetImage( pszCapSwipe );
			}
			m_pCapImage->SetVisible( true );

			// Tell the cap highlight image to fire up if it's our point being capped
			if ( m_pCapHighlightImage && pPlayer->GetTeamNumber() != iCappingTeam && pPlayer->GetTeamNumber() > LAST_SHARED_TEAM )
			{
				if ( ShouldDraw() && GetParent() && GetParent()->IsVisible() )
				{
					m_pCapHighlightImage->SetVisible( true );
					m_pCapHighlightImage->StartSwoop();
				}
				m_pBaseImage->StartPulsing( STARTCAPANIM_ICON_SWITCH, 0, true );
			}
			else
			{
				m_pBaseImage->StartPulsing( 0, 0, true );
			}

			if ( m_pCapPlayerImage )
			{
				m_pCapPlayerImage->SetVisible( true );
			}

			m_iPrevCappers = iCappingTeam;
			InvalidateLayout( true );
		}
		else
		{
			m_pBaseImage->StopPulsing();
			m_pCapImage->SetVisible( false );
			if ( m_pCapHighlightImage )
			{
				m_pCapHighlightImage->SetVisible( false );
			}
			if ( m_pCapPlayerImage )
			{
				m_pCapPlayerImage->SetVisible( false );
			}
			if ( m_pCapNumPlayers )
			{
				m_pCapNumPlayers->SetVisible( false );
			}
		}
	}
}