cleanup CoinMode and Premium names

This commit is contained in:
Chris Danford
2007-02-26 09:40:14 +00:00
parent e9f66fbc75
commit 0c972a4dd7
12 changed files with 46 additions and 39 deletions
+6 -6
View File
@@ -397,7 +397,7 @@ int GetNumCreditsPaid()
int iNumCreditsPaid = GAMESTATE->GetNumSidesJoined();
// players other than the first joined for free
if( GAMESTATE->GetPremium() == PREMIUM_JOINT )
if( GAMESTATE->GetPremium() == Premium_2PlayersFor1Credit )
iNumCreditsPaid = min( iNumCreditsPaid, 1 );
return iNumCreditsPaid;
@@ -406,7 +406,7 @@ int GetNumCreditsPaid()
int GetCreditsRequiredToPlayStyle( const Style *style )
{
if( GAMESTATE->GetPremium() == PREMIUM_JOINT )
if( GAMESTATE->GetPremium() == Premium_2PlayersFor1Credit )
return 1;
switch( style->m_StyleType )
@@ -417,7 +417,7 @@ int GetCreditsRequiredToPlayStyle( const Style *style )
case StyleType_TwoPlayersTwoSides:
return 2;
case StyleType_OnePlayerTwoSides:
return (GAMESTATE->GetPremium() == PREMIUM_DOUBLE) ? 1 : 2;
return (GAMESTATE->GetPremium() == Premium_DoubleFor1Credit) ? 1 : 2;
DEFAULT_FAIL( style->m_StyleType );
}
}
@@ -463,8 +463,8 @@ bool GameCommand::IsPlayable( RString *why ) const
switch( GAMESTATE->GetCoinMode() )
{
case COIN_MODE_HOME:
case COIN_MODE_FREE:
case CoinMode_Home:
case CoinMode_Free:
iCredits = NUM_PLAYERS; /* not iNumCreditsPaid */
}
@@ -627,7 +627,7 @@ void GameCommand::ApplySelf( const vector<PlayerNumber> &vpns ) const
// players joined. If enough players aren't joined, then
// we need to subtract credits for the sides that will be
// joined as a result of applying this option.
if( GAMESTATE->GetCoinMode() == COIN_MODE_PAY )
if( GAMESTATE->GetCoinMode() == CoinMode_Pay )
{
int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyle);
int iNumCreditsPaid = GetNumCreditsPaid();
+4 -3
View File
@@ -114,12 +114,13 @@ LuaXType( CoinMode );
static const char *PremiumNames[] = {
"None",
"Double",
"Joint",
"Off",
"DoubleFor1Credit",
"2PlayersFor1Credit",
};
XToString( Premium );
StringToX( Premium );
XToLocalizedString( Premium );
LuaXType( Premium );
+7 -6
View File
@@ -312,9 +312,9 @@ const int ITEM_NONE = -1;
enum CoinMode
{
COIN_MODE_HOME,
COIN_MODE_PAY,
COIN_MODE_FREE,
CoinMode_Home,
CoinMode_Pay,
CoinMode_Free,
NUM_CoinMode,
CoinMode_Invalid
};
@@ -327,13 +327,14 @@ LuaDeclareType( CoinMode );
//
enum Premium
{
PREMIUM_NONE,
PREMIUM_DOUBLE,
PREMIUM_JOINT,
Premium_Off,
Premium_DoubleFor1Credit,
Premium_2PlayersFor1Credit,
NUM_Premium,
Premium_Invalid
};
const RString& PremiumToString( Premium p );
const RString& PremiumToLocalizedString( Premium p );
LuaDeclareType( Premium );
+1 -1
View File
@@ -3,7 +3,7 @@
// This options has weird interactions depending on m_bEventMode;
// use GameState::GetCoinMode().
Preference<CoinMode> GamePreferences::m_CoinMode( "CoinMode", COIN_MODE_HOME );
Preference<CoinMode> GamePreferences::m_CoinMode( "CoinMode", CoinMode_Home );
Preference<PlayerController> GamePreferences::m_AutoPlay( "AutoPlay", PC_HUMAN );
+6 -6
View File
@@ -97,7 +97,7 @@ static const ThemeMetric<Grade> GRADE_TIER_FOR_EXTRA_2 ("GameState","GradeTierFo
static DynamicThemeMetric<bool> ARE_STAGE_PLAYER_MODS_FORCED( "GameState","AreStagePlayerModsForced" );
static DynamicThemeMetric<bool> ARE_STAGE_SONG_MODS_FORCED( "GameState","AreStageSongModsForced" );
static Preference<Premium> g_Premium( "Premium", PREMIUM_NONE );
static Preference<Premium> g_Premium( "Premium", Premium_Off );
GameState::GameState() :
m_pCurGame( Message_CurrentGameChanged ),
@@ -356,11 +356,11 @@ int GameState::GetCoinsNeededToJoin() const
{
int iCoinsToCharge = 0;
if( GetCoinMode() == COIN_MODE_PAY )
if( GetCoinMode() == CoinMode_Pay )
iCoinsToCharge = PREFSMAN->m_iCoinsPerCredit;
// If joint premium don't take away a credit for the 2nd join.
if( GetPremium() == PREMIUM_JOINT &&
if( GetPremium() == Premium_2PlayersFor1Credit &&
GetNumSidesJoined() == 1 )
iCoinsToCharge = 0;
@@ -1816,8 +1816,8 @@ bool GameState::IsEventMode() const
CoinMode GameState::GetCoinMode() const
{
if( IsEventMode() && GamePreferences::m_CoinMode == COIN_MODE_PAY )
return COIN_MODE_FREE;
if( IsEventMode() && GamePreferences::m_CoinMode == CoinMode_Pay )
return CoinMode_Free;
else
return GamePreferences::m_CoinMode;
}
@@ -1825,7 +1825,7 @@ CoinMode GameState::GetCoinMode() const
Premium GameState::GetPremium() const
{
if( IsEventMode() )
return PREMIUM_NONE;
return Premium_Off;
else
return g_Premium;
}
+3 -3
View File
@@ -55,13 +55,13 @@ void ScreenAttract::AttractInput( const InputEventPlus &input, ScreenWithMenuEle
case MENU_BUTTON_COIN:
switch( GAMESTATE->GetCoinMode() )
{
case COIN_MODE_PAY:
case CoinMode_Pay:
LOG->Trace("ScreenAttract::AttractInput: COIN_PAY (%i/%i)", GAMESTATE->m_iCoins, PREFSMAN->m_iCoinsPerCredit.Get() );
if( GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit )
break; // don't fall through
// fall through
case COIN_MODE_HOME:
case COIN_MODE_FREE:
case CoinMode_Home:
case CoinMode_Free:
if( pScreen->IsTransitioning() )
return;
+6 -5
View File
@@ -100,6 +100,7 @@ static void MoveMap( int &sel, IPreference &opt, bool ToSel, const T *mapping, u
template <class T>
static void MoveMap( int &sel, const ConfOption *pConfOption, bool ToSel, const T *mapping, unsigned cnt )
{
ASSERT( pConfOption );
IPreference *pPref = IPreference::GetPreferenceByName( pConfOption->m_sPrefName );
ASSERT_M( pPref != NULL, pConfOption->m_sPrefName );
@@ -368,16 +369,16 @@ static void MusicWheelSwitchSpeed( int &sel, bool ToSel, const ConfOption *pConf
/* Gameplay options */
static void CoinModeNoHome( int &sel, bool ToSel, const ConfOption *pConfOption )
{
// The mapping without home is easy: subtract one to compensate for the missing COIN_MODE_HOME
// The mapping without home is easy: subtract one to compensate for the missing CoinMode_Home
if( ToSel )
{
MovePref<CoinMode>( sel, ToSel, pConfOption );
if( sel > static_cast<int>(COIN_MODE_HOME) )
if( sel > static_cast<int>(CoinMode_Home) )
--sel;
}
else
{
if( sel >= static_cast<int>(COIN_MODE_HOME) )
if( sel >= static_cast<int>(CoinMode_Home) )
++sel;
MovePref<CoinMode>( sel, ToSel, pConfOption );
}
@@ -423,7 +424,7 @@ static void LifeDifficulty( int &sel, bool ToSel, const ConfOption *pConfOption
static int GetLifeDifficulty()
{
int iLifeDifficulty = 0;
LifeDifficulty( iLifeDifficulty, true, NULL );
LifeDifficulty( iLifeDifficulty, true, ConfOption::Find("Premium") );
iLifeDifficulty++; // LifeDifficulty returns an index
return iLifeDifficulty;
}
@@ -661,7 +662,7 @@ static void InitializeConfOptions()
ADD( ConfOption( "ProgressiveNonstopLifebar", MovePref<int>, "Off","|1","|2","|3","|4","|5","|6","|7","|8","Insanity") );
ADD( ConfOption( "DefaultFailType", DefaultFailType, "Immediate","ImmediateContinue","End of Song","Off" ) );
ADD( ConfOption( "CoinsPerCredit", CoinsPerCredit, "|1","|2","|3","|4","|5","|6","|7","|8","|9","|10","|11","|12","|13","|14","|15","|16" ) );
ADD( ConfOption( "Premium", MovePref<Premium>, "Off","Double for 1 Credit","Joint Premium" ) );
ADD( ConfOption( "Premium", MovePref<Premium>, "Off","Double for 1 Credit","2 Players for 1 Credit" ) );
ADD( ConfOption( "ShowSongOptions", MovePref<Maybe>, "Ask", "Hide","Show" ) );
ADD( ConfOption( "GetRankingName", MovePref<GetRankingName>, "Off", "On", "Ranking Songs" ) );
+1 -1
View File
@@ -116,7 +116,7 @@ void ScreenSelect::Update( float fDelta )
}
// don't time out on this screen is coin mode is pay.
// If we're here, then there's a credit in the machine.
if( GAMESTATE->GetCoinMode() != COIN_MODE_PAY )
if( GAMESTATE->GetCoinMode() != CoinMode_Pay )
{
if( IDLE_TIMEOUT_SECONDS > 0 && m_timerIdleTimeout.PeekDeltaTime() >= IDLE_TIMEOUT_SECONDS )
{
+2 -2
View File
@@ -200,9 +200,9 @@ void ScreenSelectMode::UpdateSelectableChoices()
(mc.m_pStyle == NULL) ?
1 :
1;
if( GAMESTATE->GetPremium()!=PREMIUM_JOINT ||
if( GAMESTATE->GetPremium()!=Premium_2PlayersFor1Credit ||
(
(GAMESTATE->GetPremium()==PREMIUM_JOINT) &&
(GAMESTATE->GetPremium()==Premium_2PlayersFor1Credit) &&
(
(INCLUDE_DOUBLE_IN_JP == 1 && (GAMESTATE->GetNumSidesJoined() == SidesJoinedToPlay)) ||
(
+2 -2
View File
@@ -102,11 +102,11 @@ void ScreenSelectStyle::Init()
switch( GAMESTATE->GetPremium() )
{
case PREMIUM_DOUBLE:
case Premium_DoubleFor1Credit:
m_sprPremium.Load( THEME->GetPathG(m_sName,"doubles premium") );
this->AddChild( &m_sprPremium );
break;
case PREMIUM_JOINT:
case Premium_2PlayersFor1Credit:
m_sprPremium.Load( THEME->GetPathG(m_sName,"joint premium") );
this->AddChild( &m_sprPremium );
break;
+3 -3
View File
@@ -98,13 +98,13 @@ namespace
{
switch( GAMESTATE->GetCoinMode() )
{
case COIN_MODE_HOME:
case CoinMode_Home:
if( GAMESTATE->PlayersCanJoin() )
return CREDITS_PRESS_START.GetValue();
else
return CREDITS_NOT_PRESENT.GetValue();
case COIN_MODE_PAY:
case CoinMode_Pay:
{
int Credits = GAMESTATE->m_iCoins / PREFSMAN->m_iCoinsPerCredit;
int Coins = GAMESTATE->m_iCoins % PREFSMAN->m_iCoinsPerCredit;
@@ -115,7 +115,7 @@ namespace
sCredits += ssprintf(" %d/%d", Coins, PREFSMAN->m_iCoinsPerCredit.Get() );
return sCredits;
}
case COIN_MODE_FREE:
case CoinMode_Free:
if( GAMESTATE->PlayersCanJoin() )
return CREDITS_FREE_PLAY.GetValue();
else