split bJointPermium into bVersusForOneCredit and bDoubleForOneCredit

This commit is contained in:
Chris Danford
2003-11-07 12:56:32 +00:00
parent 5657cc859f
commit c3474fe287
12 changed files with 100 additions and 52 deletions
+3 -2
View File
@@ -2065,11 +2065,12 @@ TimerSeconds=0
PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster
NextScreen=ScreenOptionsMenu@ScreenOptionsMaster NextScreen=ScreenOptionsMenu@ScreenOptionsMaster
OptionMenuFlags=rows,4;together;explanations OptionMenuFlags=rows,5;together;explanations
Line1=conf,CoinMode Line1=conf,CoinMode
Line2=conf,SongsPerPlay Line2=conf,SongsPerPlay
Line3=conf,CoinsPerCredit Line3=conf,CoinsPerCredit
Line4=conf,JointPremium Line4=conf,VersusPremium
Line5=conf,DoublePremium
[ScreenMachineOptions] [ScreenMachineOptions]
StyleIcon=0 StyleIcon=0
+59 -2
View File
@@ -10,6 +10,7 @@
#include "StepMania.h" #include "StepMania.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "SongManager.h" #include "SongManager.h"
#include "PrefsManager.h"
#include "arch/ArchHooks/ArchHooks.h" #include "arch/ArchHooks/ArchHooks.h"
void ModeChoice::Init() 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 bool ModeChoice::IsPlayable( CString *why ) const
{ {
if( m_bInvalid ) if( m_bInvalid )
@@ -167,10 +184,22 @@ bool ModeChoice::IsPlayable( CString *why ) const
if ( m_style != STYLE_INVALID ) if ( m_style != STYLE_INVALID )
{ {
const int SidesJoinedToPlay = GAMEMAN->GetStyleDefForStyle(m_style)->NumSidesJoinedToPlay(); bool bUsingPremium = PREFSMAN->m_bVersusForOneCredit || PREFSMAN->m_bDoubleForOneCredit;
if( SidesJoinedToPlay != GAMESTATE->GetNumSidesJoined() ) int iNumCreditsInserted = GAMESTATE->m_iCoins/PREFSMAN->m_iCoinsPerCredit;
int iNumCreditsRequired = GetCreditsToPlayStyle(m_style);
int iNumSidesJoined = GAMESTATE->GetNumSidesJoined();
if( bUsingPremium )
{
if( iNumCreditsInserted < iNumCreditsRequired )
return false; return false;
} }
else
{
if( iNumCreditsRequired != iNumSidesJoined )
return false;
}
}
/* Don't allow a PlayMode that's incompatible with our current Style (if set), /* Don't allow a PlayMode that's incompatible with our current Style (if set),
* and vice versa. */ * and vice versa. */
@@ -232,7 +261,35 @@ void ModeChoice::Apply( PlayerNumber pn ) const
if( m_pm != PLAY_MODE_INVALID ) if( m_pm != PLAY_MODE_INVALID )
GAMESTATE->m_PlayMode = m_pm; GAMESTATE->m_PlayMode = m_pm;
if( m_style != STYLE_INVALID ) if( m_style != STYLE_INVALID )
{
GAMESTATE->m_CurStyle = m_style; 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; p<NUM_PLAYERS; p++ )
GAMESTATE->m_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 ) if( m_dc != DIFFICULTY_INVALID && pn != PLAYER_INVALID )
GAMESTATE->m_PreferredDifficulty[pn] = m_dc; GAMESTATE->m_PreferredDifficulty[pn] = m_dc;
if( m_sAnnouncer != "" ) if( m_sAnnouncer != "" )
+6 -3
View File
@@ -87,7 +87,8 @@ PrefsManager::PrefsManager()
m_iMarvelousTiming = 2; m_iMarvelousTiming = 2;
m_iCoinMode = COIN_HOME; m_iCoinMode = COIN_HOME;
m_iCoinsPerCredit = 1; m_iCoinsPerCredit = 1;
m_bJointPremium = false; m_bVersusForOneCredit = false;
m_bDoubleForOneCredit = false;
m_iBoostAppPriority = -1; m_iBoostAppPriority = -1;
m_bAntiAliasing = false; m_bAntiAliasing = false;
m_ShowSongOptions = YES; m_ShowSongOptions = YES;
@@ -259,7 +260,8 @@ void PrefsManager::ReadGlobalPrefsFromDisk()
ini.GetValue( "Options", "SoundResampleQuality", m_iSoundResampleQuality ); ini.GetValue( "Options", "SoundResampleQuality", m_iSoundResampleQuality );
ini.GetValue( "Options", "CoinMode", m_iCoinMode ); ini.GetValue( "Options", "CoinMode", m_iCoinMode );
ini.GetValue( "Options", "CoinsPerCredit", m_iCoinsPerCredit ); 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", "BoostAppPriority", m_iBoostAppPriority );
ini.GetValue( "Options", "PickExtraStage", m_bPickExtraStage ); ini.GetValue( "Options", "PickExtraStage", m_bPickExtraStage );
ini.GetValue( "Options", "ComboContinuesBetweenSongs", m_bComboContinuesBetweenSongs ); ini.GetValue( "Options", "ComboContinuesBetweenSongs", m_bComboContinuesBetweenSongs );
@@ -398,7 +400,8 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
ini.SetValue( "Options", "SoundResampleQuality", m_iSoundResampleQuality ); ini.SetValue( "Options", "SoundResampleQuality", m_iSoundResampleQuality );
ini.SetValue( "Options", "CoinMode", m_iCoinMode ); ini.SetValue( "Options", "CoinMode", m_iCoinMode );
ini.SetValue( "Options", "CoinsPerCredit", m_iCoinsPerCredit ); 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", "BoostAppPriority", m_iBoostAppPriority );
ini.SetValue( "Options", "PickExtraStage", m_bPickExtraStage ); ini.SetValue( "Options", "PickExtraStage", m_bPickExtraStage );
ini.SetValue( "Options", "ComboContinuesBetweenSongs", m_bComboContinuesBetweenSongs ); ini.SetValue( "Options", "ComboContinuesBetweenSongs", m_bComboContinuesBetweenSongs );
+2 -1
View File
@@ -72,7 +72,8 @@ public:
int m_iMarvelousTiming; int m_iMarvelousTiming;
int m_iCoinMode; int m_iCoinMode;
int m_iCoinsPerCredit; int m_iCoinsPerCredit;
bool m_bJointPremium; bool m_bVersusForOneCredit;
bool m_bDoubleForOneCredit;
bool m_bPickExtraStage; bool m_bPickExtraStage;
bool m_bComboContinuesBetweenSongs; bool m_bComboContinuesBetweenSongs;
float m_fLongVerSongSeconds; float m_fLongVerSongSeconds;
+4 -2
View File
@@ -189,8 +189,10 @@ bool Screen::JoinInput( const DeviceInput& DeviceI, const InputEventType type, c
if( PREFSMAN->m_iCoinMode == COIN_PAY ) if( PREFSMAN->m_iCoinMode == COIN_PAY )
iCoinsToCharge = PREFSMAN->m_iCoinsPerCredit; iCoinsToCharge = PREFSMAN->m_iCoinsPerCredit;
if( PREFSMAN->m_bJointPremium ) // If using premium, subtract credits only after choosing a style,
if( GAMESTATE->m_MasterPlayerNumber!=PLAYER_INVALID ) // one side already joined // not when the players join.
bool bUsingPremium = PREFSMAN->m_bVersusForOneCredit || PREFSMAN->m_bDoubleForOneCredit;
if( bUsingPremium )
iCoinsToCharge = 0; iCoinsToCharge = 0;
if( GAMESTATE->m_iCoins < iCoinsToCharge ) if( GAMESTATE->m_iCoins < iCoinsToCharge )
+4 -2
View File
@@ -263,7 +263,8 @@ static void CoinsPerCredit( int &sel, bool ToSel, const CStringArray &choices )
MoveMap( sel, PREFSMAN->m_iCoinsPerCredit, ToSel, mapping, ARRAYSIZE(mapping) ); 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 ) 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( "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( "Default\nFail Type", DefaultFailType, "ARCADE","END OF SONG","OFF" ),
ConfOption( "Coins Per\nCredit", CoinsPerCredit, "1","2","3","4","5","6","7","8" ), 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 Song\nOptions", ShowSongOptions, "HIDE","SHOW","ASK" ),
ConfOption( "Show Name\nEntry", ShowNameEntry, "OFF", "ON", "RANKING SONGS" ), ConfOption( "Show Name\nEntry", ShowNameEntry, "OFF", "ON", "RANKING SONGS" ),
+10 -1
View File
@@ -93,10 +93,19 @@ void ScreenSelect::Input( const DeviceInput& DeviceI, const InputEventType type,
{ {
// LOG->Trace( "ScreenSelect::Input()" ); // LOG->Trace( "ScreenSelect::Input()" );
bool bUsingPremium = PREFSMAN->m_bVersusForOneCredit || PREFSMAN->m_bDoubleForOneCredit;
if( bUsingPremium )
{
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) ) if( Screen::JoinInput(DeviceI, type, GameI, MenuI, StyleI) )
{ {
this->UpdateSelectableChoices(); this->UpdateSelectableChoices();
return; return; // don't let the screen handle the MENU_START press
}
} }
if( m_Menu.IsTransitioning() ) if( m_Menu.IsTransitioning() )
+4 -14
View File
@@ -163,24 +163,14 @@ void ScreenSelectMode::UpdateSelectableChoices()
modename.MakeUpper(); modename.MakeUpper();
// if its joint premium and inclusive of double consider double and versus as needing another coin // FIXME for new premium prefs
// 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)
)*/
const int SidesJoinedToPlay = const int SidesJoinedToPlay =
(mc.m_style == STYLE_INVALID) ? (mc.m_style == STYLE_INVALID) ?
1 : 1 :
GAMEMAN->GetStyleDefForStyle(mc.m_style)->NumSidesJoinedToPlay(); 1;
if( (!PREFSMAN->m_bJointPremium ) || if( !(PREFSMAN->m_bVersusForOneCredit||PREFSMAN->m_bDoubleForOneCredit ) ||
( (
PREFSMAN->m_bJointPremium && (PREFSMAN->m_bVersusForOneCredit||PREFSMAN->m_bDoubleForOneCredit) &&
( (
(INCLUDE_DOUBLE_IN_JP == 1 && (GAMESTATE->GetNumSidesJoined() == SidesJoinedToPlay)) || (INCLUDE_DOUBLE_IN_JP == 1 && (GAMESTATE->GetNumSidesJoined() == SidesJoinedToPlay)) ||
( (
+1 -1
View File
@@ -108,7 +108,7 @@ ScreenSelectStyle::ScreenSelectStyle( CString sClassName ) : ScreenSelect( sClas
m_sprJointPremium.SetName( "JointPremium" ); m_sprJointPremium.SetName( "JointPremium" );
if( PREFSMAN->m_bJointPremium ) if( PREFSMAN->m_bVersusForOneCredit||PREFSMAN->m_bDoubleForOneCredit )
{ {
m_sprJointPremium.Load( THEME->GetPathToG(m_sName + " joint premium") ); m_sprJointPremium.Load( THEME->GetPathToG(m_sName + " joint premium") );
this->AddChild( &m_sprJointPremium ); this->AddChild( &m_sprJointPremium );
+1 -1
View File
@@ -71,7 +71,7 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam
CodeDetector::RefreshCacheItems(); 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") ); m_JointPremium.LoadFromAniDir( THEME->GetPathToB("ScreenTitleMenu joint premium") );
this->AddChild( &m_JointPremium ); this->AddChild( &m_JointPremium );
-15
View File
@@ -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;
}
}
-2
View File
@@ -78,8 +78,6 @@ public:
bool MatchesNotesType( StepsType type ) const; bool MatchesNotesType( StepsType type ) const;
void GetMinAndMaxColX( PlayerNumber pn, float& fMixXOut, float& fMaxXOut ) const; void GetMinAndMaxColX( PlayerNumber pn, float& fMixXOut, float& fMaxXOut ) const;
int NumSidesJoinedToPlay() const;
}; };