From 3c41ff7d849498c3a4488314795c4e5c44313e7b Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 21 Jan 2004 08:38:06 +0000 Subject: [PATCH] allow showing separate difficulties for each player --- stepmania/src/CourseContentsList.cpp | 13 ++--- stepmania/src/CourseEntryDisplay.cpp | 81 +++++++++++++++++----------- stepmania/src/CourseEntryDisplay.h | 8 +-- 3 files changed, 63 insertions(+), 39 deletions(-) diff --git a/stepmania/src/CourseContentsList.cpp b/stepmania/src/CourseContentsList.cpp index ddd1a0063f..f2030071b0 100644 --- a/stepmania/src/CourseContentsList.cpp +++ b/stepmania/src/CourseContentsList.cpp @@ -57,16 +57,17 @@ void CourseContentsList::SetFromCourse( const Course* pCourse ) return; } + vector ci[NUM_PLAYERS]; + for( int pn = 0; pn < NUM_PLAYERS; ++pn ) + pCourse->GetCourseInfo( GAMESTATE->GetCurrentStyleDef()->m_StepsType, ci[pn], GAMESTATE->m_CourseDifficulty[pn] ); + m_iNumContents = 0; - - vector ci; - pCourse->GetCourseInfo( GAMESTATE->GetCurrentStyleDef()->m_StepsType, ci, GAMESTATE->m_CourseDifficulty[GAMESTATE->m_MasterPlayerNumber] ); - - for( int i=0; i #include "ThemeManager.h" #include "Steps.h" #include "GameState.h" #include "StyleDef.h" #include "ActorUtil.h" +#include +#define SEPARATE_COURSE_METERS THEME->GetMetricB(m_sName,"SeparateCouresMeters") void CourseEntryDisplay::Load() { @@ -45,15 +46,24 @@ void CourseEntryDisplay::Load() SET_XY_AND_ON_COMMAND( &m_TextBanner ); this->AddChild( &m_TextBanner ); - m_textFoot.SetName( "Foot" ); - m_textFoot.LoadFromTextureAndChars( THEME->GetPathToG("CourseEntryDisplay difficulty 2x1"),"10" ); - SET_XY_AND_ON_COMMAND( &m_textFoot ); - this->AddChild( &m_textFoot ); + for( int pn = 0; pn < NUM_PLAYERS; ++pn ) + { + if( !GAMESTATE->IsHumanPlayer((PlayerNumber)pn) ) + continue; // skip - m_textDifficultyNumber.SetName( "Difficulty" ); - m_textDifficultyNumber.LoadFromFont( THEME->GetPathToF("Common normal") ); - SET_XY_AND_ON_COMMAND( &m_textDifficultyNumber ); - this->AddChild( &m_textDifficultyNumber ); + if( !SEPARATE_COURSE_METERS && pn != GAMESTATE->m_MasterPlayerNumber ) + continue; // skip + + m_textFoot[pn].SetName( SEPARATE_COURSE_METERS? ssprintf("FootP%i", pn+1):"Foot" ); + m_textFoot[pn].LoadFromTextureAndChars( THEME->GetPathToG("CourseEntryDisplay difficulty 2x1"),"10" ); + SET_XY_AND_ON_COMMAND( &m_textFoot[pn] ); + this->AddChild( &m_textFoot[pn] ); + + m_textDifficultyNumber[pn].SetName( SEPARATE_COURSE_METERS? ssprintf("DifficultyP%i", pn+1):"Difficulty" ); + m_textDifficultyNumber[pn].LoadFromFont( THEME->GetPathToF("Common normal") ); + SET_XY_AND_ON_COMMAND( &m_textDifficultyNumber[pn] ); + this->AddChild( &m_textDifficultyNumber[pn] ); + } m_textModifiers.SetName( "Modifiers" ); m_textModifiers.LoadFromFont( THEME->GetPathToF("Common normal") ); @@ -61,25 +71,38 @@ void CourseEntryDisplay::Load() this->AddChild( &m_textModifiers ); } -void CourseEntryDisplay::LoadFromCourseInfo( int iNum, const Course *pCourse, const Course::Info &ci ) +void CourseEntryDisplay::SetDifficulty( PlayerNumber pn, const CString &text, RageColor c ) { - RageColor colorNotes; + if( !GAMESTATE->IsHumanPlayer(pn) ) + return; // skip + if( !SEPARATE_COURSE_METERS && pn != GAMESTATE->m_MasterPlayerNumber ) + return; + + m_textDifficultyNumber[pn].SetText( text ); + m_textDifficultyNumber[pn].SetDiffuse( c ); + + m_textFoot[pn].SetText( "1" ); + m_textFoot[pn].SetDiffuse( c ); +} + +void CourseEntryDisplay::LoadFromCourseInfo( int iNum, const Course *pCourse, const Course::Info pci[NUM_PLAYERS] ) +{ + const Course::Info &ci = pci[GAMESTATE->m_MasterPlayerNumber]; + if( ci.Mystery ) { - Difficulty dc = pCourse->GetDifficulty( ci ); - - if( dc == DIFFICULTY_INVALID ) + for( int pn = 0; pn < NUM_PLAYERS; ++pn ) { - int iLow, iHigh; - pCourse->GetMeterRange(ci, iLow, iHigh); + Difficulty dc = pCourse->GetDifficulty( pci[pn] ); + if( dc == DIFFICULTY_INVALID ) + { + int iLow, iHigh; + pCourse->GetMeterRange(pci[pn], iLow, iHigh); - colorNotes = RageColor(1,1,1,1); - m_textDifficultyNumber.SetText( ssprintf(iLow==iHigh?"%d":"%d-%d", iLow, iHigh) ); - } - else - { - colorNotes = SONGMAN->GetDifficultyColor( dc ); - m_textDifficultyNumber.SetText( "?" ); + SetDifficulty( (PlayerNumber)pn, ssprintf(iLow==iHigh?"%d":"%d-%d", iLow, iHigh), RageColor(1,1,1,1) ); + } + else + SetDifficulty( (PlayerNumber)pn, "?", SONGMAN->GetDifficultyColor( dc ) ); } m_TextBanner.LoadFromString( "??????????", "??????????", "", "", "", "" ); @@ -87,8 +110,11 @@ void CourseEntryDisplay::LoadFromCourseInfo( int iNum, const Course *pCourse, co } else { - colorNotes = SONGMAN->GetDifficultyColor( ci.pNotes->GetDifficulty() ); - m_textDifficultyNumber.SetText( ssprintf("%d", ci.pNotes->GetMeter()) ); + for( int pn = 0; pn < NUM_PLAYERS; ++pn ) + { + RageColor colorNotes = SONGMAN->GetDifficultyColor( pci[pn].pNotes->GetDifficulty() ); + SetDifficulty( (PlayerNumber)pn, ssprintf("%d", pci[pn].pNotes->GetMeter()), colorNotes ); + } m_TextBanner.LoadFromSong( ci.pSong ); m_TextBanner.SetDiffuse( SONGMAN->GetSongColor( ci.pSong ) ); @@ -96,10 +122,5 @@ void CourseEntryDisplay::LoadFromCourseInfo( int iNum, const Course *pCourse, co m_textNumber.SetText( ssprintf("%d", iNum) ); - m_textFoot.SetText( "1" ); - m_textFoot.SetDiffuse( colorNotes ); - m_textModifiers.SetText( ci.Modifiers ); - - m_textDifficultyNumber.SetDiffuse( colorNotes ); } diff --git a/stepmania/src/CourseEntryDisplay.h b/stepmania/src/CourseEntryDisplay.h index 4d77c53a11..c97f3de568 100644 --- a/stepmania/src/CourseEntryDisplay.h +++ b/stepmania/src/CourseEntryDisplay.h @@ -28,14 +28,16 @@ class CourseEntryDisplay : public ActorFrame public: void Load(); - void LoadFromCourseInfo( int iNum, const Course *pCourse, const Course::Info &ci ); + void LoadFromCourseInfo( int iNum, const Course *pCourse, const Course::Info ci[NUM_PLAYERS] ); private: + void SetDifficulty( PlayerNumber pn, const CString &text, RageColor c ); + Sprite m_sprFrame; BitmapText m_textNumber; TextBanner m_TextBanner; - BitmapText m_textFoot; - BitmapText m_textDifficultyNumber; + BitmapText m_textFoot[NUM_PLAYERS]; + BitmapText m_textDifficultyNumber[NUM_PLAYERS]; BitmapText m_textModifiers; };