don't warn about dimensions if texture is "_blank"

This commit is contained in:
Chris Danford
2005-03-21 07:40:23 +00:00
parent 6df73d3839
commit fd94e4f38d
4 changed files with 32 additions and 13 deletions
+4 -1
View File
@@ -19,7 +19,10 @@ bool DifficultyIcon::Load( CString sPath )
{
Sprite::Load( sPath );
int iStates = GetNumStates();
if( iStates != NUM_DIFFICULTIES && iStates != NUM_DIFFICULTIES*2 )
bool bWarn = iStates != NUM_DIFFICULTIES && iStates != NUM_DIFFICULTIES*2;
if( sPath.Find("_blank") != -1 )
bWarn = false;
if( bWarn )
{
CString sError = ssprintf(
"The difficulty icon graphic '%s' must have %d or %d frames. It has %d states.",
+2 -1
View File
@@ -826,8 +826,9 @@ void Font::Load(const CString &sFontOrTextureFilePath, CString sChars)
it != fp->m_iCharToGlyphNo.end(); ++it)
{
if(it->second < fp->m_pTexture->GetNumFrames()) continue; /* OK */
RageException::Throw( "The font '%s' maps %s to frame %i, but the font only has %i frames.",
CString sError = ssprintf( "The font '%s' maps %s to frame %i, but the font only has %i frames.",
TexturePaths[i].c_str(), WcharDisplayText(wchar_t(it->first)).c_str(), it->second, fp->m_pTexture->GetNumFrames() );
RageException::Throw( sError );
}
// LOG->Trace("Adding page %s (%s) to %s; %i glyphs",
+25 -10
View File
@@ -5,6 +5,8 @@
#include "PrefsManager.h"
#include "ThemeManager.h"
#include "RageTexture.h"
#include "arch/Dialog/Dialog.h"
#include "RageLog.h"
const float SCROLL_TIME = 5.0f;
@@ -28,8 +30,15 @@ bool GradeDisplay::Load( RageTextureID ID )
Sprite::Load( ID );
Sprite::StopAnimating();
if( Sprite::GetNumStates() != 8 && Sprite::GetNumStates() != 16 )
RageException::Throw( "The grade graphic '%s' must have either 8 or 16 frames.", ID.filename.c_str() );
bool bWarn = Sprite::GetNumStates() != 8 && Sprite::GetNumStates() != 16;
if( ID.filename.Find("_blank") != -1 )
bWarn = false;
if( bWarn )
{
CString sError = ssprintf( "The grade graphic '%s' must have either 8 or 16 frames.", ID.filename.c_str() );
LOG->Warn( sError );
Dialog::OK( sError );
}
return true;
}
@@ -70,16 +79,19 @@ void GradeDisplay::DrawPrimitives()
Sprite::DrawPrimitives();
}
int GradeDisplay::GetFrameNo( PlayerNumber pn, Grade g )
int GradeDisplay::GetFrameIndex( PlayerNumber pn, Grade g )
{
if( this->m_pTexture->GetID().filename.Find("_blank") != -1 )
return 0;
// either 8, or 16 states
int iNumCols;
switch( Sprite::GetNumStates() )
{
default:
ASSERT(0);
case 8: iNumCols=1; break;
case 16: iNumCols=2; break;
default:
ASSERT(0);
}
int iFrame;
@@ -111,17 +123,20 @@ void GradeDisplay::SetGrade( PlayerNumber pn, Grade g )
if(g != GRADE_NO_DATA)
{
SetState( GetFrameNo(pn,g) );
SetDiffuse( RageColor(1,1,1,1.0f) );
} else
SetDiffuse( RageColor(1,1,1,0) );
SetState( GetFrameIndex(pn,g) );
SetDiffuseAlpha( 1 );
}
else
{
SetDiffuseAlpha( 0 );
}
}
void GradeDisplay::Spin()
{
m_bDoScrolling = true;
int iFrameNo = GetFrameNo( m_PlayerNumber, m_Grade );
int iFrameNo = GetFrameIndex( m_PlayerNumber, m_Grade );
m_frectDestTexCoords = *m_pTexture->GetTextureCoordRect( iFrameNo );
m_frectStartTexCoords = m_frectDestTexCoords;
+1 -1
View File
@@ -26,7 +26,7 @@ public:
Grade GetGrade () const {return m_Grade;}
protected:
int GetFrameNo( PlayerNumber pn, Grade g );
int GetFrameIndex( PlayerNumber pn, Grade g );
PlayerNumber m_PlayerNumber;
Grade m_Grade;