From e44141c8d374ba7a4b4d81e14965bcd74ce1b04a Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 22 Sep 2002 20:34:11 +0000 Subject: [PATCH] Fixed extended ASCII support in BitmapText --- stepmania/TODO.chris | 10 ---------- stepmania/src/BitmapText.cpp | 7 +++++-- stepmania/src/BitmapText.h | 4 ++-- stepmania/src/Font.cpp | 2 +- stepmania/src/ScoreDisplayOni.cpp | 2 +- stepmania/src/ScreenManager.cpp | 22 ++-------------------- 6 files changed, 11 insertions(+), 36 deletions(-) diff --git a/stepmania/TODO.chris b/stepmania/TODO.chris index 99c7843682..fdca24fd40 100644 --- a/stepmania/TODO.chris +++ b/stepmania/TODO.chris @@ -5,8 +5,6 @@ Fix on Ez2, the Ranking doesn't save (AAA, AA, A, B e.t.c.) but the score does, any ideas why? -timing window in INI - if you do an entire song in it. and save it'll crash re-add texture hints @@ -15,18 +13,10 @@ refresh rates screwed up pump life meter -Don't unload textures after loading them once - - SMANIAC difficulty BLUE DUDE! DO IT! yes because basically these days, Oni challenge modes are defined as smaniac Spig301: so really, challenge = smaniac - -the CDTitles DWI style arent being read anymore. - -faster IniFile (with std::map?) - fix movie texture crash The "groove bar" reports at the results screen is broken. diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index d1a72020bd..03ed281131 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -114,6 +114,9 @@ void BitmapText::SetText( CString sText ) strncpy( m_szText, sText, MAX_TEXT_CHARS ); m_szText[MAX_TEXT_CHARS-1] = '\0'; +/* + Do NOT stop out all extended ASCII chars. Why was this here? -Chris + int iLength = strlen( m_szText ); // @@ -124,7 +127,7 @@ void BitmapText::SetText( CString sText ) if( m_szText[i] < 0 || m_szText[i] > MAX_FONT_CHARS-1 ) m_szText[i] = ' '; } - +*/ // // break the string into lines // @@ -224,7 +227,7 @@ void BitmapText::DrawPrimitives() for( int j=0; jm_iCharToFrameNo[c]; + const int iFrameNo = m_pFont->m_iCharToFrameNo[ (unsigned char)c ]; if( iFrameNo == -1 ) // this font doesn't impelemnt this character throw RageException( "The font '%s' does not implement the character '%c'", m_sFontFilePath, c ); const int iCharWidth = m_pFont->m_iFrameNoToWidth[iFrameNo]; diff --git a/stepmania/src/BitmapText.h b/stepmania/src/BitmapText.h index d8af24cb62..4837339c83 100644 --- a/stepmania/src/BitmapText.h +++ b/stepmania/src/BitmapText.h @@ -45,8 +45,8 @@ protected: Font* m_pFont; // recalculate the items below on SetText() - TCHAR m_szText[MAX_TEXT_CHARS]; - TCHAR* m_szTextLines[MAX_TEXT_LINES]; // pointers into m_szText + char m_szText[MAX_TEXT_CHARS]; + char* m_szTextLines[MAX_TEXT_LINES]; // pointers into m_szText int m_iLineLengths[MAX_TEXT_LINES]; // in characters int m_iNumLines; int m_iLineWidths[MAX_TEXT_LINES]; // in source pixels diff --git a/stepmania/src/Font.cpp b/stepmania/src/Font.cpp index 29661cc8a0..8cdfe9c326 100644 --- a/stepmania/src/Font.cpp +++ b/stepmania/src/Font.cpp @@ -157,7 +157,7 @@ int Font::GetLineWidthInSourcePixels( const char *szLine, int iLength ) for( int i=0; iTrace( "ScoreDisplayOni::ScoreDisplayOni()" ); // init the text - BitmapText::LoadFromTextureAndChars( THEME->GetPathTo("Graphics","gameplay score numbers"), "01234 :56789%." ); + BitmapText::LoadFromNumbers( THEME->GetPathTo("Numbers","gameplay score numbers") ); TurnShadowOff(); } diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index 9612f99306..e57fd94dc0 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -25,26 +25,8 @@ ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our p #define STATS_X THEME->GetMetricF("ScreenManager","StatsX") #define STATS_Y THEME->GetMetricF("ScreenManager","StatsY") -#define CREDITS_P1_X THEME->GetMetricF("ScreenManager","CreditsP1X") -#define CREDITS_P1_Y THEME->GetMetricF("ScreenManager","CreditsP1Y") -#define CREDITS_P2_X THEME->GetMetricF("ScreenManager","CreditsP2X") -#define CREDITS_P2_Y THEME->GetMetricF("ScreenManager","CreditsP2Y") - -float CREDITS_X( int p ) { - switch( p ) { - case PLAYER_1: return CREDITS_P1_X; - case PLAYER_2: return CREDITS_P2_X; - default: ASSERT(0); return 0; - } -} -float CREDITS_Y( int p ) { - switch( p ) { - case PLAYER_1: return CREDITS_P1_Y; - case PLAYER_2: return CREDITS_P2_Y; - default: ASSERT(0); return 0; - } -} - +#define CREDITS_X( p ) THEME->GetMetricF("ScreenManager",ssprintf("CreditsP%dX",p+1)) +#define CREDITS_Y( p ) THEME->GetMetricF("ScreenManager",ssprintf("CreditsP%dY",p+1)) ScreenManager::ScreenManager()