Had to go back on the ScreenNetSelectMusic controls commit. My apologies.

The MusicWheelType metric is still there, though.
This commit is contained in:
AJ Kelly
2011-02-10 14:00:09 -06:00
parent 6131f27571
commit 0178610e55
3 changed files with 124 additions and 128 deletions
+5 -4
View File
@@ -10,9 +10,13 @@ supported but exist anyways.)
_____________________________________________________________________________ _____________________________________________________________________________
================================================================================ ================================================================================
sm-ssc v1.2.1 | 201102?? sm-ssc v1.2.1 | 2011021?
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
20110210
--------
* Had to go back on the ScreenNetSelectMusic controls commit. My apologies. [AJ]
20110209 20110209
-------- --------
* [ScreenOptionsMemoryCard] Added three strings: "(no label)", "size ???", and * [ScreenOptionsMemoryCard] Added three strings: "(no label)", "size ???", and
@@ -22,9 +26,6 @@ sm-ssc v1.2.1 | 201102??
20110208 20110208
-------- --------
* [ScreenNetSelectMusic] Reworked the input on this screen. [AJ]
Left and Right still move the wheel. Up and Down now change the difficulty
using CodeDetector. The Options menu is now accessed with the Select button.
* [ScreenNetSelectMusic] Added MusicWheelType metric. [AJ] * [ScreenNetSelectMusic] Added MusicWheelType metric. [AJ]
20110201 20110201
+111 -114
View File
@@ -7,7 +7,6 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "GameState.h" #include "GameState.h"
#include "CodeDetector.h"
#include "Style.h" #include "Style.h"
#include "Steps.h" #include "Steps.h"
#include "RageTimer.h" #include "RageTimer.h"
@@ -25,6 +24,7 @@
#include "SongUtil.h" #include "SongUtil.h"
#include "RageInput.h" #include "RageInput.h"
#include "SongManager.h" #include "SongManager.h"
#include "CodeDetector.h"
AutoScreenMessage( SM_NoSongs ) AutoScreenMessage( SM_NoSongs )
AutoScreenMessage( SM_ChangeSong ) AutoScreenMessage( SM_ChangeSong )
@@ -45,12 +45,11 @@ void ScreenNetSelectMusic::Init()
ScreenNetSelectBase::Init(); ScreenNetSelectBase::Init();
SAMPLE_MUSIC_PREVIEW_MODE.Load( m_sName, "SampleMusicPreviewMode" ); SAMPLE_MUSIC_PREVIEW_MODE.Load( m_sName, "SampleMusicPreviewMode" );
CODES.Load( m_sName, "Codes" );
MUSIC_WHEEL_TYPE.Load( m_sName, "MusicWheelType" ); MUSIC_WHEEL_TYPE.Load( m_sName, "MusicWheelType" );
FOREACH_EnabledPlayer (p) FOREACH_EnabledPlayer (p)
{ {
m_Difficulty[p] = GAMESTATE->m_PreferredDifficulty[p]; m_DC[p] = GAMESTATE->m_PreferredDifficulty[p];
m_StepsDisplays[p].SetName( ssprintf("StepsDisplayP%d",p+1) ); m_StepsDisplays[p].SetName( ssprintf("StepsDisplayP%d",p+1) );
m_StepsDisplays[p].Load( "StepsDisplayNet", NULL ); m_StepsDisplays[p].Load( "StepsDisplayNet", NULL );
@@ -95,8 +94,6 @@ void ScreenNetSelectMusic::Init()
m_bInitialSelect = false; m_bInitialSelect = false;
m_bAllowInput = false; m_bAllowInput = false;
ZERO( m_iSelection );
} }
void ScreenNetSelectMusic::Input( const InputEventPlus &input ) void ScreenNetSelectMusic::Input( const InputEventPlus &input )
@@ -116,7 +113,7 @@ void ScreenNetSelectMusic::Input( const InputEventPlus &input )
bool bHoldingCtrl = bool bHoldingCtrl =
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL)) || INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL)) ||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL)) || INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL)) ||
(!NSMAN->useSMserver); //If we are disconnected, assume no chatting (!NSMAN->useSMserver); // If we are disconnected, assume no chatting
wchar_t c = INPUTMAN->DeviceInputToChar(input.DeviceI,false); wchar_t c = INPUTMAN->DeviceInputToChar(input.DeviceI,false);
MakeUpper( &c, 1 ); MakeUpper( &c, 1 );
@@ -141,19 +138,6 @@ void ScreenNetSelectMusic::Input( const InputEventPlus &input )
m_MusicWheel.Move(+1); m_MusicWheel.Move(+1);
} }
// todo: handle input here instead of in Menu* functions -aj
if( input.MenuI == GAME_BUTTON_SELECT && input.type != IET_REPEAT )
{
NSMAN->ReportNSSOnOff(3);
GAMESTATE->m_EditMode = EditMode_Full;
// todo: allow themers to define options screen -aj
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromPlayerOptions );
}
// handle CodeDetector
if( input.type == IET_FIRST_PRESS && DetectCodes(input) )
return;
ScreenNetSelectBase::Input( input ); ScreenNetSelectBase::Input( input );
} }
@@ -178,9 +162,8 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
} }
else if( SM == SM_ChangeSong ) else if( SM == SM_ChangeSong )
{ {
/* First check to see if this song is already selected. This is so that // First check to see if this song is already selected. This is so that if
* if you have multiple copies of the "same" song, you can choose which // you have multiple copies of the "same" song you can chose which copy to play.
* copy to play. */
Song* CurSong = m_MusicWheel.GetSelectedSong(); Song* CurSong = m_MusicWheel.GetSelectedSong();
if(CurSong != NULL ) if(CurSong != NULL )
@@ -196,8 +179,8 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
NSMAN->m_iSelectMode = 0; NSMAN->m_iSelectMode = 0;
NSMAN->SelectUserSong(); NSMAN->SelectUserSong();
break; break;
case 2: //Proper starting of song case 2: // Proper starting of song
case 3: //Blind starting of song case 3: // Blind starting of song
StartSelectedSong(); StartSelectedSong();
goto done; goto done;
} }
@@ -221,7 +204,7 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
case 3: case 3:
StartSelectedSong(); StartSelectedSong();
break; break;
case 2: //We need to do cmd 1 as well here case 2: // We need to do cmd 1 as well here
if(haveSong) if(haveSong)
{ {
if(!m_MusicWheel.SelectSong( m_cSong ) ) if(!m_MusicWheel.SelectSong( m_cSong ) )
@@ -237,7 +220,7 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
m_MusicWheel.Select(); m_MusicWheel.Select();
} }
break; break;
case 1: //Scroll to song as well case 1: // Scroll to song as well
if(haveSong) if(haveSong)
{ {
if(!m_MusicWheel.SelectSong( m_cSong ) ) if(!m_MusicWheel.SelectSong( m_cSong ) )
@@ -254,8 +237,8 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
m_MusicWheel.Move(1); m_MusicWheel.Move(1);
m_MusicWheel.Select(); m_MusicWheel.Select();
} }
//don't break here // don't break here
case 0: //See if client has song case 0: // See if client has song
if(haveSong) if(haveSong)
NSMAN->m_iSelectMode = 0; NSMAN->m_iSelectMode = 0;
else else
@@ -263,7 +246,7 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
NSMAN->SelectUserSong(); NSMAN->SelectUserSong();
} }
} }
else if( SM == SM_SetWheelSong ) // After we're done the sort on wheel, select song. else if( SM == SM_SetWheelSong ) // After we've done the sort on wheel, select song.
{ {
m_MusicWheel.SelectSong( m_cSong ); m_MusicWheel.SelectSong( m_cSong );
} }
@@ -311,14 +294,6 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
} }
} }
} }
else if( SM == SM_GainFocus )
{
CodeDetector::RefreshCacheItems( CODES );
}
else if( SM == SM_LoseFocus )
{
CodeDetector::RefreshCacheItems(); // reset for other screens
}
done: done:
// Must be at end, as so it is last resort for SMOnline packets. // Must be at end, as so it is last resort for SMOnline packets.
@@ -326,68 +301,94 @@ done:
ScreenNetSelectBase::HandleScreenMessage( SM ); ScreenNetSelectBase::HandleScreenMessage( SM );
} }
void ScreenNetSelectMusic::ChangeSteps( const InputEventPlus &input, int dir ) bool ScreenNetSelectMusic::LeftAndRightPressed( const PlayerNumber pn )
{ {
if( GAMESTATE->m_pCurSong == NULL ) return INPUTMAPPER->IsBeingPressed( GAME_BUTTON_LEFT, pn )
return; && INPUTMAPPER->IsBeingPressed( GAME_BUTTON_RIGHT, pn );
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
m_vpSteps = GAMESTATE->m_pCurSong->GetStepsByStepsType( st );
if( m_vpSteps.size() == 0 )
m_Difficulty[input.pn] = NUM_Difficulty;
else
{
m_iSelection[input.pn] += dir;
wrap( m_iSelection[input.pn], m_vpSteps.size() );
Steps *pSteps = m_vpSteps[m_iSelection[input.pn]];
m_Difficulty[input.pn] = (Difficulty)pSteps->GetDifficulty();
GAMESTATE->ChangePreferredDifficultyAndStepsType( input.pn, m_Difficulty[input.pn], st );
}
UpdateDifficulty( input.pn );
}
bool ScreenNetSelectMusic::DetectCodes( const InputEventPlus &input )
{
if( CodeDetector::EnteredPrevSteps(input.GameI.controller) )
{
ChangeSteps( input, -1 );
}
else if( CodeDetector::EnteredNextSteps(input.GameI.controller) )
{
ChangeSteps( input, +1 );
}
else if( CodeDetector::EnteredModeMenu(input.GameI.controller) )
{
m_MusicWheel.ChangeSort( SORT_MODE_MENU );
}
// todo: support NextGroup/PrevGroup
else if( CodeDetector::EnteredCloseFolder(input.GameI.controller) )
{
RString sCurSection = m_MusicWheel.GetSelectedSection();
m_MusicWheel.SelectSection(sCurSection);
m_MusicWheel.SetOpenSection("");
MusicChanged();
}
else
{
return false;
}
return true;
} }
void ScreenNetSelectMusic::MenuLeft( const InputEventPlus &input ) void ScreenNetSelectMusic::MenuLeft( const InputEventPlus &input )
{ {
MESSAGEMAN->Broadcast( "PreviousSong" ); PlayerNumber pn = input.pn;
m_MusicWheel.Move( -1 );
if( LeftAndRightPressed(pn) )
m_MusicWheel.ChangeSort( SORT_MODE_MENU );
else
m_MusicWheel.Move( -1 );
} }
void ScreenNetSelectMusic::MenuRight( const InputEventPlus &input ) void ScreenNetSelectMusic::MenuRight( const InputEventPlus &input )
{ {
MESSAGEMAN->Broadcast( "NextSong" ); PlayerNumber pn = input.pn;
m_MusicWheel.Move( +1 );
if( LeftAndRightPressed(pn) )
m_MusicWheel.ChangeSort( SORT_MODE_MENU );
else
m_MusicWheel.Move( +1 );
}
void ScreenNetSelectMusic::MenuUp( const InputEventPlus &input )
{
NSMAN->ReportNSSOnOff(3);
GAMESTATE->m_EditMode = EditMode_Full;
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromPlayerOptions );
}
void ScreenNetSelectMusic::MenuDown( const InputEventPlus &input )
{
/* Tricky: If we have a player on player 2, and there is only player 2,
* allow them to use player 1's controls to change their difficulty. */
/* Why? Nothing else allows that. (-who?) */
// I agree, that's a stupid idea -aj
PlayerNumber pn = input.pn;
if( GAMESTATE->IsPlayerEnabled( PLAYER_2 ) &&
!GAMESTATE->IsPlayerEnabled( PLAYER_1 ) )
pn = PLAYER_2;
if( GAMESTATE->m_pCurSong == NULL )
return;
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
vector <Steps *> MultiSteps;
MultiSteps = GAMESTATE->m_pCurSong->GetStepsByStepsType( st );
if(MultiSteps.size() == 0)
m_DC[pn] = NUM_Difficulty;
else
{
int i;
bool dcs[NUM_Difficulty];
for( i=0; i<NUM_Difficulty; ++i )
dcs[i] = false;
for( i=0; i<(int)MultiSteps.size(); ++i )
dcs[MultiSteps[i]->GetDifficulty()] = true;
for( i=0; i<NUM_Difficulty; ++i )
{
if( (dcs[i]) && (i > m_DC[pn]) )
{
m_DC[pn] = (Difficulty)i;
break;
}
}
// If failed to go up, loop
if( i == NUM_Difficulty )
{
for(i = 0;i<NUM_Difficulty;i++)
{
if(dcs[i])
{
m_DC[pn] = (Difficulty)i;
break;
}
}
}
}
UpdateDifficulties( pn );
GAMESTATE->m_PreferredDifficulty[pn].Set( m_DC[pn] );
} }
void ScreenNetSelectMusic::MenuStart( const InputEventPlus &input ) void ScreenNetSelectMusic::MenuStart( const InputEventPlus &input )
@@ -438,6 +439,7 @@ void ScreenNetSelectMusic::TweenOffScreen()
FOREACH_EnabledPlayer (pn) FOREACH_EnabledPlayer (pn)
{ {
OFF_COMMAND( m_StepsDisplays[pn] ); OFF_COMMAND( m_StepsDisplays[pn] );
//OFF_COMMAND( m_DifficultyIcon[pn] );
OFF_COMMAND( m_ModIconRow[pn] ); OFF_COMMAND( m_ModIconRow[pn] );
} }
@@ -453,8 +455,8 @@ void ScreenNetSelectMusic::StartSelectedSong()
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; //StepsType_dance_single; StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; //StepsType_dance_single;
FOREACH_EnabledPlayer (pn) FOREACH_EnabledPlayer (pn)
{ {
GAMESTATE->m_PreferredDifficulty[pn].Set( m_Difficulty[pn] ); GAMESTATE->m_PreferredDifficulty[pn].Set( m_DC[pn] );
Steps *pSteps = SongUtil::GetStepsByDifficulty(pSong, st, m_Difficulty[pn]); Steps *pSteps = SongUtil::GetStepsByDifficulty(pSong, st, m_DC[pn]);
GAMESTATE->m_pCurSteps[pn].Set( pSteps ); GAMESTATE->m_pCurSteps[pn].Set( pSteps );
} }
@@ -468,19 +470,21 @@ void ScreenNetSelectMusic::StartSelectedSong()
StartTransitioningScreen( SM_GoToNextScreen ); StartTransitioningScreen( SM_GoToNextScreen );
} }
void ScreenNetSelectMusic::UpdateDifficulty( PlayerNumber pn ) void ScreenNetSelectMusic::UpdateDifficulties( PlayerNumber pn )
{ {
if( GAMESTATE->m_pCurSong == NULL ) if( GAMESTATE->m_pCurSong == NULL )
{ {
m_StepsDisplays[pn].SetFromStepsTypeAndMeterAndDifficultyAndCourseType( StepsType_Invalid, 0, Difficulty_Beginner, CourseType_Invalid ); m_StepsDisplays[pn].SetFromStepsTypeAndMeterAndDifficultyAndCourseType( StepsType_Invalid, 0, Difficulty_Beginner, CourseType_Invalid );
//m_DifficultyIcon[pn].SetFromSteps( pn, NULL ); // It will blank it out
return; return;
} }
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
Steps* pSteps = SongUtil::GetStepsByDifficulty( GAMESTATE->m_pCurSong, st, m_Difficulty[pn] );
Steps * pSteps = SongUtil::GetStepsByDifficulty( GAMESTATE->m_pCurSong, st, m_DC[pn] );
GAMESTATE->m_pCurSteps[pn].Set( pSteps ); GAMESTATE->m_pCurSteps[pn].Set( pSteps );
if( ( m_Difficulty[pn] < NUM_Difficulty ) && ( m_Difficulty[pn] >= Difficulty_Beginner ) ) if( ( m_DC[pn] < NUM_Difficulty ) && ( m_DC[pn] >= Difficulty_Beginner ) )
m_StepsDisplays[pn].SetFromSteps( pSteps ); m_StepsDisplays[pn].SetFromSteps( pSteps );
else else
m_StepsDisplays[pn].SetFromStepsTypeAndMeterAndDifficultyAndCourseType( StepsType_Invalid, 0, Difficulty_Beginner, CourseType_Invalid ); m_StepsDisplays[pn].SetFromStepsTypeAndMeterAndDifficultyAndCourseType( StepsType_Invalid, 0, Difficulty_Beginner, CourseType_Invalid );
@@ -492,31 +496,23 @@ void ScreenNetSelectMusic::MusicChanged()
{ {
m_BPMDisplay.NoBPM(); m_BPMDisplay.NoBPM();
FOREACH_EnabledPlayer (pn) FOREACH_EnabledPlayer (pn)
UpdateDifficulty( pn ); UpdateDifficulties( pn );
SOUND->StopMusic(); SOUND->StopMusic();
// todo: handle playing section music correctly. -aj // todo: handle playing section music correctly. -aj
/* // SOUND->PlayMusic( m_sSectionMusicPath, NULL, true, 0, -1 );
if(SOUND->GetMusicPath().CompareNoCase(m_sSectionMusicPath))
{
SOUND->PlayMusic( m_sSectionMusicPath, NULL, true, 0, -1 );
}
*/
return; return;
} }
m_BPMDisplay.SetBpmFromSong( GAMESTATE->m_pCurSong ); m_BPMDisplay.SetBpmFromSong( GAMESTATE->m_pCurSong );
SongUtil::GetPlayableSteps( GAMESTATE->m_pCurSong, m_vpSteps ); FOREACH_EnabledPlayer (pn)
FOREACH_EnabledPlayer(pn)
{ {
// Wondering if this can be simplified... -aj m_DC[pn] = GAMESTATE->m_PreferredDifficulty[pn];
m_Difficulty[pn] = GAMESTATE->m_PreferredDifficulty[pn];
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
vector<Steps*> MultiSteps; vector <Steps *> MultiSteps;
MultiSteps = GAMESTATE->m_pCurSong->GetStepsByStepsType( st ); MultiSteps = GAMESTATE->m_pCurSong->GetStepsByStepsType( st );
if(MultiSteps.size() == 0) if(MultiSteps.size() == 0)
m_Difficulty[pn] = NUM_Difficulty; m_DC[pn] = NUM_Difficulty;
else else
{ {
int i; int i;
@@ -534,17 +530,17 @@ void ScreenNetSelectMusic::MusicChanged()
if( dcs[i] ) if( dcs[i] )
{ {
Target = (Difficulty)i; Target = (Difficulty)i;
if( i >= m_Difficulty[pn] ) if( i >= m_DC[pn] )
{ {
m_Difficulty[pn] = (Difficulty)i; m_DC[pn] = (Difficulty)i;
break; break;
} }
} }
if( i == NUM_Difficulty ) if( i == NUM_Difficulty )
m_Difficulty[pn] = Target; m_DC[pn] = Target;
} }
UpdateDifficulty( pn ); UpdateDifficulties( pn );
} }
// Copied from ScreenSelectMusic // Copied from ScreenSelectMusic
@@ -552,7 +548,8 @@ void ScreenNetSelectMusic::MusicChanged()
SOUND->StopMusic(); SOUND->StopMusic();
if( GAMESTATE->m_pCurSong->HasMusic() ) if( GAMESTATE->m_pCurSong->HasMusic() )
{ {
if(SOUND->GetMusicPath().CompareNoCase(GAMESTATE->m_pCurSong->GetMusicPath())) // don't play the same sound over and over // don't play the same sound over and over
if(SOUND->GetMusicPath().CompareNoCase(GAMESTATE->m_pCurSong->GetMusicPath()))
{ {
SOUND->StopMusic(); SOUND->StopMusic();
SOUND->PlayMusic( SOUND->PlayMusic(
+7 -9
View File
@@ -28,32 +28,30 @@ protected:
virtual void MenuBack( const InputEventPlus &input ); virtual void MenuBack( const InputEventPlus &input );
virtual void MenuLeft( const InputEventPlus &input ); virtual void MenuLeft( const InputEventPlus &input );
virtual void MenuRight( const InputEventPlus &input ); virtual void MenuRight( const InputEventPlus &input );
bool DetectCodes( const InputEventPlus &input ); virtual void MenuUp( const InputEventPlus &input );
virtual void MenuDown( const InputEventPlus &input );
bool LeftAndRightPressed( const PlayerNumber pn );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
void ChangeSteps( const InputEventPlus &input, int dir );
void MusicChanged(); void MusicChanged();
void TweenOffScreen(); void TweenOffScreen();
vector<Steps*> m_vpSteps;
int m_iSelection[NUM_PLAYERS];
ThemeMetric<SampleMusicPreviewMode> SAMPLE_MUSIC_PREVIEW_MODE; ThemeMetric<SampleMusicPreviewMode> SAMPLE_MUSIC_PREVIEW_MODE;
RString m_sSectionMusicPath; RString m_sSectionMusicPath;
RString m_sRouletteMusicPath; RString m_sRouletteMusicPath;
RString m_sRandomMusicPath; RString m_sRandomMusicPath;
ThemeMetric<RString> CODES;
ThemeMetric<RString> MUSIC_WHEEL_TYPE; ThemeMetric<RString> MUSIC_WHEEL_TYPE;
private: private:
MusicWheel m_MusicWheel; MusicWheel m_MusicWheel;
Difficulty m_Difficulty[NUM_PLAYERS];
StepsDisplay m_StepsDisplays[NUM_PLAYERS]; StepsDisplay m_StepsDisplays[NUM_PLAYERS];
void UpdateDifficulty( PlayerNumber pn ); Difficulty m_DC[NUM_PLAYERS];
void UpdateDifficulties( PlayerNumber pn );
RageSound m_soundChangeOpt; RageSound m_soundChangeOpt;
RageSound m_soundChangeSel; RageSound m_soundChangeSel;
@@ -62,7 +60,7 @@ private:
BPMDisplay m_BPMDisplay; BPMDisplay m_BPMDisplay;
ModIconRow m_ModIconRow[NUM_PLAYERS]; ModIconRow m_ModIconRow[NUM_PLAYERS];
Song* m_cSong; Song * m_cSong;
bool m_bInitialSelect; bool m_bInitialSelect;
bool m_bAllowInput; bool m_bAllowInput;