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
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
+60 -3
View File
@@ -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; 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 )
GAMESTATE->m_PreferredDifficulty[pn] = m_dc;
if( m_sAnnouncer != "" )
+6 -3
View File
@@ -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 );
+2 -1
View File
@@ -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;
+6 -4
View File
@@ -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
+5 -3
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) );
}
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" ),
+12 -3
View File
@@ -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() )
+4 -14
View File
@@ -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)) ||
(
+1 -1
View File
@@ -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 );
+1 -1
View File
@@ -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 );
-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;
void GetMinAndMaxColX( PlayerNumber pn, float& fMixXOut, float& fMaxXOut ) const;
int NumSidesJoinedToPlay() const;
};