diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index a4d870ae9a..f7d149fc78 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -28,8 +28,8 @@ REGISTER_ACTOR_CLASS( BitmapText ) */ #define RAINBOW_COLOR(n) THEME->GetMetricC("BitmapText",ssprintf("RainbowColor%i", n+1)) -const int NUM_RAINBOW_COLORS = 7; -RageColor RAINBOW_COLORS[NUM_RAINBOW_COLORS]; +static const int NUM_RAINBOW_COLORS = 7; +static RageColor RAINBOW_COLORS[NUM_RAINBOW_COLORS]; BitmapText::BitmapText() { @@ -45,6 +45,7 @@ BitmapText::BitmapText() m_pFont = NULL; m_bRainbow = false; + m_bJitter = false; m_iWrapWidthPixels = -1; m_fMaxWidth = 0; @@ -77,6 +78,7 @@ BitmapText &BitmapText::operator =( const BitmapText &cpy ) CPY( m_fMaxWidth ); CPY( m_fMaxHeight ); CPY( m_bRainbow ); + CPY( m_bJitter ); CPY( m_iVertSpacing ); CPY( m_aVertices ); CPY( m_pTextures ); @@ -559,7 +561,41 @@ void BitmapText::DrawPrimitives() } } + // apply jitter to verts + vector vGlyphJitter; + if( m_bJitter ) + { + int iSeed = (int)roundf( RageTimer::GetTimeSinceStartFast()*8 ); + RandomGen rnd( iSeed ); + + for( unsigned i=0; i { public: - static int wrapwidthpixels( T* p, lua_State *L ) { p->SetWrapWidthPixels( IArg(1) ); return 0; } - static int maxwidth( T* p, lua_State *L ) { p->SetMaxWidth( FArg(1) ); return 0; } - static int maxheight( T* p, lua_State *L ) { p->SetMaxHeight( FArg(1) ); return 0; } - static int vertspacing( T* p, lua_State *L ) { p->SetVertSpacing( IArg(1) ); return 0; } + static int wrapwidthpixels( T* p, lua_State *L ) { p->SetWrapWidthPixels( IArg(1) ); return 0; } + static int maxwidth( T* p, lua_State *L ) { p->SetMaxWidth( FArg(1) ); return 0; } + static int maxheight( T* p, lua_State *L ) { p->SetMaxHeight( FArg(1) ); return 0; } + static int vertspacing( T* p, lua_State *L ) { p->SetVertSpacing( IArg(1) ); return 0; } static int settext( T* p, lua_State *L ) { RString s = SArg(1); @@ -866,7 +902,8 @@ public: p->SetText( s ); return 0; } - static int GetText( T* p, lua_State *L ) { lua_pushstring( L, p->GetText() ); return 1; } + static int jitter( T* p, lua_State *L ) { p->SetJitter( BArg(1) ); return 0; } + static int GetText( T* p, lua_State *L ) { lua_pushstring( L, p->GetText() ); return 1; } LunaBitmapText() { @@ -875,6 +912,7 @@ public: ADD_METHOD( maxheight ); ADD_METHOD( vertspacing ); ADD_METHOD( settext ); + ADD_METHOD( jitter ); ADD_METHOD( GetText ); } }; diff --git a/stepmania/src/BitmapText.h b/stepmania/src/BitmapText.h index e123cf8a0b..ccfc412f79 100644 --- a/stepmania/src/BitmapText.h +++ b/stepmania/src/BitmapText.h @@ -31,8 +31,8 @@ public: virtual bool EarlyAbortDraw() const; virtual void DrawPrimitives(); - void TurnRainbowOn() { m_bRainbow = true; } - void TurnRainbowOff() { m_bRainbow = false; } + void SetRainbow( bool b ) { m_bRainbow = b; } + void SetJitter( bool b ) { m_bJitter = b; } void SetHorizAlign( HorizAlign ha ); void SetVertAlign( VertAlign va ); @@ -52,14 +52,15 @@ public: Font* m_pFont; protected: - RString m_sText; - vector m_wTextLines; - vector m_iLineWidths; // in source pixels - int m_iWrapWidthPixels; // -1 = no wrap - float m_fMaxWidth; - float m_fMaxHeight; - bool m_bRainbow; - int m_iVertSpacing; + RString m_sText; + vector m_wTextLines; + vector m_iLineWidths; // in source pixels + int m_iWrapWidthPixels; // -1 = no wrap + float m_fMaxWidth; + float m_fMaxHeight; + bool m_bRainbow; + bool m_bJitter; + int m_iVertSpacing; vector m_aVertices; vector m_pTextures; diff --git a/stepmania/src/GroupList.cpp b/stepmania/src/GroupList.cpp index 44069d00a0..644934fe35 100644 --- a/stepmania/src/GroupList.cpp +++ b/stepmania/src/GroupList.cpp @@ -78,11 +78,11 @@ void GroupList::Load( const vector& asGroupNames ) if( i == 0 ) { - label->TurnRainbowOn(); + label->SetRainbow( true ); } else { - label->TurnRainbowOff(); + label->SetRainbow( false ); label->SetDiffuse( SONGMAN->GetSongGroupColor(asGroupNames[i]) ); } diff --git a/stepmania/src/ScreenNetEvaluation.cpp b/stepmania/src/ScreenNetEvaluation.cpp index 613c4cba29..9ae039523c 100644 --- a/stepmania/src/ScreenNetEvaluation.cpp +++ b/stepmania/src/ScreenNetEvaluation.cpp @@ -147,9 +147,9 @@ void ScreenNetEvaluation::HandleScreenMessage( const ScreenMessage SM ) m_textUsers[i].SetText( NSMAN->m_PlayerNames[NSMAN->m_EvalPlayerData[i].name] ); if ( NSMAN->m_EvalPlayerData[i].grade < Grade_Tier03 ) //Yes, hardcoded (I'd like to leave it that way) - m_textUsers[i].TurnRainbowOn(); + m_textUsers[i].SetRainbow( true ); else - m_textUsers[i].TurnRainbowOff(); + m_textUsers[i].SetRainbow( false ); ON_COMMAND( m_textUsers[i] ); LOG->Trace("SMNETCheckpoint%d",i); }