From fd94e4f38de37e8ce9010ff9fd1e5194aa7b6142 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 21 Mar 2005 07:40:23 +0000 Subject: [PATCH] don't warn about dimensions if texture is "_blank" --- stepmania/src/DifficultyIcon.cpp | 5 ++++- stepmania/src/Font.cpp | 3 ++- stepmania/src/GradeDisplay.cpp | 35 +++++++++++++++++++++++--------- stepmania/src/GradeDisplay.h | 2 +- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/stepmania/src/DifficultyIcon.cpp b/stepmania/src/DifficultyIcon.cpp index 65c01f0675..2474cb9581 100644 --- a/stepmania/src/DifficultyIcon.cpp +++ b/stepmania/src/DifficultyIcon.cpp @@ -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.", diff --git a/stepmania/src/Font.cpp b/stepmania/src/Font.cpp index 9ecb8c78a3..54769537c5 100644 --- a/stepmania/src/Font.cpp +++ b/stepmania/src/Font.cpp @@ -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", diff --git a/stepmania/src/GradeDisplay.cpp b/stepmania/src/GradeDisplay.cpp index 52f67b9571..a5a366fad1 100644 --- a/stepmania/src/GradeDisplay.cpp +++ b/stepmania/src/GradeDisplay.cpp @@ -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; diff --git a/stepmania/src/GradeDisplay.h b/stepmania/src/GradeDisplay.h index b8a595ac94..3bad4efbb3 100644 --- a/stepmania/src/GradeDisplay.h +++ b/stepmania/src/GradeDisplay.h @@ -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;