This commit is contained in:
Chris Danford
2005-04-28 10:57:57 +00:00
parent f71ffd76c0
commit 6fb70bdcf5
2 changed files with 67 additions and 128 deletions
+63 -115
View File
@@ -52,6 +52,14 @@ MusicWheelItem::MusicWheelItem()
SetName( "MusicWheelItem" ); SetName( "MusicWheelItem" );
m_sprSongBar.Load( THEME->GetPathG("MusicWheelItem","song") );
m_sprSongBar.SetXY( 0, 0 );
this->AddChild( &m_sprSongBar );
m_sprSectionBar.Load( THEME->GetPathG("MusicWheelItem","section") );
m_sprSectionBar.SetXY( 0, 0 );
this->AddChild( &m_sprSectionBar );
m_fPercentGray = 0; m_fPercentGray = 0;
m_WheelNotifyIcon.SetXY( ICON_X, ICON_Y ); m_WheelNotifyIcon.SetXY( ICON_X, ICON_Y );
m_WheelNotifyIcon.RunCommands( ICON_ON_COMMAND ); m_WheelNotifyIcon.RunCommands( ICON_ON_COMMAND );
@@ -62,14 +70,6 @@ MusicWheelItem::MusicWheelItem()
m_TextBanner.RunCommands( SONG_NAME_ON_COMMAND ); m_TextBanner.RunCommands( SONG_NAME_ON_COMMAND );
this->AddChild( &m_TextBanner ); this->AddChild( &m_TextBanner );
m_sprSongBar.Load( THEME->GetPathG("MusicWheelItem","song") );
m_sprSongBar.SetXY( 0, 0 );
this->AddChild( &m_sprSongBar );
m_sprSectionBar.Load( THEME->GetPathG("MusicWheelItem","section") );
m_sprSectionBar.SetXY( 0, 0 );
this->AddChild( &m_sprSectionBar );
m_textSectionName.LoadFromFont( THEME->GetPathF("MusicWheelItem","section") ); m_textSectionName.LoadFromFont( THEME->GetPathF("MusicWheelItem","section") );
m_textSectionName.SetShadowLength( 0 ); m_textSectionName.SetShadowLength( 0 );
m_textSectionName.SetXY( SECTION_X, SECTION_Y ); m_textSectionName.SetXY( SECTION_X, SECTION_Y );
@@ -83,14 +83,6 @@ MusicWheelItem::MusicWheelItem()
m_textRoulette.RunCommands( ROULETTE_ON_COMMAND ); m_textRoulette.RunCommands( ROULETTE_ON_COMMAND );
this->AddChild( &m_textRoulette ); this->AddChild( &m_textRoulette );
FOREACH_PlayerNumber( p )
{
m_GradeDisplay[p].Load( THEME->GetPathG("MusicWheelItem","grades") );
m_GradeDisplay[p].SetZoom( 1.0f );
m_GradeDisplay[p].SetXY( GRADE_X.GetValue(p), 0 );
this->AddChild( &m_GradeDisplay[p] );
}
m_textCourse.SetName( "CourseName" ); m_textCourse.SetName( "CourseName" );
m_textCourse.LoadFromFont( THEME->GetPathF("MusicWheelItem","course") ); m_textCourse.LoadFromFont( THEME->GetPathF("MusicWheelItem","course") );
SET_XY_AND_ON_COMMAND( &m_textCourse ); SET_XY_AND_ON_COMMAND( &m_textCourse );
@@ -100,27 +92,37 @@ MusicWheelItem::MusicWheelItem()
m_textSort.LoadFromFont( THEME->GetPathF("MusicWheelItem","sort") ); m_textSort.LoadFromFont( THEME->GetPathF("MusicWheelItem","sort") );
SET_XY_AND_ON_COMMAND( &m_textSort ); SET_XY_AND_ON_COMMAND( &m_textSort );
this->AddChild( &m_textSort ); this->AddChild( &m_textSort );
FOREACH_PlayerNumber( p )
{
m_GradeDisplay[p].Load( THEME->GetPathG("MusicWheelItem","grades") );
m_GradeDisplay[p].SetZoom( 1.0f );
m_GradeDisplay[p].SetXY( GRADE_X.GetValue(p), 0 );
this->AddChild( &m_GradeDisplay[p] );
}
} }
void MusicWheelItem::LoadFromWheelItemData( WheelItemData* pWID ) void MusicWheelItem::LoadFromWheelItemData( WheelItemData* pWID )
{ {
ASSERT( pWID != NULL ); ASSERT( pWID != NULL );
data = pWID; data = pWID;
/*
// copy all data items
this->m_Type = pWID->m_Type;
this->m_sSectionName = pWID->m_sSectionName;
this->m_pCourse = pWID->m_pCourse;
this->m_pSong = pWID->m_pSong;
this->m_color = pWID->m_color;
this->m_Type = pWID->m_Type; */
// init type specific stuff // hide all
m_WheelNotifyIcon.SetHidden( true );
m_TextBanner.SetHidden( true );
m_sprSongBar.SetHidden( true );
m_sprSectionBar.SetHidden( true );
m_textSectionName.SetHidden( true );
m_textRoulette.SetHidden( true );
FOREACH_PlayerNumber( p )
m_GradeDisplay[p].SetHidden( true );
m_textCourse.SetHidden( true );
m_textSort.SetHidden( true );
// init and unhide type specific stuff
switch( pWID->m_Type ) switch( pWID->m_Type )
{ {
case TYPE_SECTION: case TYPE_SECTION:
@@ -151,37 +153,61 @@ void MusicWheelItem::LoadFromWheelItemData( WheelItemData* pWID )
bt->SetText( sDisplayName, sTranslitName ); bt->SetText( sDisplayName, sTranslitName );
bt->SetDiffuse( data->m_color ); bt->SetDiffuse( data->m_color );
bt->TurnRainbowOff(); bt->TurnRainbowOff();
bt->SetHidden( false );
} }
break; break;
case TYPE_SONG: case TYPE_SONG:
{ {
m_TextBanner.LoadFromSong( data->m_pSong ); m_TextBanner.LoadFromSong( data->m_pSong );
m_TextBanner.SetDiffuse( data->m_color ); m_TextBanner.SetDiffuse( data->m_color );
m_TextBanner.SetHidden( false );
m_WheelNotifyIcon.SetFlags( data->m_Flags ); m_WheelNotifyIcon.SetFlags( data->m_Flags );
m_WheelNotifyIcon.SetHidden( false );
RefreshGrades(); RefreshGrades();
} }
break; break;
case TYPE_ROULETTE: case TYPE_ROULETTE:
m_textRoulette.SetText( THEME->GetMetric("MusicWheel","Roulette") ); m_textRoulette.SetText( THEME->GetMetric("MusicWheel","Roulette") );
m_textRoulette.SetHidden( false );
break; break;
case TYPE_RANDOM: case TYPE_RANDOM:
m_textRoulette.SetText( THEME->GetMetric("MusicWheel","Random") ); m_textRoulette.SetText( THEME->GetMetric("MusicWheel","Random") );
m_textRoulette.SetHidden( false );
break; break;
case TYPE_PORTAL: case TYPE_PORTAL:
m_textRoulette.SetText( THEME->GetMetric("MusicWheel","Portal") ); m_textRoulette.SetText( THEME->GetMetric("MusicWheel","Portal") );
m_textRoulette.SetHidden( false );
break; break;
default: default:
ASSERT( 0 ); // invalid type ASSERT( 0 ); // invalid type
} }
switch( data->m_Type )
{
case TYPE_SECTION:
case TYPE_ROULETTE:
case TYPE_RANDOM:
case TYPE_PORTAL:
case TYPE_SORT:
m_sprSectionBar.SetHidden( false );
break;
case TYPE_SONG:
case TYPE_COURSE:
m_sprSongBar.SetHidden( false );
break;
default: ASSERT(0);
}
} }
void MusicWheelItem::RefreshGrades() void MusicWheelItem::RefreshGrades()
{ {
// Refresh Grades // Refresh Grades
FOREACH_PlayerNumber( p ) FOREACH_HumanPlayer( p )
{ {
if( !data->m_pSong || // this isn't a song display if( !data->m_pSong || // this isn't a song display
!GAMESTATE->IsHumanPlayer(p) ) !GAMESTATE->IsHumanPlayer(p) )
@@ -209,99 +235,21 @@ void MusicWheelItem::RefreshGrades()
void MusicWheelItem::Update( float fDeltaTime ) void MusicWheelItem::Update( float fDeltaTime )
{ {
Actor::Update( fDeltaTime ); ActorFrame::Update( fDeltaTime );
// update manually
switch( data->m_Type )
{
case TYPE_SECTION:
m_sprSectionBar.Update( fDeltaTime );
m_textSectionName.Update( fDeltaTime );
break;
case TYPE_ROULETTE:
case TYPE_RANDOM:
case TYPE_PORTAL:
m_sprSectionBar.Update( fDeltaTime );
m_textRoulette.Update( fDeltaTime );
break;
case TYPE_SONG:
{
m_sprSongBar.Update( fDeltaTime );
m_WheelNotifyIcon.Update( fDeltaTime );
m_TextBanner.Update( fDeltaTime );
FOREACH_PlayerNumber( p )
m_GradeDisplay[p].Update( fDeltaTime );
}
break;
case TYPE_COURSE:
m_sprSongBar.Update( fDeltaTime );
m_textCourse.Update( fDeltaTime );
break;
case TYPE_SORT:
m_sprSectionBar.Update( fDeltaTime );
m_textSort.Update( fDeltaTime );
break;
default:
ASSERT(0);
}
} }
void MusicWheelItem::DrawPrimitives() void MusicWheelItem::DrawPrimitives()
{ {
// draw manually ActorFrame::DrawPrimitives();
Sprite *bar = NULL;
switch( data->m_Type )
{
case TYPE_SECTION:
case TYPE_ROULETTE:
case TYPE_RANDOM:
case TYPE_PORTAL:
case TYPE_SORT:
bar = &m_sprSectionBar;
break;
case TYPE_SONG:
case TYPE_COURSE:
bar = &m_sprSongBar;
break;
default: ASSERT(0);
}
bar->Draw();
switch( data->m_Type )
{
case TYPE_SECTION:
m_textSectionName.Draw();
break;
case TYPE_ROULETTE:
case TYPE_RANDOM:
case TYPE_PORTAL:
m_textRoulette.Draw();
break;
case TYPE_SONG:
m_TextBanner.Draw();
m_WheelNotifyIcon.Draw();
FOREACH_PlayerNumber( p )
m_GradeDisplay[p].Draw();
break;
case TYPE_COURSE:
m_textCourse.Draw();
break;
case TYPE_SORT:
m_textSort.Draw();
break;
default:
ASSERT(0);
}
if( m_fPercentGray > 0 ) if( m_fPercentGray > 0 )
{ {
bar->SetGlow( RageColor(0,0,0,m_fPercentGray) ); Sprite &bar = m_sprSectionBar.GetHidden() ? m_sprSongBar : m_sprSectionBar;
bar->SetDiffuse( RageColor(0,0,0,0) ); bar.SetGlow( RageColor(0,0,0,m_fPercentGray) );
bar->Draw(); bar.SetDiffuse( RageColor(0,0,0,0) );
bar->SetDiffuse( RageColor(0,0,0,1) ); bar.Draw();
bar->SetGlow( RageColor(0,0,0,0) ); bar.SetDiffuse( RageColor(0,0,0,1) );
bar.SetGlow( RageColor(0,0,0,0) );
} }
} }
+4 -13
View File
@@ -29,24 +29,15 @@ public:
WheelItemData *data; WheelItemData *data;
float m_fPercentGray; float m_fPercentGray;
// for TYPE_SECTION and TYPE_ROULETTE
Sprite m_sprSectionBar;
// for TYPE_SECTION
BitmapText m_textSectionName;
// for TYPE_ROULETTE
BitmapText m_textRoulette;
// for a TYPE_MUSIC
Sprite m_sprSongBar; Sprite m_sprSongBar;
Sprite m_sprSectionBar;
WheelNotifyIcon m_WheelNotifyIcon; WheelNotifyIcon m_WheelNotifyIcon;
TextBanner m_TextBanner; TextBanner m_TextBanner;
GradeDisplay m_GradeDisplay[NUM_PLAYERS]; BitmapText m_textSectionName;
BitmapText m_textRoulette;
// for TYPE_COURSE
BitmapText m_textCourse; BitmapText m_textCourse;
// for TYPE_SORT
BitmapText m_textSort; BitmapText m_textSort;
GradeDisplay m_GradeDisplay[NUM_PLAYERS];
}; };
enum WheelItemType enum WheelItemType