clean up premium coin logic
This commit is contained in:
@@ -2079,12 +2079,11 @@ TimerSeconds=0
|
||||
PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster
|
||||
NextScreen=ScreenOptionsMenu@ScreenOptionsMaster
|
||||
|
||||
OptionMenuFlags=rows,5;together;explanations
|
||||
OptionMenuFlags=rows,4;together;explanations
|
||||
Line1=conf,CoinMode
|
||||
Line2=conf,SongsPerPlay
|
||||
Line3=conf,CoinsPerCredit
|
||||
Line4=conf,VersusPremium
|
||||
Line5=conf,DoublePremium
|
||||
Line4=conf,Premium
|
||||
|
||||
[ScreenMachineOptions]
|
||||
StyleIcon=0
|
||||
|
||||
@@ -1012,10 +1012,3 @@ void GameState::StoreRankingName( PlayerNumber pn, CString name )
|
||||
*aFeats[i].pStringToFill = name;
|
||||
}
|
||||
}
|
||||
|
||||
bool GameState::UsingPremiumAndPaying()
|
||||
{
|
||||
return
|
||||
(PREFSMAN->m_bVersusForOneCredit || PREFSMAN->m_bDoubleForOneCredit) &&
|
||||
PREFSMAN->m_iCoinMode == COIN_PAY;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,6 @@ public:
|
||||
iNumSidesJoined++; // left side, and right side
|
||||
return iNumSidesJoined;
|
||||
};
|
||||
bool UsingPremiumAndPaying();
|
||||
|
||||
GameDef* GetCurrentGameDef();
|
||||
const StyleDef* GetCurrentStyleDef();
|
||||
|
||||
@@ -161,22 +161,6 @@ void ModeChoice::Load( int iIndex, CString sChoice )
|
||||
}
|
||||
}
|
||||
|
||||
int GetCreditsRequiredToPlayStyle( 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;
|
||||
}
|
||||
}
|
||||
|
||||
int GetSidesRequiredToPlayStyle( Style style )
|
||||
{
|
||||
switch( GAMEMAN->GetStyleDefForStyle(style)->m_StyleType )
|
||||
@@ -184,8 +168,9 @@ int GetSidesRequiredToPlayStyle( Style style )
|
||||
case StyleDef::ONE_PLAYER_ONE_CREDIT:
|
||||
return 1;
|
||||
case StyleDef::TWO_PLAYERS_TWO_CREDITS:
|
||||
case StyleDef::ONE_PLAYER_TWO_CREDITS:
|
||||
return 2;
|
||||
case StyleDef::ONE_PLAYER_TWO_CREDITS:
|
||||
return (PREFSMAN->m_Premium == PrefsManager::DOUBLE_FOR_1CREDIT) ? 1 : 2;
|
||||
default:
|
||||
ASSERT(0);
|
||||
return 1;
|
||||
@@ -199,21 +184,11 @@ bool ModeChoice::IsPlayable( CString *why ) const
|
||||
|
||||
if ( m_style != STYLE_INVALID )
|
||||
{
|
||||
int iNumCreditsInserted = GAMESTATE->m_iCoins/PREFSMAN->m_iCoinsPerCredit;
|
||||
int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_style);
|
||||
int iNumSidesJoined = GAMESTATE->GetNumSidesJoined();
|
||||
int iNumSidesRequired = GetSidesRequiredToPlayStyle(m_style);
|
||||
|
||||
if( GAMESTATE->UsingPremiumAndPaying() )
|
||||
{
|
||||
if( iNumCreditsInserted < iNumCreditsRequired )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( iNumSidesRequired != iNumSidesJoined )
|
||||
return false;
|
||||
}
|
||||
if( iNumSidesRequired != iNumSidesJoined )
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Don't allow a PlayMode that's incompatible with our current Style (if set),
|
||||
@@ -297,15 +272,6 @@ void ModeChoice::Apply( PlayerNumber pn ) const
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
// If using a premium setting, subtract coins only after choosing a style.
|
||||
int iNumCoinsInserted = GAMESTATE->m_iCoins;
|
||||
int iNumCoinsRequired = PREFSMAN->m_iCoinsPerCredit*GetCreditsRequiredToPlayStyle(m_style);
|
||||
if( GAMESTATE->UsingPremiumAndPaying() )
|
||||
{
|
||||
ASSERT( iNumCoinsInserted >= iNumCoinsRequired );
|
||||
GAMESTATE->m_iCoins -= iNumCoinsRequired;
|
||||
}
|
||||
}
|
||||
if( m_dc != DIFFICULTY_INVALID && pn != PLAYER_INVALID )
|
||||
GAMESTATE->m_PreferredDifficulty[pn] = m_dc;
|
||||
|
||||
@@ -87,8 +87,7 @@ PrefsManager::PrefsManager()
|
||||
m_iMarvelousTiming = 2;
|
||||
m_iCoinMode = COIN_HOME;
|
||||
m_iCoinsPerCredit = 1;
|
||||
m_bVersusForOneCredit = false;
|
||||
m_bDoubleForOneCredit = false;
|
||||
m_Premium = NO_PREMIUM;
|
||||
m_iBoostAppPriority = -1;
|
||||
m_bAntiAliasing = false;
|
||||
m_ShowSongOptions = YES;
|
||||
@@ -260,8 +259,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk()
|
||||
ini.GetValue( "Options", "SoundResampleQuality", m_iSoundResampleQuality );
|
||||
ini.GetValue( "Options", "CoinMode", m_iCoinMode );
|
||||
ini.GetValue( "Options", "CoinsPerCredit", m_iCoinsPerCredit );
|
||||
ini.GetValue( "Options", "VersusForOneCredit", m_bVersusForOneCredit );
|
||||
ini.GetValue( "Options", "DoubleForOneCredit", m_bDoubleForOneCredit );
|
||||
ini.GetValue( "Options", "Premium", (int&)m_Premium );
|
||||
ini.GetValue( "Options", "BoostAppPriority", m_iBoostAppPriority );
|
||||
ini.GetValue( "Options", "PickExtraStage", m_bPickExtraStage );
|
||||
ini.GetValue( "Options", "ComboContinuesBetweenSongs", m_bComboContinuesBetweenSongs );
|
||||
@@ -400,8 +398,7 @@ 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", "VersusForOneCredit", m_bVersusForOneCredit );
|
||||
ini.SetValue( "Options", "DoubleForOneCredit", m_bDoubleForOneCredit );
|
||||
ini.SetValue( "Options", "Premium", m_Premium );
|
||||
ini.SetValue( "Options", "BoostAppPriority", m_iBoostAppPriority );
|
||||
ini.SetValue( "Options", "PickExtraStage", m_bPickExtraStage );
|
||||
ini.SetValue( "Options", "ComboContinuesBetweenSongs", m_bComboContinuesBetweenSongs );
|
||||
|
||||
@@ -72,8 +72,8 @@ public:
|
||||
int m_iMarvelousTiming;
|
||||
int m_iCoinMode;
|
||||
int m_iCoinsPerCredit;
|
||||
bool m_bVersusForOneCredit;
|
||||
bool m_bDoubleForOneCredit;
|
||||
enum Premium { NO_PREMIUM, DOUBLE_FOR_1CREDIT, JOINT_PREMIUM };
|
||||
Premium m_Premium;
|
||||
bool m_bPickExtraStage;
|
||||
bool m_bComboContinuesBetweenSongs;
|
||||
float m_fLongVerSongSeconds;
|
||||
|
||||
@@ -189,10 +189,9 @@ bool Screen::JoinInput( const DeviceInput& DeviceI, const InputEventType type, c
|
||||
if( PREFSMAN->m_iCoinMode == COIN_PAY )
|
||||
iCoinsToCharge = PREFSMAN->m_iCoinsPerCredit;
|
||||
|
||||
// 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 )
|
||||
// If joint premium don't take away a credit for the 2nd join.
|
||||
if( PREFSMAN->m_Premium == PrefsManager::JOINT_PREMIUM &&
|
||||
GAMESTATE->GetNumSidesJoined() == 1 )
|
||||
iCoinsToCharge = 0;
|
||||
|
||||
if( GAMESTATE->m_iCoins < iCoinsToCharge )
|
||||
|
||||
@@ -199,16 +199,21 @@ void ScreenSystemLayer::RefreshCreditsMessages()
|
||||
Profile* pProfile = PROFILEMAN->GetProfile( (PlayerNumber)p );
|
||||
if( pProfile )
|
||||
sPlayerInfo = pProfile->m_sName;
|
||||
else if( GAMESTATE->m_bPlayersCanJoin )
|
||||
sPlayerInfo = PLAYER_INFO_INSERT_CARD;
|
||||
else if( GAMESTATE->m_bIsOnSystemMenu )
|
||||
else if( GAMESTATE->m_bIsOnSystemMenu ) // no mem card
|
||||
sPlayerInfo = "";
|
||||
else
|
||||
sPlayerInfo = PLAYER_INFO_NO_CARD;
|
||||
else if( PREFSMAN->m_sMemoryCardDir[p]!="" )
|
||||
{
|
||||
if( GAMESTATE->m_bPlayersCanJoin )
|
||||
sPlayerInfo = PLAYER_INFO_INSERT_CARD;
|
||||
else
|
||||
sPlayerInfo = PLAYER_INFO_NO_CARD;
|
||||
}
|
||||
}
|
||||
else if( GAMESTATE->m_bPlayersCanJoin )
|
||||
{
|
||||
if( PREFSMAN->m_iCoinMode==COIN_PAY && GAMESTATE->m_iCoins<PREFSMAN->m_iCoinsPerCredit )
|
||||
if( PREFSMAN->m_iCoinMode==COIN_PAY &&
|
||||
PREFSMAN->m_Premium!=PrefsManager::JOINT_PREMIUM &&
|
||||
GAMESTATE->m_iCoins<PREFSMAN->m_iCoinsPerCredit )
|
||||
sPlayerInfo = PLAYER_INFO_INSERT_MORE;
|
||||
else
|
||||
sPlayerInfo = PLAYER_INFO_PRESS_START;
|
||||
|
||||
@@ -263,8 +263,11 @@ static void CoinsPerCredit( int &sel, bool ToSel, const CStringArray &choices )
|
||||
MoveMap( sel, PREFSMAN->m_iCoinsPerCredit, ToSel, mapping, ARRAYSIZE(mapping) );
|
||||
}
|
||||
|
||||
MOVE( VersusPremium, PREFSMAN->m_bVersusForOneCredit );
|
||||
MOVE( DoublePremium, PREFSMAN->m_bDoubleForOneCredit );
|
||||
static void Premium( int &sel, bool ToSel, const CStringArray &choices )
|
||||
{
|
||||
const PrefsManager::Premium mapping[] = { PrefsManager::NO_PREMIUM,PrefsManager::DOUBLE_FOR_1CREDIT,PrefsManager::JOINT_PREMIUM };
|
||||
MoveMap( sel, PREFSMAN->m_Premium, ToSel, mapping, ARRAYSIZE(mapping) );
|
||||
}
|
||||
|
||||
static void SongsPerPlay( int &sel, bool ToSel, const CStringArray &choices )
|
||||
{
|
||||
@@ -454,8 +457,7 @@ 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( "Versus\nPremium", VersusPremium, "OFF (2 credits)","ON (1 credit)" ),
|
||||
ConfOption( "Double\nPremium", DoublePremium, "OFF (2 credits)","ON (1 credit)" ),
|
||||
ConfOption( "Premium", Premium, "OFF","DOUBLE FOR 1 CREDIT","JOINT PREMIUM" ),
|
||||
ConfOption( "Show Song\nOptions", ShowSongOptions, "HIDE","SHOW","ASK" ),
|
||||
ConfOption( "Show Name\nEntry", ShowNameEntry, "OFF", "ON", "RANKING SONGS" ),
|
||||
|
||||
|
||||
@@ -93,18 +93,10 @@ void ScreenSelect::Input( const DeviceInput& DeviceI, const InputEventType type,
|
||||
{
|
||||
// LOG->Trace( "ScreenSelect::Input()" );
|
||||
|
||||
if( GAMESTATE->UsingPremiumAndPaying() )
|
||||
if( Screen::JoinInput(DeviceI, type, GameI, MenuI, StyleI) )
|
||||
{
|
||||
if( MenuI.IsValid() && MenuI.button==MENU_BUTTON_COIN && GAMESTATE->m_iCoins==PREFSMAN->m_iCoinsPerCredit*2 )
|
||||
this->UpdateSelectableChoices();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( Screen::JoinInput(DeviceI, type, GameI, MenuI, StyleI) )
|
||||
{
|
||||
this->UpdateSelectableChoices();
|
||||
return; // don't let the screen handle the MENU_START press
|
||||
}
|
||||
this->UpdateSelectableChoices();
|
||||
return; // don't let the screen handle the MENU_START press
|
||||
}
|
||||
|
||||
if( m_Menu.IsTransitioning() )
|
||||
|
||||
@@ -168,9 +168,9 @@ void ScreenSelectMode::UpdateSelectableChoices()
|
||||
(mc.m_style == STYLE_INVALID) ?
|
||||
1 :
|
||||
1;
|
||||
if( !(PREFSMAN->m_bVersusForOneCredit||PREFSMAN->m_bDoubleForOneCredit ) ||
|
||||
if( PREFSMAN->m_Premium!=PrefsManager::JOINT_PREMIUM ||
|
||||
(
|
||||
(PREFSMAN->m_bVersusForOneCredit||PREFSMAN->m_bDoubleForOneCredit) &&
|
||||
(PREFSMAN->m_Premium==PrefsManager::JOINT_PREMIUM) &&
|
||||
(
|
||||
(INCLUDE_DOUBLE_IN_JP == 1 && (GAMESTATE->GetNumSidesJoined() == SidesJoinedToPlay)) ||
|
||||
(
|
||||
|
||||
@@ -108,7 +108,7 @@ ScreenSelectStyle::ScreenSelectStyle( CString sClassName ) : ScreenSelect( sClas
|
||||
|
||||
m_sprJointPremium.SetName( "JointPremium" );
|
||||
|
||||
if( GAMESTATE->UsingPremiumAndPaying() )
|
||||
if( PREFSMAN->m_Premium==PrefsManager::JOINT_PREMIUM )
|
||||
{
|
||||
m_sprJointPremium.Load( THEME->GetPathToG(m_sName + " joint premium") );
|
||||
this->AddChild( &m_sprJointPremium );
|
||||
|
||||
@@ -62,6 +62,7 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam
|
||||
{
|
||||
LOG->Trace( "ScreenTitleMenu::ScreenTitleMenu()" );
|
||||
|
||||
|
||||
/* XXX We really need two common calls: 1, something run when exiting from gameplay
|
||||
* (to do this reset), and 2, something run when entering gameplay, to apply default
|
||||
* options. Having special cases in attract screens and the title menu to reset
|
||||
@@ -71,7 +72,7 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam
|
||||
|
||||
CodeDetector::RefreshCacheItems();
|
||||
|
||||
if( GAMESTATE->UsingPremiumAndPaying() )
|
||||
if( PREFSMAN->m_Premium==PrefsManager::JOINT_PREMIUM )
|
||||
{
|
||||
m_JointPremium.LoadFromAniDir( THEME->GetPathToB("ScreenTitleMenu joint premium") );
|
||||
this->AddChild( &m_JointPremium );
|
||||
|
||||
Reference in New Issue
Block a user