cleanup. (hate this fade logic ...)
This commit is contained in:
@@ -280,18 +280,18 @@ void BitmapText::DrawChars()
|
|||||||
|
|
||||||
/* We fade from 0 to LeftColor, then from RightColor to 0. (We won't fade all the way to
|
/* We fade from 0 to LeftColor, then from RightColor to 0. (We won't fade all the way to
|
||||||
* 0 if the crop is beyond the outer edge.) */
|
* 0 if the crop is beyond the outer edge.) */
|
||||||
const float RightAlpha = SCALE( FadeSize.right, FadeDist.right, 0, 1, 0 );
|
const float fRightAlpha = SCALE( FadeSize.right, FadeDist.right, 0, 1, 0 );
|
||||||
const float LeftAlpha = SCALE( FadeSize.left, FadeDist.left, 0, 1, 0 );
|
const float fLeftAlpha = SCALE( FadeSize.left, FadeDist.left, 0, 1, 0 );
|
||||||
|
|
||||||
const float StartFadeLeftPercent = m_pTempState->crop.left;
|
const float fStartFadeLeftPercent = m_pTempState->crop.left;
|
||||||
const float StopFadeLeftPercent = m_pTempState->crop.left + FadeSize.left;
|
const float fStopFadeLeftPercent = m_pTempState->crop.left + FadeSize.left;
|
||||||
const float fLeftFadeStartGlyph = SCALE( StartFadeLeftPercent, 0.f, 1.f, 0, (float) iNumGlyphs );
|
const float fLeftFadeStartGlyph = SCALE( fStartFadeLeftPercent, 0.f, 1.f, 0, (float) iNumGlyphs );
|
||||||
const float fLeftFadeStopGlyph = SCALE( StopFadeLeftPercent, 0.f, 1.f, 0, (float) iNumGlyphs );
|
const float fLeftFadeStopGlyph = SCALE( fStopFadeLeftPercent, 0.f, 1.f, 0, (float) iNumGlyphs );
|
||||||
|
|
||||||
const float StartFadeRightPercent = 1-(m_pTempState->crop.right + FadeSize.right);
|
const float fStartFadeRightPercent = 1-(m_pTempState->crop.right + FadeSize.right);
|
||||||
const float StopFadeRightPercent = 1-(m_pTempState->crop.right);
|
const float fStopFadeRightPercent = 1-(m_pTempState->crop.right);
|
||||||
const float fRightFadeStartGlyph = SCALE( StartFadeRightPercent, 0.f, 1.f, 0, (float) iNumGlyphs );
|
const float fRightFadeStartGlyph = SCALE( fStartFadeRightPercent, 0.f, 1.f, 0, (float) iNumGlyphs );
|
||||||
const float fRightFadeStopGlyph = SCALE( StopFadeRightPercent, 0.f, 1.f, 0, (float) iNumGlyphs );
|
const float fRightFadeStopGlyph = SCALE( fStopFadeRightPercent, 0.f, 1.f, 0, (float) iNumGlyphs );
|
||||||
|
|
||||||
for( int start = iStartGlyph; start < iEndGlyph; ++start )
|
for( int start = iStartGlyph; start < iEndGlyph; ++start )
|
||||||
{
|
{
|
||||||
@@ -303,14 +303,14 @@ void BitmapText::DrawChars()
|
|||||||
/* Add .5, so we fade wrt. the center of the vert, not the left side. */
|
/* Add .5, so we fade wrt. the center of the vert, not the left side. */
|
||||||
float fPercent = SCALE( start+0.5f, fLeftFadeStartGlyph, fLeftFadeStopGlyph, 0.0f, 1.0f );
|
float fPercent = SCALE( start+0.5f, fLeftFadeStartGlyph, fLeftFadeStopGlyph, 0.0f, 1.0f );
|
||||||
fPercent = clamp( fPercent, 0.0f, 1.0f );
|
fPercent = clamp( fPercent, 0.0f, 1.0f );
|
||||||
fAlpha *= fPercent * LeftAlpha;
|
fAlpha *= fPercent * fLeftAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FadeSize.right > 0.001f )
|
if( FadeSize.right > 0.001f )
|
||||||
{
|
{
|
||||||
float fPercent = SCALE( start+0.5f, fRightFadeStartGlyph, fRightFadeStopGlyph, 1.0f, 0.0f );
|
float fPercent = SCALE( start+0.5f, fRightFadeStartGlyph, fRightFadeStopGlyph, 1.0f, 0.0f );
|
||||||
fPercent = clamp( fPercent, 0.0f, 1.0f );
|
fPercent = clamp( fPercent, 0.0f, 1.0f );
|
||||||
fAlpha *= fPercent * RightAlpha;
|
fAlpha *= fPercent * fRightAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int j = 0; j < 4; ++j )
|
for( int j = 0; j < 4; ++j )
|
||||||
@@ -510,9 +510,9 @@ void BitmapText::DrawPrimitives()
|
|||||||
/* Draw if we're not fully transparent or the zbuffer is enabled */
|
/* Draw if we're not fully transparent or the zbuffer is enabled */
|
||||||
if( m_pTempState->diffuse[0].a != 0 )
|
if( m_pTempState->diffuse[0].a != 0 )
|
||||||
{
|
{
|
||||||
//////////////////////
|
//
|
||||||
// render the shadow
|
// render the shadow
|
||||||
//////////////////////
|
//
|
||||||
if( m_fShadowLength != 0 )
|
if( m_fShadowLength != 0 )
|
||||||
{
|
{
|
||||||
DISPLAY->PushMatrix();
|
DISPLAY->PushMatrix();
|
||||||
@@ -527,9 +527,9 @@ void BitmapText::DrawPrimitives()
|
|||||||
DISPLAY->PopMatrix();
|
DISPLAY->PopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////
|
//
|
||||||
// render the diffuse pass
|
// render the diffuse pass
|
||||||
//////////////////////
|
//
|
||||||
if( m_bRainbow )
|
if( m_bRainbow )
|
||||||
{
|
{
|
||||||
int color_index = int(RageTimer::GetTimeSinceStartFast() / 0.200) % NUM_RAINBOW_COLORS;
|
int color_index = int(RageTimer::GetTimeSinceStartFast() / 0.200) % NUM_RAINBOW_COLORS;
|
||||||
@@ -634,7 +634,7 @@ void ColorBitmapText::SetText( const CString& _sText, const CString& _sAlternate
|
|||||||
// First: Check for the special (color) case.
|
// First: Check for the special (color) case.
|
||||||
|
|
||||||
CString FirstThree = m_sText.substr( i, 3 );
|
CString FirstThree = m_sText.substr( i, 3 );
|
||||||
if ( ( FirstThree.CompareNoCase( "|c0" ) == 0 ) && ( iCharsLeft > 8 ) )
|
if( FirstThree.CompareNoCase("|c0") == 0 && iCharsLeft > 8 )
|
||||||
{
|
{
|
||||||
ColorChange change;
|
ColorChange change;
|
||||||
int k;
|
int k;
|
||||||
@@ -658,7 +658,7 @@ void ColorBitmapText::SetText( const CString& _sText, const CString& _sAlternate
|
|||||||
switch( curChar )
|
switch( curChar )
|
||||||
{
|
{
|
||||||
case ' ':
|
case ' ':
|
||||||
if ( /*( iLineWidth == 0 ) &&*/ ( iWordWidth == 0 ) )
|
if( /* iLineWidth == 0 &&*/ iWordWidth == 0 )
|
||||||
break;
|
break;
|
||||||
sCurrentLine += sCurrentWord + " ";
|
sCurrentLine += sCurrentWord + " ";
|
||||||
iLineWidth += iWordWidth + iCharLen;
|
iLineWidth += iWordWidth + iCharLen;
|
||||||
@@ -686,7 +686,7 @@ void ColorBitmapText::SetText( const CString& _sText, const CString& _sAlternate
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ( ( iWordWidth + iCharLen > iWrapWidthPixels ) && ( iLineWidth == 0 ) )
|
if( iWordWidth + iCharLen > iWrapWidthPixels && iLineWidth == 0 )
|
||||||
{
|
{
|
||||||
SimpleAddLine( sCurrentWord, iWordWidth );
|
SimpleAddLine( sCurrentWord, iWordWidth );
|
||||||
sCurrentWord = curChar; iWordWidth = iCharLen;
|
sCurrentWord = curChar; iWordWidth = iCharLen;
|
||||||
@@ -736,9 +736,9 @@ void ColorBitmapText::DrawPrimitives( )
|
|||||||
/* Draw if we're not fully transparent or the zbuffer is enabled */
|
/* Draw if we're not fully transparent or the zbuffer is enabled */
|
||||||
if( m_pTempState->diffuse[0].a != 0 )
|
if( m_pTempState->diffuse[0].a != 0 )
|
||||||
{
|
{
|
||||||
//////////////////////
|
//
|
||||||
// render the shadow
|
// render the shadow
|
||||||
//////////////////////
|
//
|
||||||
if( m_fShadowLength != 0 )
|
if( m_fShadowLength != 0 )
|
||||||
{
|
{
|
||||||
DISPLAY->PushMatrix();
|
DISPLAY->PushMatrix();
|
||||||
@@ -753,9 +753,9 @@ void ColorBitmapText::DrawPrimitives( )
|
|||||||
DISPLAY->PopMatrix();
|
DISPLAY->PopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////
|
//
|
||||||
// render the diffuse pass
|
// render the diffuse pass
|
||||||
//////////////////////
|
//
|
||||||
int loc = 0, cur = 0;
|
int loc = 0, cur = 0;
|
||||||
RageColor c = m_pTempState->diffuse[0];
|
RageColor c = m_pTempState->diffuse[0];
|
||||||
|
|
||||||
@@ -763,11 +763,13 @@ void ColorBitmapText::DrawPrimitives( )
|
|||||||
{
|
{
|
||||||
loc++;
|
loc++;
|
||||||
if( cur < (int)m_vColors.size() )
|
if( cur < (int)m_vColors.size() )
|
||||||
|
{
|
||||||
if ( loc > m_vColors[cur].l )
|
if ( loc > m_vColors[cur].l )
|
||||||
{
|
{
|
||||||
c = m_vColors[cur].c;
|
c = m_vColors[cur].c;
|
||||||
cur++;
|
cur++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for( unsigned j=0; j<4; j++ )
|
for( unsigned j=0; j<4; j++ )
|
||||||
m_aVertices[i+j].c = c;
|
m_aVertices[i+j].c = c;
|
||||||
}
|
}
|
||||||
@@ -823,7 +825,7 @@ void ColorBitmapText::SetMaxLines( int iNumLines, int iDirection )
|
|||||||
|
|
||||||
// If we already have a color set for the first char
|
// If we already have a color set for the first char
|
||||||
// do not override it.
|
// do not override it.
|
||||||
if ( ( m_vColors.size() > 0 ) && ( m_vColors[0].l > 0 ) )
|
if( m_vColors.size() > 0 && m_vColors[0].l > 0 )
|
||||||
{
|
{
|
||||||
ColorChange tmp;
|
ColorChange tmp;
|
||||||
tmp.c = LastColor;
|
tmp.c = LastColor;
|
||||||
|
|||||||
Reference in New Issue
Block a user