From 6723b6fdb1e833e61b9d0d7215174eb0d0cb34e9 Mon Sep 17 00:00:00 2001 From: Andrew Livy Date: Sat, 25 Jan 2003 23:48:33 +0000 Subject: [PATCH] Ez2/Pump/Para Song Select Screen now supports the 'stars' and/or 'blob' difficulty ratings as seen in para/ez2. --- stepmania/Themes/default/metrics.ini | 7 +- stepmania/src/DifficultyRating.cpp | 120 +++++++++++++++++++++++++ stepmania/src/DifficultyRating.h | 34 +++++++ stepmania/src/RageDisplay.cpp | 2 +- stepmania/src/ScreenEz2SelectMusic.cpp | 18 +++- stepmania/src/ScreenEz2SelectMusic.h | 5 +- stepmania/src/StepMania.dsp | 16 +++- 7 files changed, 191 insertions(+), 11 deletions(-) create mode 100644 stepmania/src/DifficultyRating.cpp create mode 100644 stepmania/src/DifficultyRating.h diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index b26c57dcb8..0aa3b38251 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -1,4 +1,4 @@ -// Possible NextScreen Codes: +// Possible NextScreen Codes: // - ScreenCaution // - ScreenEz2SelectPlayer // - ScreenSelectMode @@ -254,6 +254,10 @@ ShuffleIconP1X=40 ShuffleIconP2X=600 ShuffleIconP1Y=320 ShuffleIconP2Y=320 +DifficultyRatingX=999 +DifficultyRatingY=999 +DifficultyRatingOrientation=0 +DifficultyRatingSpacing=40.0 PreviewMusicMode=0 // 0 = play music as you select, 1 = no music plays, select once and preview music plays, select again for confirm, 2 = no music plays at all. [ScreenSelectCourse] @@ -714,6 +718,7 @@ MenuButtons=The default setting allows the dance pad's panels to navigate::the m AutoPlay=This option is useful for those who would like to play::without using a pad. However, you will not be able to set::high scores or earn extra stages while this options is ON. BackDelayed=Turning this option ON will require that you hold the Back button::for 0.5 seconds before it will regiser. This is useful if you find::yourself accidentally pressing the Back button on your controller. OptionsNavigation=When using &oq;SM style&cq;, the Start button will take::you to the next screen and Up/Down will switch option lines.::When using &oq;Arcade style&cq;, the Start button will move the cursor::to the next line and Up/Down will be ignored. +WheelSpeed=Adjusts the speed of the DDR style musicwheel. [ScreenMachineOptions] MenuTimer=Turn this &oq;OFF&cq; to disable the time limit in menus. diff --git a/stepmania/src/DifficultyRating.cpp b/stepmania/src/DifficultyRating.cpp new file mode 100644 index 0000000000..d7680a881b --- /dev/null +++ b/stepmania/src/DifficultyRating.cpp @@ -0,0 +1,120 @@ +#include "stdafx.h" +#include "DifficultyRating.h" +#include "ThemeManager.h" +#include "RageUtil.h" + +/**************************** +DifficultyRating +Desc: see header +Copyright: Andrew Livy +*****************************/ + +const int ORIENTATION_LEFT = 0; +const int ORIENTATION_CENTER = 1; + +#define ELEMSPACING THEME->GetMetricF("ScreenEz2SelectMusic","DifficultyRatingSpacing") + +DifficultyRating::DifficultyRating() +{ + iMaxElements=10; + for(int i=0; iLoad( THEME->GetPathTo("Graphics","Select Music DifficultyRatingIcon") ); + m_apSprites.push_back( pNewSprite ); + m_apSprites[i]->SetDiffuse( RageColor(1,1,1,0) ); + } +} + +DifficultyRating::~DifficultyRating() +{ + +} + +void DifficultyRating::DrawPrimitives() +{ + for(int i=0; iDraw(); + } +} + +void DifficultyRating::SetDifficulty(int Difficulty) +{ + iCurrentDifficulty = Difficulty; + for(int i=0; iSetDiffuse( RageColor(1,1,1,1) ); + } + else + { + m_apSprites[i]->SetDiffuse( RageColor(1,1,1,0) ); + } + } + +} + +void DifficultyRating::SetOrientation(int Orientation) +{ + if(Orientation == ORIENTATION_LEFT) + { + for(int i=0; iSetX(0 + (ELEMSPACING * i) ); + } + } + else // central orientation + { + if(iCurrentDifficulty % 2 == 0) // even number? + { + //damn! in that case everything is to the side of the middle.... + int incrementor=1; // start on one... 0 is reserved for 'central' (read odd number) + int offset=0; + for(int i=0; iSetX((0 - 0.5f) + offset); + incrementor++; + } + else // - offset + { + m_apSprites[i]->SetX((0 + 0.5f) - offset); + offset += ELEMSPACING; // increase offset + incrementor=1; + } + } + } + else + { + int incrementor=0; + int offset=0; + for(int i=0; iSetX(0); // set to the middle. + offset=ELEMSPACING; + incrementor++; + } + //the rest go either side.... + else + { + if(incrementor == 1) // + offset + { + m_apSprites[i]->SetX(0+offset); + incrementor++; + } + else // - offset + { + m_apSprites[i]->SetX(0-offset); + offset += ELEMSPACING; // increase offset + incrementor=1; + } + } + } + } + } +} \ No newline at end of file diff --git a/stepmania/src/DifficultyRating.h b/stepmania/src/DifficultyRating.h new file mode 100644 index 0000000000..3ea915f4b5 --- /dev/null +++ b/stepmania/src/DifficultyRating.h @@ -0,0 +1,34 @@ +#ifndef DIFFICULTYRATING_H +#define DIFFICULTYRATING_H +/* +----------------------------------------------------------------------------- + Class: DifficultyRating + + Desc: Displays a whole bunch of graphics, either left aligned or center aligned. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Andrew Livy +----------------------------------------------------------------------------- +*/ + +#include "ActorFrame.h" +#include "Banner.h" +#include "Sprite.h" +#include "ThemeManager.h" + +class DifficultyRating : public ActorFrame +{ +public: + DifficultyRating(); + ~DifficultyRating(); + void SetDifficulty(int Difficulty); + void SetOrientation(int Orientation); + virtual void DrawPrimitives(); +private: + int iMaxElements; + int iOrientation; + int iCurrentDifficulty; + vector m_apSprites; // stores the list of elements (left to right) +}; + +#endif \ No newline at end of file diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index e9c5c8d9e5..e3ee74edce 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -502,7 +502,7 @@ void RageDisplay::DrawLoop_Polys( const RageVertex v[], int iNumVerts, float Lin /* Join the lines with circles so we get rounded corners. */ GLUquadricObj *q = gluNewQuadric(); - for(int i = 0; i < iNumVerts; ++i) + for(i = 0; i < iNumVerts; ++i) { glPushMatrix(); glColor4fv(v[i].c); diff --git a/stepmania/src/ScreenEz2SelectMusic.cpp b/stepmania/src/ScreenEz2SelectMusic.cpp index 28c22e14f0..46249a3ff0 100644 --- a/stepmania/src/ScreenEz2SelectMusic.cpp +++ b/stepmania/src/ScreenEz2SelectMusic.cpp @@ -47,6 +47,9 @@ #define SHUFFLEICON_X( p ) THEME->GetMetricF("ScreenEz2SelectMusic",ssprintf("ShuffleIconP%dX",p+1)) #define SHUFFLEICON_Y( p ) THEME->GetMetricF("ScreenEz2SelectMusic",ssprintf("ShuffleIconP%dY",p+1)) #define PREVIEWMUSICMODE THEME->GetMetricI("ScreenEz2SelectMusic","PreviewMusicMode") +#define DIFFICULTYRATING_X THEME->GetMetricF("ScreenEz2SelectMusic","DifficultyRatingX") +#define DIFFICULTYRATING_Y THEME->GetMetricF("ScreenEz2SelectMusic","DifficultyRatingY") +#define DIFFICULTYRATING_ORIENTATION THEME->GetMetricF("ScreenEz2SelectMusic","DifficultyRatingOrientation") const float TWEEN_TIME = 0.5f; @@ -106,9 +109,9 @@ ScreenEz2SelectMusic::ScreenEz2SelectMusic() for(int p=0; pAddChild( &m_FootMeter[p] ); + // m_FootMeter[p].SetXY( METER_X(p), METER_Y(p) ); + // m_FootMeter[p].SetShadowLength( 2 ); + // this->AddChild( &m_FootMeter[p] ); m_SpeedIcon[p].Load( THEME->GetPathTo("Graphics","select music speedicon")); m_SpeedIcon[p].SetXY( SPEEDICON_X(p), SPEEDICON_Y(p) ); @@ -138,6 +141,10 @@ ScreenEz2SelectMusic::ScreenEz2SelectMusic() m_PumpDifficultyRating.SetXY( PUMP_DIFF_X, PUMP_DIFF_Y ); this->AddChild(&m_PumpDifficultyRating); + m_DifficultyRating.SetOrientation(DIFFICULTYRATING_ORIENTATION); + m_DifficultyRating.SetX(DIFFICULTYRATING_X); + m_DifficultyRating.SetY(DIFFICULTYRATING_Y); + this->AddChild(&m_DifficultyRating); m_sprOptionsMessage.Load( THEME->GetPathTo("Graphics","select music options message") ); m_sprOptionsMessage.StopAnimating(); @@ -498,12 +505,15 @@ void ScreenEz2SelectMusic::AfterNotesChange( PlayerNumber pn ) if( pNotes != NULL && pn == GAMESTATE->m_MasterPlayerNumber ) + { m_PumpDifficultyRating.SetText(ssprintf("Lv.%d",pNotes->GetMeter())); + m_DifficultyRating.SetDifficulty(pNotes->GetMeter()); + } // GAMESTATE->m_pCurNotes[pn] = pNotes; // Notes* m_pNotes = GAMESTATE->m_pCurNotes[pn]; - m_FootMeter[pn].SetFromNotes( pNotes ); +// m_FootMeter[pn].SetFromNotes( pNotes ); } diff --git a/stepmania/src/ScreenEz2SelectMusic.h b/stepmania/src/ScreenEz2SelectMusic.h index c660a39d9a..1d66b4a359 100644 --- a/stepmania/src/ScreenEz2SelectMusic.h +++ b/stepmania/src/ScreenEz2SelectMusic.h @@ -20,6 +20,8 @@ #include "MusicBannerWheel.h" #include "MenuElements.h" #include "FootMeter.h" +#include "DifficultyRating.h" + class ScreenEz2SelectMusic : public Screen { @@ -65,7 +67,8 @@ protected: MusicBannerWheel m_MusicBannerWheel; MenuElements m_Menu; - FootMeter m_FootMeter[NUM_PLAYERS]; + DifficultyRating m_DifficultyRating; +// FootMeter m_FootMeter[NUM_PLAYERS]; vector m_arrayNotes[NUM_PLAYERS]; int m_iSelection[NUM_PLAYERS]; bool m_bGoToOptions; diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 643a90396b..6dba3c25b0 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -57,10 +57,10 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /pdb:none # Begin Special Build Tool IntDir=.\../Release6 -TargetDir=\temp\stepmania +TargetDir=\Stepmania\stepmania TargetName=StepMania SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -92,10 +92,10 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib # Begin Special Build Tool IntDir=.\../Debug6 -TargetDir=\temp\stepmania +TargetDir=\Stepmania\stepmania TargetName=StepMania-debug SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -956,6 +956,14 @@ SOURCE=.\DifficultyIcon.h # End Source File # Begin Source File +SOURCE=.\DifficultyRating.cpp +# End Source File +# Begin Source File + +SOURCE=.\DifficultyRating.h +# End Source File +# Begin Source File + SOURCE=.\FadingBanner.cpp # End Source File # Begin Source File