2003-04-02 04:41:49 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: GrooveGraph
|
|
|
|
|
|
|
|
|
|
Desc: See header.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "GrooveGraph.h"
|
|
|
|
|
#include "RageUtil.h"
|
|
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "RageBitmapTexture.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "ThemeManager.h"
|
2003-08-03 00:13:55 +00:00
|
|
|
#include "Steps.h"
|
2003-04-02 04:41:49 +00:00
|
|
|
#include "RageDisplay.h"
|
2003-04-03 21:29:14 +00:00
|
|
|
#include "song.h"
|
2003-04-02 04:41:49 +00:00
|
|
|
#include "GameState.h"
|
|
|
|
|
#include "StyleDef.h"
|
|
|
|
|
|
|
|
|
|
const float GRAPH_EDGE_WIDTH = 2;
|
|
|
|
|
|
2003-04-22 08:43:12 +00:00
|
|
|
#define EDGE_WIDTH THEME->GetMetricF("GrooveGraph","EdgeWidth")
|
|
|
|
|
#define DIFFICULTY_COLORS(dc) THEME->GetMetricC("GrooveGraph",Capitalize(DifficultyToString(dc))+"Color")
|
2004-02-10 09:42:01 +00:00
|
|
|
#define SHOW_CATEGORY(cat) THEME->GetMetricB("GrooveGraph","Show"+Capitalize(RadarCategoryToString(cat)))
|
|
|
|
|
#define CATEGORY_X(cat) THEME->GetMetricF("GrooveGraph",Capitalize(RadarCategoryToString(cat))+"X")
|
2003-04-23 05:54:56 +00:00
|
|
|
#define MOUNTAINS_BASE_Y THEME->GetMetricF("GrooveGraph","MountainsBaseY")
|
2003-04-22 08:43:12 +00:00
|
|
|
CachedThemeMetricF MOUNTAIN_WIDTH ("GrooveGraph","MountainWidth");
|
|
|
|
|
CachedThemeMetricF MOUNTAIN_HEIGHT ("GrooveGraph","MountainHeight");
|
|
|
|
|
|
|
|
|
|
RageColor g_DifficultyColorsCache[NUM_DIFFICULTIES];
|
2003-11-27 05:17:19 +00:00
|
|
|
static const int NUM_SHOWN_RADAR_CATEGORIES = 5;
|
2003-04-22 08:43:12 +00:00
|
|
|
|
2003-04-02 04:41:49 +00:00
|
|
|
GrooveGraph::GrooveGraph()
|
|
|
|
|
{
|
2003-04-22 08:43:12 +00:00
|
|
|
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 );
|
|
|
|
|
|
2003-11-27 05:17:19 +00:00
|
|
|
for( int c=0; c<NUM_SHOWN_RADAR_CATEGORIES; c++ )
|
2003-04-02 04:41:49 +00:00
|
|
|
{
|
2003-04-22 08:43:12 +00:00
|
|
|
if( !SHOW_CATEGORY((RadarCategory)c) )
|
|
|
|
|
continue;
|
2003-04-02 04:41:49 +00:00
|
|
|
|
2003-04-23 05:54:56 +00:00
|
|
|
m_Mountains[c].SetXY( CATEGORY_X((RadarCategory)c), MOUNTAINS_BASE_Y );
|
2003-04-02 04:41:49 +00:00
|
|
|
this->AddChild( &m_Mountains[c] );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GrooveGraph::SetFromSong( Song* pSong )
|
|
|
|
|
{
|
2004-03-12 05:24:32 +00:00
|
|
|
RadarValues rvs[NUM_DIFFICULTIES];
|
2003-04-22 08:43:12 +00:00
|
|
|
|
|
|
|
|
if( pSong )
|
2003-04-02 04:41:49 +00:00
|
|
|
{
|
2003-04-22 08:43:12 +00:00
|
|
|
for( int i=0; i<NUM_DIFFICULTIES; i++ )
|
|
|
|
|
{
|
2004-05-24 03:41:39 +00:00
|
|
|
Steps* pSteps = pSong->GetStepsByDifficulty( GAMESTATE->GetCurrentStyleDef()->m_StepsType, (Difficulty)i );
|
|
|
|
|
if( pSteps )
|
|
|
|
|
rvs[i] = pSteps->GetRadarValues();
|
2003-04-22 08:43:12 +00:00
|
|
|
}
|
2003-04-02 04:41:49 +00:00
|
|
|
}
|
|
|
|
|
|
2003-11-27 05:17:19 +00:00
|
|
|
for( int j=0; j<NUM_SHOWN_RADAR_CATEGORIES; j++ )
|
2003-04-02 04:41:49 +00:00
|
|
|
{
|
2004-03-12 05:24:32 +00:00
|
|
|
float fValues[NUM_DIFFICULTIES];
|
|
|
|
|
FOREACH_Difficulty( dc )
|
|
|
|
|
{
|
|
|
|
|
fValues[dc] = rvs[j][dc];
|
|
|
|
|
}
|
|
|
|
|
m_Mountains[j].SetValues( fValues );
|
2003-04-02 04:41:49 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GrooveGraph::TweenOnScreen()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GrooveGraph::TweenOffScreen()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GrooveGraph::Mountain::Mountain()
|
|
|
|
|
{
|
2003-04-22 08:43:12 +00:00
|
|
|
m_fPercentTowardNew = 0;
|
2003-04-02 04:41:49 +00:00
|
|
|
|
|
|
|
|
for( int i=0; i<NUM_DIFFICULTIES; i++ )
|
|
|
|
|
{
|
|
|
|
|
m_fValuesNew[i] = 0;
|
|
|
|
|
m_fValuesOld[i] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GrooveGraph::Mountain::SetValues( float fNewValues[NUM_DIFFICULTIES] )
|
|
|
|
|
{
|
2003-04-22 08:43:12 +00:00
|
|
|
m_fPercentTowardNew = 0;
|
2003-04-02 04:41:49 +00:00
|
|
|
|
2003-04-22 08:43:12 +00:00
|
|
|
for( int i=0; i<NUM_DIFFICULTIES; i++ )
|
|
|
|
|
{
|
|
|
|
|
m_fValuesOld[i] = m_fValuesNew[i];
|
|
|
|
|
m_fValuesNew[i] = fNewValues[i];
|
|
|
|
|
}
|
2003-04-02 04:41:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GrooveGraph::Mountain::Update( float fDeltaTime )
|
|
|
|
|
{
|
2003-04-22 08:43:12 +00:00
|
|
|
Actor::Update( fDeltaTime );
|
2003-04-02 04:41:49 +00:00
|
|
|
|
2003-04-22 08:43:12 +00:00
|
|
|
m_fPercentTowardNew += 4.0f*fDeltaTime;
|
|
|
|
|
CLAMP( m_fPercentTowardNew, 0, 1 );
|
2003-04-02 04:41:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GrooveGraph::Mountain::DrawPrimitives()
|
|
|
|
|
{
|
2004-02-04 09:55:18 +00:00
|
|
|
DISPLAY->ClearAllTextures();
|
2003-04-02 04:41:49 +00:00
|
|
|
DISPLAY->SetTextureModeModulate();
|
2003-07-07 01:29:18 +00:00
|
|
|
RageSpriteVertex v[4];
|
2003-04-02 04:41:49 +00:00
|
|
|
|
|
|
|
|
for( int i=NUM_DIFFICULTIES-1; i>=0; i-- )
|
|
|
|
|
{
|
2003-04-22 08:43:12 +00:00
|
|
|
float fValue = SCALE(m_fPercentTowardNew, 0.f, 1.f, m_fValuesOld[i], m_fValuesNew[i] );
|
|
|
|
|
float fHeight = MOUNTAIN_HEIGHT*fValue;
|
2003-05-22 05:28:37 +00:00
|
|
|
v[0].p = v[3].p = RageVector3( -MOUNTAIN_WIDTH/2, 0, 0 );
|
2003-04-23 05:54:56 +00:00
|
|
|
v[1].p = RageVector3( MOUNTAIN_WIDTH/2, 0, 0 );
|
|
|
|
|
v[2].p = RageVector3( 0, -fHeight, 0 );
|
2003-05-22 05:28:37 +00:00
|
|
|
v[0].c = v[1].c = v[2].c = v[3].c = g_DifficultyColorsCache[i];
|
2003-04-22 08:43:12 +00:00
|
|
|
DISPLAY->DrawFan( v, 3 );
|
2003-04-02 04:41:49 +00:00
|
|
|
}
|
|
|
|
|
|
2003-05-22 05:28:37 +00:00
|
|
|
// TODO: Add this back in
|
2003-06-29 01:06:08 +00:00
|
|
|
// This shouldn't be needed anymore. -glenn
|
2003-05-22 05:28:37 +00:00
|
|
|
// switch( PREFSMAN->m_iPolygonRadar )
|
|
|
|
|
// {
|
|
|
|
|
// case 0: DISPLAY->DrawLoop_LinesAndPoints( v, 3, 2 ); break;
|
|
|
|
|
// case 1: DISPLAY->DrawLoop_Polys( v, 3, 2 ); break;
|
|
|
|
|
// default:
|
|
|
|
|
// case -1:
|
|
|
|
|
DISPLAY->DrawLineStrip( v, 4, 2 );
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
2003-04-02 04:41:49 +00:00
|
|
|
}
|
|
|
|
|
|