mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-19 10:17:55 +03:00
Support for multiple colors for different outro credits columns on the same row
This commit is contained in:
parent
93d586a82e
commit
f79f07e915
@ -35,8 +35,7 @@ struct creditname_t
|
|||||||
|
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
// New credits stuff
|
// New credits stuff
|
||||||
|
CCopyableUtlVector<int> cColorOverride;
|
||||||
Color cColorOverride;
|
|
||||||
|
|
||||||
// Images
|
// Images
|
||||||
int iImageID = -1;
|
int iImageID = -1;
|
||||||
@ -408,8 +407,8 @@ void CHudCredits::DrawOutroCreditsName( void )
|
|||||||
Color cColor = m_TextColor;
|
Color cColor = m_TextColor;
|
||||||
|
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
if (pCredit->cColorOverride.a() > 0)
|
if (pCredit->cColorOverride.Count() > 0)
|
||||||
cColor = pCredit->cColorOverride;
|
cColor.SetRawColor( pCredit->cColorOverride[0] );
|
||||||
|
|
||||||
// Some lines should stick around and fade out
|
// Some lines should stick around and fade out
|
||||||
if ( i >= m_CreditsList.Count()-m_iEndLines )
|
if ( i >= m_CreditsList.Count()-m_iEndLines )
|
||||||
@ -473,6 +472,12 @@ void CHudCredits::DrawOutroCreditsName( void )
|
|||||||
{
|
{
|
||||||
FOR_EACH_VEC( outStrings, i )
|
FOR_EACH_VEC( outStrings, i )
|
||||||
{
|
{
|
||||||
|
if (i < pCredit->cColorOverride.Count())
|
||||||
|
{
|
||||||
|
// Change color to this particular column's color
|
||||||
|
cColor.SetRawColor( pCredit->cColorOverride[i] );
|
||||||
|
}
|
||||||
|
|
||||||
int iImageID = GetOrAllocateImageID( outStrings[i] );
|
int iImageID = GetOrAllocateImageID( outStrings[i] );
|
||||||
|
|
||||||
// Center the image if needed
|
// Center the image if needed
|
||||||
@ -492,6 +497,12 @@ void CHudCredits::DrawOutroCreditsName( void )
|
|||||||
{
|
{
|
||||||
FOR_EACH_VEC( outStrings, i )
|
FOR_EACH_VEC( outStrings, i )
|
||||||
{
|
{
|
||||||
|
if (i < pCredit->cColorOverride.Count())
|
||||||
|
{
|
||||||
|
// Change color to this particular column's color
|
||||||
|
cColor.SetRawColor( pCredit->cColorOverride[i] );
|
||||||
|
}
|
||||||
|
|
||||||
DrawOutroCreditFont( outStrings[i], pCredit->flYPos, m_hTFont, cColor, iWidth*(i + 1), iDivisor );
|
DrawOutroCreditFont( outStrings[i], pCredit->flYPos, m_hTFont, cColor, iWidth*(i + 1), iDivisor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -768,8 +779,8 @@ void CHudCredits::DrawIntroCreditsName( void )
|
|||||||
surface()->DrawSetTextFont( m_hTFont );
|
surface()->DrawSetTextFont( m_hTFont );
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
Color cColor = m_cColor;
|
Color cColor = m_cColor;
|
||||||
if (pCredit->cColorOverride.a() > 0)
|
if (pCredit->cColorOverride.Count() > 0)
|
||||||
cColor = pCredit->cColorOverride;
|
cColor.SetRawColor( pCredit->cColorOverride[0] );
|
||||||
|
|
||||||
surface()->DrawSetTextColor( cColor[0], cColor[1], cColor[2], FadeBlend( m_flFadeInTime, m_flFadeOutTime, m_flFadeHoldTime + pCredit->flTimeAdd, localTime ) * cColor[3] );
|
surface()->DrawSetTextColor( cColor[0], cColor[1], cColor[2], FadeBlend( m_flFadeInTime, m_flFadeOutTime, m_flFadeHoldTime + pCredit->flTimeAdd, localTime ) * cColor[3] );
|
||||||
#else
|
#else
|
||||||
@ -941,9 +952,25 @@ void CHudCredits::PrepareOutroCredits( void )
|
|||||||
|
|
||||||
// Get color
|
// Get color
|
||||||
case 2:
|
case 2:
|
||||||
|
char *pToken = strtok( outStrings[i], "," );
|
||||||
|
if (pToken)
|
||||||
|
{
|
||||||
|
// Multiple colors for multiple columns
|
||||||
|
while (pToken != NULL)
|
||||||
|
{
|
||||||
|
int tmp[4];
|
||||||
|
UTIL_StringToIntArray( tmp, 4, pToken );
|
||||||
|
pCredit->cColorOverride.AddToTail( Color( tmp[0], tmp[1], tmp[2], tmp[3] ).GetRawColor() );
|
||||||
|
|
||||||
|
pToken = strtok( NULL, "," );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
int tmp[4];
|
int tmp[4];
|
||||||
UTIL_StringToIntArray( tmp, 4, outStrings[i] );
|
UTIL_StringToIntArray( tmp, 4, outStrings[i] );
|
||||||
pCredit->cColorOverride = Color( tmp[0], tmp[1], tmp[2], tmp[3] );
|
pCredit->cColorOverride.AddToTail( Color( tmp[0], tmp[1], tmp[2], tmp[3] ).GetRawColor() );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -999,9 +1026,25 @@ void CHudCredits::PrepareOutroCredits( void )
|
|||||||
{
|
{
|
||||||
// Get color
|
// Get color
|
||||||
case 1:
|
case 1:
|
||||||
|
char *pToken = strtok( outStrings[i], "," );
|
||||||
|
if (pToken)
|
||||||
|
{
|
||||||
|
// Multiple colors for multiple columns
|
||||||
|
while (pToken != NULL)
|
||||||
|
{
|
||||||
|
int tmp[4];
|
||||||
|
UTIL_StringToIntArray( tmp, 4, pToken );
|
||||||
|
pCredit->cColorOverride.AddToTail( Color( tmp[0], tmp[1], tmp[2], tmp[3] ).GetRawColor() );
|
||||||
|
|
||||||
|
pToken = strtok( NULL, "," );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
int tmp[4];
|
int tmp[4];
|
||||||
UTIL_StringToIntArray( tmp, 4, outStrings[i] );
|
UTIL_StringToIntArray( tmp, 4, outStrings[i] );
|
||||||
pCredit->cColorOverride = Color( tmp[0], tmp[1], tmp[2], tmp[3] );
|
pCredit->cColorOverride.AddToTail( Color( tmp[0], tmp[1], tmp[2], tmp[3] ).GetRawColor() );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1024,8 +1067,12 @@ void CHudCredits::PrepareOutroCredits( void )
|
|||||||
|
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
// Check if the last line has a color override. If it does, use that as the alpha for the fadeout
|
// Check if the last line has a color override. If it does, use that as the alpha for the fadeout
|
||||||
if (m_CreditsList.Tail().cColorOverride.a() != 0)
|
if (m_CreditsList.Tail().cColorOverride.Count() > 0)
|
||||||
m_Alpha = m_CreditsList.Tail().cColorOverride.a();
|
{
|
||||||
|
Color clr;
|
||||||
|
clr.SetRawColor( m_CreditsList.Tail().cColorOverride[0] );
|
||||||
|
m_Alpha = clr.a();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SetActive( true );
|
SetActive( true );
|
||||||
@ -1057,9 +1104,10 @@ void CHudCredits::PrepareIntroCredits( void )
|
|||||||
{
|
{
|
||||||
// Get color
|
// Get color
|
||||||
case 1:
|
case 1:
|
||||||
|
// TODO: Columns?
|
||||||
int tmp[4];
|
int tmp[4];
|
||||||
UTIL_StringToIntArray( tmp, 4, outStrings[i] );
|
UTIL_StringToIntArray( tmp, 4, outStrings[i] );
|
||||||
pCredit->cColorOverride = Color( tmp[0], tmp[1], tmp[2], tmp[3] );
|
pCredit->cColorOverride.AddToTail( Color( tmp[0], tmp[1], tmp[2], tmp[3] ).GetRawColor() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user