mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-05-04 02:49:31 +03:00
Updated text commentary nodes
This commit is contained in:
parent
20f29c5552
commit
f67a1b95e5
@ -110,7 +110,7 @@ private:
|
|||||||
CPanelAnimationVarAliasType( int, m_iTypeTextW, "type_text_wide", "400", "proportional_int" );
|
CPanelAnimationVarAliasType( int, m_iTypeTextW, "type_text_wide", "400", "proportional_int" );
|
||||||
CPanelAnimationVarAliasType( int, m_iTypeTextT, "type_text_tall", "200", "proportional_int" );
|
CPanelAnimationVarAliasType( int, m_iTypeTextT, "type_text_tall", "200", "proportional_int" );
|
||||||
CPanelAnimationVarAliasType( int, m_iTypeTextCountXFR, "type_text_count_xpos_from_right", "10", "proportional_int" );
|
CPanelAnimationVarAliasType( int, m_iTypeTextCountXFR, "type_text_count_xpos_from_right", "10", "proportional_int" );
|
||||||
CPanelAnimationVarAliasType( int, m_iTypeTextCountY, "type_text_count_ypos", "184", "proportional_int" );
|
CPanelAnimationVarAliasType( int, m_iTypeTextCountYFB, "type_text_count_ypos_from_bottom", "16", "proportional_int" );
|
||||||
CPanelAnimationVar( Color, m_TextBackgroundColor, "type_text_bg", "0 0 0 192" );
|
CPanelAnimationVar( Color, m_TextBackgroundColor, "type_text_bg", "0 0 0 192" );
|
||||||
CPanelAnimationVar( Color, m_TextColor, "type_text_fg", "255 230 180 255" );
|
CPanelAnimationVar( Color, m_TextColor, "type_text_fg", "255 230 180 255" );
|
||||||
#endif
|
#endif
|
||||||
@ -380,7 +380,7 @@ void C_PointCommentaryNode::StartTextCommentary( const char *pszCommentaryFile,
|
|||||||
// Get the duration so we know when it finishes
|
// Get the duration so we know when it finishes
|
||||||
//float flDuration = enginesound->GetSoundDuration( STRING( CSoundEnvelopeController::GetController().SoundGetName( m_sndCommentary ) ) ) ;
|
//float flDuration = enginesound->GetSoundDuration( STRING( CSoundEnvelopeController::GetController().SoundGetName( m_sndCommentary ) ) ) ;
|
||||||
|
|
||||||
// TODO: Determine from text length
|
// TODO: Determine from text length?
|
||||||
float flDuration = commentary_text_endtime.GetFloat();
|
float flDuration = commentary_text_endtime.GetFloat();
|
||||||
|
|
||||||
// Tell the HUD element
|
// Tell the HUD element
|
||||||
@ -529,11 +529,19 @@ void CHudCommentary::Paint()
|
|||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
if (m_bTextCommentary)
|
if (m_bTextCommentary)
|
||||||
{
|
{
|
||||||
vgui::surface()->DrawSetColor( clr );
|
// TODO: Make this a control?
|
||||||
vgui::surface()->DrawOutlinedRect( xOffset, yOffset, xOffset + m_iBarWide, m_iTypeTextT - (yOffset + m_iBarTall) );
|
static int iTextBorderSpace = 8;
|
||||||
|
|
||||||
|
// Figure out the size before setting bounds
|
||||||
|
int lW, lT;
|
||||||
|
m_pLabel->GetContentSize( lW, lT );
|
||||||
|
|
||||||
m_pLabel->SetFgColor( m_TextColor );
|
m_pLabel->SetFgColor( m_TextColor );
|
||||||
m_pLabel->SetBounds( xOffset + 4, yOffset + 4, m_iBarWide - 4, m_iTypeTextT - (m_iBarTall + 4) );
|
m_pLabel->SetBounds(
|
||||||
|
xOffset + iTextBorderSpace,
|
||||||
|
yOffset + iTextBorderSpace,
|
||||||
|
m_iBarWide - iTextBorderSpace,
|
||||||
|
lT /*m_iTypeTextT - ((yOffset * 2) + iTextBorderSpace)*/ );
|
||||||
m_pLabel->SetFont( hFont );
|
m_pLabel->SetFont( hFont );
|
||||||
|
|
||||||
// Draw the speaker names
|
// Draw the speaker names
|
||||||
@ -541,6 +549,14 @@ void CHudCommentary::Paint()
|
|||||||
vgui::surface()->DrawSetTextColor( Color( 255, 200, 100, GetAlpha() ) );
|
vgui::surface()->DrawSetTextColor( Color( 255, 200, 100, GetAlpha() ) );
|
||||||
vgui::surface()->DrawSetTextPos( xOffset+4, yOffset+4 );
|
vgui::surface()->DrawSetTextPos( xOffset+4, yOffset+4 );
|
||||||
vgui::surface()->DrawPrintText( m_pszText, wcslen( m_pszText ) );*/
|
vgui::surface()->DrawPrintText( m_pszText, wcslen( m_pszText ) );*/
|
||||||
|
|
||||||
|
lT += (iTextBorderSpace * 2);
|
||||||
|
|
||||||
|
vgui::surface()->DrawSetColor( clr );
|
||||||
|
vgui::surface()->DrawOutlinedRect( xOffset, yOffset, xOffset + m_iBarWide, yOffset + lT ); //m_iTypeTextT - (yOffset /*+ m_iBarTall*/) );
|
||||||
|
|
||||||
|
lT += (yOffset * 2);
|
||||||
|
SetBounds( x, ( (float)m_iTypeTextT * MAX( (200.0f / (float)lT), 1.75f ) ), wide, lT );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -589,7 +605,7 @@ void CHudCommentary::Paint()
|
|||||||
|
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
if (m_bTextCommentary)
|
if (m_bTextCommentary)
|
||||||
vgui::surface()->DrawSetTextPos( wide - m_iTypeTextCountXFR - iCountWide, m_iTypeTextCountY );
|
vgui::surface()->DrawSetTextPos( wide - m_iTypeTextCountXFR - iCountWide, tall - m_iTypeTextCountYFB - iCountTall );
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
vgui::surface()->DrawSetTextPos( wide - m_iCountXFR - iCountWide, m_iCountY );
|
vgui::surface()->DrawSetTextPos( wide - m_iCountXFR - iCountWide, m_iCountY );
|
||||||
@ -616,6 +632,10 @@ bool CHudCommentary::ShouldDraw()
|
|||||||
void CHudCommentary::Init( void )
|
void CHudCommentary::Init( void )
|
||||||
{
|
{
|
||||||
m_matIcon.Init( "vgui/hud/icon_commentary", TEXTURE_GROUP_VGUI );
|
m_matIcon.Init( "vgui/hud/icon_commentary", TEXTURE_GROUP_VGUI );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
SetProportional( true );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -706,18 +726,6 @@ void CHudCommentary::StartTextCommentary( C_PointCommentaryNode *pNode, const ch
|
|||||||
//m_pLabel->SizeToContents();
|
//m_pLabel->SizeToContents();
|
||||||
m_pLabel->SetContentAlignment( vgui::Label::a_northwest );
|
m_pLabel->SetContentAlignment( vgui::Label::a_northwest );
|
||||||
|
|
||||||
/*
|
|
||||||
// Find a localization token first.
|
|
||||||
// If one isn't found, use this static buffer.
|
|
||||||
static wchar_t szRawTextBuf[512];
|
|
||||||
m_pszText = g_pVGuiLocalize->Find( pszText );
|
|
||||||
if (!m_pszText)
|
|
||||||
{
|
|
||||||
g_pVGuiLocalize->ConvertANSIToUnicode( pszText, szRawTextBuf, sizeof( szRawTextBuf ) );
|
|
||||||
m_pszText = szRawTextBuf;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
m_bShouldPaint = true;
|
m_bShouldPaint = true;
|
||||||
SetPaintBackgroundEnabled( m_bShouldPaint );
|
SetPaintBackgroundEnabled( m_bShouldPaint );
|
||||||
|
|
||||||
|
@ -905,6 +905,11 @@ void CPointCommentaryNode::Spawn( void )
|
|||||||
char *szModel = (char *)STRING( GetModelName() );
|
char *szModel = (char *)STRING( GetModelName() );
|
||||||
if (!szModel || !*szModel)
|
if (!szModel || !*szModel)
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_bTextCommentary)
|
||||||
|
szModel = "models/extras/info_text.mdl";
|
||||||
|
else
|
||||||
|
#endif
|
||||||
szModel = "models/extras/info_speech.mdl";
|
szModel = "models/extras/info_speech.mdl";
|
||||||
SetModelName( AllocPooledString(szModel) );
|
SetModelName( AllocPooledString(szModel) );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user