diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 43ccf454a4..7925f5fa0d 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -2065,11 +2065,12 @@ TimerSeconds=0 PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster NextScreen=ScreenOptionsMenu@ScreenOptionsMaster -OptionMenuFlags=rows,4;together;explanations +OptionMenuFlags=rows,5;together;explanations Line1=conf,CoinMode Line2=conf,SongsPerPlay Line3=conf,CoinsPerCredit -Line4=conf,JointPremium +Line4=conf,VersusPremium +Line5=conf,DoublePremium [ScreenMachineOptions] StyleIcon=0 diff --git a/stepmania/src/ModeChoice.cpp b/stepmania/src/ModeChoice.cpp index c2865b1aba..30b8290fca 100644 --- a/stepmania/src/ModeChoice.cpp +++ b/stepmania/src/ModeChoice.cpp @@ -10,6 +10,7 @@ #include "StepMania.h" #include "ScreenManager.h" #include "SongManager.h" +#include "PrefsManager.h" #include "arch/ArchHooks/ArchHooks.h" void ModeChoice::Init() @@ -160,6 +161,22 @@ void ModeChoice::Load( int iIndex, CString sChoice ) } } +int GetCreditsToPlayStyle( Style style ) +{ + switch( GAMEMAN->GetStyleDefForStyle(style)->m_StyleType ) + { + case StyleDef::ONE_PLAYER_ONE_CREDIT: + return 1; + case StyleDef::TWO_PLAYERS_TWO_CREDITS: + return PREFSMAN->m_bVersusForOneCredit ? 1 : 2; + case StyleDef::ONE_PLAYER_TWO_CREDITS: + return PREFSMAN->m_bDoubleForOneCredit ? 1 : 2; + default: + ASSERT(0); + return 1; + } +} + bool ModeChoice::IsPlayable( CString *why ) const { if( m_bInvalid ) @@ -167,9 +184,21 @@ bool ModeChoice::IsPlayable( CString *why ) const if ( m_style != STYLE_INVALID ) { - const int SidesJoinedToPlay = GAMEMAN->GetStyleDefForStyle(m_style)->NumSidesJoinedToPlay(); - if( SidesJoinedToPlay != GAMESTATE->GetNumSidesJoined() ) - return false; + bool bUsingPremium = PREFSMAN->m_bVersusForOneCredit || PREFSMAN->m_bDoubleForOneCredit; + int iNumCreditsInserted = GAMESTATE->m_iCoins/PREFSMAN->m_iCoinsPerCredit; + int iNumCreditsRequired = GetCreditsToPlayStyle(m_style); + int iNumSidesJoined = GAMESTATE->GetNumSidesJoined(); + + if( bUsingPremium ) + { + if( iNumCreditsInserted < iNumCreditsRequired ) + return false; + } + else + { + if( iNumCreditsRequired != iNumSidesJoined ) + return false; + } } /* Don't allow a PlayMode that's incompatible with our current Style (if set), @@ -232,7 +261,35 @@ void ModeChoice::Apply( PlayerNumber pn ) const if( m_pm != PLAY_MODE_INVALID ) GAMESTATE->m_PlayMode = m_pm; if( m_style != STYLE_INVALID ) + { GAMESTATE->m_CurStyle = m_style; + + // If only one side is joined and we picked a style + // that requires both sides, join the other side. + switch( GAMEMAN->GetStyleDefForStyle(m_style)->m_StyleType ) + { + case StyleDef::ONE_PLAYER_ONE_CREDIT: + break; + case StyleDef::TWO_PLAYERS_TWO_CREDITS: + case StyleDef::ONE_PLAYER_TWO_CREDITS: + int p; + for( p=0; pm_bSideIsJoined[p] = true; + break; + default: + ASSERT(0); + } + + // If using a premium setting, subtract coins only after choosing a style. + bool bUsingPremium = PREFSMAN->m_bVersusForOneCredit || PREFSMAN->m_bDoubleForOneCredit; + int iNumCoinsInserted = GAMESTATE->m_iCoins; + int iNumCoinsRequired = PREFSMAN->m_iCoinsPerCredit*GetCreditsToPlayStyle(m_style); + if( bUsingPremium ) + { + ASSERT( iNumCoinsInserted >= iNumCoinsRequired ); + GAMESTATE->m_iCoins -= iNumCoinsRequired; + } + } if( m_dc != DIFFICULTY_INVALID && pn != PLAYER_INVALID ) GAMESTATE->m_PreferredDifficulty[pn] = m_dc; if( m_sAnnouncer != "" ) diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index b8dec901cb..2cd33c12fe 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -87,7 +87,8 @@ PrefsManager::PrefsManager() m_iMarvelousTiming = 2; m_iCoinMode = COIN_HOME; m_iCoinsPerCredit = 1; - m_bJointPremium = false; + m_bVersusForOneCredit = false; + m_bDoubleForOneCredit = false; m_iBoostAppPriority = -1; m_bAntiAliasing = false; m_ShowSongOptions = YES; @@ -259,7 +260,8 @@ void PrefsManager::ReadGlobalPrefsFromDisk() ini.GetValue( "Options", "SoundResampleQuality", m_iSoundResampleQuality ); ini.GetValue( "Options", "CoinMode", m_iCoinMode ); ini.GetValue( "Options", "CoinsPerCredit", m_iCoinsPerCredit ); - ini.GetValue( "Options", "JointPremium", m_bJointPremium ); + ini.GetValue( "Options", "VersusForOneCredit", m_bVersusForOneCredit ); + ini.GetValue( "Options", "DoubleForOneCredit", m_bDoubleForOneCredit ); ini.GetValue( "Options", "BoostAppPriority", m_iBoostAppPriority ); ini.GetValue( "Options", "PickExtraStage", m_bPickExtraStage ); ini.GetValue( "Options", "ComboContinuesBetweenSongs", m_bComboContinuesBetweenSongs ); @@ -398,7 +400,8 @@ void PrefsManager::SaveGlobalPrefsToDisk() const ini.SetValue( "Options", "SoundResampleQuality", m_iSoundResampleQuality ); ini.SetValue( "Options", "CoinMode", m_iCoinMode ); ini.SetValue( "Options", "CoinsPerCredit", m_iCoinsPerCredit ); - ini.SetValue( "Options", "JointPremium", m_bJointPremium ); + ini.SetValue( "Options", "VersusForOneCredit", m_bVersusForOneCredit ); + ini.SetValue( "Options", "DoubleForOneCredit", m_bDoubleForOneCredit ); ini.SetValue( "Options", "BoostAppPriority", m_iBoostAppPriority ); ini.SetValue( "Options", "PickExtraStage", m_bPickExtraStage ); ini.SetValue( "Options", "ComboContinuesBetweenSongs", m_bComboContinuesBetweenSongs ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index 7e47a93375..06812bf2c5 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -72,7 +72,8 @@ public: int m_iMarvelousTiming; int m_iCoinMode; int m_iCoinsPerCredit; - bool m_bJointPremium; + bool m_bVersusForOneCredit; + bool m_bDoubleForOneCredit; bool m_bPickExtraStage; bool m_bComboContinuesBetweenSongs; float m_fLongVerSongSeconds; diff --git a/stepmania/src/Screen.cpp b/stepmania/src/Screen.cpp index 9679845e86..c782f13f9e 100644 --- a/stepmania/src/Screen.cpp +++ b/stepmania/src/Screen.cpp @@ -188,10 +188,12 @@ bool Screen::JoinInput( const DeviceInput& DeviceI, const InputEventType type, c int iCoinsToCharge = 0; if( PREFSMAN->m_iCoinMode == COIN_PAY ) iCoinsToCharge = PREFSMAN->m_iCoinsPerCredit; - - if( PREFSMAN->m_bJointPremium ) - if( GAMESTATE->m_MasterPlayerNumber!=PLAYER_INVALID ) // one side already joined - iCoinsToCharge = 0; + + // If using premium, subtract credits only after choosing a style, + // not when the players join. + bool bUsingPremium = PREFSMAN->m_bVersusForOneCredit || PREFSMAN->m_bDoubleForOneCredit; + if( bUsingPremium ) + iCoinsToCharge = 0; if( GAMESTATE->m_iCoins < iCoinsToCharge ) return false; // not enough coins diff --git a/stepmania/src/ScreenOptionsMasterPrefs.cpp b/stepmania/src/ScreenOptionsMasterPrefs.cpp index 33f09c946b..33abd21614 100644 --- a/stepmania/src/ScreenOptionsMasterPrefs.cpp +++ b/stepmania/src/ScreenOptionsMasterPrefs.cpp @@ -263,7 +263,8 @@ static void CoinsPerCredit( int &sel, bool ToSel, const CStringArray &choices ) MoveMap( sel, PREFSMAN->m_iCoinsPerCredit, ToSel, mapping, ARRAYSIZE(mapping) ); } -MOVE( JointPremium, PREFSMAN->m_bJointPremium ); +MOVE( VersusPremium, PREFSMAN->m_bVersusForOneCredit ); +MOVE( DoublePremium, PREFSMAN->m_bDoubleForOneCredit ); static void SongsPerPlay( int &sel, bool ToSel, const CStringArray &choices ) { @@ -452,7 +453,8 @@ static const ConfOption g_ConfOptions[] = ConfOption( "Progressive\nNonstop Lifebar",ProgressiveNonstopLifebar,"OFF","1","2","3","4","5","6","7","8","INSANITY"), ConfOption( "Default\nFail Type", DefaultFailType, "ARCADE","END OF SONG","OFF" ), ConfOption( "Coins Per\nCredit", CoinsPerCredit, "1","2","3","4","5","6","7","8" ), - ConfOption( "Joint\nPremium", JointPremium, "OFF","ON" ), + ConfOption( "Versus\nPremium", VersusPremium, "OFF (2 credits)","ON (1 credit)" ), + ConfOption( "Double\nPremium", DoublePremium, "OFF (2 credits)","ON (1 credit)" ), ConfOption( "Show Song\nOptions", ShowSongOptions, "HIDE","SHOW","ASK" ), ConfOption( "Show Name\nEntry", ShowNameEntry, "OFF", "ON", "RANKING SONGS" ), @@ -462,7 +464,7 @@ static const ConfOption g_ConfOptions[] = ConfOption( "Display\nColor", DisplayColor, "16BIT","32BIT" ), ConfOption( "Texture\nResolution", TextureResolution, "256","512","1024","2048" ), ConfOption( "Texture\nColor", TextureColor, "16BIT","32BIT" ), - ConfOption( "Movie\nColor", MovieColor, "16BIT","32BIT" ), + ConfOption( "Movie\nColor", MovieColor, "16BIT","32BIT" ), ConfOption( "Keep Textures\nIn Memory", KeepTexturesInMemory, "NO","YES" ), ConfOption( "Refresh\nRate", RefreshRate, "DEFAULT","60","70","72","75","80","85","90","100","120","150" ), ConfOption( "Wait For\nVsync", WaitForVsync, "NO", "YES" ), diff --git a/stepmania/src/ScreenSelect.cpp b/stepmania/src/ScreenSelect.cpp index b81447034b..43258dd9c9 100644 --- a/stepmania/src/ScreenSelect.cpp +++ b/stepmania/src/ScreenSelect.cpp @@ -93,10 +93,19 @@ void ScreenSelect::Input( const DeviceInput& DeviceI, const InputEventType type, { // LOG->Trace( "ScreenSelect::Input()" ); - if( Screen::JoinInput(DeviceI, type, GameI, MenuI, StyleI) ) + bool bUsingPremium = PREFSMAN->m_bVersusForOneCredit || PREFSMAN->m_bDoubleForOneCredit; + if( bUsingPremium ) { - this->UpdateSelectableChoices(); - return; + if( MenuI.IsValid() && MenuI.button==MENU_BUTTON_COIN && GAMESTATE->m_iCoins==PREFSMAN->m_iCoinsPerCredit*2 ) + this->UpdateSelectableChoices(); + } + else // !bUsingPremium + { + if( Screen::JoinInput(DeviceI, type, GameI, MenuI, StyleI) ) + { + this->UpdateSelectableChoices(); + return; // don't let the screen handle the MENU_START press + } } if( m_Menu.IsTransitioning() ) diff --git a/stepmania/src/ScreenSelectMode.cpp b/stepmania/src/ScreenSelectMode.cpp index cd7ee9c8d8..d3b66811db 100644 --- a/stepmania/src/ScreenSelectMode.cpp +++ b/stepmania/src/ScreenSelectMode.cpp @@ -163,24 +163,14 @@ void ScreenSelectMode::UpdateSelectableChoices() modename.MakeUpper(); - // if its joint premium and inclusive of double consider double and versus as needing another coin - // if its joint premium and non-inclusive of double consider double as appearing only when one player is available. - // if its joint premium, everythings available for play -/* if( (PREFSMAN->m_bJointPremium && INCLUDE_DOUBLE_IN_JP == 1 && (GAMESTATE->GetNumSidesJoined() == mc.numSidesJoinedToPlay) ) || - (PREFSMAN->m_bJointPremium && INCLUDE_DOUBLE_IN_JP == 0 && - modename.substr(0, 6) == "DOUBLE" || modename.substr(0, 13) == "ARCADE-DOUBLE" || - modename.substr(0, 10) == "HALFDOUBLE" || modename.substr(0, 17) == "ARCADE-HALFDOUBLE" || - (GAMESTATE->GetNumSidesJoined() != mc.numSidesJoinedToPlay)) || - (!PREFSMAN->m_bJointPremium) - )*/ - + // FIXME for new premium prefs const int SidesJoinedToPlay = (mc.m_style == STYLE_INVALID) ? 1 : - GAMEMAN->GetStyleDefForStyle(mc.m_style)->NumSidesJoinedToPlay(); - if( (!PREFSMAN->m_bJointPremium ) || + 1; + if( !(PREFSMAN->m_bVersusForOneCredit||PREFSMAN->m_bDoubleForOneCredit ) || ( - PREFSMAN->m_bJointPremium && + (PREFSMAN->m_bVersusForOneCredit||PREFSMAN->m_bDoubleForOneCredit) && ( (INCLUDE_DOUBLE_IN_JP == 1 && (GAMESTATE->GetNumSidesJoined() == SidesJoinedToPlay)) || ( diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index 791397857e..238c589ebe 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -108,7 +108,7 @@ ScreenSelectStyle::ScreenSelectStyle( CString sClassName ) : ScreenSelect( sClas m_sprJointPremium.SetName( "JointPremium" ); - if( PREFSMAN->m_bJointPremium ) + if( PREFSMAN->m_bVersusForOneCredit||PREFSMAN->m_bDoubleForOneCredit ) { m_sprJointPremium.Load( THEME->GetPathToG(m_sName + " joint premium") ); this->AddChild( &m_sprJointPremium ); diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 41d13b095c..5378f5357e 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -71,7 +71,7 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam CodeDetector::RefreshCacheItems(); - if( PREFSMAN->m_iCoinMode!=COIN_HOME && PREFSMAN->m_bJointPremium ) + if( PREFSMAN->m_iCoinMode!=COIN_HOME && (PREFSMAN->m_bVersusForOneCredit||PREFSMAN->m_bDoubleForOneCredit) ) { m_JointPremium.LoadFromAniDir( THEME->GetPathToB("ScreenTitleMenu joint premium") ); this->AddChild( &m_JointPremium ); diff --git a/stepmania/src/StyleDef.cpp b/stepmania/src/StyleDef.cpp index 93a259ae59..b1bcf001d6 100644 --- a/stepmania/src/StyleDef.cpp +++ b/stepmania/src/StyleDef.cpp @@ -100,18 +100,3 @@ void StyleDef::GetMinAndMaxColX( PlayerNumber pn, float& fMixXOut, float& fMaxXO } } -int StyleDef::NumSidesJoinedToPlay() const -{ - switch( m_StyleType ) - { - case StyleDef::ONE_PLAYER_ONE_CREDIT: - return 1; - case StyleDef::TWO_PLAYERS_TWO_CREDITS: - case StyleDef::ONE_PLAYER_TWO_CREDITS: - return 2; - default: - ASSERT(0); - return 1; - } -} - diff --git a/stepmania/src/StyleDef.h b/stepmania/src/StyleDef.h index 8b559f8536..3caa2fd978 100644 --- a/stepmania/src/StyleDef.h +++ b/stepmania/src/StyleDef.h @@ -78,8 +78,6 @@ public: bool MatchesNotesType( StepsType type ) const; void GetMinAndMaxColX( PlayerNumber pn, float& fMixXOut, float& fMaxXOut ) const; - - int NumSidesJoinedToPlay() const; };