rename: ModeChoice -> GameCommand

This commit is contained in:
Chris Danford
2004-12-02 06:29:20 +00:00
parent e1da21f61c
commit ab37218c47
20 changed files with 166 additions and 165 deletions
@@ -1,5 +1,5 @@
#include "global.h" #include "global.h"
#include "ModeChoice.h" #include "GameCommand.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "RageLog.h" #include "RageLog.h"
#include "GameManager.h" #include "GameManager.h"
@@ -18,7 +18,7 @@
#include "Style.h" #include "Style.h"
#include "Foreach.h" #include "Foreach.h"
void ModeChoice::Init() void GameCommand::Init()
{ {
m_sName = ""; m_sName = "";
m_bInvalid = true; m_bInvalid = true;
@@ -40,7 +40,7 @@ void ModeChoice::Init()
bool CompareSongOptions( const SongOptions &so1, const SongOptions &so2 ); bool CompareSongOptions( const SongOptions &so1, const SongOptions &so2 );
bool ModeChoice::DescribesCurrentModeForAllPlayers() const bool GameCommand::DescribesCurrentModeForAllPlayers() const
{ {
FOREACH_HumanPlayer( pn ) FOREACH_HumanPlayer( pn )
if( !DescribesCurrentMode(pn) ) if( !DescribesCurrentMode(pn) )
@@ -49,7 +49,7 @@ bool ModeChoice::DescribesCurrentModeForAllPlayers() const
return true; return true;
} }
bool ModeChoice::DescribesCurrentMode( PlayerNumber pn ) const bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const
{ {
if( m_pGame != NULL && m_pGame != GAMESTATE->m_pCurGame ) if( m_pGame != NULL && m_pGame != GAMESTATE->m_pCurGame )
return false; return false;
@@ -97,7 +97,7 @@ bool ModeChoice::DescribesCurrentMode( PlayerNumber pn ) const
return true; return true;
} }
void ModeChoice::Load( int iIndex, const ActorCommands& acs ) void GameCommand::Load( int iIndex, const ActorCommands& acs )
{ {
m_iIndex = iIndex; m_iIndex = iIndex;
@@ -294,7 +294,7 @@ static bool AreStyleAndPlayModeCompatible( const Style *style, PlayMode pm )
return true; return true;
} }
bool ModeChoice::IsPlayable( CString *why ) const bool GameCommand::IsPlayable( CString *why ) const
{ {
if( m_bInvalid ) if( m_bInvalid )
{ {
@@ -401,7 +401,7 @@ bool ModeChoice::IsPlayable( CString *why ) const
return true; return true;
} }
void ModeChoice::ApplyToAllPlayers() const void GameCommand::ApplyToAllPlayers() const
{ {
FOREACH_HumanPlayer( pn ) FOREACH_HumanPlayer( pn )
Apply( pn); Apply( pn);
@@ -410,7 +410,7 @@ void ModeChoice::ApplyToAllPlayers() const
SCREENMAN->SetNewScreen( m_sScreen ); SCREENMAN->SetNewScreen( m_sScreen );
} }
void ModeChoice::Apply( PlayerNumber pn ) const void GameCommand::Apply( PlayerNumber pn ) const
{ {
if( !GAMESTATE->IsHumanPlayer(pn) ) if( !GAMESTATE->IsHumanPlayer(pn) )
return; return;
@@ -493,7 +493,7 @@ void ModeChoice::Apply( PlayerNumber pn ) const
GAMESTATE->m_SongOptions.m_LifeType = SongOptions::LIFE_BATTERY; GAMESTATE->m_SongOptions.m_LifeType = SongOptions::LIFE_BATTERY;
} }
bool ModeChoice::IsZero() const bool GameCommand::IsZero() const
{ {
if( m_pGame != NULL || if( m_pGame != NULL ||
m_pm != PLAY_MODE_INVALID || m_pm != PLAY_MODE_INVALID ||
@@ -1,7 +1,7 @@
/* ModeChoice */ /* GameCommand */
#ifndef MODECHOICE_H #ifndef GameCommand_H
#define MODECHOICE_H #define GameCommand_H
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PlayerNumber.h" #include "PlayerNumber.h"
@@ -16,9 +16,9 @@ class Style;
class Game; class Game;
struct ActorCommands; struct ActorCommands;
struct ModeChoice // used in SelectMode struct GameCommand // used in SelectMode
{ {
ModeChoice() { Init(); } GameCommand() { Init(); }
void Init(); void Init();
void Load( int iIndex, const ActorCommands& acs ); void Load( int iIndex, const ActorCommands& acs );
+5 -5
View File
@@ -11,7 +11,7 @@
#include "SongManager.h" #include "SongManager.h"
#include "Steps.h" #include "Steps.h"
#include "NoteSkinManager.h" #include "NoteSkinManager.h"
#include "ModeChoice.h" #include "GameCommand.h"
#include "NoteFieldPositioning.h" #include "NoteFieldPositioning.h"
#include "Character.h" #include "Character.h"
#include "UnlockSystem.h" #include "UnlockSystem.h"
@@ -85,7 +85,7 @@ void GameState::ApplyCmdline()
CString sMode; CString sMode;
for( int i = 0; GetCommandlineArgument( "mode", &sMode, i ); ++i ) for( int i = 0; GetCommandlineArgument( "mode", &sMode, i ); ++i )
{ {
ModeChoice m; GameCommand m;
m.Load( 0, ParseActorCommands(sMode) ); m.Load( 0, ParseActorCommands(sMode) );
CString why; CString why;
if( !m.IsPlayable(&why) ) if( !m.IsPlayable(&why) )
@@ -175,7 +175,7 @@ void GameState::Reset()
// one or the other. -Chris // one or the other. -Chris
// Having default modifiers in prefs is needed for several things. // Having default modifiers in prefs is needed for several things.
// The theme setting is for eg. BM being reverse by default. (This // The theme setting is for eg. BM being reverse by default. (This
// could be done in the title menu ModeChoice, but then it wouldn't // could be done in the title menu GameCommand, but then it wouldn't
// affect demo, and other non-gameplay things ...) -glenn // affect demo, and other non-gameplay things ...) -glenn
ApplyModifiers( p, DEFAULT_MODIFIERS ); ApplyModifiers( p, DEFAULT_MODIFIERS );
ApplyModifiers( p, PREFSMAN->m_sDefaultModifiers ); ApplyModifiers( p, PREFSMAN->m_sDefaultModifiers );
@@ -256,7 +256,7 @@ void GameState::PlayersFinalized()
GAMESTATE->m_PlayerOptions[pn].ResetSavedPrefs(); GAMESTATE->m_PlayerOptions[pn].ResetSavedPrefs();
GAMESTATE->ApplyModifiers( pn, sModifiers ); GAMESTATE->ApplyModifiers( pn, sModifiers );
} }
// Only set the sort order if it wasn't already set by a ModeChoice (or by an earlier profile) // Only set the sort order if it wasn't already set by a GameCommand (or by an earlier profile)
if( m_SortOrder == SORT_INVALID && pProfile->m_SortOrder != SORT_INVALID ) if( m_SortOrder == SORT_INVALID && pProfile->m_SortOrder != SORT_INVALID )
m_SortOrder = pProfile->m_SortOrder; m_SortOrder = pProfile->m_SortOrder;
if( pProfile->m_LastDifficulty != DIFFICULTY_INVALID ) if( pProfile->m_LastDifficulty != DIFFICULTY_INVALID )
@@ -584,7 +584,7 @@ static int GetNumStagesForCurrentSong()
* stage is the final stage, and we picked a stage that takes two songs, it * stage is the final stage, and we picked a stage that takes two songs, it
* only counts as one stage (so it doesn't bump us all the way to Ex2). * only counts as one stage (so it doesn't bump us all the way to Ex2).
* One case where this happens is a long/marathon extra stage. Another is * One case where this happens is a long/marathon extra stage. Another is
* if a long/marathon song is selected explicitly in the theme with a ModeChoice, * if a long/marathon song is selected explicitly in the theme with a GameCommand,
* and PREFSMAN->m_iNumArcadeStages is less than the number of stages that * and PREFSMAN->m_iNumArcadeStages is less than the number of stages that
* song takes. */ * song takes. */
int iNumStagesLeft = PREFSMAN->m_iNumArcadeStages - GAMESTATE->m_iCurrentStageIndex; int iNumStagesLeft = PREFSMAN->m_iNumArcadeStages - GAMESTATE->m_iCurrentStageIndex;
+3 -2
View File
@@ -56,9 +56,10 @@ Attack.cpp Attack.h AutoKeysounds.cpp AutoKeysounds.h BannerCache.cpp BannerCach
Character.cpp Character.h CharacterHead.cpp CharacterHead.h \ Character.cpp Character.h CharacterHead.cpp CharacterHead.h \
CodeDetector.cpp CodeDetector.h Difficulty.cpp Difficulty.h EnumHelper.cpp EnumHelper.h Course.cpp Course.h \ CodeDetector.cpp CodeDetector.h Difficulty.cpp Difficulty.h EnumHelper.cpp EnumHelper.h Course.cpp Course.h \
CourseUtil.cpp CourseUtil.h DateTime.cpp DateTime.h Font.cpp Font.h FontCharAliases.cpp FontCharAliases.h \ CourseUtil.cpp CourseUtil.h DateTime.cpp DateTime.h Font.cpp Font.h FontCharAliases.cpp FontCharAliases.h \
FontCharmaps.cpp FontCharmaps.h Game.cpp Game.h GameConstantsAndTypes.cpp GameConstantsAndTypes.h \ FontCharmaps.cpp FontCharmaps.h Game.cpp Game.h GameCommand.cpp GameCommand.h \
GameConstantsAndTypes.cpp GameConstantsAndTypes.h \
GameInput.cpp GameInput.h Grade.cpp Grade.h HighScore.cpp HighScore.h Inventory.cpp Inventory.h LuaFunctions.h \ GameInput.cpp GameInput.h Grade.cpp Grade.h HighScore.cpp HighScore.h Inventory.cpp Inventory.h LuaFunctions.h \
LuaHelpers.cpp LuaHelpers.h LyricsLoader.cpp LyricsLoader.h MenuInput.h ModeChoice.cpp ModeChoice.h \ LuaHelpers.cpp LuaHelpers.h LyricsLoader.cpp LyricsLoader.h MenuInput.h \
NoteData.cpp NoteData.h NoteDataUtil.cpp NoteDataUtil.h NoteDataWithScoring.cpp NoteDataWithScoring.h \ NoteData.cpp NoteData.h NoteDataUtil.cpp NoteDataUtil.h NoteDataWithScoring.cpp NoteDataWithScoring.h \
NoteFieldPositioning.cpp NoteFieldPositioning.h NoteTypes.cpp NoteTypes.h NotesLoader.cpp NotesLoader.h \ NoteFieldPositioning.cpp NoteFieldPositioning.h NoteTypes.cpp NoteTypes.h NotesLoader.cpp NotesLoader.h \
NotesLoaderBMS.cpp NotesLoaderBMS.h NotesLoaderDWI.cpp NotesLoaderDWI.h NotesLoaderKSF.cpp NotesLoaderKSF.h \ NotesLoaderBMS.cpp NotesLoaderBMS.h NotesLoaderDWI.cpp NotesLoaderDWI.h NotesLoaderKSF.cpp NotesLoaderKSF.h \
+1 -1
View File
@@ -17,7 +17,7 @@
#include "Banner.h" #include "Banner.h"
#include "Steps.h" #include "Steps.h"
#include "UnlockSystem.h" #include "UnlockSystem.h"
#include "ModeChoice.h" #include "GameCommand.h"
#include "ActorUtil.h" #include "ActorUtil.h"
#include "SongUtil.h" #include "SongUtil.h"
#include "CourseUtil.h" #include "CourseUtil.h"
+2 -2
View File
@@ -9,7 +9,7 @@
#include "WheelNotifyIcon.h" #include "WheelNotifyIcon.h"
#include "TextBanner.h" #include "TextBanner.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "ModeChoice.h" #include "GameCommand.h"
class Course; class Course;
class Song; class Song;
@@ -77,7 +77,7 @@ struct WheelItemData
// for TYPE_SORT // for TYPE_SORT
CString m_sLabel; CString m_sLabel;
ModeChoice m_Action; GameCommand m_Action;
SortOrder m_SortOrder; SortOrder m_SortOrder;
}; };
+2 -2
View File
@@ -4,7 +4,7 @@
#include "ScreenManager.h" #include "ScreenManager.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "LuaHelpers.h" #include "LuaHelpers.h"
#include "ModeChoice.h" #include "GameCommand.h"
#include "RageUtil.h" #include "RageUtil.h"
#define CHOICES THEME->GetMetric (m_sName,"Choices") #define CHOICES THEME->GetMetric (m_sName,"Choices")
@@ -43,7 +43,7 @@ void ScreenBranch::HandleScreenMessage( const ScreenMessage SM )
CString sNextScreen = NEXT_SCREEN(m_sChoice); CString sNextScreen = NEXT_SCREEN(m_sChoice);
LOG->Trace( "Branching to '%s'", sNextScreen.c_str() ); LOG->Trace( "Branching to '%s'", sNextScreen.c_str() );
ModeChoice mc; GameCommand mc;
mc.Load( 0, ParseActorCommands(sNextScreen) ); mc.Load( 0, ParseActorCommands(sNextScreen) );
if( mc.m_sScreen == "" ) if( mc.m_sScreen == "" )
RageException::Throw("Metric %s::%s must set \"screen\"", RageException::Throw("Metric %s::%s must set \"screen\"",
+10 -10
View File
@@ -50,7 +50,7 @@ void ScreenOptionsMaster::SetList( OptionRowData &row, OptionRowHandler &hand, C
{ {
arraySkinNames[skin].MakeUpper(); arraySkinNames[skin].MakeUpper();
ModeChoice mc; GameCommand mc;
mc.m_sModifiers = arraySkinNames[skin]; mc.m_sModifiers = arraySkinNames[skin];
hand.ListEntries.push_back( mc ); hand.ListEntries.push_back( mc );
row.choices.push_back( arraySkinNames[skin] ); row.choices.push_back( arraySkinNames[skin] );
@@ -78,7 +78,7 @@ void ScreenOptionsMaster::SetList( OptionRowData &row, OptionRowHandler &hand, C
for( int col = 0; col < NumCols; ++col ) for( int col = 0; col < NumCols; ++col )
{ {
ModeChoice mc; GameCommand mc;
mc.Load( 0, ParseActorCommands(ENTRY_MODE(ListName, col)) ); mc.Load( 0, ParseActorCommands(ENTRY_MODE(ListName, col)) );
if( mc.m_sName == "" ) if( mc.m_sName == "" )
RageException::Throw( "List \"%s\", col %i has no name", ListName.c_str(), col ); RageException::Throw( "List \"%s\", col %i has no name", ListName.c_str(), col );
@@ -104,7 +104,7 @@ void ScreenOptionsMaster::SetStep( OptionRowData &row, OptionRowHandler &hand )
if( GAMESTATE->m_bEditing ) if( GAMESTATE->m_bEditing )
{ {
row.choices.push_back( "" ); row.choices.push_back( "" );
hand.ListEntries.push_back( ModeChoice() ); hand.ListEntries.push_back( GameCommand() );
} }
else if( GAMESTATE->IsCourseMode() ) // playing a course else if( GAMESTATE->IsCourseMode() ) // playing a course
{ {
@@ -118,7 +118,7 @@ void ScreenOptionsMaster::SetStep( OptionRowData &row, OptionRowHandler &hand )
CString s = CourseDifficultyToThemedString( pTrail->m_CourseDifficulty ); CString s = CourseDifficultyToThemedString( pTrail->m_CourseDifficulty );
row.choices.push_back( s ); row.choices.push_back( s );
ModeChoice mc; GameCommand mc;
mc.m_pTrail = pTrail; mc.m_pTrail = pTrail;
hand.ListEntries.push_back( mc ); hand.ListEntries.push_back( mc );
} }
@@ -140,7 +140,7 @@ void ScreenOptionsMaster::SetStep( OptionRowData &row, OptionRowHandler &hand )
s += ssprintf( " (%d)", pSteps->GetMeter() ); s += ssprintf( " (%d)", pSteps->GetMeter() );
row.choices.push_back( s ); row.choices.push_back( s );
ModeChoice mc; GameCommand mc;
mc.m_pSteps = pSteps; mc.m_pSteps = pSteps;
mc.m_dc = pSteps->GetDifficulty(); mc.m_dc = pSteps->GetDifficulty();
hand.ListEntries.push_back( mc ); hand.ListEntries.push_back( mc );
@@ -174,7 +174,7 @@ void ScreenOptionsMaster::SetCharacter( OptionRowData &row, OptionRowHandler &ha
{ {
row.choices.push_back( ENTRY_NAME("Off") ); row.choices.push_back( ENTRY_NAME("Off") );
ModeChoice mc; GameCommand mc;
mc.m_pCharacter = GAMESTATE->GetDefaultCharacter(); mc.m_pCharacter = GAMESTATE->GetDefaultCharacter();
hand.ListEntries.push_back( mc ); hand.ListEntries.push_back( mc );
} }
@@ -188,7 +188,7 @@ void ScreenOptionsMaster::SetCharacter( OptionRowData &row, OptionRowHandler &ha
s.MakeUpper(); s.MakeUpper();
row.choices.push_back( s ); row.choices.push_back( s );
ModeChoice mc; GameCommand mc;
mc.m_pCharacter = pCharacter; mc.m_pCharacter = pCharacter;
hand.ListEntries.push_back( mc ); hand.ListEntries.push_back( mc );
} }
@@ -290,7 +290,7 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ):
if( m_OptionsNavigation == NAV_TOGGLE_THREE_KEY ) if( m_OptionsNavigation == NAV_TOGGLE_THREE_KEY )
{ {
row.choices.insert( row.choices.begin(), ENTRY_NAME("NextRow") ); row.choices.insert( row.choices.begin(), ENTRY_NAME("NextRow") );
hand.ListEntries.insert( hand.ListEntries.begin(), ModeChoice() ); hand.ListEntries.insert( hand.ListEntries.begin(), GameCommand() );
} }
OptionRowHandlers.push_back( hand ); OptionRowHandlers.push_back( hand );
@@ -326,7 +326,7 @@ void ScreenOptionsMaster::ImportOption( const OptionRowData &row, const OptionRo
for( unsigned e = 0; e < hand.ListEntries.size(); ++e ) for( unsigned e = 0; e < hand.ListEntries.size(); ++e )
{ {
const ModeChoice &mc = hand.ListEntries[e]; const GameCommand &mc = hand.ListEntries[e];
vbSelectedOut[e] = false; vbSelectedOut[e] = false;
@@ -522,7 +522,7 @@ void ScreenOptionsMaster::ExportOptions()
if( hand.type == ROW_LIST ) if( hand.type == ROW_LIST )
{ {
const int choice = m_Rows[row]->m_iChoiceWithFocus[0]; const int choice = m_Rows[row]->m_iChoiceWithFocus[0];
const ModeChoice &mc = hand.ListEntries[choice]; const GameCommand &mc = hand.ListEntries[choice];
if( mc.m_sScreen != "" ) if( mc.m_sScreen != "" )
m_NextScreen = mc.m_sScreen; m_NextScreen = mc.m_sScreen;
} }
+3 -3
View File
@@ -2,7 +2,7 @@
#define SCREEN_OPTIONS_MASTER_H #define SCREEN_OPTIONS_MASTER_H
#include "ScreenOptions.h" #include "ScreenOptions.h"
#include "ModeChoice.h" #include "GameCommand.h"
struct ConfOption; struct ConfOption;
@@ -30,8 +30,8 @@ private:
OptionRowType type; OptionRowType type;
/* ROW_LIST: */ /* ROW_LIST: */
vector<ModeChoice> ListEntries; vector<GameCommand> ListEntries;
ModeChoice Default; GameCommand Default;
/* ROW_CONFIG: */ /* ROW_CONFIG: */
const ConfOption *opt; const ConfOption *opt;
+11 -11
View File
@@ -12,7 +12,7 @@
#include "GameState.h" #include "GameState.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "ModeChoice.h" #include "GameCommand.h"
#include "RageDisplay.h" #include "RageDisplay.h"
#include "UnlockSystem.h" #include "UnlockSystem.h"
#include "arch/ArchHooks/ArchHooks.h" #include "arch/ArchHooks/ArchHooks.h"
@@ -49,10 +49,10 @@ ScreenSelect::ScreenSelect( CString sClassName ) : ScreenWithMenuElements(sClass
CString sChoiceName = asChoiceNames[c]; CString sChoiceName = asChoiceNames[c];
CString sChoice = CHOICE(sChoiceName); CString sChoice = CHOICE(sChoiceName);
ModeChoice mc; GameCommand mc;
mc.m_sName = sChoiceName; mc.m_sName = sChoiceName;
mc.Load( c, ParseActorCommands(sChoice) ); mc.Load( c, ParseActorCommands(sChoice) );
m_aModeChoices.push_back( mc ); m_aGameCommands.push_back( mc );
CString sBGAnimationDir = THEME->GetPath(BGAnimations, m_sName, mc.m_sName, true); // true="optional" CString sBGAnimationDir = THEME->GetPath(BGAnimations, m_sName, mc.m_sName, true); // true="optional"
if( sBGAnimationDir == "" ) if( sBGAnimationDir == "" )
@@ -73,12 +73,12 @@ ScreenSelect::ScreenSelect( CString sClassName ) : ScreenWithMenuElements(sClass
m_aCodes.push_back( code ); m_aCodes.push_back( code );
m_aCodeActions.push_back( CODE_ACTION(c) ); m_aCodeActions.push_back( CODE_ACTION(c) );
ModeChoice mc; GameCommand mc;
mc.Load( c, ParseActorCommands(CODE_ACTION(c)) ); mc.Load( c, ParseActorCommands(CODE_ACTION(c)) );
m_aCodeChoices.push_back( mc ); m_aCodeChoices.push_back( mc );
} }
if( !m_aModeChoices.size() ) if( !m_aGameCommands.size() )
RageException::Throw( "Screen \"%s\" does not set any choices", m_sName.c_str() ); RageException::Throw( "Screen \"%s\" does not set any choices", m_sName.c_str() );
// derived classes can override if they want // derived classes can override if they want
@@ -176,8 +176,8 @@ void ScreenSelect::FinalizeChoices()
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
{ {
const int sel = GetSelectionIndex( p ); const int sel = GetSelectionIndex( p );
if( m_aModeChoices[sel].m_pStyle ) if( m_aGameCommands[sel].m_pStyle )
GAMESTATE->m_pCurStyle = m_aModeChoices[sel].m_pStyle; GAMESTATE->m_pCurStyle = m_aGameCommands[sel].m_pStyle;
} }
SCREENMAN->RefreshCreditsMessages(); SCREENMAN->RefreshCreditsMessages();
} }
@@ -203,7 +203,7 @@ void ScreenSelect::HandleScreenMessage( const ScreenMessage SM )
* long time (200+ms), and at SM_AllDoneChoosing, we're still tweening stuff * long time (200+ms), and at SM_AllDoneChoosing, we're still tweening stuff
* off-screen. */ * off-screen. */
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
m_aModeChoices[this->GetSelectionIndex(p)].Apply( p ); m_aGameCommands[this->GetSelectionIndex(p)].Apply( p );
// //
// Finalize players if we set a style on this screen. // Finalize players if we set a style on this screen.
@@ -211,7 +211,7 @@ void ScreenSelect::HandleScreenMessage( const ScreenMessage SM )
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
{ {
const int sel = GetSelectionIndex( p ); const int sel = GetSelectionIndex( p );
if( m_aModeChoices[sel].m_pStyle ) if( m_aGameCommands[sel].m_pStyle )
{ {
GAMESTATE->PlayersFinalized(); GAMESTATE->PlayersFinalized();
break; break;
@@ -219,8 +219,8 @@ void ScreenSelect::HandleScreenMessage( const ScreenMessage SM )
} }
const int iSelectionIndex = GetSelectionIndex(GAMESTATE->m_MasterPlayerNumber); const int iSelectionIndex = GetSelectionIndex(GAMESTATE->m_MasterPlayerNumber);
if( m_aModeChoices[iSelectionIndex].m_sScreen != "" ) if( m_aGameCommands[iSelectionIndex].m_sScreen != "" )
SCREENMAN->SetNewScreen( m_aModeChoices[iSelectionIndex ].m_sScreen ); SCREENMAN->SetNewScreen( m_aGameCommands[iSelectionIndex ].m_sScreen );
else else
SCREENMAN->SetNewScreen( NEXT_SCREEN(iSelectionIndex) ); SCREENMAN->SetNewScreen( NEXT_SCREEN(iSelectionIndex) );
} }
+3 -3
View File
@@ -5,7 +5,7 @@
#include "ScreenWithMenuElements.h" #include "ScreenWithMenuElements.h"
#include "BGAnimation.h" #include "BGAnimation.h"
#include "ModeChoice.h" #include "GameCommand.h"
#include "CodeDetector.h" #include "CodeDetector.h"
// Derived classes must send this when done // Derived classes must send this when done
@@ -33,10 +33,10 @@ protected:
void FinalizeChoices(); void FinalizeChoices();
vector<BGAnimation*> m_vpBGAnimations; vector<BGAnimation*> m_vpBGAnimations;
vector<ModeChoice> m_aModeChoices; // derived classes should look here for what choices are available vector<GameCommand> m_aGameCommands; // derived classes should look here for what choices are available
vector<CodeItem> m_aCodes; vector<CodeItem> m_aCodes;
vector<ModeChoice> m_aCodeChoices; vector<GameCommand> m_aCodeChoices;
vector<CString> m_aCodeActions; vector<CString> m_aCodeActions;
}; };
+34 -34
View File
@@ -7,7 +7,7 @@
#include "ThemeManager.h" #include "ThemeManager.h"
#include "GameState.h" #include "GameState.h"
#include "AnnouncerManager.h" #include "AnnouncerManager.h"
#include "ModeChoice.h" #include "GameCommand.h"
#include "ActorUtil.h" #include "ActorUtil.h"
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
@@ -38,18 +38,18 @@ ScreenSelectDifficulty::ScreenSelectDifficulty( CString sClassName ) : ScreenSel
} }
unsigned c; // GCC is bitching again. unsigned c; // GCC is bitching again.
for( c=0; c<m_aModeChoices.size(); c++ ) for( c=0; c<m_aGameCommands.size(); c++ )
{ {
if( (int)c < NUM_CHOICES_ON_PAGE_1 ) if( (int)c < NUM_CHOICES_ON_PAGE_1 )
m_ModeChoices[PAGE_1].push_back( m_aModeChoices[c] ); m_GameCommands[PAGE_1].push_back( m_aGameCommands[c] );
else else
m_ModeChoices[PAGE_2].push_back( m_aModeChoices[c] ); m_GameCommands[PAGE_2].push_back( m_aGameCommands[c] );
} }
c = 0; c = 0;
for( int page=0; page<NUM_PAGES; page++ ) for( int page=0; page<NUM_PAGES; page++ )
{ {
for( unsigned choice=0; choice<m_ModeChoices[page].size(); choice++, c++ ) for( unsigned choice=0; choice<m_GameCommands[page].size(); choice++, c++ )
{ {
CString sInfoFile = ssprintf( "%s info%d", m_sName.c_str(), c+1 ); CString sInfoFile = ssprintf( "%s info%d", m_sName.c_str(), c+1 );
CString sPictureFile = ssprintf( "%s picture%d", m_sName.c_str(), c+1 ); CString sPictureFile = ssprintf( "%s picture%d", m_sName.c_str(), c+1 );
@@ -77,7 +77,7 @@ ScreenSelectDifficulty::ScreenSelectDifficulty( CString sClassName ) : ScreenSel
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
{ {
CLAMP( m_iChoiceOnPage[p], 0, (int)m_ModeChoices[0].size()-1 ); CLAMP( m_iChoiceOnPage[p], 0, (int)m_GameCommands[0].size()-1 );
m_bChosen[p] = false; m_bChosen[p] = false;
if( !GAMESTATE->IsHumanPlayer(p) ) if( !GAMESTATE->IsHumanPlayer(p) )
@@ -142,7 +142,7 @@ int ScreenSelectDifficulty::GetSelectionIndex( PlayerNumber pn )
{ {
int index = 0; int index = 0;
for( int page=0; page<m_CurrentPage; page++ ) for( int page=0; page<m_CurrentPage; page++ )
index += m_ModeChoices[page].size(); index += m_GameCommands[page].size();
index += m_iChoiceOnPage[pn]; index += m_iChoiceOnPage[pn];
return index; return index;
} }
@@ -153,11 +153,11 @@ void ScreenSelectDifficulty::UpdateSelectableChoices()
{ {
/* XXX: If a player joins during the tween-in, this diffuse change /* XXX: If a player joins during the tween-in, this diffuse change
* will be undone by the tween. Hmm. */ * will be undone by the tween. Hmm. */
for( unsigned i=0; i<m_ModeChoices[page].size(); i++ ) for( unsigned i=0; i<m_GameCommands[page].size(); i++ )
{ {
/* If the icon is text, use a dimmer diffuse, or we won't be /* If the icon is text, use a dimmer diffuse, or we won't be
* able to see the glow. */ * able to see the glow. */
if( m_ModeChoices[page][i].IsPlayable() ) if( m_GameCommands[page][i].IsPlayable() )
{ {
m_sprInfo[page][i].SetDiffuse( RageColor(1,1,1,1) ); m_sprInfo[page][i].SetDiffuse( RageColor(1,1,1,1) );
m_sprPicture[page][i].SetDiffuse( RageColor(1,1,1,1) ); m_sprPicture[page][i].SetDiffuse( RageColor(1,1,1,1) );
@@ -180,7 +180,7 @@ void ScreenSelectDifficulty::UpdateSelectableChoices()
// } // }
} }
static bool BothPlayersModeChoice( const ModeChoice &mc ) static bool BothPlayersGameCommand( const GameCommand &mc )
{ {
switch( mc.m_pm ) switch( mc.m_pm )
{ {
@@ -209,8 +209,8 @@ void ScreenSelectDifficulty::MenuLeft( PlayerNumber pn )
int iSwitchToIndex = -1; int iSwitchToIndex = -1;
for( int i=m_iChoiceOnPage[pn]-1; i>=0; i-- ) for( int i=m_iChoiceOnPage[pn]-1; i>=0; i-- )
{ {
const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i]; const GameCommand &mc = m_GameCommands[m_CurrentPage][i];
if( AnotherPlayerSelected && BothPlayersModeChoice(mc) ) if( AnotherPlayerSelected && BothPlayersGameCommand(mc) )
continue; continue;
if( mc.IsPlayable() ) if( mc.IsPlayable() )
{ {
@@ -243,10 +243,10 @@ void ScreenSelectDifficulty::MenuRight( PlayerNumber pn )
AnotherPlayerSelected = true; AnotherPlayerSelected = true;
int iSwitchToIndex = -1; int iSwitchToIndex = -1;
for( int i=m_iChoiceOnPage[pn]+1; i<(int) m_ModeChoices[m_CurrentPage].size(); i++ ) for( int i=m_iChoiceOnPage[pn]+1; i<(int) m_GameCommands[m_CurrentPage].size(); i++ )
{ {
const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i]; const GameCommand &mc = m_GameCommands[m_CurrentPage][i];
if( AnotherPlayerSelected && BothPlayersModeChoice(mc) ) if( AnotherPlayerSelected && BothPlayersGameCommand(mc) )
continue; continue;
if( mc.IsPlayable() ) if( mc.IsPlayable() )
{ {
@@ -257,7 +257,7 @@ void ScreenSelectDifficulty::MenuRight( PlayerNumber pn )
if( iSwitchToIndex == -1 ) if( iSwitchToIndex == -1 )
{ {
if( m_ModeChoices[m_CurrentPage+1].size()==0 ) // there is no page 2 if( m_GameCommands[m_CurrentPage+1].size()==0 ) // there is no page 2
return; return;
if( m_CurrentPage < NUM_PAGES-1 ) if( m_CurrentPage < NUM_PAGES-1 )
@@ -290,18 +290,18 @@ void ScreenSelectDifficulty::ChangePage( Page newPage )
int iSwitchToIndex = -1; int iSwitchToIndex = -1;
if( !bPageIncreasing ) if( !bPageIncreasing )
{ {
for( int i=m_ModeChoices[newPage].size()-1; i>=0; i-- ) for( int i=m_GameCommands[newPage].size()-1; i>=0; i-- )
{ {
if( m_ModeChoices[newPage][i].IsPlayable() ) if( m_GameCommands[newPage][i].IsPlayable() )
{ {
iSwitchToIndex = i; iSwitchToIndex = i;
break; break;
} }
} }
} else { } else {
for( unsigned i=0; i<m_ModeChoices[newPage].size(); i++ ) for( unsigned i=0; i<m_GameCommands[newPage].size(); i++ )
{ {
if( m_ModeChoices[newPage][i].IsPlayable() ) if( m_GameCommands[newPage][i].IsPlayable() )
{ {
iSwitchToIndex = i; iSwitchToIndex = i;
break; break;
@@ -325,7 +325,7 @@ void ScreenSelectDifficulty::ChangePage( Page newPage )
bool ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages ) bool ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages )
{ {
ASSERT_M( iNewChoice >= 0 && iNewChoice < (int) m_ModeChoices[m_CurrentPage].size(), ssprintf("%i, %i", iNewChoice, (int) m_ModeChoices[m_CurrentPage].size()) ); ASSERT_M( iNewChoice >= 0 && iNewChoice < (int) m_GameCommands[m_CurrentPage].size(), ssprintf("%i, %i", iNewChoice, (int) m_GameCommands[m_CurrentPage].size()) );
bool bAnyChanged = false; bool bAnyChanged = false;
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
@@ -369,7 +369,7 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
for( int page=0; page<NUM_PAGES; page++ ) for( int page=0; page<NUM_PAGES; page++ )
OFF_COMMAND( m_sprMore[page] ); OFF_COMMAND( m_sprMore[page] );
const ModeChoice& mc = m_ModeChoices[m_CurrentPage][m_iChoiceOnPage[pn]]; const GameCommand& mc = m_GameCommands[m_CurrentPage][m_iChoiceOnPage[pn]];
/* Don't play sound if we're recursive, since it just played. */ /* Don't play sound if we're recursive, since it just played. */
static bool bPlaySelect = true; static bool bPlaySelect = true;
@@ -380,7 +380,7 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
} }
// courses should be selected for both players at all times // courses should be selected for both players at all times
if( BothPlayersModeChoice(mc) ) if( BothPlayersGameCommand(mc) )
{ {
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
{ {
@@ -401,24 +401,24 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
if( m_bChosen[p] || p == pn ) if( m_bChosen[p] || p == pn )
continue; continue;
if( !BothPlayersModeChoice(m_ModeChoices[m_CurrentPage][m_iChoiceOnPage[p]]) ) if( !BothPlayersGameCommand(m_GameCommands[m_CurrentPage][m_iChoiceOnPage[p]]) )
continue; continue;
/* This player is currently on a choice that is no longer available due to /* This player is currently on a choice that is no longer available due to
* the selection just made. */ * the selection just made. */
int iSwitchToIndex = -1; int iSwitchToIndex = -1;
for( int i=m_iChoiceOnPage[p]+1; iSwitchToIndex == -1 && i < (int) m_ModeChoices[m_CurrentPage].size(); ++i ) for( int i=m_iChoiceOnPage[p]+1; iSwitchToIndex == -1 && i < (int) m_GameCommands[m_CurrentPage].size(); ++i )
{ {
const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i]; const GameCommand &mc = m_GameCommands[m_CurrentPage][i];
if( mc.IsPlayable() && !BothPlayersModeChoice(mc) ) if( mc.IsPlayable() && !BothPlayersGameCommand(mc) )
iSwitchToIndex = i; iSwitchToIndex = i;
} }
if( iSwitchToIndex == -1 ) /* couldn't find a spot looking up; look down */ if( iSwitchToIndex == -1 ) /* couldn't find a spot looking up; look down */
{ {
for( int i=m_iChoiceOnPage[p]-1; iSwitchToIndex == -1 && i >= 0; --i ) for( int i=m_iChoiceOnPage[p]-1; iSwitchToIndex == -1 && i >= 0; --i )
{ {
const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i]; const GameCommand &mc = m_GameCommands[m_CurrentPage][i];
if( mc.IsPlayable() && !BothPlayersModeChoice(mc) ) if( mc.IsPlayable() && !BothPlayersGameCommand(mc) )
iSwitchToIndex = i; iSwitchToIndex = i;
} }
} }
@@ -443,16 +443,16 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
if( bAnyPlayersLeft ) if( bAnyPlayersLeft )
{ {
for( unsigned c=0; c<m_ModeChoices[PAGE_1].size(); c++ ) for( unsigned c=0; c<m_GameCommands[PAGE_1].size(); c++ )
{ {
if( BothPlayersModeChoice(m_ModeChoices[PAGE_1][c]) ) if( BothPlayersGameCommand(m_GameCommands[PAGE_1][c]) )
{ {
m_sprPicture[PAGE_1][c].Command( IGNORED_ELEMENT_COMMAND ); m_sprPicture[PAGE_1][c].Command( IGNORED_ELEMENT_COMMAND );
m_sprInfo[PAGE_1][c].Command( IGNORED_ELEMENT_COMMAND ); m_sprInfo[PAGE_1][c].Command( IGNORED_ELEMENT_COMMAND );
// IGNORED_ELEMENT_COMMAND // IGNORED_ELEMENT_COMMAND
} }
// m_ModeChoices[PAGE_1].push_back( m_aModeChoices[c] ); // m_GameCommands[PAGE_1].push_back( m_aGameCommands[c] );
} }
} }
} }
@@ -494,7 +494,7 @@ void ScreenSelectDifficulty::TweenOnScreen()
SET_XY_AND_ON_COMMAND( m_sprExplanation[page] ); SET_XY_AND_ON_COMMAND( m_sprExplanation[page] );
SET_XY_AND_ON_COMMAND( m_sprMore[page] ); SET_XY_AND_ON_COMMAND( m_sprMore[page] );
for( unsigned c=0; c<m_ModeChoices[page].size(); c++ ) for( unsigned c=0; c<m_GameCommands[page].size(); c++ )
{ {
SET_XY_AND_ON_COMMAND( m_sprInfo[page][c] ); SET_XY_AND_ON_COMMAND( m_sprInfo[page][c] );
SET_XY_AND_ON_COMMAND( m_sprPicture[page][c] ); SET_XY_AND_ON_COMMAND( m_sprPicture[page][c] );
@@ -528,7 +528,7 @@ void ScreenSelectDifficulty::TweenOffScreen()
OFF_COMMAND( m_sprShadow[p] ); OFF_COMMAND( m_sprShadow[p] );
} }
for( unsigned c=0; c<m_ModeChoices[page].size(); c++ ) for( unsigned c=0; c<m_GameCommands[page].size(); c++ )
{ {
OFF_COMMAND( m_sprInfo[page][c] ); OFF_COMMAND( m_sprInfo[page][c] );
OFF_COMMAND( m_sprPicture[page][c] ); OFF_COMMAND( m_sprPicture[page][c] );
+1 -1
View File
@@ -52,7 +52,7 @@ protected:
RageSound m_soundChange; RageSound m_soundChange;
RandomSample m_soundDifficult; RandomSample m_soundDifficult;
vector<ModeChoice> m_ModeChoices[NUM_PAGES]; vector<GameCommand> m_GameCommands[NUM_PAGES];
Page m_CurrentPage; Page m_CurrentPage;
int m_iChoiceOnPage[NUM_PLAYERS]; int m_iChoiceOnPage[NUM_PLAYERS];
+28 -28
View File
@@ -7,7 +7,7 @@
#include "GameSoundManager.h" #include "GameSoundManager.h"
#include "GameState.h" #include "GameState.h"
#include "AnnouncerManager.h" #include "AnnouncerManager.h"
#include "ModeChoice.h" #include "GameCommand.h"
#include "ActorUtil.h" #include "ActorUtil.h"
#include "RageLog.h" #include "RageLog.h"
#include <set> #include <set>
@@ -42,9 +42,9 @@ REGISTER_SCREEN_CLASS( ScreenSelectMaster );
ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sClassName ) ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sClassName )
{ {
int iDefaultChoice = -1; int iDefaultChoice = -1;
for( unsigned c=0; c<m_aModeChoices.size(); c++ ) for( unsigned c=0; c<m_aGameCommands.size(); c++ )
{ {
const ModeChoice& mc = m_aModeChoices[c]; const GameCommand& mc = m_aGameCommands[c];
if( mc.m_sName == DEFAULT_CHOICE ) if( mc.m_sName == DEFAULT_CHOICE )
{ {
iDefaultChoice = c; iDefaultChoice = c;
@@ -99,9 +99,9 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
m_Scroller[0].SetName( "Scroller" ); m_Scroller[0].SetName( "Scroller" );
this->AddChild( &m_Scroller[0] ); this->AddChild( &m_Scroller[0] );
for( unsigned c=0; c<m_aModeChoices.size(); c++ ) for( unsigned c=0; c<m_aGameCommands.size(); c++ )
{ {
const ModeChoice& mc = m_aModeChoices[c]; const GameCommand& mc = m_aGameCommands[c];
CString sFName = ssprintf("%s Scroll Choice%s", m_sName.c_str(),mc.m_sName.c_str()); CString sFName = ssprintf("%s Scroll Choice%s", m_sName.c_str(),mc.m_sName.c_str());
m_sprScroll[c][0].Load( THEME->GetPathToG(sFName) ); m_sprScroll[c][0].Load( THEME->GetPathToG(sFName) );
@@ -123,9 +123,9 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
m_Scroller[p].SetName( ssprintf("ScrollerP%d",p+1) ); m_Scroller[p].SetName( ssprintf("ScrollerP%d",p+1) );
this->AddChild( &m_Scroller[p] ); this->AddChild( &m_Scroller[p] );
for( unsigned c=0; c<m_aModeChoices.size(); c++ ) for( unsigned c=0; c<m_aGameCommands.size(); c++ )
{ {
const ModeChoice& mc = m_aModeChoices[c]; const GameCommand& mc = m_aGameCommands[c];
CString sFName = ssprintf("%s Scroll Choice%s P%d", m_sName.c_str(),mc.m_sName.c_str(),p+1); CString sFName = ssprintf("%s Scroll Choice%s P%d", m_sName.c_str(),mc.m_sName.c_str(),p+1);
m_sprScroll[c][p].Load( THEME->GetPathToG(sFName) ); m_sprScroll[c][p].Load( THEME->GetPathToG(sFName) );
@@ -136,9 +136,9 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
} }
} }
for( unsigned c=0; c<m_aModeChoices.size(); c++ ) for( unsigned c=0; c<m_aGameCommands.size(); c++ )
{ {
const ModeChoice& mc = m_aModeChoices[c]; const GameCommand& mc = m_aGameCommands[c];
// init icon // init icon
for( int i=0; i<NUM_ICON_PARTS; i++ ) for( int i=0; i<NUM_ICON_PARTS; i++ )
@@ -190,7 +190,7 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
{ {
CLAMP( m_iChoice[p], 0, (int)m_aModeChoices.size()-1 ); CLAMP( m_iChoice[p], 0, (int)m_aGameCommands.size()-1 );
m_bChosen[p] = false; m_bChosen[p] = false;
} }
@@ -201,7 +201,7 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
for( int dir = 0; dir < NUM_DIRS; ++dir ) for( int dir = 0; dir < NUM_DIRS; ++dir )
{ {
/* Reasonable defaults: */ /* Reasonable defaults: */
for( unsigned c = 0; c < m_aModeChoices.size(); ++c ) for( unsigned c = 0; c < m_aGameCommands.size(); ++c )
{ {
int add; int add;
switch( dir ) switch( dir )
@@ -214,9 +214,9 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
m_Next[dir][c] = c + add; m_Next[dir][c] = c + add;
/* By default, only wrap around for DIR_AUTO. */ /* By default, only wrap around for DIR_AUTO. */
if( dir == DIR_AUTO ) if( dir == DIR_AUTO )
wrap( m_Next[dir][c], m_aModeChoices.size() ); wrap( m_Next[dir][c], m_aGameCommands.size() );
else else
m_Next[dir][c] = clamp( m_Next[dir][c], 0, (int)m_aModeChoices.size()-1 ); m_Next[dir][c] = clamp( m_Next[dir][c], 0, (int)m_aGameCommands.size()-1 );
} }
const CString dirname = dirs[dir]; const CString dirname = dirs[dir];
@@ -239,8 +239,8 @@ ScreenSelectMaster::ScreenSelectMaster( CString sClassName ) : ScreenSelect( sCl
--from; --from;
--to; --to;
if( from >= m_aModeChoices.size() || if( from >= m_aGameCommands.size() ||
to >= m_aModeChoices.size() ) to >= m_aGameCommands.size() )
{ {
LOG->Warn( "%s::OptionOrder%s out of range", m_sName.c_str(), dirname.c_str() ); LOG->Warn( "%s::OptionOrder%s out of range", m_sName.c_str(), dirname.c_str() );
continue; continue;
@@ -328,18 +328,18 @@ int ScreenSelectMaster::GetSelectionIndex( PlayerNumber pn )
void ScreenSelectMaster::UpdateSelectableChoices() void ScreenSelectMaster::UpdateSelectableChoices()
{ {
for( unsigned c=0; c<m_aModeChoices.size(); c++ ) for( unsigned c=0; c<m_aGameCommands.size(); c++ )
for( int i=0; i<NUM_ICON_PARTS; i++ ) for( int i=0; i<NUM_ICON_PARTS; i++ )
COMMAND( m_sprIcon[i][c], m_aModeChoices[c].IsPlayable()? "Enabled":"Disabled" ); COMMAND( m_sprIcon[i][c], m_aGameCommands[c].IsPlayable()? "Enabled":"Disabled" );
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
{ {
if( !GAMESTATE->IsHumanPlayer(p) ) if( !GAMESTATE->IsHumanPlayer(p) )
continue; continue;
if( !m_aModeChoices[m_iChoice[p]].IsPlayable() ) if( !m_aGameCommands[m_iChoice[p]].IsPlayable() )
Move( (PlayerNumber) p, DIR_AUTO ); Move( (PlayerNumber) p, DIR_AUTO );
ASSERT( m_aModeChoices[m_iChoice[p]].IsPlayable() ); ASSERT( m_aGameCommands[m_iChoice[p]].IsPlayable() );
} }
} }
@@ -356,7 +356,7 @@ bool ScreenSelectMaster::Move( PlayerNumber pn, Dirs dir )
return false; // went full circle and none found return false; // went full circle and none found
seen.insert( iSwitchToIndex ); seen.insert( iSwitchToIndex );
} }
while( !m_aModeChoices[iSwitchToIndex].IsPlayable() ); while( !m_aGameCommands[iSwitchToIndex].IsPlayable() );
return ChangeSelection( pn, iSwitchToIndex ); return ChangeSelection( pn, iSwitchToIndex );
} }
@@ -417,7 +417,7 @@ bool ScreenSelectMaster::ChangePage( int iNewChoice )
const CString sIconAndExplanationCommand = ssprintf( "SwitchToPage%d", newPage+1 ); const CString sIconAndExplanationCommand = ssprintf( "SwitchToPage%d", newPage+1 );
for( unsigned c=0; c<m_aModeChoices.size(); c++ ) for( unsigned c=0; c<m_aGameCommands.size(); c++ )
for( int i=0; i<NUM_ICON_PARTS; i++ ) for( int i=0; i<NUM_ICON_PARTS; i++ )
COMMAND( m_sprIcon[i][c], sIconAndExplanationCommand ); COMMAND( m_sprIcon[i][c], sIconAndExplanationCommand );
@@ -540,10 +540,10 @@ bool ScreenSelectMaster::ChangeSelection( PlayerNumber pn, int iNewChoice )
m_Scroller[p].SetDestinationItem( iNewChoice ); m_Scroller[p].SetDestinationItem( iNewChoice );
if( SHARED_PREVIEW_AND_CURSOR ) if( SHARED_PREVIEW_AND_CURSOR )
for( unsigned c=0; c<m_aModeChoices.size(); c++ ) for( unsigned c=0; c<m_aGameCommands.size(); c++ )
COMMAND( *m_sprScroll[c][0], int(c) == m_iChoice[0]? "GainFocus":"LoseFocus" ); COMMAND( *m_sprScroll[c][0], int(c) == m_iChoice[0]? "GainFocus":"LoseFocus" );
else else
for( unsigned c=0; c<m_aModeChoices.size(); c++ ) for( unsigned c=0; c<m_aGameCommands.size(); c++ )
COMMAND( *m_sprScroll[c][p], int(c) == m_iChoice[p]? "GainFocus":"LoseFocus" ); COMMAND( *m_sprScroll[c][p], int(c) == m_iChoice[p]? "GainFocus":"LoseFocus" );
} }
} }
@@ -594,7 +594,7 @@ void ScreenSelectMaster::MenuStart( PlayerNumber pn )
if( m_bChosen[pn] ) if( m_bChosen[pn] )
return; return;
ModeChoice &mc = m_aModeChoices[m_iChoice[pn]]; GameCommand &mc = m_aGameCommands[m_iChoice[pn]];
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("%s comment %s",m_sName.c_str(), mc.m_sName.c_str())) ); SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("%s comment %s",m_sName.c_str(), mc.m_sName.c_str())) );
SCREENMAN->PlayStartSound(); SCREENMAN->PlayStartSound();
@@ -635,7 +635,7 @@ void ScreenSelectMaster::MenuStart( PlayerNumber pn )
*/ */
void ScreenSelectMaster::TweenOnScreen() void ScreenSelectMaster::TweenOnScreen()
{ {
for( unsigned c=0; c<m_aModeChoices.size(); c++ ) for( unsigned c=0; c<m_aGameCommands.size(); c++ )
{ {
for( int i=0; i<NUM_ICON_PARTS; i++ ) for( int i=0; i<NUM_ICON_PARTS; i++ )
{ {
@@ -691,7 +691,7 @@ void ScreenSelectMaster::TweenOnScreen()
{ {
m_Scroller[0].SetCurrentAndDestinationItem( m_iChoice[0] ); m_Scroller[0].SetCurrentAndDestinationItem( m_iChoice[0] );
SET_XY_AND_ON_COMMAND( m_Scroller[0] ); SET_XY_AND_ON_COMMAND( m_Scroller[0] );
for( unsigned c=0; c<m_aModeChoices.size(); c++ ) for( unsigned c=0; c<m_aGameCommands.size(); c++ )
COMMAND( *m_sprScroll[c][0], int(c) == m_iChoice[0]? "GainFocus":"LoseFocus" ); COMMAND( *m_sprScroll[c][0], int(c) == m_iChoice[0]? "GainFocus":"LoseFocus" );
} }
else else
@@ -699,7 +699,7 @@ void ScreenSelectMaster::TweenOnScreen()
{ {
m_Scroller[p].SetCurrentAndDestinationItem( m_iChoice[p] ); m_Scroller[p].SetCurrentAndDestinationItem( m_iChoice[p] );
SET_XY_AND_ON_COMMAND( m_Scroller[p] ); SET_XY_AND_ON_COMMAND( m_Scroller[p] );
for( unsigned c=0; c<m_aModeChoices.size(); c++ ) for( unsigned c=0; c<m_aGameCommands.size(); c++ )
COMMAND( *m_sprScroll[c][p], int(c) == m_iChoice[p]? "GainFocus":"LoseFocus" ); COMMAND( *m_sprScroll[c][p], int(c) == m_iChoice[p]? "GainFocus":"LoseFocus" );
} }
} }
@@ -733,7 +733,7 @@ void ScreenSelectMaster::TweenOffScreen()
OFF_COMMAND( m_sprCursor[i][p] ); OFF_COMMAND( m_sprCursor[i][p] );
} }
for( unsigned c=0; c<m_aModeChoices.size(); c++ ) for( unsigned c=0; c<m_aGameCommands.size(); c++ )
{ {
if( GetPage(c) != GetCurrentPage() ) if( GetPage(c) != GetCurrentPage() )
continue; // skip continue; // skip
+4 -4
View File
@@ -53,9 +53,9 @@ ScreenSelectMode::ScreenSelectMode( CString sClassName ) : ScreenSelect( sClassN
m_soundConfirm.Load( THEME->GetPathToS("ScreenSelectMode modeconfirm")); m_soundConfirm.Load( THEME->GetPathToS("ScreenSelectMode modeconfirm"));
m_soundStart.Load( THEME->GetPathToS("ScreenSelectMode menustart")); m_soundStart.Load( THEME->GetPathToS("ScreenSelectMode menustart"));
for( unsigned i=0; i<m_aModeChoices.size(); i++ ) for( unsigned i=0; i<m_aGameCommands.size(); i++ )
{ {
const ModeChoice& mc = m_aModeChoices[i]; const GameCommand& mc = m_aGameCommands[i];
// //
// Load Sprite // Load Sprite
@@ -186,9 +186,9 @@ void ScreenSelectMode::UpdateSelectableChoices()
m_iNumChoices = 0; m_iNumChoices = 0;
unsigned i=0; unsigned i=0;
unsigned j=0; unsigned j=0;
for( i=0; i<m_aModeChoices.size(); i++ ) for( i=0; i<m_aGameCommands.size(); i++ )
{ {
const ModeChoice& mc = m_aModeChoices[i]; const GameCommand& mc = m_aGameCommands[i];
CString modename = mc.m_sName; CString modename = mc.m_sName;
modename.MakeUpper(); modename.MakeUpper();
+1 -1
View File
@@ -11,7 +11,7 @@
#include "Quad.h" #include "Quad.h"
#include "ScrollingList.h" #include "ScrollingList.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "ModeChoice.h" #include "GameCommand.h"
#include "BitmapText.h" #include "BitmapText.h"
#include "RandomSample.h" #include "RandomSample.h"
#include "Character.h" #include "Character.h"
+14 -14
View File
@@ -25,9 +25,9 @@ ScreenSelectStyle::ScreenSelectStyle( CString sClassName ) : ScreenSelect( sClas
LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU ); LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU );
for( unsigned i=0; i<m_aModeChoices.size(); i++ ) for( unsigned i=0; i<m_aGameCommands.size(); i++ )
{ {
const ModeChoice& mc = m_aModeChoices[i]; const GameCommand& mc = m_aGameCommands[i];
// //
// Load icon // Load icon
@@ -92,9 +92,9 @@ ScreenSelectStyle::ScreenSelectStyle( CString sClassName ) : ScreenSelect( sClas
// fix Z ordering of Picture and Info so that they draw on top // fix Z ordering of Picture and Info so that they draw on top
for( unsigned i=0; i<this->m_aModeChoices.size(); i++ ) for( unsigned i=0; i<this->m_aGameCommands.size(); i++ )
this->MoveToTail( &m_sprPicture[i] ); this->MoveToTail( &m_sprPicture[i] );
for( unsigned i=0; i<this->m_aModeChoices.size(); i++ ) for( unsigned i=0; i<this->m_aGameCommands.size(); i++ )
this->MoveToTail( &m_sprInfo[i] ); this->MoveToTail( &m_sprInfo[i] );
@@ -121,7 +121,7 @@ ScreenSelectStyle::ScreenSelectStyle( CString sClassName ) : ScreenSelect( sClas
// //
// TweenOnScreen // TweenOnScreen
// //
for( unsigned i=0; i<m_aModeChoices.size(); i++ ) for( unsigned i=0; i<m_aGameCommands.size(); i++ )
{ {
SET_XY_AND_ON_COMMAND( m_textIcon[i] ); SET_XY_AND_ON_COMMAND( m_textIcon[i] );
SET_XY_AND_ON_COMMAND( m_sprIcon[i] ); SET_XY_AND_ON_COMMAND( m_sprIcon[i] );
@@ -139,7 +139,7 @@ void ScreenSelectStyle::MenuLeft( PlayerNumber pn )
int iSwitchToIndex = -1; // -1 means none found int iSwitchToIndex = -1; // -1 means none found
for( int i=m_iSelection-1; i>=0; i-- ) for( int i=m_iSelection-1; i>=0; i-- )
{ {
if( m_aModeChoices[i].IsPlayable() ) if( m_aGameCommands[i].IsPlayable() )
{ {
iSwitchToIndex = i; iSwitchToIndex = i;
break; break;
@@ -158,9 +158,9 @@ void ScreenSelectStyle::MenuLeft( PlayerNumber pn )
void ScreenSelectStyle::MenuRight( PlayerNumber pn ) void ScreenSelectStyle::MenuRight( PlayerNumber pn )
{ {
int iSwitchToIndex = -1; // -1 means none found int iSwitchToIndex = -1; // -1 means none found
for( unsigned i=m_iSelection+1; i<m_aModeChoices.size(); i++ ) for( unsigned i=m_iSelection+1; i<m_aGameCommands.size(); i++ )
{ {
if( m_aModeChoices[i].IsPlayable() ) if( m_aGameCommands[i].IsPlayable() )
{ {
iSwitchToIndex = i; iSwitchToIndex = i;
break; break;
@@ -190,14 +190,14 @@ void ScreenSelectStyle::MenuStart( PlayerNumber pn )
SCREENMAN->PlayStartSound(); SCREENMAN->PlayStartSound();
SCREENMAN->SendMessageToTopScreen( SM_AllDoneChoosing ); SCREENMAN->SendMessageToTopScreen( SM_AllDoneChoosing );
const ModeChoice& mc = m_aModeChoices[GetSelectionIndex(pn)]; const GameCommand& mc = m_aGameCommands[GetSelectionIndex(pn)];
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("%s comment %s",m_sName.c_str(),mc.m_sName.c_str())) ); SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("%s comment %s",m_sName.c_str(),mc.m_sName.c_str())) );
// //
// TweenOffScreen // TweenOffScreen
// //
for( unsigned i=0; i<m_aModeChoices.size(); i++ ) for( unsigned i=0; i<m_aGameCommands.size(); i++ )
{ {
OFF_COMMAND( m_sprIcon[i] ); OFF_COMMAND( m_sprIcon[i] );
OFF_COMMAND( m_textIcon[i] ); OFF_COMMAND( m_textIcon[i] );
@@ -216,11 +216,11 @@ int ScreenSelectStyle::GetSelectionIndex( PlayerNumber pn )
void ScreenSelectStyle::UpdateSelectableChoices() void ScreenSelectStyle::UpdateSelectableChoices()
{ {
for( unsigned i=0; i<m_aModeChoices.size(); i++ ) for( unsigned i=0; i<m_aGameCommands.size(); i++ )
{ {
/* If the icon is text, use a dimmer diffuse, or we won't be /* If the icon is text, use a dimmer diffuse, or we won't be
* able to see the glow. */ * able to see the glow. */
if( m_aModeChoices[i].IsPlayable() ) if( m_aGameCommands[i].IsPlayable() )
{ {
m_sprIcon[i].SetDiffuse( RageColor(1,1,1,1) ); 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 m_textIcon[i].SetDiffuse( RageColor(0.5f,0.5f,0.5f,1) ); // gray so glow is visible
@@ -236,9 +236,9 @@ void ScreenSelectStyle::UpdateSelectableChoices()
BeforeChange(); BeforeChange();
int iSwitchToStyleIndex = -1; // -1 means none found int iSwitchToStyleIndex = -1; // -1 means none found
for( unsigned i=0; i<m_aModeChoices.size(); i++ ) for( unsigned i=0; i<m_aGameCommands.size(); i++ )
{ {
const ModeChoice& mc = m_aModeChoices[i]; const GameCommand& mc = m_aGameCommands[i];
if( mc.IsPlayable() ) if( mc.IsPlayable() )
{ {
iSwitchToStyleIndex = i; iSwitchToStyleIndex = i;
+7 -7
View File
@@ -144,9 +144,9 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam
{ {
case COIN_HOME: case COIN_HOME:
{ {
for( unsigned i=0; i<m_aModeChoices.size(); i++ ) for( unsigned i=0; i<m_aGameCommands.size(); i++ )
{ {
ModeChoice &mc = m_aModeChoices[i]; GameCommand &mc = m_aGameCommands[i];
m_textChoice[i].LoadFromFont( THEME->GetPathToF("ScreenTitleMenu choices") ); m_textChoice[i].LoadFromFont( THEME->GetPathToF("ScreenTitleMenu choices") );
m_textChoice[i].SetHorizAlign( (enum Actor::HorizAlign)MENU_TEXT_ALIGN ); m_textChoice[i].SetHorizAlign( (enum Actor::HorizAlign)MENU_TEXT_ALIGN );
@@ -180,7 +180,7 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam
m_Choice = 0; m_Choice = 0;
for( unsigned i=0; i<m_aModeChoices.size(); i++ ) for( unsigned i=0; i<m_aGameCommands.size(); i++ )
if( i != m_Choice ) if( i != m_Choice )
{ {
m_textChoice[i].SetZoom( ZOOM_NOT_SELECTED ); m_textChoice[i].SetZoom( ZOOM_NOT_SELECTED );
@@ -218,7 +218,7 @@ void ScreenTitleMenu::MoveCursor( bool up )
TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */ TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */
LoseFocus( m_Choice ); LoseFocus( m_Choice );
m_Choice += (up? -1:+1); m_Choice += (up? -1:+1);
wrap( (int&)m_Choice, m_aModeChoices.size() ); wrap( (int&)m_Choice, m_aGameCommands.size() );
m_soundChange.Play(); m_soundChange.Play();
GainFocus( m_Choice ); GainFocus( m_Choice );
} }
@@ -231,7 +231,7 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
return; return;
/* If the CoinMode was changed, we need to reload this screen /* If the CoinMode was changed, we need to reload this screen
* so that the right m_aModeChoices will show */ * so that the right m_aGameCommands will show */
if( ScreenAttract::ChangeCoinModeInput( DeviceI, type, GameI, MenuI, StyleI ) ) if( ScreenAttract::ChangeCoinModeInput( DeviceI, type, GameI, MenuI, StyleI ) )
{ {
SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
@@ -261,7 +261,7 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
break; break;
case MENU_BUTTON_START: case MENU_BUTTON_START:
/* return if the choice is invalid */ /* return if the choice is invalid */
const ModeChoice &mc = m_aModeChoices[m_Choice]; const GameCommand &mc = m_aGameCommands[m_Choice];
CString why; CString why;
if( !mc.IsPlayable( &why ) ) if( !mc.IsPlayable( &why ) )
{ {
@@ -366,7 +366,7 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM )
GAMESTATE->m_PlayerOptions[p].FromString( PREFSMAN->m_sDefaultModifiers ); GAMESTATE->m_PlayerOptions[p].FromString( PREFSMAN->m_sDefaultModifiers );
GAMESTATE->m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers ); GAMESTATE->m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers );
} }
m_aModeChoices[m_Choice].ApplyToAllPlayers(); m_aGameCommands[m_Choice].ApplyToAllPlayers();
break; break;
case SM_GoToAttractLoop: case SM_GoToAttractLoop:
SCREENMAN->SetNewScreen( INITIAL_SCREEN ); SCREENMAN->SetNewScreen( INITIAL_SCREEN );
+11 -11
View File
@@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4> # Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00 # Microsoft Developer Studio Generated Build File, Format Version 60000
# ** DO NOT EDIT ** # ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101 # TARGTYPE "Win32 (x86) Application" 0x0101
@@ -62,7 +62,7 @@ IntDir=.\../Debug6
TargetDir=\stepmania\stepmania\Program TargetDir=\stepmania\stepmania\Program
TargetName=StepMania-debug TargetName=StepMania-debug
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool # End Special Build Tool
@@ -99,7 +99,7 @@ IntDir=.\../Release6
TargetDir=\stepmania\stepmania\Program TargetDir=\stepmania\stepmania\Program
TargetName=StepMania TargetName=StepMania
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool # End Special Build Tool
@@ -740,6 +740,14 @@ SOURCE=.\Game.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\GameCommand.cpp
# End Source File
# Begin Source File
SOURCE=.\GameCommand.h
# End Source File
# Begin Source File
SOURCE=.\GameConstantsAndTypes.cpp SOURCE=.\GameConstantsAndTypes.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -804,14 +812,6 @@ SOURCE=.\LyricsLoader.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\ModeChoice.cpp
# End Source File
# Begin Source File
SOURCE=.\ModeChoice.h
# End Source File
# Begin Source File
SOURCE=.\NoteData.cpp SOURCE=.\NoteData.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
+12 -12
View File
@@ -683,6 +683,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File <File
RelativePath="Game.h"> RelativePath="Game.h">
</File> </File>
<File
RelativePath="GameCommand.cpp">
</File>
<File
RelativePath="GameCommand.h">
</File>
<File <File
RelativePath="GameConstantsAndTypes.cpp"> RelativePath="GameConstantsAndTypes.cpp">
</File> </File>
@@ -731,12 +737,6 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File <File
RelativePath="MenuInput.h"> RelativePath="MenuInput.h">
</File> </File>
<File
RelativePath="ModeChoice.cpp">
</File>
<File
RelativePath="ModeChoice.h">
</File>
<File <File
RelativePath="NoteData.cpp"> RelativePath="NoteData.cpp">
</File> </File>
@@ -2403,18 +2403,18 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File <File
RelativePath="UnlockSystem.h"> RelativePath="UnlockSystem.h">
</File> </File>
<File
RelativePath="ezsockets.cpp">
</File>
<File
RelativePath="ezsockets.h">
</File>
<File <File
RelativePath=".\VirtualKeyboard.cpp"> RelativePath=".\VirtualKeyboard.cpp">
</File> </File>
<File <File
RelativePath=".\VirtualKeyboard.h"> RelativePath=".\VirtualKeyboard.h">
</File> </File>
<File
RelativePath="ezsockets.cpp">
</File>
<File
RelativePath="ezsockets.h">
</File>
</Filter> </Filter>
<Filter <Filter
Name="Crypto" Name="Crypto"