allow showing separate difficulties for each player
This commit is contained in:
@@ -57,16 +57,17 @@ void CourseContentsList::SetFromCourse( const Course* pCourse )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<Course::Info> 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;
|
m_iNumContents = 0;
|
||||||
|
for( int i=0; i<min((int)ci[0].size(), MAX_TOTAL_CONTENTS); i++ )
|
||||||
vector<Course::Info> ci;
|
|
||||||
pCourse->GetCourseInfo( GAMESTATE->GetCurrentStyleDef()->m_StepsType, ci, GAMESTATE->m_CourseDifficulty[GAMESTATE->m_MasterPlayerNumber] );
|
|
||||||
|
|
||||||
for( int i=0; i<min((int)ci.size(), MAX_TOTAL_CONTENTS); i++ )
|
|
||||||
{
|
{
|
||||||
CourseEntryDisplay& display = m_CourseContentDisplays[m_iNumContents];
|
CourseEntryDisplay& display = m_CourseContentDisplays[m_iNumContents];
|
||||||
|
|
||||||
display.LoadFromCourseInfo( m_iNumContents+1, pCourse, ci[i] );
|
const Course::Info pci[NUM_PLAYERS] = { ci[0][i], ci[1][i] };
|
||||||
|
display.LoadFromCourseInfo( m_iNumContents+1, pCourse, pci );
|
||||||
|
|
||||||
m_iNumContents++;
|
m_iNumContents++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,13 +18,14 @@
|
|||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "Course.h"
|
#include "Course.h"
|
||||||
#include "SongManager.h"
|
#include "SongManager.h"
|
||||||
#include <math.h>
|
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "Steps.h"
|
#include "Steps.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "StyleDef.h"
|
#include "StyleDef.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#define SEPARATE_COURSE_METERS THEME->GetMetricB(m_sName,"SeparateCouresMeters")
|
||||||
|
|
||||||
void CourseEntryDisplay::Load()
|
void CourseEntryDisplay::Load()
|
||||||
{
|
{
|
||||||
@@ -45,15 +46,24 @@ void CourseEntryDisplay::Load()
|
|||||||
SET_XY_AND_ON_COMMAND( &m_TextBanner );
|
SET_XY_AND_ON_COMMAND( &m_TextBanner );
|
||||||
this->AddChild( &m_TextBanner );
|
this->AddChild( &m_TextBanner );
|
||||||
|
|
||||||
m_textFoot.SetName( "Foot" );
|
for( int pn = 0; pn < NUM_PLAYERS; ++pn )
|
||||||
m_textFoot.LoadFromTextureAndChars( THEME->GetPathToG("CourseEntryDisplay difficulty 2x1"),"10" );
|
{
|
||||||
SET_XY_AND_ON_COMMAND( &m_textFoot );
|
if( !GAMESTATE->IsHumanPlayer((PlayerNumber)pn) )
|
||||||
this->AddChild( &m_textFoot );
|
continue; // skip
|
||||||
|
|
||||||
m_textDifficultyNumber.SetName( "Difficulty" );
|
if( !SEPARATE_COURSE_METERS && pn != GAMESTATE->m_MasterPlayerNumber )
|
||||||
m_textDifficultyNumber.LoadFromFont( THEME->GetPathToF("Common normal") );
|
continue; // skip
|
||||||
SET_XY_AND_ON_COMMAND( &m_textDifficultyNumber );
|
|
||||||
this->AddChild( &m_textDifficultyNumber );
|
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.SetName( "Modifiers" );
|
||||||
m_textModifiers.LoadFromFont( THEME->GetPathToF("Common normal") );
|
m_textModifiers.LoadFromFont( THEME->GetPathToF("Common normal") );
|
||||||
@@ -61,25 +71,38 @@ void CourseEntryDisplay::Load()
|
|||||||
this->AddChild( &m_textModifiers );
|
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 )
|
if( ci.Mystery )
|
||||||
{
|
{
|
||||||
Difficulty dc = pCourse->GetDifficulty( ci );
|
for( int pn = 0; pn < NUM_PLAYERS; ++pn )
|
||||||
|
{
|
||||||
|
Difficulty dc = pCourse->GetDifficulty( pci[pn] );
|
||||||
if( dc == DIFFICULTY_INVALID )
|
if( dc == DIFFICULTY_INVALID )
|
||||||
{
|
{
|
||||||
int iLow, iHigh;
|
int iLow, iHigh;
|
||||||
pCourse->GetMeterRange(ci, iLow, iHigh);
|
pCourse->GetMeterRange(pci[pn], iLow, iHigh);
|
||||||
|
|
||||||
colorNotes = RageColor(1,1,1,1);
|
SetDifficulty( (PlayerNumber)pn, ssprintf(iLow==iHigh?"%d":"%d-%d", iLow, iHigh), RageColor(1,1,1,1) );
|
||||||
m_textDifficultyNumber.SetText( ssprintf(iLow==iHigh?"%d":"%d-%d", iLow, iHigh) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
SetDifficulty( (PlayerNumber)pn, "?", SONGMAN->GetDifficultyColor( dc ) );
|
||||||
colorNotes = SONGMAN->GetDifficultyColor( dc );
|
|
||||||
m_textDifficultyNumber.SetText( "?" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_TextBanner.LoadFromString( "??????????", "??????????", "", "", "", "" );
|
m_TextBanner.LoadFromString( "??????????", "??????????", "", "", "", "" );
|
||||||
@@ -87,8 +110,11 @@ void CourseEntryDisplay::LoadFromCourseInfo( int iNum, const Course *pCourse, co
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
colorNotes = SONGMAN->GetDifficultyColor( ci.pNotes->GetDifficulty() );
|
for( int pn = 0; pn < NUM_PLAYERS; ++pn )
|
||||||
m_textDifficultyNumber.SetText( ssprintf("%d", ci.pNotes->GetMeter()) );
|
{
|
||||||
|
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.LoadFromSong( ci.pSong );
|
||||||
m_TextBanner.SetDiffuse( SONGMAN->GetSongColor( 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_textNumber.SetText( ssprintf("%d", iNum) );
|
||||||
|
|
||||||
m_textFoot.SetText( "1" );
|
|
||||||
m_textFoot.SetDiffuse( colorNotes );
|
|
||||||
|
|
||||||
m_textModifiers.SetText( ci.Modifiers );
|
m_textModifiers.SetText( ci.Modifiers );
|
||||||
|
|
||||||
m_textDifficultyNumber.SetDiffuse( colorNotes );
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,14 +28,16 @@ class CourseEntryDisplay : public ActorFrame
|
|||||||
public:
|
public:
|
||||||
void Load();
|
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:
|
private:
|
||||||
|
void SetDifficulty( PlayerNumber pn, const CString &text, RageColor c );
|
||||||
|
|
||||||
Sprite m_sprFrame;
|
Sprite m_sprFrame;
|
||||||
BitmapText m_textNumber;
|
BitmapText m_textNumber;
|
||||||
TextBanner m_TextBanner;
|
TextBanner m_TextBanner;
|
||||||
BitmapText m_textFoot;
|
BitmapText m_textFoot[NUM_PLAYERS];
|
||||||
BitmapText m_textDifficultyNumber;
|
BitmapText m_textDifficultyNumber[NUM_PLAYERS];
|
||||||
BitmapText m_textModifiers;
|
BitmapText m_textModifiers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user