void SpectatorPanel::EnableInsetView(bool isEnabled)
{
	auto pSpectator = GETHUDCLASS( CHudSpectator );

	if( !pSpectator )
		return;

	int x = pSpectator->m_OverviewData.insetWindowX;
	int y = pSpectator->m_OverviewData.insetWindowY;
	int wide = pSpectator->m_OverviewData.insetWindowWidth;
	int tall = pSpectator->m_OverviewData.insetWindowHeight;
	int offset = x + wide + 2;
	
	if ( isEnabled )
	{
		// short black bar to see full inset
		m_TopBorder->setBounds(	XRES(offset), 0, XRES(640 - offset ), PANEL_HEIGHT );

		if ( gEngfuncs.IsSpectateOnly() )
		{
			m_TopBanner->setVisible( true );
			m_TopBanner->setPos( XRES(offset), 0 );
		}
		else
			m_TopBanner->setVisible( false );
		
		m_InsetViewButton->setBounds(	XRES( x -1 ), YRES( y ), 
										XRES( wide +2), YRES( tall ) );
		m_InsetViewButton->setVisible(true);
	}
	else
	{	
		// full black bar, no inset border
		// show banner only in real HLTV mode
		if ( gEngfuncs.IsSpectateOnly() )
		{
			m_TopBanner->setVisible( true );
			m_TopBanner->setPos( 0,0 );
		}
		else
			m_TopBanner->setVisible( false );

		m_TopBorder->setBounds( 0, 0, ScreenWidth, PANEL_HEIGHT );
						
		m_InsetViewButton->setVisible(false);
	}

	m_insetVisible = isEnabled;

	Update();

	m_CamButton->setButtonText( Localize().BufferedLocaliseTextString( GetSpectatorLabel( g_iUser1 ) ) );
}
//-----------------------------------------------------------------------------
// Purpose: Draw the weapon's crosshair
//-----------------------------------------------------------------------------
void CWeaponCombatLaserRifle::DrawCrosshair( void )
{
	BaseClass::DrawCrosshair();

	// Draw the targeting zone around the crosshair
	int r, g, b, a;
	gHUD.m_clrYellowish.GetColor( r, g, b, a );

	// Check to see if we are in vgui mode
	C_BaseTFPlayer *pPlayer	= static_cast<C_BaseTFPlayer*>( GetOwner() );
	if ( !pPlayer || pPlayer->IsInVGuiInputMode() )
		return;

	// Draw a crosshair & accuracy hoodad
	int iBarWidth = XRES(10);
	int iBarHeight = YRES(10);
	int iTotalWidth = (iBarWidth * 2) + (40 * m_flInaccuracy) + XRES(10);
	int iTotalHeight = (iBarHeight * 2) + (40 * m_flInaccuracy) + YRES(10);
	
	// Horizontal bars
	int iLeft = (ScreenWidth() - iTotalWidth) / 2;
	int iMidHeight = (ScreenHeight() / 2);

	Color dark( r, g, b, 32 );
	Color light( r, g, b, 160 );

	vgui::surface()->DrawSetColor( dark );

	vgui::surface()->DrawFilledRect( iLeft, iMidHeight-1, iLeft+ iBarWidth, iMidHeight + 2 );
	vgui::surface()->DrawFilledRect( iLeft + iTotalWidth - iBarWidth, iMidHeight-1, iLeft + iTotalWidth, iMidHeight + 2 );

	vgui::surface()->DrawSetColor( light );

	vgui::surface()->DrawFilledRect( iLeft, iMidHeight, iLeft + iBarWidth, iMidHeight + 1 );
	vgui::surface()->DrawFilledRect( iLeft + iTotalWidth - iBarWidth, iMidHeight, iLeft + iTotalWidth, iMidHeight + 1 );
	
	// Vertical bars
	int iTop = (ScreenHeight() - iTotalHeight) / 2;
	int iMidWidth = (ScreenWidth() / 2);

	vgui::surface()->DrawSetColor( dark );
	
	vgui::surface()->DrawFilledRect( iMidWidth-1, iTop, iMidWidth + 2, iTop + iBarHeight );
	vgui::surface()->DrawFilledRect( iMidWidth-1, iTop + iTotalHeight - iBarHeight, iMidWidth + 2, iTop + iTotalHeight );

	vgui::surface()->DrawSetColor( light );

	vgui::surface()->DrawFilledRect( iMidWidth, iTop, iMidWidth + 1, iTop + iBarHeight );
	vgui::surface()->DrawFilledRect( iMidWidth, iTop + iTotalHeight - iBarHeight, iMidWidth + 1, iTop + iTotalHeight );
}
void CImageLabel::LoadImage(const char * pImageName)
{
	if ( m_pTGA )
		delete m_pTGA;

	// Load the Image
	m_pTGA = LoadTGAForRes(pImageName);

	if ( m_pTGA == NULL )
	{
		// we didn't find a matching image file for this resolution
		// try to load file resolution independent

		char sz[256];
		sprintf(sz, "%s/%s",gEngfuncs.pfnGetGameDirectory(), pImageName );
		FileInputStream* fis = new FileInputStream( sz, false );
		m_pTGA = new BitmapTGA(fis,true);
		fis->close();
	}

	if ( m_pTGA == NULL )
		return;	// unable to load image
	 	
	int w,t;

	m_pTGA->getSize( w, t );

	setSize( XRES (w),YRES (t) );
	setImage( m_pTGA );
}
Exemple #4
0
static void wadsp_close(void)
{
    XRES(1);
    Z();
    SCLK(0);
    tty_close();
}
int CHudBackground::Draw(float flTime)
{
	int r = 0, g = 0, b = 0, x = 0, y = 0;
	int x_length = 0, y_length = 0;      // positions of the spots

	y_length = gHUD.GetSpriteRect(m_HUD_back).bottom - gHUD.GetSpriteRect(m_HUD_back).top;
	x_length = gHUD.GetSpriteRect(m_HUD_back).right - gHUD.GetSpriteRect(m_HUD_back).left;

	UnpackRGB(r, g, b, RGB_WHITEISH);
	ScaleColors(r, g, b, 255);
	// position the sprite in the upper right corner of display...
	x = XRES(0);

	y = (YRES(480) - y_length);

	if (g_iWaterLevel != 3)
	{
		y_length = gHUD.GetSpriteRect(m_HUD_back).bottom - gHUD.GetSpriteRect(m_HUD_back).top;
		x_length = gHUD.GetSpriteRect(m_HUD_back).right - gHUD.GetSpriteRect(m_HUD_back).left;

		SPR_Set(m_hSprite, r, g, b);
		SPR_DrawHoles(0, x, y, m_SpriteArea);
		return 1;
	}
	else
	{
		y_length = gHUD.GetSpriteRect(m_HUD_water).bottom - gHUD.GetSpriteRect(m_HUD_water).top;
		x_length = gHUD.GetSpriteRect(m_HUD_water).right - gHUD.GetSpriteRect(m_HUD_water).left;

		SPR_Set(gHUD.GetSprite(m_HUD_water), r, g, b);
		SPR_DrawHoles((((int)(flTime*14))%24), x, y, m_SpriteArea);
		return 0;
	}
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
CTFFreezePanelCallout *CTFFreezePanel::TestAndAddCallout( Vector &origin, Vector &vMins, Vector &vMaxs, CUtlVector<Vector> *vecCalloutsTL, 
			CUtlVector<Vector> *vecCalloutsBR, Vector &vecFreezeTL, Vector &vecFreezeBR, Vector &vecStatTL, Vector &vecStatBR, int *iX, int *iY )
{
	// This is the offset from the topleft of the callout to the arrow tip
	const int iXOffset = XRES(25);
	const int iYOffset = YRES(50);

	//if ( engine->IsBoxInViewCluster( vMins + origin, vMaxs + origin) && !engine->CullBox( vMins + origin, vMaxs + origin ) )
	{
		if ( GetVectorInScreenSpace( origin, *iX, *iY ) )
		{
			*iX -= iXOffset;
			*iY -= iYOffset;
			int iRight = *iX + CALLOUT_WIDE;
			int iBottom = *iY + CALLOUT_TALL;
			if ( *iX > 0 && *iY > 0 && (iRight < ScreenWidth()) && (iBottom < (ScreenHeight()-YRES(40))) )
			{
				// Make sure it wouldn't be over the top of the freezepanel or statpanel
				Vector vecCalloutTL( *iX, *iY, 0 );
				Vector vecCalloutBR( iRight, iBottom, 1 );
				if ( !QuickBoxIntersectTest( vecCalloutTL, vecCalloutBR, vecFreezeTL, vecFreezeBR ) &&
					 !QuickBoxIntersectTest( vecCalloutTL, vecCalloutBR, vecStatTL, vecStatBR ) )
				{
					// Make sure it doesn't intersect any other callouts
					bool bClear = true;
					for ( int iCall = 0; iCall < vecCalloutsTL->Count(); iCall++ )
					{
						if ( QuickBoxIntersectTest( vecCalloutTL, vecCalloutBR, vecCalloutsTL->Element(iCall), vecCalloutsBR->Element(iCall) ) )
						{
							bClear = false;
							break;
						}
					}

					if ( bClear )
					{
						// Verify that we have LOS to the gib
						trace_t	tr;
						UTIL_TraceLine( origin, MainViewOrigin(), MASK_OPAQUE, NULL, COLLISION_GROUP_NONE, &tr );
						bClear = ( tr.fraction >= 1.0f );
					}

					if ( bClear )
					{
						CTFFreezePanelCallout *pCallout = new CTFFreezePanelCallout( g_pClientMode->GetViewport(), "FreezePanelCallout" );
						m_pCalloutPanels.AddToTail( vgui::SETUP_PANEL(pCallout) );
						vecCalloutsTL->AddToTail( vecCalloutTL );
						vecCalloutsBR->AddToTail( vecCalloutBR );
						pCallout->SetVisible( true );
						pCallout->SetBounds( *iX, *iY, CALLOUT_WIDE, CALLOUT_TALL );
						return pCallout;
					}
				}
			}
		}
	}

	return NULL;
}
Exemple #7
0
static void wadsp_send_bit(int bit)
{
    if (reset) {
	XRES(0);
	reset = 0;
    }
    SDATA(bit);
    SCLK(1);
    SCLK(0);
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CAvatarImage::InitFromRGBA( const byte *rgba, int width, int height )
{
	m_iTextureID = vgui::surface()->CreateNewTextureID( true );
	vgui::surface()->DrawSetTextureRGBA( m_iTextureID, rgba, width, height, false, false );
	m_nWide = XRES(width);
	m_nTall = YRES(height);
	m_Color = Color( 255, 255, 255, 255 );

	m_bValid = true;
}
void SpectatorPanel::Update()
{
	auto pSpectator = GETHUDCLASS( CHudSpectator );

	if( !pSpectator )
		return;

	int iTextWidth, iTextHeight;
	int iTimeHeight, iTimeWidth;
	int offset,j;

	if ( m_insetVisible )
		offset = pSpectator->m_OverviewData.insetWindowX + pSpectator->m_OverviewData.insetWindowWidth + 2;
	else
		offset = 0;

	bool visible = pSpectator->m_drawstatus->value != 0;
	
	m_ExtraInfo->setVisible( visible );
	m_TimerImage->setVisible( visible );
	m_CurrentTime->setVisible( visible );
	m_Separator->setVisible( visible );

	for ( j= 0; j < TEAM_NUMBER; j++ )
		m_TeamScores[j]->setVisible( visible );

	if ( !visible )
		return;
		
	m_ExtraInfo->getTextSize( iTextWidth, iTextHeight );
	m_CurrentTime->getTextSize( iTimeWidth, iTimeHeight );

	iTimeWidth += XRES ( SEPERATOR_WIDTH*2 + 1 ); // +timer icon
	iTimeWidth += ( SEPERATOR_WIDTH-(iTimeWidth%SEPERATOR_WIDTH) );

	if ( iTimeWidth > iTextWidth )
		iTextWidth = iTimeWidth;

	int xPos = ScreenWidth - ( iTextWidth + XRES ( SEPERATOR_WIDTH + offset ) );

	m_ExtraInfo->setBounds( xPos, YRES( SEPERATOR_HEIGHT ), iTextWidth, iTextHeight );

	m_TimerImage->setBounds( xPos, YRES( SEPERATOR_HEIGHT ) + iTextHeight , XRES(SEPERATOR_WIDTH*2 + 1), YRES(SEPERATOR_HEIGHT + 1) );
	
	m_CurrentTime->setBounds( xPos + XRES ( SEPERATOR_WIDTH*2 + 1 ), YRES( SEPERATOR_HEIGHT ) + iTextHeight , iTimeWidth, iTimeHeight );

	m_Separator->setPos( ScreenWidth - ( iTextWidth + XRES ( 2*SEPERATOR_WIDTH+SEPERATOR_WIDTH/2+offset ) ) , YRES( 5 ) );
	m_Separator->setSize( XRES( 1 ),  PANEL_HEIGHT - 10  );

	for ( j= 0; j < TEAM_NUMBER; j++ )
	{
		int iwidth, iheight;
			
		m_TeamScores[j]->getTextSize( iwidth, iheight );
		m_TeamScores[j]->setBounds( ScreenWidth - ( iTextWidth + XRES ( 2*SEPERATOR_WIDTH+2*SEPERATOR_WIDTH/2+offset ) + iwidth ), YRES( SEPERATOR_HEIGHT ) + ( iheight * j ), iwidth, iheight );
	}
}
//-----------------------------------------------------------------------------
// Purpose: Draw the jetpack level
//-----------------------------------------------------------------------------
void CHudEMP::Paint()
{
	// Rush label
	int iX, iY;
	GetPos( iX, iY );
	int iWidth = XRES(16);
	int iHeight = YRES(16);

	if ( m_pFrameVar )
	{
		float curtime = gpGlobals->curtime;

		if ( curtime >= m_flNextFrameChange )
		{
			m_flNextFrameChange = curtime + ( 1.0f / HUDEMP_FRAMERATE );

			int frame = m_pFrameVar->GetIntValue();
			frame++;
			if ( frame >= m_nNumFrames )
			{
				frame = 0;
			}
			m_pFrameVar->SetIntValue(frame);
		}
	}

	IMesh* pMesh = materials->GetDynamicMesh( true, NULL, NULL, m_pEMPIcon );

	CMeshBuilder meshBuilder;
	meshBuilder.Begin( pMesh, MATERIAL_QUADS, 1 );

	meshBuilder.Color3f( 1.0, 1.0, 1.0 );
	meshBuilder.TexCoord2f( 0,0,0 );
	meshBuilder.Position3f( iX,iY,0 );
	meshBuilder.AdvanceVertex();

	meshBuilder.Color3f( 1.0, 1.0, 1.0 );
	meshBuilder.TexCoord2f( 0,1,0 );
	meshBuilder.Position3f( iX+iWidth, iY, 0 );
	meshBuilder.AdvanceVertex();

	meshBuilder.Color3f( 1.0, 1.0, 1.0 );
	meshBuilder.TexCoord2f( 0,1,1 );
	meshBuilder.Position3f( iX+iWidth, iY+iHeight, 0 );
	meshBuilder.AdvanceVertex();

	meshBuilder.Color3f( 1.0, 1.0, 1.0 );
	meshBuilder.TexCoord2f( 0,0,1 );
	meshBuilder.Position3f( iX, iY+iHeight, 0 );
	meshBuilder.AdvanceVertex();

	meshBuilder.End();
	pMesh->Draw();
}
CFirstMenu :: CFirstMenu(int iTrans, int iRemoveMe, int x, int y, int wide, int tall) : CMenuPanel(iTrans, iRemoveMe, x,y,wide,tall)
{
    CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
    SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Title Font" );
 
    int r, g, b, a;
 
    m_pPanel = new CTransparentPanel( 200, XRES(80), YRES(80), XRES(BASE_WIDTH), YRES(BASE_HEIGHT));
    m_pPanel->setParent( this );
    m_pPanel->setBorder( new LineBorder( Color(255 * 0.7,170 * 0.7,0,0) ) );
 
    m_pCancelButton = new CommandButton( gHUD.m_TextMessage.BufferedLocaliseTextString( "Cancel" ),
                                         XRES(50), YRES(279), XRES(378), YRES(42));
    m_pCancelButton->setContentAlignment(vgui::Label::a_center);
    m_pCancelButton->setParent( m_pPanel );
    m_pCancelButton->addActionSignal( new CMenuHandler_TextWindow(HIDE_TEXTWINDOW) );
 
    m_pTitle = new Label( "", XRES(1), YRES(1), XRES(478), YRES(58) );
    m_pTitle->setParent( m_pPanel );
    m_pTitle->setFont( pSchemes->getFont(hTitleScheme) );
    pSchemes->getFgColor( hTitleScheme, r, g, b, a );
    m_pTitle->setFgColor( r, g, b, a );
    pSchemes->getBgColor( hTitleScheme, r, g, b, a );
    m_pTitle->setBgColor( r, g, b, a );
    m_pTitle->setContentAlignment( vgui::Label::a_center );
    m_pTitle->setText( "Your First Menu" );
 
    // Start - VGUI Tutorial 2
    m_pSpeak = new CommandButton( "Say something", XRES(1), YRES(61), XRES(478), YRES(58));
    m_pSpeak->setContentAlignment( vgui::Label::a_center );
    m_pSpeak->setParent( m_pPanel );
    m_pSpeak->addActionSignal( new CMenuHandler_StringCommand( "test_say" ) );
    // End - VGUI Tutorial 2


	  // Start - VGUI Tutorial 3
	/*
    m_pEditbox = new TextEntry( "Testing!", XRES(200), YRES(230), XRES(230), 17);
    m_pEditbox->setVisible( true );
    m_pEditbox->setParent( m_pPanel );
*/
    m_pMyPicture = new CImageLabel( "cross", XRES(BASE_WIDTH/2), YRES(BASE_HEIGHT/2) );
	m_pMyPicture->setParent( m_pPanel );
    m_pMyPicture->setVisible( true );
    // End - VGUI Tutorial 3 
}
//-----------------------------------------------------------------------------
// Purpose: Draw the ammo counts
//-----------------------------------------------------------------------------
void CWeaponCombatShield::DrawAmmo( void )
{
	// ROBIN: Removed this now that the shield colors itself to show health level
	return;

	int r, g, b, a;
	int x, y;

	// Get the shield power level
	float flPowerLevel = GetShieldHealth();
	float flInverseFactor = 1.0 - flPowerLevel;

	// Set our color
	gHUD.m_clrNormal.GetColor( r, g, b, a );
	
	int iWidth = XRES(12);
	int iHeight = YRES(64);

	x = XRES(548);
	y = ( ScreenHeight() - YRES(2) - iHeight );

	// Flashing the power level?
	float flFlash = 0;
	if ( gpGlobals->curtime < m_flFlashTimeEnd && !GetPrimaryAmmo() )
	{
		flFlash = fmod( gpGlobals->curtime, 0.25 );
		flFlash *= 2 * M_PI;
		flFlash = cos( flFlash );
	}

	// draw the exhausted portion of the bar.
	vgui::surface()->DrawSetColor( Color( r, g * flPowerLevel, b * flPowerLevel, 100 + (flFlash * 100) ) );
	vgui::surface()->DrawFilledRect( x, y, x + iWidth, y + iHeight * flInverseFactor );

	// draw the powerered portion of the bar
	vgui::surface()->DrawSetColor( Color( r, g * flPowerLevel, b * flPowerLevel, 190 ) );
	vgui::surface()->DrawFilledRect( x, y + iHeight * flInverseFactor, x + iWidth, y + iHeight * flInverseFactor + iHeight * flPowerLevel);
}
void SpectatorPanel::Update()
{
	int iTextWidth, iTextHeight;
	int iTimeHeight, iTimeWidth;
	int offset,j;

	if ( m_insetVisible )
		offset = gHUD.m_Spectator.m_OverviewData.insetWindowX + gHUD.m_Spectator.m_OverviewData.insetWindowWidth + 2;
	else
		offset = 0;

	bool visible = gHUD.m_Spectator.m_drawstatus->value != 0;
	
	m_ExtraInfo->setVisible( visible );
	m_TimerImage->setVisible( visible );
	m_CurrentTime->setVisible( visible );
	m_Separator->setVisible( visible );

	for ( j= 0; j < TEAM_NUMBER; j++ )
		m_TeamScores[j]->setVisible( visible );

	if ( !visible )
		return;
		
	m_ExtraInfo->getTextSize( iTextWidth, iTextHeight );
	m_CurrentTime->getTextSize( iTimeWidth, iTimeHeight );

	iTimeWidth += XRES ( 14 ); // +timer icon
	iTimeWidth += ( 4-(iTimeWidth%4) );

	if ( iTimeWidth > iTextWidth )
		iTextWidth = iTimeWidth;

	int xPos = ScreenWidth - ( iTextWidth + XRES ( 4 + offset ) );

	m_ExtraInfo->setBounds( xPos, YRES( 1 ), iTextWidth, iTextHeight );

	m_TimerImage->setBounds( xPos, YRES( 2 ) + iTextHeight , XRES(14), YRES(14) );
	
	m_CurrentTime->setBounds( xPos + XRES ( 14 + 1 ), YRES( 2 ) + iTextHeight , iTimeWidth, iTimeHeight );

	m_Separator->setPos( ScreenWidth - ( iTextWidth + XRES ( 4+2+4+offset ) ) , YRES( 1 ) );
	m_Separator->setSize( XRES( 4 ), YRES( PANEL_HEIGHT - 2 ) );

	for ( j= 0; j < TEAM_NUMBER; j++ )
	{
		int iwidth, iheight;
			
		m_TeamScores[j]->getTextSize( iwidth, iheight );
		m_TeamScores[j]->setBounds( ScreenWidth - ( iTextWidth + XRES ( 4+2+4+2+offset ) + iwidth ), YRES( 1 ) + ( iheight * j ), iwidth, iheight );
	}
}
void CHudSmokeBomb::Paint()
{
	if ( !m_pIcon )
	{
		m_pIcon = gHUD.GetIcon( "cond_smoke_bomb" );
	}

	int x, y, w, h;
	GetBounds( x, y, w, h );

	if ( m_pIcon )
	{
		m_pIcon->DrawSelf( 0, 0, w, w, Color(255,255,255,255) );
	}

	// Draw a progress bar for time remaining
	int barX = XRES(5);
	int barW = w - XRES(10);
	int barY = w + YRES(5);
	int barH = YRES(10);

	C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();

	if ( !pPlayer )
		return;
    
	float flExpireTime = pPlayer->m_Shared.GetSmokeBombExpireTime();

	float flPercent = ( flExpireTime - gpGlobals->curtime ) / tf_smoke_bomb_time.GetFloat();

	surface()->DrawSetColor( Color(0,0,0,255) );
	surface()->DrawFilledRect( barX - 1, barY - 1, barX + barW + 1, barY + barH + 1 );

	surface()->DrawSetColor( Color(200,200,200,255) );
	surface()->DrawFilledRect( barX, barY, barX + (int)( (float)barW * flPercent ), barY + barH );
}
void SpectatorPanel::ShowMenu(bool isVisible)
{
	//	m_HideButton->setVisible(isVisible);	m_HideButton->setArmed( false );
	m_OptionButton->setVisible(isVisible);
	m_OptionButton->setArmed(false);
	m_CamButton->setVisible(isVisible);
	m_CamButton->setArmed(false);
	m_NextPlayerButton->setVisible(isVisible);
	m_NextPlayerButton->setArmed(false);
	m_PrevPlayerButton->setVisible(isVisible);
	m_PrevPlayerButton->setArmed(false);

	if(!isVisible)
	{
		int iLabelSizeX, iLabelSizeY;
		m_BottomMainLabel->setVisible(true);
		m_BottomMainButton->setVisible(false);

		m_BottomMainLabel->getSize(iLabelSizeX, iLabelSizeY);
		m_BottomMainLabel->setPos((ScreenWidth / 2) - (iLabelSizeX / 2), YRES(6));
	}
	else
	{
		m_BottomMainButton->setPos(XRES((15 + OPTIONS_BUTTON_X + 15) + 31), YRES(6));
		m_BottomMainLabel->setVisible(false);
		m_BottomMainButton->setVisible(true);
	}

	if(!isVisible)
	{
		gViewPort->HideCommandMenu();

		// if switching from visible menu to invisible menu, show help text
		if(m_menuVisible && this->isVisible())
		{
			char string[64];

			_snprintf(string, sizeof(string) - 1, "%c%s", HUD_PRINTCENTER, CHudTextMessage::BufferedLocaliseTextString("#Spec_Duck"));
			string[sizeof(string) - 1] = '\0';

			gHUD.m_TextMessage.MsgFunc_TextMsg(NULL, strlen(string) + 1, string);
		}
	}

	m_menuVisible = isVisible;

	gViewPort->UpdateCursorState();
}
Exemple #16
0
static int wadsp_open(const char *dev,int voltage,int power_on,
  const char *args[])
{
    prog_init(NULL,NULL,NULL,&wadsp_bit);
    if (power_on)
	return -1;
    if (voltage == 3)
	fprintf(stderr,
	  "warning: 3V operation is not reliable. Trying anyway ...\n");
    fd = tty_open_raw(dev,B19200);
    XRES(1);
    SCLK(0);
    Z();
    reset = 1;
    inverted = 0;
    sdata = -1;
    return voltage;
}
void CReplayListPanel::ApplySchemeSettings( vgui::IScheme *pScheme )
{
	BaseClass::ApplySchemeSettings( pScheme );

	LoadControlSettings( "resource/ui/replaybrowser/replaylistpanel.res", "GAME" );

#if !defined( TF_CLIENT_DLL )
	SetPaintBorderEnabled( false );
#endif

	MoveScrollBarToTop();

	vgui::ScrollBar *pScrollBar = dynamic_cast< vgui::ScrollBar * >( FindChildByName( "PanelListPanelVScroll" ) );
	pScrollBar->SetScrollbarButtonsVisible( false );
	Color clrButtonColor = GetSchemeColor( "Yellow", Color( 255, 255, 255, 255 ), pScheme );
	Color clrBgColor = GetSchemeColor( "TanDark", Color( 255, 255, 255, 255 ), pScheme );
	const int nWidth = XRES( 5 );
	pScrollBar->SetSize( nWidth, GetTall() );
	pScrollBar->GetSlider()->SetSize( nWidth, GetTall() );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CDoDHudAmmo::PaintRifleGrenadeAmmo( CWeaponDODBase *pWpn )
{
    const CHudTexture *pAmmoIcon = pWpn->GetSpriteAmmo();

    Assert( pAmmoIcon );

    int xpos = small_icon_xpos, ypos = small_icon_ypos;
    int w = small_icon_width, t = small_icon_height;

    int nIconWidth = 0, nIconHeight = 0;
    float scale = 1.0f;

    if ( pAmmoIcon )
    {
        nIconWidth = pAmmoIcon->Width();
        nIconHeight = pAmmoIcon->Height();

        scale = GetScale( nIconWidth, nIconHeight, w, t );

        nIconWidth *= scale;
        nIconHeight *= scale;

        if ( nIconWidth < small_icon_width - XRES(2) ) // 2 is our buffer for when we need to re-calculate the xpos
        {
            xpos = small_icon_xpos + small_icon_width / 2.0 - nIconWidth / 2.0;
        }

        if ( nIconHeight < small_icon_height - YRES(2) ) // 2 is our buffer for when we need to re-calculate the ypos
        {
            ypos = small_icon_ypos + small_icon_height / 2.0 - nIconHeight / 2.0;
        }

        int ammo = m_iAmmo + m_iAmmo2;

        if ( ammo > 0 )
        {
            pAmmoIcon->DrawSelf( xpos, ypos, nIconWidth, nIconHeight, m_clrIcon );
            DrawAmmoCount( ammo );
        }
    }
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseTFVehicle::DrawHudBoostData( void )
{
#define HUD_IMAGE_LEFT	XRES( 568 )

	// Boostable vehicle
	if ( IsBoostable() )
	{
		// Set our color
		CHudTexture *pVehicleBoostLabel = gHUD.GetIcon( "no2" );
		if ( pVehicleBoostLabel )
		{
			int nScreenY = ScreenHeight() - YRES( 12 );
			float nOneHudHeight = ( YRES(10) + pVehicleBoostLabel->Height() );
			nScreenY -= ( nOneHudHeight * 3 );
		
			pVehicleBoostLabel->DrawSelf( HUD_IMAGE_LEFT, nScreenY - pVehicleBoostLabel->Height(), gHUD.m_clrNormal );
			gHUD.DrawProgressBar( HUD_IMAGE_LEFT, nScreenY + YRES( 4 ), XRES( 70 ), YRES( 4 ), m_nBoostTimeLeft / 100.0f, gHUD.m_clrNormal, CHud::HUDPB_HORIZONTAL_INV );
		}
	}

#undef HUD_IMAGE_LEFT
}
void SpectatorPanel::ShowMenu(bool isVisible)
{
//	m_HideButton->setVisible(isVisible);	m_HideButton->setArmed( false );
	m_OptionButton->setVisible(isVisible);		m_OptionButton->setArmed( false );
	m_CamButton->setVisible(isVisible);			m_CamButton->setArmed( false );
	m_NextPlayerButton->setVisible(isVisible);	m_NextPlayerButton->setArmed( false );
	m_PrevPlayerButton->setVisible(isVisible);	m_PrevPlayerButton->setArmed( false );

	if ( !isVisible )
	{
		int iLabelSizeX, iLabelSizeY;
		m_BottomMainLabel->setVisible(true);
		m_BottomMainButton->setVisible(false);

		m_BottomMainLabel->getSize( iLabelSizeX, iLabelSizeY );
		m_BottomMainLabel->setPos( ( ScreenWidth / 2 ) - (iLabelSizeX/2), YRES(6) );
	}
	else
	{
		m_BottomMainButton->setPos( XRES( ( 15 + OPTIONS_BUTTON_X + 15 ) + 31 ), YRES(6) );
		m_BottomMainLabel->setVisible(false);
		m_BottomMainButton->setVisible(true);
	}

	if ( !isVisible )
	{
		gViewPort->HideCommandMenu();

		// if switching from visible menu to invisible menu, show help text
		if ( m_menuVisible && this->isVisible() )
		{
			UTIL_LocalizedTextMsg( HUD_PRINTCENTER, "%s", Localize().BufferedLocaliseTextString( "#Spec_Duck" ) );
		}
	}

	m_menuVisible = isVisible;

	gViewPort->UpdateCursorState();
}
int CHudLensflare::Draw(float flTime)
{  
	return 0;





	vec3_t sunangles, sundir , suntarget;
	vec3_t             v_forward, v_right, v_up, angles; 
	vec3_t             forward, right, up, screen;  
	pmtrace_t tr,tr1;

	//Sun position
	if(Sunanglex != NULL && Sunangley != NULL)
	{
	sunangles.x = Sunanglex;
	sunangles.y = Sunangley;
	}
	else
	{
	sunangles.x = -90;
	sunangles.y = 0;
	}

	text[0] = SPR_Load("sprites/lens/lens21.spr");
	red[0] = green[0] = blue[0] = 1.0;
	scale[0] = 25;
	multi[0] = -0.45;

	text[1] = SPR_Load("sprites/lens/lens7.spr");
	red[1] = green[0] = blue[0] = 1.0;
	scale[1] = 25;
	multi[1] = 0.2;

	text[2] = SPR_Load("sprites/lens/glow01.spr");
	red[2] = 132/255;
	green[2] = 1.0;
	blue[2] = 153/255;
	scale[2] = 35;
	multi[2] = 0.3;

	text[3] = SPR_Load("sprites/lens/glow.spr");
	red[3] = 1.0;
	green[3] = 164/255;
	blue[3] = 164/255;
	scale[3] = 40;
	multi[3] = 0.46;

	text[4] = SPR_Load("sprites/lens/lens11.spr");
	red[4] = 1.0;
	green[4] = 164/255;
	blue[4] = 164/255;
	scale[4] = 52;
	multi[4] = 0.5;

	text[5] = SPR_Load("sprites/lens/lens7.spr");
	red[5] = green[5] = blue[5] = 1.0;
	scale[5] = 31;
	multi[5] = 0.54;

	text[6] = SPR_Load("sprites/lens/lens7.spr");
	red[6] = 0.6;
	green[6] = 1.0;
	blue[6] = 0.6;
	scale[6] = 26;
	multi[6] = 0.64;

	text[7] = SPR_Load("sprites/lens/glow01.spr");
	red[7] = 0.5;
	green[7] = 1.0;
	blue[7] = 0.5;
	scale[7] = 20;
	multi[7] = 0.77;

	text[8] = SPR_Load("sprites/lens/lens11.spr");

	text[9] = SPR_Load("sprites/lens/lens21.spr");

	flPlayerBlend = 0.0;
	flPlayerBlend2 = 0.0;

	AngleVectors( v_angles, forward, null, null );

	AngleVectors( sunangles, sundir, null, null );

	suntarget = v_origin + sundir * 16384;	

	tr = *(gEngfuncs.PM_TraceLine( v_origin, suntarget, PM_TRACELINE_PHYSENTSONLY, 2, -1 ));

	if( gEngfuncs.PM_PointContents( tr.endpos, null ) == CONTENTS_SKY)
	{		
		flPlayerBlend = max( DotProduct( forward, sundir ) - 0.63, 0.0 ) * 5.8;
		if (flPlayerBlend > 1.0 )
		flPlayerBlend = 1.0;

		flPlayerBlend4 = max( DotProduct( forward, sundir ) - 0.85, 0.0 ) * 5;
		if (flPlayerBlend4 > 1.0 )
		flPlayerBlend4 = 1.0;

		flPlayerBlend6 = max( DotProduct( forward, sundir ) - 0.55, 0.0 ) * 5.7;
		if (flPlayerBlend6 > 1.0 )
		flPlayerBlend6 = 1.0;

		flPlayerBlend2 = flPlayerBlend6 * 100.0 ;
		flPlayerBlend3 = flPlayerBlend * 190.0 ;
		flPlayerBlend5 = flPlayerBlend4 * 222.0 ;

		vec3_t normal,point,origin;

		gEngfuncs.GetViewAngles((float*)normal);
		AngleVectors(normal,forward,right,up);

		VectorCopy( tr.endpos, origin );

		gEngfuncs.pTriAPI->WorldToScreen( tr.endpos, screen );

		Suncoordx = XPROJECT( screen[ 0 ] );
		Suncoordy = YPROJECT( screen[ 1 ] ); 


		if (Suncoordx < XRES( -10 ) || Suncoordx > XRES( 650 ) || Suncoordy < YRES( -10 ) || Suncoordy > YRES( 490 )) 
		return 1;

		Screenmx = ScreenWidth/2;
		Screenmy = ScreenHeight/2;

		Sundistx = Screenmx - Suncoordx;
		Sundisty = Screenmy - Suncoordy;

		gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive
		gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *) gEngfuncs.GetSpritePointer(SPR_Load("sprites/lens/lensflare1.spr")) , 0);//use hotglow, or any other sprite for the texture
		gEngfuncs.pTriAPI->CullFace( TRI_NONE ); //no culling
		gEngfuncs.pTriAPI->Color4f(255/255, 255/255 , 255/255, flPlayerBlend3/255.0);
		gEngfuncs.pTriAPI->Brightness(flPlayerBlend3/255.0);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS); //start our quad
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Suncoordx + 190, Suncoordy + 190, 0); //top left
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Suncoordx + 190, Suncoordy - 190, 0); //bottom left
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Suncoordx - 190, Suncoordy - 190, 0); //bottom right
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Suncoordx - 190, Suncoordy + 190, 0); //top right
		gEngfuncs.pTriAPI->End(); //end our list of vertexes
		gEngfuncs.pTriAPI->RenderMode(kRenderNormal);


		gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive
		gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *) gEngfuncs.GetSpritePointer(SPR_Load("sprites/lens/glow1.spr")) , 0);//use hotglow, or any other sprite for the texture
		gEngfuncs.pTriAPI->CullFace( TRI_NONE ); //no culling
		gEngfuncs.pTriAPI->Color4f(255/255, 255/255 , 255/255, flPlayerBlend3/255.0);
		gEngfuncs.pTriAPI->Brightness(flPlayerBlend3/255.0);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS); //start our quad
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Suncoordx + 160, Suncoordy + 160, 0); //top left
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Suncoordx + 160, Suncoordy - 160, 0); //bottom left
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Suncoordx - 160, Suncoordy - 160, 0); //bottom right
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Suncoordx - 160, Suncoordy + 160, 0); //top right
		gEngfuncs.pTriAPI->End(); //end our list of vertexes
		gEngfuncs.pTriAPI->RenderMode(kRenderNormal);

		gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive
		gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *) gEngfuncs.GetSpritePointer(SPR_Load("sprites/lens/lensglare1.spr")) , 0);//use hotglow, or any other sprite for the texture
		gEngfuncs.pTriAPI->CullFace( TRI_NONE ); //no culling
		gEngfuncs.pTriAPI->Color4f(1.0, 1.0 , 1.0, flPlayerBlend5/255.0);
		gEngfuncs.pTriAPI->Brightness(flPlayerBlend5/255.0);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS); //start our quad
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(0, 0, 0); //top left
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(0, ScreenHeight, 0); //bottom left
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(ScreenWidth, ScreenHeight, 0); //bottom right
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(ScreenWidth, 0, 0); //top right
		gEngfuncs.pTriAPI->End(); //end our list of vertexes
		gEngfuncs.pTriAPI->RenderMode(kRenderNormal);

		int i = 1;
		Lensx[i] = (Suncoordx + (Sundistx * multi[i]));
		Lensy[i] = (Suncoordy + (Sundisty * multi[i]));
		gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive
		gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *) gEngfuncs.GetSpritePointer(text[i]) , 0); //hotglow, or any other sprite for the texture
		gEngfuncs.pTriAPI->CullFace( TRI_NONE ); //no culling
		gEngfuncs.pTriAPI->Color4f(red[i], green[i] , green[i], flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Brightness(flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS); //start our quad
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] + scale[i], 0); //top left
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] - scale[i], 0); //bottom left
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] - scale[i], 0); //bottom right
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] + scale[i], 0); //top right
		gEngfuncs.pTriAPI->End(); //end our list of vertexes
		gEngfuncs.pTriAPI->RenderMode(kRenderNormal);

		i++;
		Lensx[i] = (Suncoordx + (Sundistx * multi[i]));
		Lensy[i] = (Suncoordy + (Sundisty * multi[i]));
		gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive
		gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *) gEngfuncs.GetSpritePointer(text[i]) , 0); //hotglow, or any other sprite for the texture
		gEngfuncs.pTriAPI->CullFace( TRI_NONE ); //no culling
		gEngfuncs.pTriAPI->Color4f(red[i], green[i] , green[i], flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Brightness(flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS); //start our quad
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] + scale[i], 0); //top left
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] - scale[i], 0); //bottom left
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] - scale[i], 0); //bottom right
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] + scale[i], 0); //top right
		gEngfuncs.pTriAPI->End(); //end our list of vertexes
		gEngfuncs.pTriAPI->RenderMode(kRenderNormal);

		i++;
		Lensx[i] = (Suncoordx + (Sundistx * multi[i]));
		Lensy[i] = (Suncoordy + (Sundisty * multi[i]));
		gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive
		gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *) gEngfuncs.GetSpritePointer(text[i]) , 0); //hotglow, or any other sprite for the texture
		gEngfuncs.pTriAPI->CullFace( TRI_NONE ); //no culling
		gEngfuncs.pTriAPI->Color4f(red[i], green[i] , green[i], flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Brightness(flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS); //start our quad
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] + scale[i], 0); //top left
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] - scale[i], 0); //bottom left
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] - scale[i], 0); //bottom right
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] + scale[i], 0); //top right
		gEngfuncs.pTriAPI->End(); //end our list of vertexes
		gEngfuncs.pTriAPI->RenderMode(kRenderNormal);

		i++;
		Lensx[i] = (Suncoordx + (Sundistx * multi[i]));
		Lensy[i] = (Suncoordy + (Sundisty * multi[i]));
		gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive
		gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *) gEngfuncs.GetSpritePointer(text[i]) , 0); //hotglow, or any other sprite for the texture
		gEngfuncs.pTriAPI->CullFace( TRI_NONE ); //no culling
		gEngfuncs.pTriAPI->Color4f(red[i], green[i] , green[i], flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Brightness(flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS); //start our quad
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] + scale[i], 0); //top left
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] - scale[i], 0); //bottom left
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] - scale[i], 0); //bottom right
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] + scale[i], 0); //top right
		gEngfuncs.pTriAPI->End(); //end our list of vertexes
		gEngfuncs.pTriAPI->RenderMode(kRenderNormal);

		i++;
		Lensx[i] = (Suncoordx + (Sundistx * multi[i]));
		Lensy[i] = (Suncoordy + (Sundisty * multi[i]));
		gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive
		gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *) gEngfuncs.GetSpritePointer(text[i]) , 0); //hotglow, or any other sprite for the texture
		gEngfuncs.pTriAPI->CullFace( TRI_NONE ); //no culling
		gEngfuncs.pTriAPI->Color4f(red[i], green[i] , green[i], flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Brightness(flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS); //start our quad
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] + scale[i], 0); //top left
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] - scale[i], 0); //bottom left
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] - scale[i], 0); //bottom right
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] + scale[i], 0); //top right
		gEngfuncs.pTriAPI->End(); //end our list of vertexes
		gEngfuncs.pTriAPI->RenderMode(kRenderNormal);

		i++;
		Lensx[i] = (Suncoordx + (Sundistx * multi[i]));
		Lensy[i] = (Suncoordy + (Sundisty * multi[i]));
		gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive
		gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *) gEngfuncs.GetSpritePointer(text[i]) , 0); //hotglow, or any other sprite for the texture
		gEngfuncs.pTriAPI->CullFace( TRI_NONE ); //no culling
		gEngfuncs.pTriAPI->Color4f(red[i], green[i] , green[i], flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Brightness(flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS); //start our quad
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] + scale[i], 0); //top left
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] - scale[i], 0); //bottom left
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] - scale[i], 0); //bottom right
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] + scale[i], 0); //top right
		gEngfuncs.pTriAPI->End(); //end our list of vertexes
		gEngfuncs.pTriAPI->RenderMode(kRenderNormal);

		i++;
		Lensx[i] = (Suncoordx + (Sundistx * multi[i]));
		Lensy[i] = (Suncoordy + (Sundisty * multi[i]));
		gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive
		gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *) gEngfuncs.GetSpritePointer(text[i]) , 0); //hotglow, or any other sprite for the texture
		gEngfuncs.pTriAPI->CullFace( TRI_NONE ); //no culling
		gEngfuncs.pTriAPI->Color4f(red[i], green[i] , green[i], flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Brightness(flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS); //start our quad
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] + scale[i], 0); //top left
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] + scale[i], Lensy[i] - scale[i], 0); //bottom left
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] - scale[i], 0); //bottom right
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx[i] - scale[i], Lensy[i] + scale[i], 0); //top right
		gEngfuncs.pTriAPI->End(); //end our list of vertexes
		gEngfuncs.pTriAPI->RenderMode(kRenderNormal);

		i++;
		int scale1 = 32;
		int Lensx1,Lensy1 = 0;
		Lensx1 = (Suncoordx + (Sundistx * 0.88));
		Lensy1 = (Suncoordy + (Sundisty * 0.88));
		gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive
		gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *) gEngfuncs.GetSpritePointer(text[i]) , 0); //hotglow, or any other sprite for the texture
		gEngfuncs.pTriAPI->CullFace( TRI_NONE ); //no culling
		gEngfuncs.pTriAPI->Color4f(0.9, 0.9 , 0.9, flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Brightness(flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS); //start our quad
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx1 + scale1, Lensy1 + scale1, 0); //top left
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx1 + scale1, Lensy1 - scale1, 0); //bottom left
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx1 - scale1, Lensy1 - scale1, 0); //bottom right
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx1 - scale1, Lensy1 + scale1, 0); //top right
		gEngfuncs.pTriAPI->End(); //end our list of vertexes
		gEngfuncs.pTriAPI->RenderMode(kRenderNormal);

		i++;
		scale1 = 140;
		Lensx1 = (Suncoordx + (Sundistx * 1.1));
		Lensy1 = (Suncoordy + (Sundisty * 1.1));
		gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); //additive
		gEngfuncs.pTriAPI->SpriteTexture( (struct model_s *) gEngfuncs.GetSpritePointer(text[i]) , 0); //hotglow, or any other sprite for the texture
		gEngfuncs.pTriAPI->CullFace( TRI_NONE ); //no culling
		gEngfuncs.pTriAPI->Color4f(0.9, 0.9 , 0.9, flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Brightness(flPlayerBlend2/255.0);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS); //start our quad
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx1 + scale1, Lensy1 + scale1, 0); //top left
		gEngfuncs.pTriAPI->TexCoord2f(0.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx1 + scale1, Lensy1 - scale1, 0); //bottom left
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 0.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx1 - scale1, Lensy1 - scale1, 0); //bottom right
		gEngfuncs.pTriAPI->TexCoord2f(1.0f, 1.0f);gEngfuncs.pTriAPI->Vertex3f(Lensx1 - scale1, Lensy1 + scale1, 0); //top right
		gEngfuncs.pTriAPI->End(); //end our list of vertexes
		gEngfuncs.pTriAPI->RenderMode(kRenderNormal);
	}
	return 1;
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CControlPointIcon::PerformLayout( void )
{
	BaseClass::PerformLayout();

	int iBaseXPos, iBaseYPos;
	ipanel()->GetAbsPos(GetVPanel(), iBaseXPos, iBaseYPos );

	m_pBaseImage->SetBounds( 0, 0, GetWide(), GetTall() );

	if ( m_pCapImage->IsVisible() )
	{
		m_pCapImage->SetBounds( 0, 0, GetWide(), GetTall() );
	}

	if ( m_pCapHighlightImage->IsVisible() )
	{
		int iHeight = ScreenHeight() * 0.75;
		m_pCapHighlightImage->SetBounds( iBaseXPos + CAP_BOX_INDENT_X, iBaseYPos - iHeight, GetWide() - (CAP_BOX_INDENT_X*2), iHeight + GetTall() -CAP_BOX_INDENT_Y );
	}

	int iCappingTeam = ObjectiveResource()->GetCappingTeam( m_iCPIndex );
	int iPlayers = ObjectiveResource()->GetNumPlayersInArea( m_iCPIndex, iCappingTeam );
	if ( !m_pCapPlayerImage->IsVisible() && iPlayers )
	{
		m_pCapPlayerImage->SetVisible(true);
	}
	if ( m_pCapPlayerImage->IsVisible() )
	{
		if ( !iPlayers )
		{
			// We're a deteriorating point
			m_pCapPlayerImage->SetVisible( false );
			m_pCapNumPlayers->SetVisible( false );
		}
		else
		{
			int iXPos, iYPos;
			if ( iPlayers < 2 || !m_pCapNumPlayers )
			{
				iXPos = (GetWide() - m_pCapPlayerImage->GetWide()) * 0.5;
			}
			else
			{
				iXPos = (GetWide() - m_pCapPlayerImage->GetWide()) * 0.5 - XRES(4);
			}
			iYPos = (GetTall() - m_pCapPlayerImage->GetTall()) * 0.5;

			m_pCapPlayerImage->SetPos( iXPos, iYPos );

			if ( m_pCapNumPlayers )
			{
				m_pCapNumPlayers->SetVisible( (iPlayers>1) );
				SetDialogVariable( "numcappers", iPlayers );

				m_pCapNumPlayers->SetFgColor( Color(0,0,0,255) );
			}
		}
	}

	if ( m_pCapPulseImage )
	{
		int iSize = GetWide() * 3;
		int iXpos = iBaseXPos - ((iSize-GetWide()) * 0.5);
		int iYpos = iBaseYPos - ((iSize-GetTall()) * 0.5);
		m_pCapPulseImage->SetBounds( iXpos, iYpos, iSize, iSize );
	}
}
//-----------------------------------------------------------------------------
// 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" );
}
Exemple #24
0
//-----------------------------------------------------------------------------
// Purpose: Create the ScoreBoard panel
//-----------------------------------------------------------------------------
ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall)
{
	CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
	SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text");
	SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text");
	SchemeHandle_t hTinyScheme = pSchemes->getSchemeHandle("Scoreboard Tiny Text");
	Font *tfont = pSchemes->getFont(hTitleScheme);
	Font *smallfont = pSchemes->getFont(hSmallScheme);
	Font *tinyfont = pSchemes->getFont(hTinyScheme);
	
	setBgColor(0, 0, 0, 96);
	m_pCurrentHighlightLabel = NULL;
	m_iHighlightRow = -1;
	// puzl: 0001073
	m_pTrackerIcon = NULL;
	m_pDevIcon = NULL;
	m_pPTIcon = NULL;
	m_pGuideIcon = NULL;
	m_pServerOpIcon = NULL;
	m_pContribIcon = NULL;
	m_pCheatingDeathIcon = NULL;
	m_pVeteranIcon = NULL;
	
	m_pTrackerIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardtracker.tga");
	m_pDevIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboarddev.tga");
	m_pPTIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardpt.tga");
	m_pGuideIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardguide.tga");
	m_pServerOpIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardserverop.tga");
	m_pContribIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcontrib.tga");
	m_pCheatingDeathIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcd.tga");
	m_pVeteranIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardveteran.tga");

	m_iIconFrame = 0;
	m_iLastFrameIncrementTime = gHUD.GetTimeOfLastUpdate();
	
	// Initialize the top title.
	m_TitleLabel.setFont(tfont);
	m_TitleLabel.setText("");
	m_TitleLabel.setBgColor( 0, 0, 0, 255 );
	m_TitleLabel.setFgColor( Scheme::sc_primary1 );
	m_TitleLabel.setContentAlignment( vgui::Label::a_west );

	LineBorder *border = new LineBorder(Color(60, 60, 60, 128));
	setBorder(border);
	setPaintBorderEnabled(true);

	int xpos = g_ColumnInfo[0].m_Width + 3;
	if (ScreenWidth() >= 640)
	{
		// only expand column size for res greater than 640
		xpos = XRES(xpos);
	}
	m_TitleLabel.setBounds(xpos, 4, wide, SBOARD_TITLE_SIZE_Y);
	m_TitleLabel.setContentFitted(false);
	m_TitleLabel.setParent(this);

	// Setup the header (labels like "name", "class", etc..).
	m_HeaderGrid.SetDimensions(NUM_COLUMNS, 1);
	m_HeaderGrid.SetSpacing(0, 0);
	
	for(int i=0; i < NUM_COLUMNS; i++)
	{
		if (g_ColumnInfo[i].m_pTitle && g_ColumnInfo[i].m_pTitle[0] == '#')
			m_HeaderLabels[i].setText(CHudTextMessage::BufferedLocaliseTextString(g_ColumnInfo[i].m_pTitle));
		else if(g_ColumnInfo[i].m_pTitle)
			m_HeaderLabels[i].setText(g_ColumnInfo[i].m_pTitle);

		int xwide = g_ColumnInfo[i].m_Width;
		if (ScreenWidth() >= 640)
		{
			xwide = XRES(xwide);
		}
		else if (ScreenWidth() == 400)
		{
			// hack to make 400x300 resolution scoreboard fit
			if (i == 1)
			{
				// reduces size of player name cell
				xwide -= 28;
			}
			else if (i == 0)
			{
				// tracker icon cell
				xwide -= 8;
			}
		}
		
		m_HeaderGrid.SetColumnWidth(i, xwide);
		m_HeaderGrid.SetEntry(i, 0, &m_HeaderLabels[i]);

		m_HeaderLabels[i].setBgColor(0,0,0,255);
		m_HeaderLabels[i].setBgColor(0,0,0,255);
		
        int theColorIndex = 0;
        Color gammaAdjustedTeamColor = BuildColor(kTeamColors[theColorIndex][0], kTeamColors[theColorIndex][1], kTeamColors[theColorIndex][2], gHUD.GetGammaSlope());
        int theR, theG, theB, theA;
        gammaAdjustedTeamColor.getColor(theR, theG, theB, theA);
        m_HeaderLabels[i].setFgColor(theR, theG, theB, theA);

		m_HeaderLabels[i].setFont(smallfont);
		m_HeaderLabels[i].setContentAlignment(g_ColumnInfo[i].m_Alignment);

		int yres = 12;
		if (ScreenHeight() >= 480)
		{
			yres = YRES(yres);
		}
		m_HeaderLabels[i].setSize(50, yres);
	}

	// Set the width of the last column to be the remaining space.
	int ex, ey, ew, eh;
	m_HeaderGrid.GetEntryBox(NUM_COLUMNS - 2, 0, ex, ey, ew, eh);
	m_HeaderGrid.SetColumnWidth(NUM_COLUMNS - 1, (wide - X_BORDER) - (ex + ew));

	m_HeaderGrid.AutoSetRowHeights();
	m_HeaderGrid.setBounds(X_BORDER, SBOARD_TITLE_SIZE_Y, wide - X_BORDER*2, m_HeaderGrid.GetRowHeight(0));
	m_HeaderGrid.setParent(this);
	m_HeaderGrid.setBgColor(0,0,0,255);


	// Now setup the listbox with the actual player data in it.
	int headerX, headerY, headerWidth, headerHeight;
	m_HeaderGrid.getBounds(headerX, headerY, headerWidth, headerHeight);
	m_PlayerList.setBounds(headerX, headerY+headerHeight, headerWidth, tall - headerY - headerHeight - 6);
	m_PlayerList.setBgColor(0,0,0,255);
	m_PlayerList.setParent(this);

	for(int row=0; row < NUM_ROWS; row++)
	{
		CGrid *pGridRow = &m_PlayerGrids[row];

		pGridRow->SetDimensions(NUM_COLUMNS, 1);
		
		for(int col=0; col < NUM_COLUMNS; col++)
		{
			m_PlayerEntries[col][row].setContentFitted(false);
			m_PlayerEntries[col][row].setRow(row);
			m_PlayerEntries[col][row].addInputSignal(this);
			pGridRow->SetEntry(col, 0, &m_PlayerEntries[col][row]);
		}

		pGridRow->setBgColor(0,0,0,255);
//		pGridRow->SetSpacing(2, 0);f
		pGridRow->SetSpacing(0, 0);
		pGridRow->CopyColumnWidths(&m_HeaderGrid);
		pGridRow->AutoSetRowHeights();
		pGridRow->setSize(PanelWidth(pGridRow), pGridRow->CalcDrawHeight());
		pGridRow->RepositionContents();

		m_PlayerList.AddItem(pGridRow);
	}


	// Add the hit test panel. It is invisible and traps mouse clicks so we can go into squelch mode.
	m_HitTestPanel.setBgColor(0,0,0,255);
	m_HitTestPanel.setParent(this);
	m_HitTestPanel.setBounds(0, 0, wide, tall);
	m_HitTestPanel.addInputSignal(this);

	m_pCloseButton = new CommandButton( "x", wide-XRES(12 + 4), YRES(2), XRES( 12 ) , YRES( 12 ) );
	m_pCloseButton->setParent( this );
	m_pCloseButton->addActionSignal( new CMenuHandler_StringCommandWatch( "-showscores", true ) );
	m_pCloseButton->setBgColor(0,0,0,255);
	m_pCloseButton->setFgColor( 255, 255, 255, 0 );
	m_pCloseButton->setFont(tfont);
	m_pCloseButton->setBoundKey( (char)255 );
	m_pCloseButton->setContentAlignment(Label::a_center);
	Initialize();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CDoDHudAmmo::PaintGunAmmo( CWeaponDODBase *pWpn )
{
    int panelX, panelY, panelW, panelT;
    GetBounds( panelX, panelY, panelW, panelT );

    //regular gun
    const CHudTexture *pEmptyClip = pWpn->GetSpriteAmmo();
    const CHudTexture *pFullClip = pWpn->GetSpriteAmmo2();
    const CHudTexture *pExtraClip = pWpn->GetSpriteAutoaim();

    Assert( pEmptyClip );
    Assert( pFullClip );
    Assert( pExtraClip );

    int xpos = 0, ypos = 0;
    int nIconWidth = 0, nIconHeight = 0;
    float scale = 1.0f;

    if ( pFullClip && pEmptyClip )
    {
        nIconWidth = pFullClip->Width();
        nIconHeight = pFullClip->Height();

        xpos = large_icon_xpos;
        ypos = large_icon_ypos;

        scale = GetScale( nIconWidth, nIconHeight, large_icon_width, large_icon_height );

        nIconWidth *= scale;
        nIconHeight *= scale;

        if ( nIconWidth < large_icon_width - XRES(2) ) // 2 is our buffer for when we need to re-calculate the xpos
        {
            xpos = small_icon_xpos + small_icon_width / 2.0 - nIconWidth / 2.0;
        }

        if ( nIconHeight < large_icon_height - YRES(2) ) // 2 is our buffer for when we need to re-calculate the ypos
        {
            ypos = small_icon_ypos + small_icon_height / 2.0 - nIconHeight / 2.0;
        }

        pFullClip->DrawSelf( xpos, ypos, nIconWidth, nIconHeight, m_clrIcon );

        // base percent is how much of the bullet clip to always draw.
        // total cropped height of the bullet sprite will be
        // base percent + bullet height * bullets
        float flBasePercent			= (float)pWpn->GetDODWpnData().m_iHudClipBaseHeight / (float)pWpn->GetDODWpnData().m_iHudClipHeight;
        float flBulletHeightPercent = (float)pWpn->GetDODWpnData().m_iHudClipBulletHeight / (float)pWpn->GetDODWpnData().m_iHudClipHeight;

        float flHeight = (float)pEmptyClip->Height();

        //Now we draw the bullets inside based on how full our clip is
        float flDrawHeight = flHeight * ( 1.0 - ( flBasePercent + flBulletHeightPercent * m_iAmmo ) );

        int nOffset = (int)flDrawHeight;
        int yPosOffset = nOffset * scale;

        pEmptyClip->DrawSelfCropped( xpos, ypos + yPosOffset, 0, nOffset, pEmptyClip->Width(), pEmptyClip->Height() - nOffset, nIconWidth, nIconHeight - yPosOffset, m_clrIcon );
    }

    // how many full or partially full clips do we have?
    int clips = m_iAmmo2 / pWpn->GetMaxClip1();

    // account for the partial clip, if it exists
    if( clips * pWpn->GetMaxClip1() < m_iAmmo2 )
    {
        clips++;
    }

    if( clips > 0 && pExtraClip )
    {
        //align the extra clip on the same baseline as the large clip
        xpos = extra_clip_xpos;
        ypos = extra_clip_ypos;

        nIconWidth = pExtraClip->Width();
        nIconHeight = pExtraClip->Height();

        if ( nIconWidth > extra_clip_width || nIconHeight > extra_clip_height )
        {
            scale = GetScale( nIconWidth, nIconHeight, extra_clip_width, extra_clip_height );
            nIconWidth *= scale;
            nIconHeight *= scale;
        }

        if ( nIconWidth < extra_clip_width - XRES(2) ) // 2 is our buffer for when we need to re-calculate the ypos
        {
            xpos = extra_clip_xpos + extra_clip_width / 2.0 - nIconWidth / 2.0;
        }

        if ( nIconHeight < extra_clip_height - YRES(2) ) // 2 is our buffer for when we need to re-calculate the ypos
        {
            ypos = extra_clip_ypos + extra_clip_height / 2.0 - nIconHeight / 2.0;
        }

        pExtraClip->DrawSelf( xpos, ypos, pExtraClip->Width() * scale, pExtraClip->Height() * scale, m_clrIcon );
        DrawAmmoCount( clips );
    }
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CDoDHudAmmo::PaintMGAmmo( CWeaponDODBase *pWpn )
{
    int panelX, panelY, panelW, panelT;
    GetBounds( panelX, panelY, panelW, panelT );

    const CHudTexture *pFullClip = pWpn->GetSpriteAmmo();
    const CHudTexture *pExtraClip = pWpn->GetSpriteAmmo2();

    Assert( pFullClip );
    Assert( pExtraClip );

    int xpos = 0, ypos = 0;
    int nIconWidth = 0, nIconHeight = 0;
    float scale = 1.0f;

    if ( pFullClip )
    {
        nIconWidth = pFullClip->Width();
        nIconHeight = pFullClip->Height();

        xpos = large_icon_xpos;
        ypos = large_icon_ypos;

        scale = GetScale( nIconWidth, nIconHeight, large_icon_width, large_icon_height );

        nIconWidth *= scale;
        nIconHeight *= scale;

        if ( nIconWidth < large_icon_width - XRES(2) ) // 2 is our buffer for when we need to re-calculate the xpos
        {
            xpos = small_icon_xpos + small_icon_width / 2.0 - nIconWidth / 2.0;
        }

        if ( nIconHeight < large_icon_height - YRES(2) ) // 2 is our buffer for when we need to re-calculate the ypos
        {
            ypos = small_icon_ypos + small_icon_height / 2.0 - nIconHeight / 2.0;
        }

        pFullClip->DrawSelf( xpos, ypos, nIconWidth, nIconHeight, m_clrIcon );

        char buf[16];
        Q_snprintf( buf, sizeof(buf), "%d", m_iAmmo );
        DrawText( buf, xpos + nIconWidth - ( (float)nIconWidth / 3.0 ), ypos + nIconHeight - ( (float)nIconHeight / 3.0 ), m_clrTextColor );
    }

    //how many full or partially full clips do we have?
    int clips = m_iAmmo2 / pWpn->GetMaxClip1();

    //account for the partial clip, if it exists
    if( clips * pWpn->GetMaxClip1() < m_iAmmo2 )
    {
        clips++;
    }

    if( clips > 0 && pExtraClip )
    {
        //align the extra clip on the same baseline as the large clip
        xpos = extra_clip_xpos;
        ypos = extra_clip_ypos;

        nIconWidth = pExtraClip->Width();
        nIconHeight = pExtraClip->Height();

        if ( nIconWidth > extra_clip_width || nIconHeight > extra_clip_height )
        {
            scale = GetScale( nIconWidth, nIconHeight, extra_clip_width, extra_clip_height );
            nIconWidth *= scale;
            nIconHeight *= scale;
        }

        if ( nIconWidth < extra_clip_width - XRES(2) ) // 2 is our buffer for when we need to re-calculate the ypos
        {
            xpos = extra_clip_xpos + extra_clip_width / 2.0 - nIconWidth / 2.0;
        }

        if ( nIconHeight < extra_clip_height - YRES(2) ) // 2 is our buffer for when we need to re-calculate the ypos
        {
            ypos = extra_clip_ypos + extra_clip_height / 2.0 - nIconHeight / 2.0;
        }

        pExtraClip->DrawSelf( xpos, ypos, pExtraClip->Width() * scale, pExtraClip->Height() * scale, m_clrIcon );
        DrawAmmoCount( clips );
    }
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CDoDHudAmmo::PaintBazookaAmmo( CWeaponDODBase *pWpn )
{
    int panelX, panelY, panelW, panelT;
    GetBounds( panelX, panelY, panelW, panelT );

    const CHudTexture *pTubeIcon = pWpn->GetSpriteAmmo2();
    const CHudTexture *pRocketIcon = pWpn->GetSpriteAmmo();
    const CHudTexture *pExtraIcon = pWpn->GetSpriteAutoaim();

    Assert( pTubeIcon );
    Assert( pRocketIcon );
    Assert( pExtraIcon );

    int xpos = 0, ypos = 0;
    int nIconWidth = 0, nIconHeight = 0;
    float scale = 1.0f;

    if ( pTubeIcon && pRocketIcon )
    {
        nIconWidth = pTubeIcon->Width();
        nIconHeight = pTubeIcon->Height();

        xpos = large_icon_xpos;
        ypos = large_icon_ypos;

        // mad hax
        int width = large_icon_width + XRES(10);

        scale = GetScale( nIconWidth, nIconHeight, width, large_icon_height );

        nIconWidth *= scale;
        nIconHeight *= scale;

        if ( nIconWidth < large_icon_width - XRES(2) ) // 2 is our buffer for when we need to re-calculate the xpos
        {
            xpos = small_icon_xpos + small_icon_width / 2.0 - nIconWidth / 2.0;
        }

        if ( nIconHeight < large_icon_height - YRES(2) ) // 2 is our buffer for when we need to re-calculate the ypos
        {
            ypos = small_icon_ypos + small_icon_height / 2.0 - nIconHeight / 2.0;
        }

        pTubeIcon->DrawSelf( xpos, ypos, nIconWidth, nIconHeight, m_clrIcon );

        // If our clip is full, draw the rocket
        if( pRocketIcon )
        {
            if( m_iAmmo > 0 )
            {
                pRocketIcon->DrawSelf( xpos, ypos, nIconWidth, nIconHeight, m_clrIcon );
            }
        }
    }

    // Draw the extra rockets
    if( m_iAmmo2 > 0 && pExtraIcon )
    {
        // Align the extra clip on the same baseline as the large clip
        xpos = extra_clip_xpos;
        ypos = extra_clip_ypos;

        nIconWidth = pExtraIcon->Width();
        nIconHeight = pExtraIcon->Height();

        if ( nIconWidth > extra_clip_width || nIconHeight > extra_clip_height )
        {
            scale = GetScale( nIconWidth, nIconHeight, extra_clip_width, extra_clip_height );
            nIconWidth *= scale;
            nIconHeight *= scale;
        }

        if ( nIconWidth < extra_clip_width - XRES(2) ) // 2 is our buffer for when we need to re-calculate the ypos
        {
            xpos = extra_clip_xpos + extra_clip_width / 2.0 - nIconWidth / 2.0;
        }

        if ( nIconHeight < extra_clip_height - YRES(2) ) // 2 is our buffer for when we need to re-calculate the ypos
        {
            ypos = extra_clip_ypos + extra_clip_height / 2.0 - nIconHeight / 2.0;
        }

        pExtraIcon->DrawSelf( xpos, ypos, pExtraIcon->Width() * scale, pExtraIcon->Height() * scale, m_clrIcon );
        DrawAmmoCount( m_iAmmo2 );
    }
}
Exemple #28
0
/*
==================
V_CalcSpectatorRefdef

==================
*/
void V_CalcSpectatorRefdef ( struct ref_params_s * pparams )
{
	static vec3_t			velocity ( 0.0f, 0.0f, 0.0f);

	static int lastWeaponModelIndex = 0;
	static int lastViewModelIndex = 0;
		
	cl_entity_t	 * ent = gEngfuncs.GetEntityByIndex( g_iUser2 );
	
	pparams->onlyClientDraw = false;

	// refresh position
	VectorCopy ( pparams->simorg, v_sim_org );

	// get old values
	VectorCopy ( pparams->cl_viewangles, v_cl_angles );
	VectorCopy ( pparams->viewangles, v_angles );
	VectorCopy ( pparams->vieworg, v_origin );

	if (  ( g_iUser1 == OBS_IN_EYE || gHUD.m_Spectator.m_pip->value == INSET_IN_EYE ) && ent )
	{
		// calculate player velocity
		float timeDiff = ent->curstate.msg_time - ent->prevstate.msg_time;

		if ( timeDiff > 0 )
		{
			vec3_t distance;
			VectorSubtract(ent->prevstate.origin, ent->curstate.origin, distance);
			VectorScale(distance, 1/timeDiff, distance );

			velocity[0] = velocity[0]*0.9f + distance[0]*0.1f;
			velocity[1] = velocity[1]*0.9f + distance[1]*0.1f;
			velocity[2] = velocity[2]*0.9f + distance[2]*0.1f;
			
			VectorCopy(velocity, pparams->simvel);
		}

		// predict missing client data and set weapon model ( in HLTV mode or inset in eye mode )
#ifdef _TFC
		if ( gEngfuncs.IsSpectateOnly() || gHUD.m_Spectator.m_pip->value == INSET_IN_EYE )
#else
		if ( gEngfuncs.IsSpectateOnly() )
#endif
		{
			V_GetInEyePos( g_iUser2, pparams->simorg, pparams->cl_viewangles );

			pparams->health = 1;

			cl_entity_t	 * gunModel = gEngfuncs.GetViewModel();

			if ( lastWeaponModelIndex != ent->curstate.weaponmodel )
			{
				// weapon model changed

				lastWeaponModelIndex = ent->curstate.weaponmodel;
				lastViewModelIndex = V_FindViewModelByWeaponModel( lastWeaponModelIndex );
				if ( lastViewModelIndex )
				{
					gEngfuncs.pfnWeaponAnim(0,0);	// reset weapon animation
				}
				else
				{
					// model not found
					gunModel->model = NULL;	// disable weapon model
					lastWeaponModelIndex = lastViewModelIndex = 0;
				}
			}

			if ( lastViewModelIndex )
			{
				gunModel->model = IEngineStudio.GetModelByIndex( lastViewModelIndex );
				gunModel->curstate.modelindex = lastViewModelIndex;
				gunModel->curstate.frame = 0;
				gunModel->curstate.colormap = 0; 
				gunModel->index = g_iUser2;
			}
			else
			{
				gunModel->model = NULL;	// disable weaopn model
			}
		}
		else
		{
			// only get viewangles from entity
			VectorCopy ( ent->angles, pparams->cl_viewangles );
			pparams->cl_viewangles[PITCH]*=-3.0f;	// see CL_ProcessEntityUpdate()
		}
	}

	v_frametime = pparams->frametime;

	if ( pparams->nextView == 0 )
	{
		// first renderer cycle, full screen

		switch ( g_iUser1 )
		{
			case OBS_CHASE_LOCKED:	V_GetChasePos( g_iUser2, NULL, v_origin, v_angles );
									break;

			case OBS_CHASE_FREE:	V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
									break;

			case OBS_ROAMING	:	VectorCopy (v_cl_angles, v_angles);
									VectorCopy (v_sim_org, v_origin);
									
									// override values if director is active
									gHUD.m_Spectator.GetDirectorCamera(v_origin, v_angles);
									break;

			case OBS_IN_EYE		:   V_CalcNormalRefdef ( pparams );
									break;
				
			case OBS_MAP_FREE  :	pparams->onlyClientDraw = true;
									V_GetMapFreePosition( v_cl_angles, v_origin, v_angles );
									break;

			case OBS_MAP_CHASE  :	pparams->onlyClientDraw = true;
									V_GetMapChasePosition( g_iUser2, v_cl_angles, v_origin, v_angles );
									break;
		}

		if ( gHUD.m_Spectator.m_pip->value )
			pparams->nextView = 1;	// force a second renderer view

		gHUD.m_Spectator.m_iDrawCycle = 0;

	}
	else
	{
		// second renderer cycle, inset window

		// set inset parameters
		pparams->viewport[0] = XRES(gHUD.m_Spectator.m_OverviewData.insetWindowX);	// change viewport to inset window
		pparams->viewport[1] = YRES(gHUD.m_Spectator.m_OverviewData.insetWindowY);
		pparams->viewport[2] = XRES(gHUD.m_Spectator.m_OverviewData.insetWindowWidth);
		pparams->viewport[3] = YRES(gHUD.m_Spectator.m_OverviewData.insetWindowHeight);
		pparams->nextView	 = 0;	// on further view

		// override some settings in certain modes
		switch ( (int)gHUD.m_Spectator.m_pip->value )
		{
			case INSET_CHASE_FREE : V_GetChasePos( g_iUser2, v_cl_angles, v_origin, v_angles );
									break;	

			case INSET_IN_EYE	 :	V_CalcNormalRefdef ( pparams );
									break;

			case INSET_MAP_FREE  :	pparams->onlyClientDraw = true;
									V_GetMapFreePosition( v_cl_angles, v_origin, v_angles );
									break;

			case INSET_MAP_CHASE  :	pparams->onlyClientDraw = true;

									if ( g_iUser1 == OBS_ROAMING )
										V_GetMapChasePosition( 0, v_cl_angles, v_origin, v_angles );
									else
										V_GetMapChasePosition( g_iUser2, v_cl_angles, v_origin, v_angles );

									break;
		}

		gHUD.m_Spectator.m_iDrawCycle = 1;
	}

	// write back new values into pparams
	VectorCopy ( v_cl_angles, pparams->cl_viewangles );
	VectorCopy ( v_angles, pparams->viewangles )
	VectorCopy ( v_origin, pparams->vieworg );

}
// Creation
CClassMenuPanel::CClassMenuPanel(int iTrans, int iRemoveMe, int x,int y,int wide,int tall) : CMenuPanel(iTrans, iRemoveMe, x,y,wide,tall)
{
	// don't show class graphics at below 640x480 resolution
	bool bShowClassGraphic = true;
	if ( ScreenWidth < 640 )
	{
		bShowClassGraphic = false;
	}

	memset( m_pClassImages, 0, sizeof(m_pClassImages) );

	// Get the scheme used for the Titles
	CSchemeManager *pSchemes = gViewPort->GetSchemeManager();

	// schemes
	SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle( "Title Font" );
	SchemeHandle_t hClassWindowText = pSchemes->getSchemeHandle( "Briefing Text" );

	// color schemes
	int r, g, b, a;

	// Create the title
	Label *pLabel = new Label( "", CLASSMENU_TITLE_X, CLASSMENU_TITLE_Y );
	pLabel->setParent( this );
	pLabel->setFont( pSchemes->getFont(hTitleScheme) );
	pSchemes->getFgColor( hTitleScheme, r, g, b, a );
	pLabel->setFgColor( r, g, b, a );
	pSchemes->getBgColor( hTitleScheme, r, g, b, a );
	pLabel->setBgColor( r, g, b, a );
	pLabel->setContentAlignment( vgui::Label::a_west );
	pLabel->setText(gHUD.m_TextMessage.BufferedLocaliseTextString("#Title_SelectYourClass"));

	// Create the Scroll panel
	m_pScrollPanel = new CTFScrollPanel( CLASSMENU_WINDOW_X, CLASSMENU_WINDOW_Y, CLASSMENU_WINDOW_SIZE_X, CLASSMENU_WINDOW_SIZE_Y );
	m_pScrollPanel->setParent(this);
	//force the scrollbars on, so after the validate clientClip will be smaller
	m_pScrollPanel->setScrollBarAutoVisible(false, false);
	m_pScrollPanel->setScrollBarVisible(true, true);
	m_pScrollPanel->setBorder( new LineBorder( Color(255 * 0.7,170 * 0.7,0,0) ) );
	m_pScrollPanel->validate();

	int clientWide=m_pScrollPanel->getClient()->getWide();

	//turn scrollpanel back into auto show scrollbar mode and validate
	m_pScrollPanel->setScrollBarAutoVisible(false,true);
	m_pScrollPanel->setScrollBarVisible(false,false);
	m_pScrollPanel->validate();

	// Create the Class buttons
	for (int i = 0; i <= PC_RANDOM; i++)
	{
		char sz[256]; 
		int iYPos = CLASSMENU_TOPLEFT_BUTTON_Y + ( (CLASSMENU_BUTTON_SIZE_Y + CLASSMENU_BUTTON_SPACER_Y) * i );

		ActionSignal *pASignal = new CMenuHandler_StringCommandClassSelect( sTFClassSelection[i], true );

		// Class button
		sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString( sLocalisedClasses[i] ) );
		m_pButtons[i] = new ClassButton( i, sz, CLASSMENU_TOPLEFT_BUTTON_X, iYPos, CLASSMENU_BUTTON_SIZE_X, CLASSMENU_BUTTON_SIZE_Y, true);
		// RandomPC uses '0'
		if ( i >= 1 && i <= 9 )
		{
			sprintf(sz,"%d",i);
		}
		else
		{
			sprintf(sz,"0");
		}
		m_pButtons[i]->setBoundKey( sz[0] );
		m_pButtons[i]->setContentAlignment( vgui::Label::a_west );
		m_pButtons[i]->addActionSignal( pASignal );
		m_pButtons[i]->addInputSignal( new CHandler_MenuButtonOver(this, i) );
		m_pButtons[i]->setParent( this );

		// Create the Class Info Window
		//m_pClassInfoPanel[i] = new CTransparentPanel( 255, CLASSMENU_WINDOW_X, CLASSMENU_WINDOW_Y, CLASSMENU_WINDOW_SIZE_X, CLASSMENU_WINDOW_SIZE_Y );
		m_pClassInfoPanel[i] = new CTransparentPanel( 255, 0, 0, clientWide, CLASSMENU_WINDOW_SIZE_Y );
		m_pClassInfoPanel[i]->setParent( m_pScrollPanel->getClient() );
		//m_pClassInfoPanel[i]->setVisible( false );

		// don't show class pic in lower resolutions
		int textOffs = XRES(8);

		if ( bShowClassGraphic )
		{
			textOffs = CLASSMENU_WINDOW_NAME_X;
		}

		// Create the Class Name Label
		sprintf(sz, "#Title_%s", sTFClassSelection[i]);
		char* localName=CHudTextMessage::BufferedLocaliseTextString( sz );
		Label *pNameLabel = new Label( "", textOffs, CLASSMENU_WINDOW_NAME_Y );
		pNameLabel->setFont( pSchemes->getFont(hTitleScheme) ); 
		pNameLabel->setParent( m_pClassInfoPanel[i] );
		pSchemes->getFgColor( hTitleScheme, r, g, b, a );
		pNameLabel->setFgColor( r, g, b, a );
		pSchemes->getBgColor( hTitleScheme, r, g, b, a );
		pNameLabel->setBgColor( r, g, b, a );
		pNameLabel->setContentAlignment( vgui::Label::a_west );
		//pNameLabel->setBorder(new LineBorder());
		pNameLabel->setText(localName);

		// Create the Class Image
		if ( bShowClassGraphic )
		{
			for ( int team = 0; team < 2; team++ )
			{
				if ( team == 1 )
				{
					sprintf( sz, "%sred", sTFClassSelection[i] );
				}
				else
				{
					sprintf( sz, "%sblue", sTFClassSelection[i] );
				}

				m_pClassImages[team][i] = new CImageLabel( sz, 0, 0, CLASSMENU_WINDOW_TEXT_X, CLASSMENU_WINDOW_TEXT_Y );

				CImageLabel *pLabel = m_pClassImages[team][i];
				pLabel->setParent( m_pClassInfoPanel[i] );
				//pLabel->setBorder(new LineBorder());

				if ( team != 1 )
				{
					pLabel->setVisible( false );
				}
				
				// Reposition it based upon it's size
				int xOut, yOut;
				pNameLabel->getTextSize( xOut, yOut );
				pLabel->setPos( (CLASSMENU_WINDOW_TEXT_X - pLabel->getWide()) / 2, yOut /2 );
			}
		}

		// Create the Player count string
		gHUD.m_TextMessage.LocaliseTextString( "#Title_CurrentlyOnYourTeam", m_sPlayersOnTeamString, STRLENMAX_PLAYERSONTEAM );
		m_pPlayers[i] = new Label( "", textOffs, CLASSMENU_WINDOW_PLAYERS_Y );
		m_pPlayers[i]->setParent( m_pClassInfoPanel[i] );
		m_pPlayers[i]->setBgColor( 0, 0, 0, 255 );
		m_pPlayers[i]->setContentAlignment( vgui::Label::a_west );
		m_pPlayers[i]->setFont( pSchemes->getFont(hClassWindowText) );

		// Open up the Class Briefing File
		sprintf(sz, "classes/short_%s.txt", sTFClassSelection[i]);
		char *cText = "Class Description not available.";
		char *pfile = (char *)gEngfuncs.COM_LoadFile( sz, 5, NULL );
		if (pfile)
		{
			cText = pfile;
		}
		
		// Create the Text info window
		TextPanel *pTextWindow = new TextPanel(cText, textOffs, CLASSMENU_WINDOW_TEXT_Y, (CLASSMENU_WINDOW_SIZE_X - textOffs)-5, CLASSMENU_WINDOW_SIZE_Y - CLASSMENU_WINDOW_TEXT_Y);
		pTextWindow->setParent( m_pClassInfoPanel[i] );
		pTextWindow->setFont( pSchemes->getFont(hClassWindowText) );
		pSchemes->getFgColor( hClassWindowText, r, g, b, a );
		pTextWindow->setFgColor( r, g, b, a );
		pSchemes->getBgColor( hClassWindowText, r, g, b, a );
		pTextWindow->setBgColor( r, g, b, a );

		// Resize the Info panel to fit it all
		int wide,tall;
		pTextWindow->getTextImage()->getTextSizeWrapped( wide,tall);
		pTextWindow->setSize(wide,tall);

		int xx,yy;
		pTextWindow->getPos(xx,yy);
		int maxX=xx+wide;
		int maxY=yy+tall;

		//check to see if the image goes lower than the text
		//just use the red teams [0] images
		if(m_pClassImages[0][i]!=null)
		{
			m_pClassImages[0][i]->getPos(xx,yy);
			if((yy+m_pClassImages[0][i]->getTall())>maxY)
			{
				maxY=yy+m_pClassImages[0][i]->getTall();
			}
		}

		m_pClassInfoPanel[i]->setSize( maxX , maxY );
		if (pfile) gEngfuncs.COM_FreeFile( pfile );
		//m_pClassInfoPanel[i]->setBorder(new LineBorder());

	}

	// Create the Cancel button
	m_pCancelButton = new CommandButton( gHUD.m_TextMessage.BufferedLocaliseTextString( "#Menu_Cancel" ), CLASSMENU_TOPLEFT_BUTTON_X, 0, CLASSMENU_BUTTON_SIZE_X, CLASSMENU_BUTTON_SIZE_Y);
	m_pCancelButton->setParent( this );
	m_pCancelButton->addActionSignal( new CMenuHandler_TextWindow(HIDE_TEXTWINDOW) );

	m_iCurrentInfo = 0;

}
void SpectatorPanel::Initialize()
{
	int x, y, wide, tall;

	getBounds(x, y, wide, tall);

	CSchemeManager *pSchemes = gViewPort->GetSchemeManager();

	SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Team Info Text");

	m_TopBorder = new CTransparentPanel(64, 0, 0, ScreenWidth, PANEL_HEIGHT);
	m_TopBorder->setParent(this);

	m_BottomBorder = new CTransparentPanel(64, 0, ScreenHeight - PANEL_HEIGHT, ScreenWidth, PANEL_HEIGHT);
	m_BottomBorder->setParent(this);

	setPaintBackgroundEnabled(false);

	m_ExtraInfo = new Label("Extra Info", 0, 0, wide, PANEL_HEIGHT);
	m_ExtraInfo->setParent(m_TopBorder);
	m_ExtraInfo->setFont(pSchemes->getFont(hSmallScheme));

	m_ExtraInfo->setPaintBackgroundEnabled(false);
	m_ExtraInfo->setFgColor(143, 143, 54, 0);
	m_ExtraInfo->setContentAlignment(vgui::Label::a_west);

	m_TimerImage = new CImageLabel("timer", 0, 0, 14, 14);
	m_TimerImage->setParent(m_TopBorder);

	m_TopBanner = new CImageLabel("banner", 0, 0, XRES(BANNER_WIDTH), YRES(BANNER_HEIGHT));
	m_TopBanner->setParent(this);

	m_CurrentTime = new Label("00:00", 0, 0, wide, PANEL_HEIGHT);
	m_CurrentTime->setParent(m_TopBorder);
	m_CurrentTime->setFont(pSchemes->getFont(hSmallScheme));
	m_CurrentTime->setPaintBackgroundEnabled(false);
	m_CurrentTime->setFgColor(143, 143, 54, 0);
	m_CurrentTime->setContentAlignment(vgui::Label::a_west);

	m_Separator = new Panel(0, 0, XRES(64), YRES(96));
	m_Separator->setParent(m_TopBorder);
	m_Separator->setFgColor(59, 58, 34, 48);
	m_Separator->setBgColor(59, 58, 34, 48);

	for(int j = 0; j < TEAM_NUMBER; j++)
	{
		m_TeamScores[j] = new Label("   ", 0, 0, wide, PANEL_HEIGHT);
		m_TeamScores[j]->setParent(m_TopBorder);
		m_TeamScores[j]->setFont(pSchemes->getFont(hSmallScheme));
		m_TeamScores[j]->setPaintBackgroundEnabled(false);
		m_TeamScores[j]->setFgColor(143, 143, 54, 0);
		m_TeamScores[j]->setContentAlignment(vgui::Label::a_west);
		m_TeamScores[j]->setVisible(false);
	}

	// Initialize command buttons.
	//	m_OptionButton = new ColorButton( CHudTextMessage::BufferedLocaliseTextString( "#SPECT_OPTIONS" ), XRES(15), YRES(6), XRES(OPTIONS_BUTTON_X), YRES(20), false, false );
	m_OptionButton = new DropDownButton(CHudTextMessage::BufferedLocaliseTextString("#SPECT_OPTIONS"), XRES(15), YRES(6), XRES(OPTIONS_BUTTON_X), YRES(20), false, false);
	m_OptionButton->setParent(m_BottomBorder);
	m_OptionButton->setContentAlignment(vgui::Label::a_center);
	m_OptionButton->setBoundKey((char)255); // special no bound to avoid leading spaces in name
	m_OptionButton->addActionSignal(new CSpectatorHandler_Command(this, SPECTATOR_PANEL_CMD_OPTIONS));
	m_OptionButton->setUnArmedBorderColor(59, 58, 34, 48);
	m_OptionButton->setArmedBorderColor(194, 202, 54, 0);
	m_OptionButton->setUnArmedColor(143, 143, 54, 0);
	m_OptionButton->setArmedColor(194, 202, 54, 0);

	m_CamButton = new DropDownButton(CHudTextMessage::BufferedLocaliseTextString("#CAM_OPTIONS"), ScreenWidth - (XRES(CAMOPTIONS_BUTTON_X) + 15), YRES(6), XRES(CAMOPTIONS_BUTTON_X), YRES(20), false, false);
	m_CamButton->setParent(m_BottomBorder);
	m_CamButton->setContentAlignment(vgui::Label::a_center);
	m_CamButton->setBoundKey((char)255); // special no bound to avoid leading spaces in name
	m_CamButton->addActionSignal(new CSpectatorHandler_Command(this, SPECTATOR_PANEL_CMD_CAMERA));
	m_CamButton->setUnArmedBorderColor(59, 58, 34, 48);
	m_CamButton->setArmedBorderColor(194, 202, 54, 0);
	m_CamButton->setUnArmedColor(143, 143, 54, 0);
	m_CamButton->setArmedColor(194, 202, 54, 0);

	//	m_PrevPlayerButton= new ColorButton("<", XRES( 15 + OPTIONS_BUTTON_X + 15 ), YRES(6), XRES(24), YRES(20), false, false );
	m_PrevPlayerButton = new CImageButton("arrowleft", XRES(15 + OPTIONS_BUTTON_X + 15), YRES(6), XRES(24), YRES(20), false, false);
	m_PrevPlayerButton->setParent(m_BottomBorder);
	m_PrevPlayerButton->setContentAlignment(vgui::Label::a_center);
	m_PrevPlayerButton->setBoundKey((char)255); // special no bound to avoid leading spaces in name
	m_PrevPlayerButton->addActionSignal(new CSpectatorHandler_Command(this, SPECTATOR_PANEL_CMD_PREVPLAYER));
	m_PrevPlayerButton->setUnArmedBorderColor(59, 58, 34, 48);
	m_PrevPlayerButton->setArmedBorderColor(194, 202, 54, 0);
	m_PrevPlayerButton->setUnArmedColor(143, 143, 54, 0);
	m_PrevPlayerButton->setArmedColor(194, 202, 54, 0);

	//	m_NextPlayerButton= new ColorButton(">", (ScreenWidth - (XRES ( CAMOPTIONS_BUTTON_X ) + 15)) - XRES ( 24 + 15 ), YRES(6), XRES(24), YRES(20),false, false );
	m_NextPlayerButton = new CImageButton("arrowright", (ScreenWidth - (XRES(CAMOPTIONS_BUTTON_X) + 15)) - XRES(24 + 15), YRES(6), XRES(24), YRES(20), false, false);
	m_NextPlayerButton->setParent(m_BottomBorder);
	m_NextPlayerButton->setContentAlignment(vgui::Label::a_center);
	m_NextPlayerButton->setBoundKey((char)255); // special no bound to avoid leading spaces in name
	m_NextPlayerButton->addActionSignal(new CSpectatorHandler_Command(this, SPECTATOR_PANEL_CMD_NEXTPLAYER));
	m_NextPlayerButton->setUnArmedBorderColor(59, 58, 34, 48);
	m_NextPlayerButton->setArmedBorderColor(194, 202, 54, 0);
	m_NextPlayerButton->setUnArmedColor(143, 143, 54, 0);
	m_NextPlayerButton->setArmedColor(194, 202, 54, 0);

	// Initialize the bottom title.

	float flLabelSize = ((ScreenWidth - (XRES(CAMOPTIONS_BUTTON_X) + 15)) - XRES(24 + 15)) - XRES((15 + OPTIONS_BUTTON_X + 15) + 38);

	m_BottomMainButton = new DropDownButton("Spectator Bottom",
	                                        XRES((15 + OPTIONS_BUTTON_X + 15) + 31), YRES(6), flLabelSize, YRES(20),
	                                        false, false);

	m_BottomMainButton->setParent(m_BottomBorder);
	m_BottomMainButton->setPaintBackgroundEnabled(false);
	m_BottomMainButton->setFgColor(Scheme::sc_primary1);
	m_BottomMainButton->setContentAlignment(vgui::Label::a_center);
	m_BottomMainButton->setBorder(new LineBorder(Color(59, 58, 34, 48)));
	m_BottomMainButton->setBoundKey((char)255); // special no bound to avoid leading spaces in name
	m_BottomMainButton->addActionSignal(new CSpectatorHandler_Command(this, SPECTATOR_PANEL_CMD_PLAYERS));
	m_BottomMainButton->setUnArmedBorderColor(59, 58, 34, 48);
	m_BottomMainButton->setArmedBorderColor(194, 202, 54, 0);
	m_BottomMainButton->setUnArmedColor(143, 143, 54, 0);
	m_BottomMainButton->setArmedColor(194, 202, 54, 0);

	m_BottomMainLabel = new Label("Spectator Bottom",
	                              XRES((15 + OPTIONS_BUTTON_X + 15) + 31), YRES(6), flLabelSize, YRES(20));

	m_BottomMainLabel->setParent(m_BottomBorder);
	m_BottomMainLabel->setPaintBackgroundEnabled(false);
	m_BottomMainLabel->setFgColor(Scheme::sc_primary1);
	m_BottomMainLabel->setContentAlignment(vgui::Label::a_center);
	m_BottomMainLabel->setBorder(NULL);
	m_BottomMainLabel->setVisible(false);

	m_InsetViewButton = new ColorButton("", XRES(2), YRES(2), XRES(240), YRES(180), false, false);
	m_InsetViewButton->setParent(this);
	m_InsetViewButton->setBoundKey((char)255);
	m_InsetViewButton->addActionSignal(new CSpectatorHandler_Command(this, SPECTATOR_PANEL_CMD_TOGGLE_INSET));
	m_InsetViewButton->setUnArmedBorderColor(59, 58, 34, 48);
	m_InsetViewButton->setArmedBorderColor(194, 202, 54, 0);
	m_InsetViewButton->setUnArmedColor(143, 143, 54, 0);
	m_InsetViewButton->setArmedColor(194, 202, 54, 0);

	m_menuVisible  = false;
	m_insetVisible = false;
	//	m_HideButton->setVisible(false);
	m_CamButton->setVisible(false);
	m_OptionButton->setVisible(false);
	m_NextPlayerButton->setVisible(false);
	m_PrevPlayerButton->setVisible(false);
	m_TopBanner->setVisible(false);
	m_ExtraInfo->setVisible(false);
	m_Separator->setVisible(false);
	m_TimerImage->setVisible(false);
}