remove legacy screens superceeded by SSelectMaster
This commit is contained in:
@@ -1,573 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "ScreenSelectDifficulty.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "GameSoundManager.h"
|
||||
#include "GameManager.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "GameState.h"
|
||||
#include "AnnouncerManager.h"
|
||||
#include "GameCommand.h"
|
||||
#include "ActorUtil.h"
|
||||
#include "ScreenDimensions.h"
|
||||
#include "InputEventPlus.h"
|
||||
|
||||
#define NUM_CHOICES_ON_PAGE_1 THEME->GetMetricI(m_sName,"NumChoicesOnPage1")
|
||||
#define LOCK_INPUT_SECONDS THEME->GetMetricF(m_sName,"LockInputSeconds")
|
||||
#define SLEEP_AFTER_CHOICE_SECONDS THEME->GetMetricF(m_sName,"SleepAfterChoiceSeconds")
|
||||
#define CURSOR_CHOOSE_COMMAND THEME->GetMetricA(m_sName,"CursorChooseCommand")
|
||||
#define CURSOR_OFFSET_X_FROM_PICTURE( p ) THEME->GetMetricF(m_sName,ssprintf("CursorP%dOffsetXFromPicture",p+1))
|
||||
#define CURSOR_OFFSET_Y_FROM_PICTURE( p ) THEME->GetMetricF(m_sName,ssprintf("CursorP%dOffsetYFromPicture",p+1))
|
||||
#define SHADOW_CHOOSE_COMMAND THEME->GetMetricA(m_sName,"ShadowChooseCommand")
|
||||
#define SHADOW_LENGTH_X THEME->GetMetricF(m_sName,"ShadowLengthX")
|
||||
#define SHADOW_LENGTH_Y THEME->GetMetricF(m_sName,"ShadowLengthY")
|
||||
#define OK_CHOOSE_COMMAND THEME->GetMetricA(m_sName,"OKChooseCommand")
|
||||
#define ENABLED_COMMAND THEME->GetMetricA(m_sName,"EnabledCommand")
|
||||
#define DISABLED_COMMAND THEME->GetMetricA(m_sName,"DisabledCommand")
|
||||
|
||||
#define IGNORED_ELEMENT_COMMAND THEME->GetMetricA(m_sName,"IgnoredElementOnCommand")
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenSelectDifficulty );
|
||||
|
||||
void ScreenSelectDifficulty::Init()
|
||||
{
|
||||
m_CurrentPage = PAGE_1;
|
||||
|
||||
ScreenSelect::Init();
|
||||
|
||||
FOREACH_PlayerNumber( p )
|
||||
{
|
||||
m_iChoiceOnPage[p] = 0;
|
||||
m_bChosen[p] = false;
|
||||
}
|
||||
|
||||
unsigned c;
|
||||
for( c=0; c<m_aGameCommands.size(); c++ )
|
||||
{
|
||||
if( (int)c < NUM_CHOICES_ON_PAGE_1 )
|
||||
m_GameCommands[PAGE_1].push_back( m_aGameCommands[c] );
|
||||
else
|
||||
m_GameCommands[PAGE_2].push_back( m_aGameCommands[c] );
|
||||
}
|
||||
|
||||
c = 0;
|
||||
for( int page=0; page<NUM_PAGES; page++ )
|
||||
{
|
||||
for( unsigned choice=0; choice<m_GameCommands[page].size(); choice++, c++ )
|
||||
{
|
||||
m_sprPicture[page][choice].SetName( ssprintf("PicturePage%dChoice%d",page+1,choice+1) );
|
||||
m_sprPicture[page][choice].Load( THEME->GetPathG(m_sName,ssprintf("picture%d",c+1)) );
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY( m_sprPicture[page][choice] );
|
||||
m_framePages.AddChild( &m_sprPicture[page][choice] );
|
||||
|
||||
m_sprInfo[page][choice].SetName( ssprintf("InfoPage%dChoice%d",page+1,choice+1) );
|
||||
m_sprInfo[page][choice].Load( THEME->GetPathG(m_sName,ssprintf("info%d",c+1)) );
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY( m_sprInfo[page][choice] );
|
||||
m_framePages.AddChild( &m_sprInfo[page][choice] );
|
||||
}
|
||||
|
||||
m_sprMore[page].SetName( ssprintf("MorePage%d",page+1) );
|
||||
m_sprMore[page].Load( THEME->GetPathG(m_sName,ssprintf("more page%d",page+1)) );
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY( m_sprMore[page] );
|
||||
m_framePages.AddChild( &m_sprMore[page] );
|
||||
|
||||
m_sprExplanation[page].SetName( ssprintf("ExplanationPage%d",page+1) );
|
||||
m_sprExplanation[page].Load( THEME->GetPathG(m_sName,"explanation") );
|
||||
m_sprExplanation[page].StopAnimating();
|
||||
m_sprExplanation[page].SetState( page );
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY( m_sprExplanation[page] );
|
||||
m_framePages.AddChild( &m_sprExplanation[page] );
|
||||
}
|
||||
|
||||
|
||||
FOREACH_PlayerNumber( p )
|
||||
{
|
||||
CLAMP( m_iChoiceOnPage[p], 0, (int)m_GameCommands[0].size()-1 );
|
||||
m_bChosen[p] = false;
|
||||
|
||||
if( !GAMESTATE->IsHumanPlayer(p) )
|
||||
continue;
|
||||
|
||||
float fCursorX = GetCursorX( p );
|
||||
float fCursorY = GetCursorY( p );
|
||||
|
||||
m_sprShadow[p].SetName( "Shadow" );
|
||||
m_sprShadow[p].Load( THEME->GetPathG(m_sName,"shadow 2x1") );
|
||||
ActorUtil::LoadAllCommands( m_sprShadow[p], m_sName );
|
||||
m_sprShadow[p].StopAnimating();
|
||||
m_sprShadow[p].SetState( p );
|
||||
m_sprShadow[p].SetDiffuse( RageColor(0,0,0,0.6f) );
|
||||
m_sprShadow[p].SetXY( fCursorX + SHADOW_LENGTH_X, fCursorY + SHADOW_LENGTH_Y );
|
||||
m_framePages.AddChild( &m_sprShadow[p] );
|
||||
|
||||
m_sprCursor[p].SetName( "Cursor" );
|
||||
m_sprCursor[p].Load( THEME->GetPathG(m_sName,"cursor 2x1") );
|
||||
ActorUtil::LoadAllCommands( m_sprCursor[p], m_sName );
|
||||
m_sprCursor[p].StopAnimating();
|
||||
m_sprCursor[p].SetState( p );
|
||||
m_sprCursor[p].SetXY( fCursorX, fCursorY );
|
||||
m_framePages.AddChild( &m_sprCursor[p] );
|
||||
|
||||
m_sprOK[p].SetName( "OK" );
|
||||
m_sprOK[p].Load( THEME->GetPathG(m_sName,"ok 2x1") );
|
||||
ActorUtil::LoadAllCommands( m_sprOK[p], m_sName );
|
||||
m_sprOK[p].SetState( p );
|
||||
m_sprOK[p].StopAnimating();
|
||||
m_sprOK[p].SetDiffuse( RageColor(1,1,1,0) );
|
||||
m_framePages.AddChild( &m_sprOK[p] );
|
||||
}
|
||||
|
||||
this->AddChild( &m_framePages );
|
||||
|
||||
m_soundChange.Load( THEME->GetPathS(m_sName,"change"), true );
|
||||
m_soundDifficult.Load( ANNOUNCER->GetPathTo("select difficulty challenge") );
|
||||
|
||||
m_fLockInputTime = LOCK_INPUT_SECONDS;
|
||||
|
||||
this->UpdateSelectableChoices();
|
||||
}
|
||||
|
||||
void ScreenSelectDifficulty::BeginScreen()
|
||||
{
|
||||
for( int page=0; page<NUM_PAGES; page++ )
|
||||
{
|
||||
ON_COMMAND( m_sprExplanation[page] );
|
||||
ON_COMMAND( m_sprMore[page] );
|
||||
|
||||
for( unsigned c=0; c<m_GameCommands[page].size(); c++ )
|
||||
{
|
||||
ON_COMMAND( m_sprInfo[page][c] );
|
||||
ON_COMMAND( m_sprPicture[page][c] );
|
||||
}
|
||||
}
|
||||
|
||||
FOREACH_HumanPlayer( p )
|
||||
{
|
||||
ON_COMMAND( m_sprCursor[p] );
|
||||
ON_COMMAND( m_sprShadow[p] );
|
||||
}
|
||||
|
||||
ScreenSelect::BeginScreen();
|
||||
}
|
||||
|
||||
void ScreenSelectDifficulty::Update( float fDelta )
|
||||
{
|
||||
ScreenSelect::Update( fDelta );
|
||||
m_fLockInputTime = max( 0, m_fLockInputTime-fDelta );
|
||||
}
|
||||
|
||||
int ScreenSelectDifficulty::GetSelectionIndex( PlayerNumber pn )
|
||||
{
|
||||
int index = 0;
|
||||
for( int page=0; page<m_CurrentPage; page++ )
|
||||
index += m_GameCommands[page].size();
|
||||
index += m_iChoiceOnPage[pn];
|
||||
return index;
|
||||
}
|
||||
|
||||
void ScreenSelectDifficulty::UpdateSelectableChoices()
|
||||
{
|
||||
for( int page=0; page<NUM_PAGES; page++ )
|
||||
{
|
||||
/* XXX: If a player joins during the tween-in, this diffuse change
|
||||
* will be undone by the tween. Hmm. */
|
||||
for( unsigned i=0; i<m_GameCommands[page].size(); i++ )
|
||||
{
|
||||
/* If the icon is text, use a dimmer diffuse, or we won't be
|
||||
* able to see the glow. */
|
||||
if( m_GameCommands[page][i].IsPlayable() )
|
||||
{
|
||||
m_sprInfo[page][i].RunCommands( ENABLED_COMMAND );
|
||||
m_sprPicture[page][i].RunCommands( ENABLED_COMMAND );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sprInfo[page][i].RunCommands( DISABLED_COMMAND );
|
||||
m_sprPicture[page][i].RunCommands( DISABLED_COMMAND );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// I'm not sure why this was here -- but there seem no ill effects
|
||||
// of it's removal.
|
||||
//
|
||||
//FOREACH_HumanPlayer( p )
|
||||
// {
|
||||
// MenuRight( p );
|
||||
// MenuLeft( p );
|
||||
// }
|
||||
}
|
||||
|
||||
static bool BothPlayersGameCommand( const GameCommand &mc )
|
||||
{
|
||||
switch( mc.m_pm )
|
||||
{
|
||||
case PLAY_MODE_ONI:
|
||||
case PLAY_MODE_NONSTOP:
|
||||
case PLAY_MODE_ENDLESS:
|
||||
case PLAY_MODE_RAVE:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ScreenSelectDifficulty::MenuLeft( const InputEventPlus &input )
|
||||
{
|
||||
PlayerNumber pn = input.pn;
|
||||
// if( m_fLockInputTime > 0 )
|
||||
// return;
|
||||
if( m_bChosen[pn] )
|
||||
return;
|
||||
|
||||
bool AnotherPlayerSelected = false;
|
||||
FOREACH_PlayerNumber( p )
|
||||
if( p != pn && m_bChosen[p] )
|
||||
AnotherPlayerSelected = true;
|
||||
|
||||
int iSwitchToIndex = -1;
|
||||
for( int i=m_iChoiceOnPage[pn]-1; i>=0; i-- )
|
||||
{
|
||||
const GameCommand &mc = m_GameCommands[m_CurrentPage][i];
|
||||
if( AnotherPlayerSelected && BothPlayersGameCommand(mc) )
|
||||
continue;
|
||||
if( mc.IsPlayable() )
|
||||
{
|
||||
iSwitchToIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( iSwitchToIndex == -1 )
|
||||
{
|
||||
if( m_CurrentPage > 0 )
|
||||
ChangePage( (Page)(m_CurrentPage-1) );
|
||||
return;
|
||||
}
|
||||
if( ChangeWithinPage( pn, iSwitchToIndex, false ) )
|
||||
m_soundChange.Play();
|
||||
}
|
||||
|
||||
|
||||
void ScreenSelectDifficulty::MenuRight( const InputEventPlus &input )
|
||||
{
|
||||
PlayerNumber pn = input.pn;
|
||||
// if( m_fLockInputTime > 0 )
|
||||
// return;
|
||||
if( m_bChosen[pn] )
|
||||
return;
|
||||
|
||||
bool AnotherPlayerSelected = false;
|
||||
FOREACH_PlayerNumber( p )
|
||||
if( p != pn && m_bChosen[p] )
|
||||
AnotherPlayerSelected = true;
|
||||
|
||||
int iSwitchToIndex = -1;
|
||||
for( int i=m_iChoiceOnPage[pn]+1; i<(int) m_GameCommands[m_CurrentPage].size(); i++ )
|
||||
{
|
||||
const GameCommand &mc = m_GameCommands[m_CurrentPage][i];
|
||||
if( AnotherPlayerSelected && BothPlayersGameCommand(mc) )
|
||||
continue;
|
||||
if( mc.IsPlayable() )
|
||||
{
|
||||
iSwitchToIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( iSwitchToIndex == -1 )
|
||||
{
|
||||
if( m_GameCommands[m_CurrentPage+1].size()==0 ) // there is no page 2
|
||||
return;
|
||||
|
||||
if( m_CurrentPage < NUM_PAGES-1 )
|
||||
ChangePage( (Page)(m_CurrentPage+1) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( ChangeWithinPage( pn, iSwitchToIndex, false ) )
|
||||
m_soundChange.Play();
|
||||
}
|
||||
|
||||
void ScreenSelectDifficulty::ChangePage( Page newPage )
|
||||
{
|
||||
// If anyone has already chosen, don't allow changing of pages
|
||||
FOREACH_HumanPlayer( p )
|
||||
if( m_bChosen[p] )
|
||||
return;
|
||||
|
||||
bool bPageIncreasing = newPage > m_CurrentPage;
|
||||
m_CurrentPage = newPage;
|
||||
|
||||
if( newPage == PAGE_2 )
|
||||
{
|
||||
/* XXX: only play this once (I thought we already did that?) */
|
||||
m_soundDifficult.Stop();
|
||||
m_soundDifficult.PlayRandom();
|
||||
}
|
||||
|
||||
// Find the first Playable mode on the new page
|
||||
int iSwitchToIndex = -1;
|
||||
if( !bPageIncreasing )
|
||||
{
|
||||
for( int i=m_GameCommands[newPage].size()-1; i>=0; i-- )
|
||||
{
|
||||
if( m_GameCommands[newPage][i].IsPlayable() )
|
||||
{
|
||||
iSwitchToIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( unsigned i=0; i<m_GameCommands[newPage].size(); i++ )
|
||||
{
|
||||
if( m_GameCommands[newPage][i].IsPlayable() )
|
||||
{
|
||||
iSwitchToIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( iSwitchToIndex == -1 )
|
||||
RageException::Throw( "\"%s\" has no selectable choices on page %i.", m_sName.c_str(), newPage);
|
||||
|
||||
// change both players
|
||||
FOREACH_PlayerNumber( p )
|
||||
ChangeWithinPage( p, iSwitchToIndex, true );
|
||||
|
||||
m_soundChange.Play();
|
||||
|
||||
// move frame with choices
|
||||
m_framePages.StopTweening();
|
||||
m_framePages.BeginTweening( 0.2f );
|
||||
m_framePages.SetX( (float)newPage*-SCREEN_WIDTH );
|
||||
}
|
||||
|
||||
bool ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages )
|
||||
{
|
||||
ASSERT_M( iNewChoice >= 0 && iNewChoice < (int) m_GameCommands[m_CurrentPage].size(), ssprintf("%i, %i", iNewChoice, (int) m_GameCommands[m_CurrentPage].size()) );
|
||||
|
||||
bool bAnyChanged = false;
|
||||
FOREACH_HumanPlayer( p )
|
||||
{
|
||||
if( p!=pn && m_CurrentPage==PAGE_1 )
|
||||
continue; // skip
|
||||
/* Don't do this. If we were on page one, with P1 on choice 0, and P2 moves
|
||||
* to the second page, then we're setting choice 0 on the second page;
|
||||
* m_iChoiceOnPage[p] is going from 0 to 0 (all that's changing is the page). */
|
||||
// if( m_iChoiceOnPage[p] == iNewChoice )
|
||||
// continue; // skip
|
||||
|
||||
bAnyChanged = true;
|
||||
m_iChoiceOnPage[p] = iNewChoice;
|
||||
|
||||
float fCursorX = GetCursorX( p );
|
||||
float fCursorY = GetCursorY( p );
|
||||
|
||||
m_sprCursor[p].StopTweening();
|
||||
m_sprCursor[p].BeginTweening( 0.2f, bChangingPages ? TWEEN_LINEAR : TWEEN_DECELERATE );
|
||||
m_sprCursor[p].SetX( fCursorX );
|
||||
m_sprCursor[p].SetY( fCursorY );
|
||||
|
||||
m_sprShadow[p].StopTweening();
|
||||
m_sprShadow[p].BeginTweening( 0.2f, bChangingPages ? TWEEN_LINEAR : TWEEN_DECELERATE );
|
||||
m_sprShadow[p].SetX( fCursorX + SHADOW_LENGTH_X );
|
||||
m_sprShadow[p].SetY( fCursorY + SHADOW_LENGTH_Y );
|
||||
}
|
||||
|
||||
return bAnyChanged;
|
||||
}
|
||||
|
||||
void ScreenSelectDifficulty::MenuStart( const InputEventPlus &input )
|
||||
{
|
||||
MakeSelection( input.pn );
|
||||
}
|
||||
|
||||
void ScreenSelectDifficulty::MakeSelection( PlayerNumber pn )
|
||||
{
|
||||
if( m_fLockInputTime > 0 )
|
||||
return;
|
||||
if( m_bChosen[pn] )
|
||||
return;
|
||||
m_bChosen[pn] = true;
|
||||
|
||||
for( int page=0; page<NUM_PAGES; page++ )
|
||||
OFF_COMMAND( m_sprMore[page] );
|
||||
|
||||
const GameCommand& mc = m_GameCommands[m_CurrentPage][m_iChoiceOnPage[pn]];
|
||||
|
||||
/* Don't play sound if we're recursive, since it just played. */
|
||||
static bool bPlaySelect = true;
|
||||
if( bPlaySelect )
|
||||
{
|
||||
SOUND->PlayOnceFromAnnouncer( ssprintf("ScreenSelectDifficulty comment %s",mc.m_sName.c_str()) );
|
||||
SCREENMAN->PlayStartSound();
|
||||
}
|
||||
|
||||
// courses should be selected for both players at all times
|
||||
if( BothPlayersGameCommand(mc) )
|
||||
{
|
||||
FOREACH_HumanPlayer( p )
|
||||
{
|
||||
if( m_bChosen[p] || p == pn )
|
||||
continue;
|
||||
|
||||
// move all cursors to the oni/nonstop selection so it graphically looks as if all players selected the same option.
|
||||
ChangeWithinPage( p, m_iChoiceOnPage[pn], false );
|
||||
bPlaySelect = false;
|
||||
MakeSelection( p ); // agree everyone
|
||||
bPlaySelect = true;
|
||||
}
|
||||
}
|
||||
else // someone must have chosen arcade style play so oni/nonstop/endless must be disabled
|
||||
{
|
||||
FOREACH_HumanPlayer( p )
|
||||
{
|
||||
if( m_bChosen[p] || p == pn )
|
||||
continue;
|
||||
|
||||
if( !BothPlayersGameCommand(m_GameCommands[m_CurrentPage][m_iChoiceOnPage[p]]) )
|
||||
continue;
|
||||
|
||||
/* This player is currently on a choice that is no longer available due to
|
||||
* the selection just made. */
|
||||
int iSwitchToIndex = -1;
|
||||
for( int i=m_iChoiceOnPage[p]+1; iSwitchToIndex == -1 && i < (int) m_GameCommands[m_CurrentPage].size(); ++i )
|
||||
{
|
||||
const GameCommand &mc = m_GameCommands[m_CurrentPage][i];
|
||||
if( mc.IsPlayable() && !BothPlayersGameCommand(mc) )
|
||||
iSwitchToIndex = i;
|
||||
}
|
||||
if( iSwitchToIndex == -1 ) /* couldn't find a spot looking up; look down */
|
||||
{
|
||||
for( int i=m_iChoiceOnPage[p]-1; iSwitchToIndex == -1 && i >= 0; --i )
|
||||
{
|
||||
const GameCommand &mc = m_GameCommands[m_CurrentPage][i];
|
||||
if( mc.IsPlayable() && !BothPlayersGameCommand(mc) )
|
||||
iSwitchToIndex = i;
|
||||
}
|
||||
}
|
||||
/* We should always find a place to go--we should at least be able to choose
|
||||
* the same thing pn picked. */
|
||||
ASSERT( iSwitchToIndex != -1 );
|
||||
|
||||
// move the cursor
|
||||
ChangeWithinPage( p, iSwitchToIndex, false );
|
||||
}
|
||||
|
||||
/* If the other player is active and hasn't yet chosen, gray out unselectable options.
|
||||
* Otherwise, don't do this, so we don't gray out stuff when nothing else can be selected
|
||||
* anyway. */
|
||||
bool bAnyPlayersLeft = false;
|
||||
FOREACH_HumanPlayer( p )
|
||||
{
|
||||
if( m_bChosen[p] || p == pn )
|
||||
continue;
|
||||
bAnyPlayersLeft = true;
|
||||
}
|
||||
|
||||
if( bAnyPlayersLeft )
|
||||
{
|
||||
for( unsigned c=0; c<m_GameCommands[PAGE_1].size(); c++ )
|
||||
{
|
||||
if( BothPlayersGameCommand(m_GameCommands[PAGE_1][c]) )
|
||||
{
|
||||
m_sprPicture[PAGE_1][c].RunCommands( IGNORED_ELEMENT_COMMAND );
|
||||
m_sprInfo[PAGE_1][c].RunCommands( IGNORED_ELEMENT_COMMAND );
|
||||
|
||||
// IGNORED_ELEMENT_COMMAND
|
||||
}
|
||||
// m_GameCommands[PAGE_1].push_back( m_aGameCommands[c] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_CurrentPage == PAGE_2 )
|
||||
{
|
||||
// choose this for all the other players too
|
||||
FOREACH_HumanPlayer( p )
|
||||
{
|
||||
if( m_bChosen[p] )
|
||||
continue;
|
||||
|
||||
bPlaySelect = false;
|
||||
MakeSelection( p );
|
||||
bPlaySelect = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_sprCursor[pn].RunCommands( CURSOR_CHOOSE_COMMAND );
|
||||
m_sprOK[pn].SetXY( m_sprShadow[pn].GetDestX(), m_sprShadow[pn].GetDestY() );
|
||||
m_sprOK[pn].RunCommands( OK_CHOOSE_COMMAND );
|
||||
m_sprShadow[pn].RunCommands( SHADOW_CHOOSE_COMMAND );
|
||||
|
||||
|
||||
// check to see if everyone has chosen
|
||||
FOREACH_HumanPlayer( p )
|
||||
{
|
||||
if( !m_bChosen[p] )
|
||||
return;
|
||||
}
|
||||
this->PostScreenMessage( SM_BeginFadingOut, SLEEP_AFTER_CHOICE_SECONDS ); // tell our owner it's time to move on
|
||||
}
|
||||
|
||||
void ScreenSelectDifficulty::TweenOffScreen()
|
||||
{
|
||||
ScreenSelect::TweenOffScreen();
|
||||
|
||||
const int page = m_CurrentPage;
|
||||
|
||||
OFF_COMMAND( m_sprExplanation[page] );
|
||||
OFF_COMMAND( m_sprMore[page] );
|
||||
|
||||
FOREACH_HumanPlayer( p )
|
||||
{
|
||||
OFF_COMMAND( m_sprCursor[p] );
|
||||
OFF_COMMAND( m_sprOK[p] );
|
||||
OFF_COMMAND( m_sprShadow[p] );
|
||||
}
|
||||
|
||||
for( unsigned c=0; c<m_GameCommands[page].size(); c++ )
|
||||
{
|
||||
OFF_COMMAND( m_sprInfo[page][c] );
|
||||
OFF_COMMAND( m_sprPicture[page][c] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float ScreenSelectDifficulty::GetCursorX( PlayerNumber pn )
|
||||
{
|
||||
return m_sprPicture[m_CurrentPage][m_iChoiceOnPage[pn]].GetX() + CURSOR_OFFSET_X_FROM_PICTURE(pn);
|
||||
}
|
||||
|
||||
float ScreenSelectDifficulty::GetCursorY( PlayerNumber pn )
|
||||
{
|
||||
return m_sprPicture[m_CurrentPage][m_iChoiceOnPage[pn]].GetY() + CURSOR_OFFSET_Y_FROM_PICTURE(pn);
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,88 +0,0 @@
|
||||
/* ScreenSelectDifficulty - Deprecated. Replaced by ScreenSelectMaster. */
|
||||
|
||||
#ifndef ScreenSelectDifficulty_H
|
||||
#define ScreenSelectDifficulty_H
|
||||
|
||||
#include "ScreenSelect.h"
|
||||
#include "Sprite.h"
|
||||
#include "BitmapText.h"
|
||||
#include "RageSound.h"
|
||||
#include "RandomSample.h"
|
||||
|
||||
#define MAX_CHOICES_PER_PAGE 15
|
||||
|
||||
class ScreenSelectDifficulty : public ScreenSelect
|
||||
{
|
||||
public:
|
||||
virtual void Init();
|
||||
virtual void BeginScreen();
|
||||
|
||||
virtual void Update( float fDelta );
|
||||
|
||||
virtual void MenuLeft( const InputEventPlus &input );
|
||||
virtual void MenuRight( const InputEventPlus &input );
|
||||
virtual void MenuStart( const InputEventPlus &input );
|
||||
// virtual void MenuBack( PlayerNumber pn );
|
||||
virtual void TweenOffScreen();
|
||||
|
||||
protected:
|
||||
enum Page { PAGE_1, PAGE_2, NUM_PAGES };
|
||||
|
||||
virtual int GetSelectionIndex( PlayerNumber pn );
|
||||
virtual void UpdateSelectableChoices();
|
||||
|
||||
float GetCursorX( PlayerNumber pn );
|
||||
float GetCursorY( PlayerNumber pn );
|
||||
bool ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages );
|
||||
void ChangePage( Page newPage );
|
||||
void MakeSelection( PlayerNumber pn );
|
||||
|
||||
ActorFrame m_framePages; // to hold the 2 pages
|
||||
|
||||
Sprite m_sprInfo[NUM_PAGES][MAX_CHOICES_PER_PAGE];
|
||||
Sprite m_sprPicture[NUM_PAGES][MAX_CHOICES_PER_PAGE];
|
||||
Sprite m_sprExplanation[NUM_PAGES];
|
||||
Sprite m_sprMore[NUM_PAGES];
|
||||
|
||||
Sprite m_sprCursor[NUM_PLAYERS];
|
||||
Sprite m_sprShadow[NUM_PLAYERS];
|
||||
Sprite m_sprOK[NUM_PLAYERS];
|
||||
|
||||
RageSound m_soundChange;
|
||||
RandomSample m_soundDifficult;
|
||||
|
||||
vector<GameCommand> m_GameCommands[NUM_PAGES];
|
||||
|
||||
Page m_CurrentPage;
|
||||
int m_iChoiceOnPage[NUM_PLAYERS];
|
||||
bool m_bChosen[NUM_PLAYERS];
|
||||
|
||||
float m_fLockInputTime;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,276 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "ScreenSelectGroup.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "GameManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "SongManager.h"
|
||||
#include "AnnouncerManager.h"
|
||||
#include "GameState.h"
|
||||
#include "GameSoundManager.h"
|
||||
#include "ThemeManager.h"
|
||||
#include <map>
|
||||
#include "ActorUtil.h"
|
||||
#include "GameState.h"
|
||||
#include "UnlockManager.h"
|
||||
#include "MenuTimer.h"
|
||||
#include "SongUtil.h"
|
||||
#include "LocalizedString.h"
|
||||
#include "Song.h"
|
||||
|
||||
#define BANNER_WIDTH THEME->GetMetricF("ScreenSelectGroup","BannerWidth")
|
||||
#define BANNER_HEIGHT THEME->GetMetricF("ScreenSelectGroup","BannerHeight")
|
||||
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenSelectGroup );
|
||||
|
||||
static LocalizedString ALL_MUSIC_STRING( "ScreenSelectGroup", "ALL MUSIC" );
|
||||
void ScreenSelectGroup::Init()
|
||||
{
|
||||
ScreenWithMenuElements::Init();
|
||||
|
||||
ASSERT( PREFSMAN->m_bShowSelectGroup );
|
||||
|
||||
vector<Song*> aAllSongs = SONGMAN->GetSongs();
|
||||
|
||||
// Filter out Songs that can't be played by the current Style
|
||||
for( int j=aAllSongs.size()-1; j>=0; j-- ) // foreach Song, back to front
|
||||
{
|
||||
bool DisplaySong = aAllSongs[j]->NormallyDisplayed();
|
||||
|
||||
if( !aAllSongs[j]->NormallyDisplayed() )
|
||||
DisplaySong = false;
|
||||
|
||||
if( aAllSongs[j]->SongCompleteForStyle(GAMESTATE->GetCurrentStyle()) &&
|
||||
DisplaySong )
|
||||
continue;
|
||||
|
||||
aAllSongs.erase( aAllSongs.begin()+j, aAllSongs.begin()+j+1 );
|
||||
}
|
||||
|
||||
// Add all group names to a map.
|
||||
map<RString, RString> mapGroupNames;
|
||||
for( unsigned i=0; i<aAllSongs.size(); i++ )
|
||||
{
|
||||
const RString& sGroupName = aAllSongs[i]->m_sGroupName;
|
||||
mapGroupNames[ sGroupName ] = ""; // group name maps to nothing
|
||||
}
|
||||
|
||||
// copy group names into a vector
|
||||
vector<RString> asGroupNames;
|
||||
asGroupNames.push_back( ALL_MUSIC_STRING ); // special group
|
||||
for( map<RString, RString>::const_iterator iter = mapGroupNames.begin(); iter != mapGroupNames.end(); ++iter )
|
||||
asGroupNames.push_back( iter->first );
|
||||
|
||||
// Add songs to the MusicList.
|
||||
m_MusicList.Load();
|
||||
for( unsigned g=0; g < asGroupNames.size(); g++ ) /* for each group */
|
||||
{
|
||||
vector<Song*> aSongsInGroup;
|
||||
/* find all songs */
|
||||
for( unsigned i=0; i<aAllSongs.size(); i++ ) // foreach Song
|
||||
{
|
||||
/* group 0 gets all songs */
|
||||
if( g != 0 && aAllSongs[i]->m_sGroupName != asGroupNames[g] )
|
||||
continue;
|
||||
|
||||
aSongsInGroup.push_back( aAllSongs[i] );
|
||||
}
|
||||
|
||||
SongUtil::SortSongPointerArrayByTitle( aSongsInGroup );
|
||||
|
||||
m_MusicList.AddGroup();
|
||||
m_MusicList.AddSongsToGroup(aSongsInGroup);
|
||||
}
|
||||
|
||||
m_bChosen = false;
|
||||
|
||||
m_sprExplanation.SetName( "Explanation" );
|
||||
m_sprExplanation.Load( THEME->GetPathG("ScreenSelectGroup","explanation") );
|
||||
this->AddChild( &m_sprExplanation );
|
||||
|
||||
// these guys get loaded SetSong and TweenToSong
|
||||
m_Banner.SetName( "Banner" );
|
||||
m_Banner.ScaleToClipped( BANNER_WIDTH, BANNER_HEIGHT );
|
||||
this->AddChild( &m_Banner );
|
||||
|
||||
m_sprFrame.SetName( "Frame" );
|
||||
m_sprFrame.Load( THEME->GetPathG("ScreenSelectGroup","frame") );
|
||||
this->AddChild( &m_sprFrame );
|
||||
|
||||
m_textNumber.SetName( "Number" );
|
||||
m_textNumber.LoadFromFont( THEME->GetPathF(m_sName, "num songs") );
|
||||
this->AddChild( &m_textNumber );
|
||||
|
||||
m_sprContents.SetName( "Contents" );
|
||||
m_sprContents.Load( THEME->GetPathG("ScreenSelectGroup","contents") );
|
||||
this->AddChild( &m_sprContents );
|
||||
|
||||
m_MusicList.SetName( "MusicList" );
|
||||
this->AddChild( &m_MusicList );
|
||||
|
||||
m_GroupList.SetName( "GroupList" );
|
||||
m_GroupList.Load( asGroupNames );
|
||||
this->AddChild( &m_GroupList );
|
||||
|
||||
|
||||
m_soundChange.Load( THEME->GetPathS("ScreenSelectGroup","change"), true );
|
||||
|
||||
SOUND->PlayOnceFromAnnouncer( "select group intro" );
|
||||
|
||||
AfterChange();
|
||||
m_GroupList.SetSelection(0);
|
||||
}
|
||||
|
||||
|
||||
void ScreenSelectGroup::Input( const InputEventPlus &input )
|
||||
{
|
||||
LOG->Trace( "ScreenSelectGroup::Input()" );
|
||||
|
||||
if( IsTransitioning() )
|
||||
return;
|
||||
|
||||
ScreenWithMenuElements::Input( input ); // default input handler
|
||||
}
|
||||
|
||||
void ScreenSelectGroup::HandleScreenMessage( const ScreenMessage SM )
|
||||
{
|
||||
if( SM == SM_BeginFadingOut )
|
||||
{
|
||||
StartTransitioningScreen( SM_GoToNextScreen );
|
||||
return;
|
||||
}
|
||||
ScreenWithMenuElements::HandleScreenMessage( SM );
|
||||
}
|
||||
|
||||
void ScreenSelectGroup::AfterChange()
|
||||
{
|
||||
int sel = m_GroupList.GetSelection();
|
||||
m_MusicList.SetGroupNo(sel);
|
||||
|
||||
RString sSelectedGroupName = m_GroupList.GetSelectionName();
|
||||
if( sSelectedGroupName == ALL_MUSIC_STRING.GetValue() )
|
||||
m_Banner.LoadAllMusic();
|
||||
else
|
||||
m_Banner.LoadFromSongGroup( sSelectedGroupName );
|
||||
|
||||
const int iNumSongs = m_MusicList.GetNumSongs();
|
||||
m_textNumber.SetText( ssprintf("%d", iNumSongs) );
|
||||
}
|
||||
|
||||
|
||||
void ScreenSelectGroup::MenuLeft( const InputEventPlus &input )
|
||||
{
|
||||
MenuUp( input );
|
||||
}
|
||||
|
||||
void ScreenSelectGroup::MenuRight( const InputEventPlus &input )
|
||||
{
|
||||
MenuDown( input );
|
||||
}
|
||||
|
||||
void ScreenSelectGroup::MenuUp( const InputEventPlus &input )
|
||||
{
|
||||
if( m_bChosen )
|
||||
return;
|
||||
|
||||
m_GroupList.Up();
|
||||
|
||||
AfterChange();
|
||||
|
||||
m_soundChange.Play();
|
||||
}
|
||||
|
||||
|
||||
void ScreenSelectGroup::MenuDown( const InputEventPlus &input )
|
||||
{
|
||||
if( m_bChosen )
|
||||
return;
|
||||
|
||||
m_GroupList.Down();
|
||||
|
||||
AfterChange();
|
||||
|
||||
m_soundChange.Play();
|
||||
}
|
||||
|
||||
void ScreenSelectGroup::MenuStart( const InputEventPlus &input )
|
||||
{
|
||||
if( m_bChosen )
|
||||
return;
|
||||
|
||||
SCREENMAN->PlayStartSound();
|
||||
m_MenuTimer->Stop();
|
||||
m_bChosen = true;
|
||||
|
||||
GAMESTATE->m_pCurSong.Set( NULL );
|
||||
GAMESTATE->m_sPreferredSongGroup.Set( m_GroupList.GetSelectionName()==ALL_MUSIC_STRING.GetValue() ? GROUP_ALL : m_GroupList.GetSelectionName() );
|
||||
|
||||
if( GAMESTATE->m_sPreferredSongGroup == GROUP_ALL )
|
||||
SOUND->PlayOnceFromAnnouncer( "select group comment all music" );
|
||||
else
|
||||
SOUND->PlayOnceFromAnnouncer( "select group comment general" );
|
||||
|
||||
this->PostScreenMessage( SM_BeginFadingOut, 0 );
|
||||
}
|
||||
|
||||
void ScreenSelectGroup::MenuBack( const InputEventPlus &input )
|
||||
{
|
||||
Cancel( SM_GoToPrevScreen );
|
||||
}
|
||||
|
||||
void ScreenSelectGroup::TweenOffScreen()
|
||||
{
|
||||
ScreenWithMenuElements::TweenOffScreen();
|
||||
|
||||
OFF_COMMAND( m_sprExplanation );
|
||||
OFF_COMMAND( m_sprFrame );
|
||||
OFF_COMMAND( m_Banner );
|
||||
OFF_COMMAND( m_textNumber );
|
||||
OFF_COMMAND( m_sprContents );
|
||||
OFF_COMMAND( m_MusicList );
|
||||
OFF_COMMAND( m_GroupList );
|
||||
m_MusicList.TweenOffScreen();
|
||||
m_GroupList.TweenOffScreen();
|
||||
}
|
||||
|
||||
void ScreenSelectGroup::TweenOnScreen()
|
||||
{
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_sprExplanation );
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_sprFrame );
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_Banner );
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_textNumber );
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_sprContents );
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_MusicList );
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_GroupList );
|
||||
m_MusicList.TweenOnScreen();
|
||||
m_GroupList.TweenOnScreen();
|
||||
|
||||
ScreenWithMenuElements::TweenOnScreen();
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,75 +0,0 @@
|
||||
/* ScreenSelectGroup - Set the current song group from a list. Deprecated. Replaced by ScreenSelectMaster. */
|
||||
|
||||
#ifndef SCREEN_SELECT_GROUP_H
|
||||
#define SCREEN_SELECT_GROUP_H
|
||||
|
||||
#include "ScreenWithMenuElements.h"
|
||||
#include "Sprite.h"
|
||||
#include "RageSound.h"
|
||||
#include "FadingBanner.h"
|
||||
#include "MusicList.h"
|
||||
#include "GroupList.h"
|
||||
|
||||
|
||||
class ScreenSelectGroup : public ScreenWithMenuElements
|
||||
{
|
||||
public:
|
||||
virtual void Init();
|
||||
|
||||
virtual void Input( const InputEventPlus &input );
|
||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||
|
||||
void AfterChange();
|
||||
|
||||
void MenuLeft( const InputEventPlus &input );
|
||||
void MenuRight( const InputEventPlus &input );
|
||||
void MenuUp( const InputEventPlus &input );
|
||||
void MenuDown( const InputEventPlus &input );
|
||||
void MenuStart( const InputEventPlus &input );
|
||||
void MenuBack( const InputEventPlus &input );
|
||||
|
||||
void TweenOnScreen();
|
||||
void TweenOffScreen();
|
||||
|
||||
private:
|
||||
|
||||
Sprite m_sprExplanation;
|
||||
Sprite m_sprFrame;
|
||||
FadingBanner m_Banner;
|
||||
BitmapText m_textNumber;
|
||||
Sprite m_sprContents;
|
||||
|
||||
MusicList m_MusicList;
|
||||
GroupList m_GroupList;
|
||||
|
||||
RageSound m_soundChange;
|
||||
|
||||
bool m_bChosen;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,322 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "ScreenSelectStyle.h"
|
||||
#include "GameManager.h"
|
||||
#include "GameSoundManager.h"
|
||||
#include "NetworkSyncManager.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "ScreenManager.h"
|
||||
#include "GameState.h"
|
||||
#include "AnnouncerManager.h"
|
||||
#include "ActorUtil.h"
|
||||
#include "CommonMetrics.h"
|
||||
#include "LocalizedString.h"
|
||||
#include "InputEventPlus.h"
|
||||
|
||||
#define ICON_GAIN_FOCUS_COMMAND THEME->GetMetricA(m_sName,"IconGainFocusCommand")
|
||||
#define ICON_LOSE_FOCUS_COMMAND THEME->GetMetricA(m_sName,"IconLoseFocusCommand")
|
||||
#define DISABLED_COMMAND THEME->GetMetricA(m_sName,"DisabledCommand")
|
||||
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenSelectStyle );
|
||||
|
||||
void ScreenSelectStyle::Init()
|
||||
{
|
||||
ScreenSelect::Init();
|
||||
|
||||
m_iSelection = 0;
|
||||
|
||||
for( unsigned i=0; i<m_aGameCommands.size(); i++ )
|
||||
{
|
||||
const GameCommand& mc = m_aGameCommands[i];
|
||||
|
||||
//
|
||||
// Load icon
|
||||
//
|
||||
RString sIconPath = THEME->GetPathG(m_sName,ssprintf("icon%d",i+1));
|
||||
|
||||
m_textIcon[i].SetName( ssprintf("Icon%d",i+1) );
|
||||
m_sprIcon[i].SetName( ssprintf("Icon%d",i+1) );
|
||||
|
||||
if( sIconPath.empty() ) // element doesn't exist
|
||||
{
|
||||
m_textIcon[i].LoadFromFont( THEME->GetPathF("Common","normal") );
|
||||
m_textIcon[i].SetText( mc.m_sName );
|
||||
m_textIcon[i].SetZoom(0.5f);
|
||||
this->AddChild( &m_textIcon[i] );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sprIcon[i].Load( sIconPath );
|
||||
this->AddChild( &m_sprIcon[i] );
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Load Picture
|
||||
//
|
||||
RString sPicturePath = THEME->GetPathG(m_sName, ssprintf("picture%d",i+1));
|
||||
if( sPicturePath != "" )
|
||||
{
|
||||
m_sprPicture[i].SetName( "Picture" );
|
||||
m_sprPicture[i].Load( sPicturePath );
|
||||
m_sprPicture[i].SetDiffuse( RageColor(1,1,1,0) );
|
||||
this->AddChild( &m_sprPicture[i] );
|
||||
LOAD_ALL_COMMANDS( m_sprPicture[i] );
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Load info
|
||||
//
|
||||
RString sInfoPath = THEME->GetPathG(m_sName,ssprintf("info%d",i+1));
|
||||
if( sInfoPath != "" )
|
||||
{
|
||||
m_sprInfo[i].SetName( "Info" );
|
||||
m_sprInfo[i].Load( sInfoPath );
|
||||
m_sprInfo[i].SetDiffuse( RageColor(1,1,1,0) );
|
||||
this->AddChild( &m_sprInfo[i] );
|
||||
LOAD_ALL_COMMANDS( m_sprInfo[i] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_sprWarning.SetName( "Warning" );
|
||||
m_sprWarning.Load( THEME->GetPathG(m_sName,"warning") );
|
||||
this->AddChild( &m_sprWarning );
|
||||
|
||||
m_sprExplanation.SetName( "Explanation" );
|
||||
m_sprExplanation.Load( THEME->GetPathG(m_sName,"explanation") );
|
||||
this->AddChild( &m_sprExplanation );
|
||||
|
||||
|
||||
|
||||
// fix Z ordering of Picture and Info so that they draw on top
|
||||
for( unsigned i=0; i<this->m_aGameCommands.size(); i++ )
|
||||
this->MoveToTail( &m_sprPicture[i] );
|
||||
for( unsigned i=0; i<this->m_aGameCommands.size(); i++ )
|
||||
this->MoveToTail( &m_sprInfo[i] );
|
||||
|
||||
|
||||
m_sprPremium.SetName( "Premium" );
|
||||
|
||||
switch( GAMESTATE->GetPremium() )
|
||||
{
|
||||
case Premium_DoubleFor1Credit:
|
||||
m_sprPremium.Load( THEME->GetPathG(m_sName,"doubles premium") );
|
||||
this->AddChild( &m_sprPremium );
|
||||
break;
|
||||
case Premium_2PlayersFor1Credit:
|
||||
m_sprPremium.Load( THEME->GetPathG(m_sName,"joint premium") );
|
||||
this->AddChild( &m_sprPremium );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
m_soundChange.Load( THEME->GetPathS(m_sName,"change"), true );
|
||||
|
||||
|
||||
//
|
||||
// TweenOnScreen
|
||||
//
|
||||
for( unsigned i=0; i<m_aGameCommands.size(); i++ )
|
||||
{
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY( m_textIcon[i] );
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY( m_sprIcon[i] );
|
||||
}
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY( m_sprExplanation );
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY( m_sprWarning );
|
||||
LOAD_ALL_COMMANDS_AND_SET_XY( m_sprPremium );
|
||||
|
||||
// let AfterChange tween Picture and Info
|
||||
}
|
||||
|
||||
void ScreenSelectStyle::BeginScreen()
|
||||
{
|
||||
this->UpdateSelectableChoices();
|
||||
|
||||
//
|
||||
// TweenOnScreen
|
||||
//
|
||||
for( unsigned i=0; i<m_aGameCommands.size(); i++ )
|
||||
{
|
||||
ON_COMMAND( m_textIcon[i] );
|
||||
ON_COMMAND( m_sprIcon[i] );
|
||||
}
|
||||
ON_COMMAND( m_sprExplanation );
|
||||
ON_COMMAND( m_sprWarning );
|
||||
ON_COMMAND( m_sprPremium );
|
||||
|
||||
ScreenSelect::BeginScreen();
|
||||
}
|
||||
|
||||
void ScreenSelectStyle::MenuLeft( const InputEventPlus &input )
|
||||
{
|
||||
int iSwitchToIndex = -1; // -1 means none found
|
||||
for( int i=m_iSelection-1; i>=0; i-- )
|
||||
{
|
||||
if( m_aGameCommands[i].IsPlayable() )
|
||||
{
|
||||
iSwitchToIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( iSwitchToIndex == -1 )
|
||||
return;
|
||||
|
||||
BeforeChange();
|
||||
m_iSelection = iSwitchToIndex;
|
||||
m_soundChange.Play();
|
||||
AfterChange();
|
||||
}
|
||||
|
||||
void ScreenSelectStyle::MenuRight( const InputEventPlus &input )
|
||||
{
|
||||
int iSwitchToIndex = -1; // -1 means none found
|
||||
for( unsigned i=m_iSelection+1; i<m_aGameCommands.size(); i++ )
|
||||
{
|
||||
if( m_aGameCommands[i].IsPlayable() )
|
||||
{
|
||||
iSwitchToIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( iSwitchToIndex == -1 )
|
||||
return;
|
||||
|
||||
BeforeChange();
|
||||
m_iSelection = iSwitchToIndex;
|
||||
m_soundChange.Play();
|
||||
AfterChange();
|
||||
}
|
||||
|
||||
void ScreenSelectStyle::MenuStart( const InputEventPlus &input )
|
||||
{
|
||||
/* Stop all tweens where they are, since we might have selected before
|
||||
* we finished tweening in. */
|
||||
for( unsigned i=0; i<m_SubActors.size(); i++ )
|
||||
m_SubActors[i]->StopTweening();
|
||||
|
||||
SCREENMAN->PlayStartSound();
|
||||
SCREENMAN->SendMessageToTopScreen( SM_BeginFadingOut );
|
||||
|
||||
const GameCommand& mc = m_aGameCommands[GetSelectionIndex(input.pn)];
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("%s comment %s",m_sName.c_str(),mc.m_sName.c_str())) );
|
||||
|
||||
//
|
||||
// TweenOffScreen
|
||||
//
|
||||
|
||||
for( unsigned i=0; i<m_aGameCommands.size(); i++ )
|
||||
{
|
||||
OFF_COMMAND( m_sprIcon[i] );
|
||||
OFF_COMMAND( m_textIcon[i] );
|
||||
}
|
||||
OFF_COMMAND( m_sprExplanation );
|
||||
OFF_COMMAND( m_sprWarning );
|
||||
OFF_COMMAND( m_sprPicture[m_iSelection] );
|
||||
OFF_COMMAND( m_sprInfo[m_iSelection] );
|
||||
OFF_COMMAND( m_sprPremium );
|
||||
}
|
||||
|
||||
int ScreenSelectStyle::GetSelectionIndex( PlayerNumber pn )
|
||||
{
|
||||
return m_iSelection;
|
||||
}
|
||||
|
||||
static LocalizedString NO_STYLES_ARE_SELECTABLE( "ScreenSMOnlineLogin", "No Styles are selectable." );
|
||||
void ScreenSelectStyle::UpdateSelectableChoices()
|
||||
{
|
||||
for( unsigned i=0; i<m_aGameCommands.size(); i++ )
|
||||
{
|
||||
/* If the icon is text, use a dimmer diffuse, or we won't be
|
||||
* able to see the glow. */
|
||||
if( m_aGameCommands[i].IsPlayable() )
|
||||
{
|
||||
m_sprIcon[i].SetDiffuse( RageColor(1,1,1,1) );
|
||||
m_textIcon[i].SetDiffuse( RageColor(0.5f,0.5f,0.5f,1) ); // gray so glow is visible
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sprIcon[i].RunCommands( DISABLED_COMMAND );
|
||||
m_textIcon[i].RunCommands( DISABLED_COMMAND );
|
||||
}
|
||||
}
|
||||
|
||||
// Select the first enabled choice.
|
||||
BeforeChange();
|
||||
|
||||
int iSwitchToStyleIndex = -1; // -1 means none found
|
||||
for( unsigned i=0; i<m_aGameCommands.size(); i++ )
|
||||
{
|
||||
const GameCommand& mc = m_aGameCommands[i];
|
||||
if( mc.IsPlayable() )
|
||||
{
|
||||
iSwitchToStyleIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( iSwitchToStyleIndex == -1 )// no styles are enabled. We're stuck!
|
||||
{
|
||||
DEBUG_ASSERT(0);
|
||||
SCREENMAN->SystemMessage( NO_STYLES_ARE_SELECTABLE );
|
||||
this->PostScreenMessage( SM_GoToPrevScreen, 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
m_iSelection = iSwitchToStyleIndex;
|
||||
AfterChange();
|
||||
}
|
||||
|
||||
void ScreenSelectStyle::BeforeChange()
|
||||
{
|
||||
// dim/hide old selection
|
||||
m_sprIcon[m_iSelection].RunCommands( ICON_LOSE_FOCUS_COMMAND );
|
||||
m_textIcon[m_iSelection].RunCommands( ICON_LOSE_FOCUS_COMMAND );
|
||||
m_sprPicture[m_iSelection].StopTweening();
|
||||
m_sprInfo[m_iSelection].StopTweening();
|
||||
m_sprPicture[m_iSelection].SetDiffuse( RageColor(1,1,1,0) );
|
||||
m_sprInfo[m_iSelection].SetDiffuse( RageColor(1,1,1,0) );
|
||||
m_sprPicture[m_iSelection].SetGlow( RageColor(1,1,1,0) );
|
||||
m_sprInfo[m_iSelection].SetGlow( RageColor(1,1,1,0) );
|
||||
}
|
||||
|
||||
void ScreenSelectStyle::AfterChange()
|
||||
{
|
||||
m_sprIcon[m_iSelection].RunCommands( ICON_GAIN_FOCUS_COMMAND );
|
||||
m_textIcon[m_iSelection].RunCommands( ICON_GAIN_FOCUS_COMMAND );
|
||||
m_sprPicture[m_iSelection].SetDiffuse( RageColor(1,1,1,1) );
|
||||
m_sprInfo[m_iSelection].SetDiffuse( RageColor(1,1,1,1) );
|
||||
m_sprPicture[m_iSelection].SetZoom( 1 );
|
||||
m_sprInfo[m_iSelection].SetZoom( 1 );
|
||||
SET_XY_AND_ON_COMMAND( m_sprPicture[m_iSelection] );
|
||||
SET_XY_AND_ON_COMMAND( m_sprInfo[m_iSelection] );
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -1,70 +0,0 @@
|
||||
/* ScreenSelectStyle - Deprecated. Replaced by ScreenSelectMaster. */
|
||||
|
||||
#ifndef ScreenSelectStyle_H
|
||||
#define ScreenSelectStyle_H
|
||||
|
||||
#include "ScreenSelect.h"
|
||||
#include "Sprite.h"
|
||||
#include "BitmapText.h"
|
||||
#include "RageSound.h"
|
||||
|
||||
#define MAX_MODE_CHOICES 30
|
||||
|
||||
class ScreenSelectStyle : public ScreenSelect
|
||||
{
|
||||
public:
|
||||
virtual void Init();
|
||||
virtual void BeginScreen();
|
||||
|
||||
virtual void MenuLeft( const InputEventPlus &input );
|
||||
virtual void MenuRight( const InputEventPlus &input );
|
||||
virtual void MenuStart( const InputEventPlus &input );
|
||||
|
||||
protected:
|
||||
virtual int GetSelectionIndex( PlayerNumber pn );
|
||||
virtual void UpdateSelectableChoices();
|
||||
|
||||
void BeforeChange();
|
||||
void AfterChange();
|
||||
|
||||
Sprite m_sprIcon[MAX_MODE_CHOICES];
|
||||
// Artists don't make graphics for every single Game, so
|
||||
// have a text representation if textures are missing.
|
||||
BitmapText m_textIcon[MAX_MODE_CHOICES];
|
||||
Sprite m_sprPicture[MAX_MODE_CHOICES];
|
||||
Sprite m_sprInfo[MAX_MODE_CHOICES];
|
||||
Sprite m_sprExplanation;
|
||||
Sprite m_sprWarning;
|
||||
Sprite m_sprPremium;
|
||||
|
||||
RageSound m_soundChange;
|
||||
|
||||
int m_iSelection;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -773,22 +773,6 @@
|
||||
RelativePath="ScreenSelectCharacter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSelectDifficulty.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSelectDifficulty.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSelectGroup.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSelectGroup.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenSelectLanguage.cpp"
|
||||
>
|
||||
@@ -829,14 +813,6 @@
|
||||
RelativePath=".\ScreenSelectProfile.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSelectStyle.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenSelectStyle.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ScreenServiceAction.cpp"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user