working on GrooveGraph
This commit is contained in:
@@ -13,6 +13,18 @@
|
|||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
|
|
||||||
|
CString CategoryToString( RadarCategory cat )
|
||||||
|
{
|
||||||
|
switch( cat )
|
||||||
|
{
|
||||||
|
case RADAR_STREAM: return "stream";
|
||||||
|
case RADAR_VOLTAGE: return "voltage";
|
||||||
|
case RADAR_AIR: return "air";
|
||||||
|
case RADAR_FREEZE: return "freeze";
|
||||||
|
case RADAR_CHAOS: return "chaos";
|
||||||
|
default: ASSERT(0); return ""; // invalid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CString DifficultyToString( Difficulty dc )
|
CString DifficultyToString( Difficulty dc )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ enum RadarCategory // starting from 12-o'clock rotating clockwise
|
|||||||
NUM_RADAR_CATEGORIES // leave this at the end
|
NUM_RADAR_CATEGORIES // leave this at the end
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CString CategoryToString( RadarCategory cat );
|
||||||
|
|
||||||
enum Difficulty
|
enum Difficulty
|
||||||
{
|
{
|
||||||
DIFFICULTY_BEGINNER, // corresponds to DDREX Beginner
|
DIFFICULTY_BEGINNER, // corresponds to DDREX Beginner
|
||||||
@@ -56,7 +58,6 @@ enum Difficulty
|
|||||||
};
|
};
|
||||||
|
|
||||||
CString DifficultyToString( Difficulty dc );
|
CString DifficultyToString( Difficulty dc );
|
||||||
|
|
||||||
Difficulty StringToDifficulty( CString sDC );
|
Difficulty StringToDifficulty( CString sDC );
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,27 +26,43 @@
|
|||||||
|
|
||||||
const float GRAPH_EDGE_WIDTH = 2;
|
const float GRAPH_EDGE_WIDTH = 2;
|
||||||
|
|
||||||
|
#define EDGE_WIDTH THEME->GetMetricF("GrooveGraph","EdgeWidth")
|
||||||
|
#define DIFFICULTY_COLORS(dc) THEME->GetMetricC("GrooveGraph",Capitalize(DifficultyToString(dc))+"Color")
|
||||||
|
#define SHOW_CATEGORY(cat) THEME->GetMetricB("GrooveGraph","Show"+Capitalize(CategoryToString(cat)))
|
||||||
|
#define CATEGORY_X(cat) THEME->GetMetricF("GrooveGraph",Capitalize(CategoryToString(cat))+"X")
|
||||||
|
#define MOUNTAINS_Y THEME->GetMetricF("GrooveGraph","MountainsY")
|
||||||
|
CachedThemeMetricF MOUNTAIN_WIDTH ("GrooveGraph","MountainWidth");
|
||||||
|
CachedThemeMetricF MOUNTAIN_HEIGHT ("GrooveGraph","MountainHeight");
|
||||||
|
|
||||||
|
RageColor g_DifficultyColorsCache[NUM_DIFFICULTIES];
|
||||||
|
|
||||||
GrooveGraph::GrooveGraph()
|
GrooveGraph::GrooveGraph()
|
||||||
{
|
{
|
||||||
|
for( int i=0; i<NUM_DIFFICULTIES; i++ )
|
||||||
|
g_DifficultyColorsCache[i] = DIFFICULTY_COLORS((Difficulty)i);
|
||||||
|
MOUNTAIN_WIDTH.Refresh();
|
||||||
|
MOUNTAIN_HEIGHT.Refresh();
|
||||||
|
|
||||||
|
m_sprBase.Load( THEME->GetPathToG("GrooveGraph base") );
|
||||||
|
this->AddChild( &m_sprBase );
|
||||||
|
|
||||||
for( int c=0; c<NUM_RADAR_CATEGORIES; c++ )
|
for( int c=0; c<NUM_RADAR_CATEGORIES; c++ )
|
||||||
{
|
{
|
||||||
float fTotalWidth = 60 * NUM_RADAR_CATEGORIES;
|
if( !SHOW_CATEGORY((RadarCategory)c) )
|
||||||
float fX = SCALE(c,0,NUM_RADAR_CATEGORIES-1, -fTotalWidth, +fTotalWidth );
|
continue;
|
||||||
|
|
||||||
m_Mountains[c].SetXY( fX, -20 );
|
m_Mountains[c].SetXY( CATEGORY_X((RadarCategory)c), MOUNTAINS_Y );
|
||||||
this->AddChild( &m_Mountains[c] );
|
this->AddChild( &m_Mountains[c] );
|
||||||
|
|
||||||
m_sprLabels[c].Load( THEME->GetPathToG("GrooveGraph labels 1x5") );
|
|
||||||
m_sprLabels[c].StopAnimating();
|
|
||||||
m_sprLabels[c].SetState( c );
|
|
||||||
m_sprLabels[c].SetXY( fX, +10 );
|
|
||||||
this->AddChild( &m_sprLabels[c] );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrooveGraph::SetFromSong( Song* pSong )
|
void GrooveGraph::SetFromSong( Song* pSong )
|
||||||
{
|
{
|
||||||
float fValues[NUM_RADAR_CATEGORIES][NUM_DIFFICULTIES];
|
float fValues[NUM_RADAR_CATEGORIES][NUM_DIFFICULTIES];
|
||||||
|
ZERO( fValues );
|
||||||
|
|
||||||
|
if( pSong )
|
||||||
|
{
|
||||||
for( int i=0; i<NUM_DIFFICULTIES; i++ )
|
for( int i=0; i<NUM_DIFFICULTIES; i++ )
|
||||||
{
|
{
|
||||||
Notes* pNotes = pSong->GetNotes( GAMESTATE->GetCurrentStyleDef()->m_NotesType, (Difficulty)i );
|
Notes* pNotes = pSong->GetNotes( GAMESTATE->GetCurrentStyleDef()->m_NotesType, (Difficulty)i );
|
||||||
@@ -54,6 +70,7 @@ void GrooveGraph::SetFromSong( Song* pSong )
|
|||||||
for( int j=0; j<NUM_RADAR_CATEGORIES; j++ )
|
for( int j=0; j<NUM_RADAR_CATEGORIES; j++ )
|
||||||
fValues[j][i] = fRadarValues ? fRadarValues[j] : 0;
|
fValues[j][i] = fRadarValues ? fRadarValues[j] : 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for( int j=0; j<NUM_RADAR_CATEGORIES; j++ )
|
for( int j=0; j<NUM_RADAR_CATEGORIES; j++ )
|
||||||
{
|
{
|
||||||
@@ -71,7 +88,7 @@ void GrooveGraph::TweenOffScreen()
|
|||||||
|
|
||||||
GrooveGraph::Mountain::Mountain()
|
GrooveGraph::Mountain::Mountain()
|
||||||
{
|
{
|
||||||
m_PercentTowardNew = 0;
|
m_fPercentTowardNew = 0;
|
||||||
|
|
||||||
for( int i=0; i<NUM_DIFFICULTIES; i++ )
|
for( int i=0; i<NUM_DIFFICULTIES; i++ )
|
||||||
{
|
{
|
||||||
@@ -82,46 +99,39 @@ GrooveGraph::Mountain::Mountain()
|
|||||||
|
|
||||||
void GrooveGraph::Mountain::SetValues( float fNewValues[NUM_DIFFICULTIES] )
|
void GrooveGraph::Mountain::SetValues( float fNewValues[NUM_DIFFICULTIES] )
|
||||||
{
|
{
|
||||||
m_PercentTowardNew = 0;
|
m_fPercentTowardNew = 0;
|
||||||
|
|
||||||
memcpy( m_fValuesOld, m_fValuesNew, sizeof(m_fValuesNew) );
|
for( int i=0; i<NUM_DIFFICULTIES; i++ )
|
||||||
memcpy( m_fValuesNew, fNewValues, sizeof(fNewValues) );
|
{
|
||||||
|
m_fValuesOld[i] = m_fValuesNew[i];
|
||||||
|
m_fValuesNew[i] = fNewValues[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrooveGraph::Mountain::Update( float fDeltaTime )
|
void GrooveGraph::Mountain::Update( float fDeltaTime )
|
||||||
{
|
{
|
||||||
ActorFrame::Update( fDeltaTime );
|
Actor::Update( fDeltaTime );
|
||||||
|
|
||||||
m_PercentTowardNew = min( m_PercentTowardNew+4.0f*fDeltaTime, 1 );
|
m_fPercentTowardNew += 4.0f*fDeltaTime;
|
||||||
|
CLAMP( m_fPercentTowardNew, 0, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
const RageColor g_DifficultyColors[NUM_DIFFICULTIES] =
|
|
||||||
{
|
|
||||||
RageColor(0.5f,0.5f,1,1), // light blue
|
|
||||||
RageColor(1,1,0,1), // yellow
|
|
||||||
RageColor(1,0,0,1), // red
|
|
||||||
RageColor(0,1,0,1), // green
|
|
||||||
RageColor(0,0,1,1), // blue
|
|
||||||
};
|
|
||||||
|
|
||||||
void GrooveGraph::Mountain::DrawPrimitives()
|
void GrooveGraph::Mountain::DrawPrimitives()
|
||||||
{
|
{
|
||||||
ActorFrame::DrawPrimitives();
|
|
||||||
|
|
||||||
DISPLAY->SetTexture( NULL );
|
DISPLAY->SetTexture( NULL );
|
||||||
DISPLAY->SetTextureModeModulate();
|
DISPLAY->SetTextureModeModulate();
|
||||||
RageVertex v[3];
|
RageVertex v[3];
|
||||||
|
|
||||||
for( int i=NUM_DIFFICULTIES-1; i>=0; i-- )
|
for( int i=NUM_DIFFICULTIES-1; i>=0; i-- )
|
||||||
{
|
{
|
||||||
float fValue = m_fValuesOld[i] + (m_fValuesNew[i]-m_fValuesOld[i]) * m_PercentTowardNew;
|
float fValue = SCALE(m_fPercentTowardNew, 0.f, 1.f, m_fValuesOld[i], m_fValuesNew[i] );
|
||||||
v[0].p = RageVector3( -30, -30, 0 );
|
float fHeight = MOUNTAIN_HEIGHT*fValue;
|
||||||
v[1].p = RageVector3( 30, -30, 0 );
|
v[0].p = RageVector3( -MOUNTAIN_WIDTH/2, MOUNTAIN_HEIGHT/2, 0 );
|
||||||
v[2].p = RageVector3( 0, -30+60*fValue, 0 );
|
v[1].p = RageVector3( MOUNTAIN_WIDTH/2, MOUNTAIN_HEIGHT/2, 0 );
|
||||||
v[0].c = v[1].c = v[2].c = g_DifficultyColors[i];
|
v[2].p = RageVector3( 0, (MOUNTAIN_HEIGHT/2)-fHeight, 0 );
|
||||||
}
|
v[0].c = v[1].c = v[2].c = g_DifficultyColorsCache[i];
|
||||||
|
|
||||||
DISPLAY->DrawFan( v, 3 );
|
DISPLAY->DrawFan( v, 3 );
|
||||||
|
}
|
||||||
|
|
||||||
switch( PREFSMAN->m_iPolygonRadar )
|
switch( PREFSMAN->m_iPolygonRadar )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
class Mountain : public ActorFrame
|
class Mountain : public Actor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Mountain();
|
Mountain();
|
||||||
@@ -39,13 +39,13 @@ protected:
|
|||||||
|
|
||||||
void SetValues( float fNewValues[] );
|
void SetValues( float fNewValues[] );
|
||||||
|
|
||||||
float m_PercentTowardNew;
|
float m_fPercentTowardNew;
|
||||||
float m_fValuesNew[NUM_DIFFICULTIES];
|
float m_fValuesNew[NUM_DIFFICULTIES];
|
||||||
float m_fValuesOld[NUM_DIFFICULTIES];
|
float m_fValuesOld[NUM_DIFFICULTIES];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Sprite m_sprBase;
|
||||||
Mountain m_Mountains[NUM_RADAR_CATEGORIES];
|
Mountain m_Mountains[NUM_RADAR_CATEGORIES];
|
||||||
Sprite m_sprLabels[NUM_RADAR_CATEGORIES];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ const int NUM_SCORE_DIGITS = 9;
|
|||||||
#define BANNER_HEIGHT THEME->GetMetricF("ScreenSelectMusic","BannerHeight")
|
#define BANNER_HEIGHT THEME->GetMetricF("ScreenSelectMusic","BannerHeight")
|
||||||
#define SONG_OPTIONS_EXTRA_COMMAND THEME->GetMetric ("ScreenSelectMusic","SongOptionsExtraCommand")
|
#define SONG_OPTIONS_EXTRA_COMMAND THEME->GetMetric ("ScreenSelectMusic","SongOptionsExtraCommand")
|
||||||
#define SAMPLE_MUSIC_DELAY THEME->GetMetricF("ScreenSelectMusic","SampleMusicDelay")
|
#define SAMPLE_MUSIC_DELAY THEME->GetMetricF("ScreenSelectMusic","SampleMusicDelay")
|
||||||
|
#define SHOW_RADAR THEME->GetMetricB("ScreenSelectMusic","ShowRadar")
|
||||||
|
#define SHOW_GRAPH THEME->GetMetricB("ScreenSelectMusic","ShowGraph")
|
||||||
|
|
||||||
|
|
||||||
static const ScreenMessage SM_AllowOptionsMenuRepeat = ScreenMessage(SM_User+1);
|
static const ScreenMessage SM_AllowOptionsMenuRepeat = ScreenMessage(SM_User+1);
|
||||||
@@ -84,8 +86,13 @@ ScreenSelectMusic::ScreenSelectMusic() : Screen("ScreenSelectMusic")
|
|||||||
this->AddChild( &m_sprCDTitle );
|
this->AddChild( &m_sprCDTitle );
|
||||||
|
|
||||||
m_GrooveRadar.SetName( "Radar" );
|
m_GrooveRadar.SetName( "Radar" );
|
||||||
|
if( SHOW_RADAR )
|
||||||
this->AddChild( &m_GrooveRadar );
|
this->AddChild( &m_GrooveRadar );
|
||||||
|
|
||||||
|
m_GrooveGraph.SetName( "Graph" );
|
||||||
|
if( SHOW_GRAPH )
|
||||||
|
this->AddChild( &m_GrooveGraph );
|
||||||
|
|
||||||
m_textSongOptions.SetName( "SongOptions" );
|
m_textSongOptions.SetName( "SongOptions" );
|
||||||
m_textSongOptions.LoadFromFont( THEME->GetPathToF("Common normal") );
|
m_textSongOptions.LoadFromFont( THEME->GetPathToF("Common normal") );
|
||||||
this->AddChild( &m_textSongOptions );
|
this->AddChild( &m_textSongOptions );
|
||||||
@@ -197,6 +204,8 @@ void ScreenSelectMusic::TweenOnScreen()
|
|||||||
SET_XY_AND_ON_COMMAND( m_sprCDTitle );
|
SET_XY_AND_ON_COMMAND( m_sprCDTitle );
|
||||||
m_GrooveRadar.TweenOnScreen();
|
m_GrooveRadar.TweenOnScreen();
|
||||||
SET_XY_AND_ON_COMMAND( m_GrooveRadar );
|
SET_XY_AND_ON_COMMAND( m_GrooveRadar );
|
||||||
|
m_GrooveGraph.TweenOnScreen();
|
||||||
|
SET_XY_AND_ON_COMMAND( m_GrooveGraph );
|
||||||
SET_XY_AND_ON_COMMAND( m_textSongOptions );
|
SET_XY_AND_ON_COMMAND( m_textSongOptions );
|
||||||
SET_XY_AND_ON_COMMAND( m_MusicSortDisplay );
|
SET_XY_AND_ON_COMMAND( m_MusicSortDisplay );
|
||||||
m_MusicWheel.TweenOnScreen();
|
m_MusicWheel.TweenOnScreen();
|
||||||
@@ -230,6 +239,8 @@ void ScreenSelectMusic::TweenOffScreen()
|
|||||||
OFF_COMMAND( m_sprCDTitle );
|
OFF_COMMAND( m_sprCDTitle );
|
||||||
m_GrooveRadar.TweenOffScreen();
|
m_GrooveRadar.TweenOffScreen();
|
||||||
OFF_COMMAND( m_GrooveRadar );
|
OFF_COMMAND( m_GrooveRadar );
|
||||||
|
m_GrooveGraph.TweenOffScreen();
|
||||||
|
OFF_COMMAND( m_GrooveGraph );
|
||||||
OFF_COMMAND( m_textSongOptions );
|
OFF_COMMAND( m_textSongOptions );
|
||||||
OFF_COMMAND( m_MusicSortDisplay );
|
OFF_COMMAND( m_MusicSortDisplay );
|
||||||
m_MusicWheel.TweenOffScreen();
|
m_MusicWheel.TweenOffScreen();
|
||||||
@@ -724,6 +735,8 @@ void ScreenSelectMusic::AfterMusicChange()
|
|||||||
|
|
||||||
m_sprStage.Load( THEME->GetPathToG("ScreenSelectMusic stage "+GAMESTATE->GetStageText()) );
|
m_sprStage.Load( THEME->GetPathToG("ScreenSelectMusic stage "+GAMESTATE->GetStageText()) );
|
||||||
|
|
||||||
|
m_GrooveGraph.SetFromSong( pSong );
|
||||||
|
|
||||||
int pn;
|
int pn;
|
||||||
for( pn = 0; pn < NUM_PLAYERS; ++pn)
|
for( pn = 0; pn < NUM_PLAYERS; ++pn)
|
||||||
m_arrayNotes[pn].clear();
|
m_arrayNotes[pn].clear();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "BPMDisplay.h"
|
#include "BPMDisplay.h"
|
||||||
#include "MenuElements.h"
|
#include "MenuElements.h"
|
||||||
#include "GrooveRadar.h"
|
#include "GrooveRadar.h"
|
||||||
|
#include "GrooveGraph.h"
|
||||||
#include "DifficultyIcon.h"
|
#include "DifficultyIcon.h"
|
||||||
#include "DifficultyMeter.h"
|
#include "DifficultyMeter.h"
|
||||||
#include "OptionIconRow.h"
|
#include "OptionIconRow.h"
|
||||||
@@ -68,6 +69,7 @@ protected:
|
|||||||
DifficultyIcon m_DifficultyIcon[NUM_PLAYERS];
|
DifficultyIcon m_DifficultyIcon[NUM_PLAYERS];
|
||||||
Sprite m_AutoGenIcon[NUM_PLAYERS];
|
Sprite m_AutoGenIcon[NUM_PLAYERS];
|
||||||
GrooveRadar m_GrooveRadar;
|
GrooveRadar m_GrooveRadar;
|
||||||
|
GrooveGraph m_GrooveGraph;
|
||||||
BitmapText m_textSongOptions;
|
BitmapText m_textSongOptions;
|
||||||
OptionIconRow m_OptionIconRow[NUM_PLAYERS];
|
OptionIconRow m_OptionIconRow[NUM_PLAYERS];
|
||||||
Sprite m_sprMeterFrame[NUM_PLAYERS];
|
Sprite m_sprMeterFrame[NUM_PLAYERS];
|
||||||
|
|||||||
Reference in New Issue
Block a user