experimental: AutoJoin, join players immediately (or as soon as possible) when enough coins are inserted

This commit is contained in:
Glenn Maynard
2008-05-27 20:51:18 +00:00
parent 0bd98720fe
commit ba6a4c4feb
4 changed files with 35 additions and 1 deletions
+12
View File
@@ -103,6 +103,7 @@ static ThemeMetric<bool> ARE_STAGE_PLAYER_MODS_FORCED( "GameState","AreStagePlay
static ThemeMetric<bool> ARE_STAGE_SONG_MODS_FORCED( "GameState","AreStageSongModsForced" );
static Preference<Premium> g_Premium( "Premium", Premium_Off );
Preference<bool> GameState::m_bAutoJoin( "AutoJoin", false );
GameState::GameState() :
m_pCurGame( Message_CurrentGameChanged ),
@@ -413,6 +414,17 @@ bool GameState::JoinInput( PlayerNumber pn )
return true;
}
bool GameState::JoinPlayers()
{
bool bJoined = false;
FOREACH_PlayerNumber( pn )
{
if( JoinInput(pn) )
bJoined = true;
}
return bJoined;
}
int GameState::GetCoinsNeededToJoin() const
{
int iCoinsToCharge = 0;
+7 -1
View File
@@ -12,6 +12,7 @@
#include "RageTimer.h"
#include "PlayerOptions.h"
#include "SongOptions.h"
#include "Preference.h"
#include <map>
#include <deque>
@@ -45,6 +46,7 @@ public:
void JoinPlayer( PlayerNumber pn );
void UnjoinPlayer( PlayerNumber pn );
bool JoinInput( PlayerNumber pn );
bool JoinPlayers();
void LoadProfiles( bool bLoadEdits = true );
void SaveProfiles();
void SaveProfile( PlayerNumber pn );
@@ -301,10 +303,14 @@ public:
PlayerState* m_pMultiPlayerState[NUM_MultiPlayer];
//
// Preference wrappers
// Preferences
//
static Preference<bool> m_bAutoJoin;
//
// These options have weird interactions depending on m_bEventMode,
// so wrap them
//
bool m_bTemporaryEventMode;
bool IsEventMode() const;
CoinMode GetCoinMode() const;
+9
View File
@@ -127,6 +127,15 @@ void ScreenWithMenuElements::BeginScreen()
/* Evaluate FirstUpdateCommand. */
this->PlayCommand( "FirstUpdate" );
/* If AutoJoin is enabled, we may have a credit that couldn't be used to join when
* the coin was inserted due to AllowLateJoin being disabled at the time. Try to
* join players when a new screen starts. */
if( GAMESTATE->m_bAutoJoin.Get() )
{
if( GAMESTATE->JoinPlayers() )
SCREENMAN->PlayStartSound();
}
}
void ScreenWithMenuElements::HandleScreenMessage( const ScreenMessage SM )
+7
View File
@@ -1198,6 +1198,13 @@ void StepMania::InsertCoin( int iNum, bool bCountInBookkeeping )
else
SCREENMAN->PlayInvalidSound();
/* If AutoJoin and enough coins to join have been inserted, then try to join a player. */
if( GAMESTATE->m_bAutoJoin.Get() )
{
if( GAMESTATE->JoinPlayers() )
SCREENMAN->PlayStartSound();
}
Message msg( "CoinInserted" );
// below params are unused
//msg.SetParam( "Coins", GAMESTATE->m_iCoins );