cleanup: override SM_GoToNextScreen instead of having a different path

This commit is contained in:
Glenn Maynard
2005-07-12 06:33:00 +00:00
parent 57cef3fb5a
commit c570457834
20 changed files with 260 additions and 267 deletions
+52 -52
View File
@@ -86,6 +86,58 @@ void ScreenCourseManager::Init()
void ScreenCourseManager::HandleScreenMessage( const ScreenMessage SM )
{
if( SM == SM_GoToNextScreen )
{
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
{
default:
ASSERT(0);
case ROW_COURSE_GROUP:
SCREENMAN->PlayInvalidSound();
break;
case ROW_COURSE:
SCREENMAN->PlayInvalidSound();
break;
case ROW_ACTION:
{
OptionRow &row = *m_pRows[ROW_ACTION];
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
vector<CourseManagerAction> vActions;
GetPossibleActions( vActions );
CourseManagerAction action = vActions[iChoice];
switch( action )
{
default:
ASSERT(0);
case ACTION_EDIT:
GAMESTATE->m_iEditCourseEntryIndex.Set( 0 );
SCREENMAN->SetNewScreen( "ScreenEditCourse" );
break;
case ACTION_DELETE:
SCREENMAN->PlayInvalidSound();
break;
case ACTION_COPY_TO_NEW:
SCREENMAN->PlayInvalidSound();
break;
case ACTION_CREATE_NEW:
SCREENMAN->PlayInvalidSound();
break;
}
}
break;
case ROW_DONE:
SCREENMAN->SetNewScreen( FIRST_ATTRACT_SCREEN );
break;
}
return;
}
else if( SM == SM_GoToPrevScreen )
{
SCREENMAN->SetNewScreen( FIRST_ATTRACT_SCREEN );
return;
}
ScreenOptions::HandleScreenMessage( SM );
}
@@ -178,58 +230,6 @@ void ScreenCourseManager::ExportOptions( int row, const vector<PlayerNumber> &vp
}
void ScreenCourseManager::GoToNextScreen()
{
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
{
default:
ASSERT(0);
case ROW_COURSE_GROUP:
SCREENMAN->PlayInvalidSound();
break;
case ROW_COURSE:
SCREENMAN->PlayInvalidSound();
break;
case ROW_ACTION:
{
OptionRow &row = *m_pRows[ROW_ACTION];
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
vector<CourseManagerAction> vActions;
GetPossibleActions( vActions );
CourseManagerAction action = vActions[iChoice];
switch( action )
{
default:
ASSERT(0);
case ACTION_EDIT:
GAMESTATE->m_iEditCourseEntryIndex.Set( 0 );
SCREENMAN->SetNewScreen( "ScreenEditCourse" );
break;
case ACTION_DELETE:
SCREENMAN->PlayInvalidSound();
break;
case ACTION_COPY_TO_NEW:
SCREENMAN->PlayInvalidSound();
break;
case ACTION_CREATE_NEW:
SCREENMAN->PlayInvalidSound();
break;
}
}
break;
case ROW_DONE:
SCREENMAN->SetNewScreen( FIRST_ATTRACT_SCREEN );
break;
}
}
void ScreenCourseManager::GoToPrevScreen()
{
SCREENMAN->SetNewScreen( FIRST_ATTRACT_SCREEN );
}
/*
* (c) 2002-2004 Chris Danford
* All rights reserved.
-3
View File
@@ -16,9 +16,6 @@ protected:
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void GoToNextScreen();
virtual void GoToPrevScreen();
virtual void AfterChangeValueInRow( PlayerNumber pn );
virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type );
};
+35 -34
View File
@@ -146,6 +146,41 @@ void ScreenEditCourse::Init()
void ScreenEditCourse::HandleScreenMessage( const ScreenMessage SM )
{
if( SM == SM_GoToNextScreen )
{
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
{
default:
case ROW_TITLE:
case ROW_REPEAT:
case ROW_RANDOMIZE:
case ROW_LIVES:
case ROW_TYPE:
case ROW_TYPE_METER:
ASSERT(0);
case ROW_INSERT_ENTRY:
case ROW_DELETE_ENTRY:
SCREENMAN->SetNewScreen( "ScreenEditCourse" );
break;
case ROW_EDIT_ENTRY:
SCREENMAN->SetNewScreen( "ScreenEditCourseEntry" );
break;
case ROW_DONE:
SCREENMAN->SetNewScreen( "ScreenCourseManager" );
break;
}
return;
}
else if( SM == SM_GoToPrevScreen )
{
// revert
Course *pCourse = GAMESTATE->m_pCurCourse;
*pCourse = m_Original;
SCREENMAN->SetNewScreen( "ScreenCourseManager" );
return;
}
ScreenOptions::HandleScreenMessage( SM );
}
@@ -245,40 +280,6 @@ void ScreenEditCourse::ExportOptions( int row, const vector<PlayerNumber> &vpns
}
void ScreenEditCourse::GoToNextScreen()
{
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
{
default:
case ROW_TITLE:
case ROW_REPEAT:
case ROW_RANDOMIZE:
case ROW_LIVES:
case ROW_TYPE:
case ROW_TYPE_METER:
ASSERT(0);
case ROW_INSERT_ENTRY:
case ROW_DELETE_ENTRY:
SCREENMAN->SetNewScreen( "ScreenEditCourse" );
break;
case ROW_EDIT_ENTRY:
SCREENMAN->SetNewScreen( "ScreenEditCourseEntry" );
break;
case ROW_DONE:
SCREENMAN->SetNewScreen( "ScreenCourseManager" );
break;
}
}
void ScreenEditCourse::GoToPrevScreen()
{
// revert
Course *pCourse = GAMESTATE->m_pCurCourse;
*pCourse = m_Original;
SCREENMAN->SetNewScreen( "ScreenCourseManager" );
}
void ScreenEditCourse::ProcessMenuStart( PlayerNumber pn, const InputEventType type )
{
Course *pCourse = GAMESTATE->m_pCurCourse;
-3
View File
@@ -17,9 +17,6 @@ protected:
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void GoToNextScreen();
virtual void GoToPrevScreen();
virtual void AfterChangeValueInRow( PlayerNumber pn );
virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type );
+30 -29
View File
@@ -112,6 +112,36 @@ void ScreenEditCourseEntry::Init()
void ScreenEditCourseEntry::HandleScreenMessage( const ScreenMessage SM )
{
if( SM == SM_GoToNextScreen )
{
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
{
case ROW_SONG_GROUP:
case ROW_SONG:
case ROW_BASE_DIFFICULTY:
case ROW_LOW_METER:
case ROW_HIGH_METER:
case ROW_CHOOSE_INDEX:
break;
case ROW_SET_MODS:
SCREENMAN->SetNewScreen( "ScreenEditCourseMods" );
break;
case ROW_DONE:
SCREENMAN->SetNewScreen( "ScreenEditCourse" );
break;
}
return;
}
else if( SM == SM_GoToPrevScreen )
{
// revert
Course *pCourse = GAMESTATE->m_pCurCourse;
pCourse->m_vEntries[ GAMESTATE->m_iEditCourseEntryIndex ] = m_Original;
SCREENMAN->SetNewScreen( "ScreenEditCourse" );
return;
}
ScreenOptions::HandleScreenMessage( SM );
}
@@ -301,35 +331,6 @@ void ScreenEditCourseEntry::ExportOptions( int row, const vector<PlayerNumber> &
}
void ScreenEditCourseEntry::GoToNextScreen()
{
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
{
case ROW_SONG_GROUP:
case ROW_SONG:
case ROW_BASE_DIFFICULTY:
case ROW_LOW_METER:
case ROW_HIGH_METER:
case ROW_CHOOSE_INDEX:
break;
case ROW_SET_MODS:
SCREENMAN->SetNewScreen( "ScreenEditCourseMods" );
break;
case ROW_DONE:
SCREENMAN->SetNewScreen( "ScreenEditCourse" );
break;
}
}
void ScreenEditCourseEntry::GoToPrevScreen()
{
// revert
Course *pCourse = GAMESTATE->m_pCurCourse;
pCourse->m_vEntries[ GAMESTATE->m_iEditCourseEntryIndex ] = m_Original;
SCREENMAN->SetNewScreen( "ScreenEditCourse" );
}
void ScreenEditCourseEntry::ProcessMenuStart( PlayerNumber pn, const InputEventType type )
{
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
-3
View File
@@ -17,9 +17,6 @@ protected:
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns ) {}
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void GoToNextScreen();
virtual void GoToPrevScreen();
virtual void AfterChangeValueInRow( PlayerNumber pn );
virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type );
+14 -8
View File
@@ -135,16 +135,22 @@ void ScreenMiniMenu::ExportOptions( int r, const vector<PlayerNumber> &vpns )
s_viLastAnswers[r] = m_pRows[r]->GetOneSharedSelection( true );
}
void ScreenMiniMenu::GoToNextScreen()
void ScreenMiniMenu::HandleScreenMessage( const ScreenMessage SM )
{
s_bCancelled = false;
SCREENMAN->PopTopScreen( m_SMSendOnOK );
}
if( SM == SM_GoToNextScreen )
{
s_bCancelled = false;
SCREENMAN->PopTopScreen( m_SMSendOnOK );
return;
}
else if( SM == SM_GoToPrevScreen )
{
s_bCancelled = true;
SCREENMAN->PopTopScreen( m_SMSendOnCancel );
return;
}
void ScreenMiniMenu::GoToPrevScreen()
{
s_bCancelled = true;
SCREENMAN->PopTopScreen( m_SMSendOnCancel );
ScreenOptions::HandleScreenMessage( SM );
}
+1 -3
View File
@@ -83,15 +83,13 @@ public:
ScreenMiniMenu( CString sScreenClass );
void Init( const MenuDef* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel );
void HandleScreenMessage( const ScreenMessage SM );
protected:
virtual void OnChange( PlayerNumber pn );
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void GoToNextScreen();
virtual void GoToPrevScreen();
// Screens that get pushed on top of other screens don't
// use the ScreenManager's shared background, so they must draw their own.
AutoActor m_Background;
+10 -10
View File
@@ -69,16 +69,6 @@ void ScreenNetworkOptions::Init()
}
void ScreenNetworkOptions::GoToPrevScreen()
{
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
}
void ScreenNetworkOptions::GoToNextScreen()
{
GoToPrevScreen();
}
void ScreenNetworkOptions::HandleScreenMessage( const ScreenMessage SM )
{
if( SM == SM_DoneConnecting )
@@ -108,6 +98,16 @@ void ScreenNetworkOptions::HandleScreenMessage( const ScreenMessage SM )
SCREENMAN->SystemMessage( "Server failed: " + NSMAN->LANserver->lastError + ssprintf(" Code:%d",NSMAN->LANserver->lastErrorCode) );
}
}
else if( SM == SM_GoToNextScreen )
{
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
return;
}
else if( SM == SM_GoToPrevScreen )
{
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
return;
}
ScreenOptions::HandleScreenMessage( SM );
}
-3
View File
@@ -17,9 +17,6 @@ private:
void ImportOptions( int row, const vector<PlayerNumber> &vpns );
void ExportOptions( int row, const vector<PlayerNumber> &vpns );
void GoToNextScreen();
void GoToPrevScreen();
void UpdateConnectStatus();
CString m_sClassName;
+24 -23
View File
@@ -154,29 +154,6 @@ void ScreenOptionsMaster::BeginFadingOut()
ScreenOptions::BeginFadingOut();
}
void ScreenOptionsMaster::GoToNextScreen()
{
if( SCREENMAN->IsStackedScreen(this) )
SCREENMAN->PopTopScreen( SM_None );
else if( m_bExportWillSetANewScreen )
; // Do nothing. Let Export set the screen.
else if( NEXT_SCREEN != "" )
SCREENMAN->SetNewScreen( NEXT_SCREEN );
}
void ScreenOptionsMaster::GoToPrevScreen()
{
if( SCREENMAN->IsStackedScreen(this) )
{
SCREENMAN->PopTopScreen( SM_None );
}
else
{
SCREENMAN->DeletePreparedScreens();
SCREENMAN->SetNewScreen( PREV_SCREEN );
}
}
void ScreenOptionsMaster::RefreshIcons( int r, PlayerNumber pn )
{
OptionRow &row = *m_pRows[r];
@@ -272,6 +249,30 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
CHECKPOINT;
if( !(m_iChangeMask & OPT_RESET_GAME) )
this->HandleScreenMessage( SM_GoToNextScreen );
return;
}
else if( SM == SM_GoToNextScreen )
{
if( SCREENMAN->IsStackedScreen(this) )
SCREENMAN->PopTopScreen( SM_None );
else if( m_bExportWillSetANewScreen )
; // Do nothing. Let Export set the screen.
else if( NEXT_SCREEN != "" )
SCREENMAN->SetNewScreen( NEXT_SCREEN );
return;
}
else if( SM == SM_GoToPrevScreen )
{
if( SCREENMAN->IsStackedScreen(this) )
{
SCREENMAN->PopTopScreen( SM_None );
}
else
{
SCREENMAN->DeletePreparedScreens();
SCREENMAN->SetNewScreen( PREV_SCREEN );
}
return;
}
else
ScreenOptions::HandleScreenMessage( SM );
-2
View File
@@ -25,8 +25,6 @@ protected:
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void BeginFadingOut();
virtual void GoToNextScreen();
virtual void GoToPrevScreen();
virtual void RefreshIcons( int row, PlayerNumber pn );
};
+26 -25
View File
@@ -144,34 +144,35 @@ void ScreenPlayerOptions::HandleScreenMessage( const ScreenMessage SM )
}
}
if( SM == SM_GoToNextScreen )
{
if( SCREENMAN->IsStackedScreen(this) )
{
SCREENMAN->PopTopScreen( SM_BackFromPlayerOptions );
}
else
{
SCREENMAN->SetNewScreen( NEXT_SCREEN );
}
return;
}
else if( SM == SM_GoToPrevScreen )
{
if( SCREENMAN->IsStackedScreen(this) )
{
SCREENMAN->PopTopScreen( SM_BackFromPlayerOptions );
}
else
{
SCREENMAN->DeletePreparedScreens();
SCREENMAN->SetNewScreen( PREV_SCREEN );
}
return;
}
ScreenOptionsMaster::HandleScreenMessage( SM );
}
void ScreenPlayerOptions::GoToPrevScreen()
{
if( SCREENMAN->IsStackedScreen(this) )
{
SCREENMAN->PopTopScreen( SM_BackFromPlayerOptions );
}
else
{
SCREENMAN->DeletePreparedScreens();
SCREENMAN->SetNewScreen( PREV_SCREEN );
}
}
void ScreenPlayerOptions::GoToNextScreen()
{
if( SCREENMAN->IsStackedScreen(this) )
{
SCREENMAN->PopTopScreen( SM_BackFromPlayerOptions );
}
else
{
SCREENMAN->SetNewScreen( NEXT_SCREEN );
}
}
void ScreenPlayerOptions::UpdateDisqualified( int row, PlayerNumber pn )
{
ASSERT( GAMESTATE->IsHumanPlayer(pn) );
-3
View File
@@ -22,9 +22,6 @@ public:
virtual void PushSelf( lua_State *L );
private:
void GoToNextScreen();
void GoToPrevScreen();
vector<bool> m_bRowCausesDisqualified[NUM_PLAYERS];
void UpdateDisqualified( int row, PlayerNumber pn );
+12 -12
View File
@@ -126,20 +126,20 @@ void ScreenProfileOptions::ExportOptions( int row, const vector<PlayerNumber> &v
}
}
void ScreenProfileOptions::GoToPrevScreen()
{
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
}
void ScreenProfileOptions::GoToNextScreen()
{
PREFSMAN->SaveGlobalPrefsToDisk();
GoToPrevScreen();
}
void ScreenProfileOptions::HandleScreenMessage( const ScreenMessage SM )
{
if( SM == SM_DoneCreating)
if( SM == SM_GoToNextScreen )
{
PREFSMAN->SaveGlobalPrefsToDisk();
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
return;
}
else if( SM == SM_GoToPrevScreen )
{
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
return;
}
else if( SM == SM_DoneCreating )
{
if( !ScreenTextEntry::s_bCancelledLast && ScreenTextEntry::s_sLastAnswer != "" )
{
-3
View File
@@ -17,9 +17,6 @@ private:
void ImportOptions( int row, const vector<PlayerNumber> &vpns );
void ExportOptions( int row, const vector<PlayerNumber> &vpns );
void GoToNextScreen();
void GoToPrevScreen();
CString GetSelectedProfileID();
CString GetSelectedProfileName();
};
+36 -33
View File
@@ -95,39 +95,6 @@ void ScreenSMOnlineLogin::ExportOptions( int row, const vector<PlayerNumber> &vp
}
}
void ScreenSMOnlineLogin::GoToPrevScreen()
{
SCREENMAN->SetNewScreen(PREV_SCREEN);
}
void ScreenSMOnlineLogin::GoToNextScreen()
{
vector<PlayerNumber> v;
v.push_back( GAMESTATE->m_MasterPlayerNumber );
for( unsigned r=0; r<m_pRows.size(); r++ )
ExportOptions( r, v );
PREFSMAN->SaveGlobalPrefsToDisk();
FOREACH_EnabledPlayer(pn)
{
PROFILEMAN->LoadLocalProfileFromMachine((PlayerNumber) pn);
}
if(GAMESTATE->IsPlayerEnabled((PlayerNumber) 0) && GAMESTATE->IsPlayerEnabled((PlayerNumber) 1) &&
(GAMESTATE->GetPlayerDisplayName((PlayerNumber) 0) == GAMESTATE->GetPlayerDisplayName((PlayerNumber) 1)))
{
SCREENMAN->SystemMessage("Each Player Needs A Unique Profile!");
SCREENMAN->SetNewScreen("ScreenSMOnlineLogin");
}
else
{
m_iPlayer=0;
while(!GAMESTATE->IsPlayerEnabled((PlayerNumber) m_iPlayer))
++m_iPlayer;
ScreenTextEntry::Password(SM_PasswordDone, "You are logging on as:\n" + GAMESTATE->GetPlayerDisplayName((PlayerNumber) m_iPlayer) + "\n\nPlease enter your password.", NULL );
}
}
void ScreenSMOnlineLogin::HandleScreenMessage(const ScreenMessage SM)
{
if( SM == SM_PasswordDone )
@@ -159,6 +126,42 @@ void ScreenSMOnlineLogin::HandleScreenMessage(const ScreenMessage SM)
}
}
}
if( SM == SM_GoToNextScreen )
{
vector<PlayerNumber> v;
v.push_back( GAMESTATE->m_MasterPlayerNumber );
for( unsigned r=0; r<m_pRows.size(); r++ )
ExportOptions( r, v );
PREFSMAN->SaveGlobalPrefsToDisk();
FOREACH_EnabledPlayer(pn)
{
PROFILEMAN->LoadLocalProfileFromMachine((PlayerNumber) pn);
}
if(GAMESTATE->IsPlayerEnabled((PlayerNumber) 0) && GAMESTATE->IsPlayerEnabled((PlayerNumber) 1) &&
(GAMESTATE->GetPlayerDisplayName((PlayerNumber) 0) == GAMESTATE->GetPlayerDisplayName((PlayerNumber) 1)))
{
SCREENMAN->SystemMessage("Each Player Needs A Unique Profile!");
SCREENMAN->SetNewScreen("ScreenSMOnlineLogin");
}
else
{
m_iPlayer=0;
while(!GAMESTATE->IsPlayerEnabled((PlayerNumber) m_iPlayer))
++m_iPlayer;
ScreenTextEntry::Password(SM_PasswordDone, "You are logging on as:\n" + GAMESTATE->GetPlayerDisplayName((PlayerNumber) m_iPlayer) + "\n\nPlease enter your password.", NULL );
}
return;
}
else if( SM == SM_GoToPrevScreen )
{
SCREENMAN->SetNewScreen(PREV_SCREEN);
return;
}
ScreenOptions::HandleScreenMessage(SM);
}
-2
View File
@@ -15,8 +15,6 @@ public:
private:
void ImportOptions( int row, const vector<PlayerNumber> &vpns );
void ExportOptions( int row, const vector<PlayerNumber> &vpns );
void GoToNextScreen();
void GoToPrevScreen();
CString GetSelectedProfileID();
int m_iPlayer;
};
+19 -13
View File
@@ -39,25 +39,31 @@ void ScreenSongOptions::ExportOptions( int row, const vector<PlayerNumber> &vpns
GAMESTATE->m_bChangedFailTypeOnScreenSongOptions = true;
}
void ScreenSongOptions::GoToPrevScreen()
void ScreenSongOptions::HandleScreenMessage( const ScreenMessage SM )
{
if( SCREENMAN->IsStackedScreen(this) )
if( SM == SM_GoToNextScreen )
{
SCREENMAN->PopTopScreen( SM_BackFromSongOptions );
if( SCREENMAN->IsStackedScreen(this) )
SCREENMAN->PopTopScreen( SM_BackFromSongOptions );
else
SCREENMAN->SetNewScreen( NEXT_SCREEN );
return;
}
else
else if( SM == SM_GoToPrevScreen )
{
SCREENMAN->DeletePreparedScreens();
SCREENMAN->SetNewScreen( PREV_SCREEN );
if( SCREENMAN->IsStackedScreen(this) )
{
SCREENMAN->PopTopScreen( SM_BackFromSongOptions );
}
else
{
SCREENMAN->DeletePreparedScreens();
SCREENMAN->SetNewScreen( PREV_SCREEN );
}
return;
}
}
void ScreenSongOptions::GoToNextScreen()
{
if( SCREENMAN->IsStackedScreen(this) )
SCREENMAN->PopTopScreen( SM_BackFromSongOptions );
else
SCREENMAN->SetNewScreen( NEXT_SCREEN );
ScreenOptionsMaster::HandleScreenMessage( SM );
}
/*
+1 -3
View File
@@ -10,12 +10,10 @@ class ScreenSongOptions : public ScreenOptionsMaster
public:
ScreenSongOptions( CString sName );
virtual void Init();
virtual void HandleScreenMessage( const ScreenMessage SM );
private:
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
void GoToNextScreen();
void GoToPrevScreen();
};
#endif