Allow ScreenSelectProfile to Finish() with guest players

Passing a -3 as profile index to ScreenSelectProfile's SetProfileIndex now
allows a player to play without having a local or USB profile assigned.

Also adds a message (PlayerProfileSet) that's broadcast anytime a player selects
a profile or chooses to play as a guest and subscribes ScreenSelectMusic to it.
This commit is contained in:
Ivana Kellyerova
2022-06-07 19:35:30 +02:00
committed by Martin Natano
parent 64b4676a14
commit 02b9925b12
6 changed files with 19 additions and 4 deletions
+2 -1
View File
@@ -5409,7 +5409,8 @@ Details of the <code>event</code> table:
Sets the profile index of Player <code>pn</code> to <code>iProfileIndex</code>.<br />
The following values of <code>iProfileIndex</code> have special, hardcoded behavior:<br />
<code>-1</code>: join the player and play the theme's start sound effect<br />
<code>-2</code>: unjoin the player, unlock their MemoryCard, and unmount their MemoryCard
<code>-2</code>: unjoin the player, unlock their MemoryCard, and unmount their MemoryCard<br />
<code>-3</code>: allow the user to play without a local or USB profile (as a guest)
</Function>
</Class>
<Class name='ScreenTextEntry' grouping='Screen'>
+1
View File
@@ -57,6 +57,7 @@ static const char *MessageIDNames[] = {
"MenuSelectionChanged",
"PlayerJoined",
"PlayerUnjoined",
"PlayerProfileSet",
"AutosyncChanged",
"PreferredSongGroupChanged",
"PreferredCourseGroupChanged",
+1
View File
@@ -53,6 +53,7 @@ enum MessageID
Message_MenuSelectionChanged,
Message_PlayerJoined,
Message_PlayerUnjoined,
Message_PlayerProfileSet,
Message_AutosyncChanged,
Message_PreferredSongGroupChanged,
Message_PreferredCourseGroupChanged,
+3 -1
View File
@@ -118,6 +118,7 @@ MusicWheelItem::MusicWheelItem( RString sType ):
this->SubscribeToMessage( Message_CurrentTrailP2Changed );
this->SubscribeToMessage( Message_PreferredDifficultyP1Changed );
this->SubscribeToMessage( Message_PreferredDifficultyP2Changed );
this->SubscribeToMessage( Message_PlayerProfileSet );
}
MusicWheelItem::MusicWheelItem( const MusicWheelItem &cpy ):
@@ -382,7 +383,8 @@ void MusicWheelItem::HandleMessage( const Message &msg )
msg == Message_CurrentTrailP1Changed ||
msg == Message_CurrentTrailP2Changed ||
msg == Message_PreferredDifficultyP1Changed ||
msg == Message_PreferredDifficultyP2Changed )
msg == Message_PreferredDifficultyP2Changed ||
msg == Message_PlayerProfileSet )
{
const MusicWheelItemData *pWID = dynamic_cast<const MusicWheelItemData*>( m_pData );
MusicWheelItemType type = MusicWheelItemType_Invalid;
+1
View File
@@ -137,6 +137,7 @@ void ScreenSelectMusic::Init()
ScreenWithMenuElements::Init();
this->SubscribeToMessage( Message_PlayerJoined );
this->SubscribeToMessage( Message_PlayerProfileSet );
// Cache these values
// Marking for change -- Midiman (why? -aj)
+11 -2
View File
@@ -128,7 +128,7 @@ bool ScreenSelectProfile::SetProfileIndex( PlayerNumber pn, int iProfileIndex )
return false;
// wrong selection
if( iProfileIndex < -2 )
if( iProfileIndex < -3 )
return false;
// unload player
@@ -160,7 +160,7 @@ bool ScreenSelectProfile::Finish(){
FOREACH_PlayerNumber( p )
{
// not all players has made their choices
// not all players have made their choices
if( GAMESTATE->IsHumanPlayer( p ) && ( m_iSelectedProfiles[p] == -1 ) )
iUnselectedProfiles++;
@@ -209,7 +209,16 @@ bool ScreenSelectProfile::Finish(){
MEMCARDMAN->LockCard( p );
}
}
// If the player picked a profile (>= 0) or chose to play as a guest (-3),
// broadcast a message
if( m_iSelectedProfiles[p] >= 0 || m_iSelectedProfiles[p] == -3 ) {
Message msg( MessageIDToString(Message_PlayerProfileSet) );
msg.SetParam( "Player", p );
MESSAGEMAN->Broadcast( msg );
}
}
StartTransitioningScreen( SM_GoToNextScreen );
return true;
}