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
+5 -1
View File
@@ -537,7 +537,7 @@ Insanity=Insanity
Insert Entry=Insert Entry Insert Entry=Insert Entry
Instant=Instant Instant=Instant
Invert=Invert Invert=Invert
Joint Premium=Joint Premium Versus for 1 Credit=Versus for 1 Credit
Justice=Justice Justice=Justice
Left=Left Left=Left
LifeTime=Survival LifeTime=Survival
@@ -1764,3 +1764,7 @@ HelpText=Ctrl + Enter to enter room/select song
[LowLevelWindow_Win32] [LowLevelWindow_Win32]
OpenGL hardware acceleration is not available.=OpenGL hardware acceleration is not available. OpenGL hardware acceleration is not available.=OpenGL hardware acceleration is not available.
[Premium]
Off=Off
DoubleFor1Credit=Double For 1 Credit
2PlayersFor1Credit=2 Players For 1 Credit
+6 -6
View File
@@ -397,7 +397,7 @@ int GetNumCreditsPaid()
int iNumCreditsPaid = GAMESTATE->GetNumSidesJoined(); int iNumCreditsPaid = GAMESTATE->GetNumSidesJoined();
// players other than the first joined for free // players other than the first joined for free
if( GAMESTATE->GetPremium() == PREMIUM_JOINT ) if( GAMESTATE->GetPremium() == Premium_2PlayersFor1Credit )
iNumCreditsPaid = min( iNumCreditsPaid, 1 ); iNumCreditsPaid = min( iNumCreditsPaid, 1 );
return iNumCreditsPaid; return iNumCreditsPaid;
@@ -406,7 +406,7 @@ int GetNumCreditsPaid()
int GetCreditsRequiredToPlayStyle( const Style *style ) int GetCreditsRequiredToPlayStyle( const Style *style )
{ {
if( GAMESTATE->GetPremium() == PREMIUM_JOINT ) if( GAMESTATE->GetPremium() == Premium_2PlayersFor1Credit )
return 1; return 1;
switch( style->m_StyleType ) switch( style->m_StyleType )
@@ -417,7 +417,7 @@ int GetCreditsRequiredToPlayStyle( const Style *style )
case StyleType_TwoPlayersTwoSides: case StyleType_TwoPlayersTwoSides:
return 2; return 2;
case StyleType_OnePlayerTwoSides: case StyleType_OnePlayerTwoSides:
return (GAMESTATE->GetPremium() == PREMIUM_DOUBLE) ? 1 : 2; return (GAMESTATE->GetPremium() == Premium_DoubleFor1Credit) ? 1 : 2;
DEFAULT_FAIL( style->m_StyleType ); DEFAULT_FAIL( style->m_StyleType );
} }
} }
@@ -463,8 +463,8 @@ bool GameCommand::IsPlayable( RString *why ) const
switch( GAMESTATE->GetCoinMode() ) switch( GAMESTATE->GetCoinMode() )
{ {
case COIN_MODE_HOME: case CoinMode_Home:
case COIN_MODE_FREE: case CoinMode_Free:
iCredits = NUM_PLAYERS; /* not iNumCreditsPaid */ 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 // players joined. If enough players aren't joined, then
// we need to subtract credits for the sides that will be // we need to subtract credits for the sides that will be
// joined as a result of applying this option. // 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 iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyle);
int iNumCreditsPaid = GetNumCreditsPaid(); int iNumCreditsPaid = GetNumCreditsPaid();
+4 -3
View File
@@ -114,12 +114,13 @@ LuaXType( CoinMode );
static const char *PremiumNames[] = { static const char *PremiumNames[] = {
"None", "Off",
"Double", "DoubleFor1Credit",
"Joint", "2PlayersFor1Credit",
}; };
XToString( Premium ); XToString( Premium );
StringToX( Premium ); StringToX( Premium );
XToLocalizedString( Premium );
LuaXType( Premium ); LuaXType( Premium );
+7 -6
View File
@@ -312,9 +312,9 @@ const int ITEM_NONE = -1;
enum CoinMode enum CoinMode
{ {
COIN_MODE_HOME, CoinMode_Home,
COIN_MODE_PAY, CoinMode_Pay,
COIN_MODE_FREE, CoinMode_Free,
NUM_CoinMode, NUM_CoinMode,
CoinMode_Invalid CoinMode_Invalid
}; };
@@ -327,13 +327,14 @@ LuaDeclareType( CoinMode );
// //
enum Premium enum Premium
{ {
PREMIUM_NONE, Premium_Off,
PREMIUM_DOUBLE, Premium_DoubleFor1Credit,
PREMIUM_JOINT, Premium_2PlayersFor1Credit,
NUM_Premium, NUM_Premium,
Premium_Invalid Premium_Invalid
}; };
const RString& PremiumToString( Premium p ); const RString& PremiumToString( Premium p );
const RString& PremiumToLocalizedString( Premium p );
LuaDeclareType( Premium ); LuaDeclareType( Premium );
+1 -1
View File
@@ -3,7 +3,7 @@
// This options has weird interactions depending on m_bEventMode; // This options has weird interactions depending on m_bEventMode;
// use GameState::GetCoinMode(). // 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 ); 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_PLAYER_MODS_FORCED( "GameState","AreStagePlayerModsForced" );
static DynamicThemeMetric<bool> ARE_STAGE_SONG_MODS_FORCED( "GameState","AreStageSongModsForced" ); 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() : GameState::GameState() :
m_pCurGame( Message_CurrentGameChanged ), m_pCurGame( Message_CurrentGameChanged ),
@@ -356,11 +356,11 @@ int GameState::GetCoinsNeededToJoin() const
{ {
int iCoinsToCharge = 0; int iCoinsToCharge = 0;
if( GetCoinMode() == COIN_MODE_PAY ) if( GetCoinMode() == CoinMode_Pay )
iCoinsToCharge = PREFSMAN->m_iCoinsPerCredit; iCoinsToCharge = PREFSMAN->m_iCoinsPerCredit;
// If joint premium don't take away a credit for the 2nd join. // If joint premium don't take away a credit for the 2nd join.
if( GetPremium() == PREMIUM_JOINT && if( GetPremium() == Premium_2PlayersFor1Credit &&
GetNumSidesJoined() == 1 ) GetNumSidesJoined() == 1 )
iCoinsToCharge = 0; iCoinsToCharge = 0;
@@ -1816,8 +1816,8 @@ bool GameState::IsEventMode() const
CoinMode GameState::GetCoinMode() const CoinMode GameState::GetCoinMode() const
{ {
if( IsEventMode() && GamePreferences::m_CoinMode == COIN_MODE_PAY ) if( IsEventMode() && GamePreferences::m_CoinMode == CoinMode_Pay )
return COIN_MODE_FREE; return CoinMode_Free;
else else
return GamePreferences::m_CoinMode; return GamePreferences::m_CoinMode;
} }
@@ -1825,7 +1825,7 @@ CoinMode GameState::GetCoinMode() const
Premium GameState::GetPremium() const Premium GameState::GetPremium() const
{ {
if( IsEventMode() ) if( IsEventMode() )
return PREMIUM_NONE; return Premium_Off;
else else
return g_Premium; return g_Premium;
} }
+3 -3
View File
@@ -55,13 +55,13 @@ void ScreenAttract::AttractInput( const InputEventPlus &input, ScreenWithMenuEle
case MENU_BUTTON_COIN: case MENU_BUTTON_COIN:
switch( GAMESTATE->GetCoinMode() ) 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() ); LOG->Trace("ScreenAttract::AttractInput: COIN_PAY (%i/%i)", GAMESTATE->m_iCoins, PREFSMAN->m_iCoinsPerCredit.Get() );
if( GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit ) if( GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit )
break; // don't fall through break; // don't fall through
// fall through // fall through
case COIN_MODE_HOME: case CoinMode_Home:
case COIN_MODE_FREE: case CoinMode_Free:
if( pScreen->IsTransitioning() ) if( pScreen->IsTransitioning() )
return; 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> template <class T>
static void MoveMap( int &sel, const ConfOption *pConfOption, bool ToSel, const T *mapping, unsigned cnt ) static void MoveMap( int &sel, const ConfOption *pConfOption, bool ToSel, const T *mapping, unsigned cnt )
{ {
ASSERT( pConfOption );
IPreference *pPref = IPreference::GetPreferenceByName( pConfOption->m_sPrefName ); IPreference *pPref = IPreference::GetPreferenceByName( pConfOption->m_sPrefName );
ASSERT_M( pPref != NULL, 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 */ /* Gameplay options */
static void CoinModeNoHome( int &sel, bool ToSel, const ConfOption *pConfOption ) 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 ) if( ToSel )
{ {
MovePref<CoinMode>( sel, ToSel, pConfOption ); MovePref<CoinMode>( sel, ToSel, pConfOption );
if( sel > static_cast<int>(COIN_MODE_HOME) ) if( sel > static_cast<int>(CoinMode_Home) )
--sel; --sel;
} }
else else
{ {
if( sel >= static_cast<int>(COIN_MODE_HOME) ) if( sel >= static_cast<int>(CoinMode_Home) )
++sel; ++sel;
MovePref<CoinMode>( sel, ToSel, pConfOption ); MovePref<CoinMode>( sel, ToSel, pConfOption );
} }
@@ -423,7 +424,7 @@ static void LifeDifficulty( int &sel, bool ToSel, const ConfOption *pConfOption
static int GetLifeDifficulty() static int GetLifeDifficulty()
{ {
int iLifeDifficulty = 0; int iLifeDifficulty = 0;
LifeDifficulty( iLifeDifficulty, true, NULL ); LifeDifficulty( iLifeDifficulty, true, ConfOption::Find("Premium") );
iLifeDifficulty++; // LifeDifficulty returns an index iLifeDifficulty++; // LifeDifficulty returns an index
return iLifeDifficulty; 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( "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( "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( "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( "ShowSongOptions", MovePref<Maybe>, "Ask", "Hide","Show" ) );
ADD( ConfOption( "GetRankingName", MovePref<GetRankingName>, "Off", "On", "Ranking Songs" ) ); 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. // 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 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 ) 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) ? (mc.m_pStyle == NULL) ?
1 : 1 :
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)) || (INCLUDE_DOUBLE_IN_JP == 1 && (GAMESTATE->GetNumSidesJoined() == SidesJoinedToPlay)) ||
( (
+2 -2
View File
@@ -102,11 +102,11 @@ void ScreenSelectStyle::Init()
switch( GAMESTATE->GetPremium() ) switch( GAMESTATE->GetPremium() )
{ {
case PREMIUM_DOUBLE: case Premium_DoubleFor1Credit:
m_sprPremium.Load( THEME->GetPathG(m_sName,"doubles premium") ); m_sprPremium.Load( THEME->GetPathG(m_sName,"doubles premium") );
this->AddChild( &m_sprPremium ); this->AddChild( &m_sprPremium );
break; break;
case PREMIUM_JOINT: case Premium_2PlayersFor1Credit:
m_sprPremium.Load( THEME->GetPathG(m_sName,"joint premium") ); m_sprPremium.Load( THEME->GetPathG(m_sName,"joint premium") );
this->AddChild( &m_sprPremium ); this->AddChild( &m_sprPremium );
break; break;
+3 -3
View File
@@ -98,13 +98,13 @@ namespace
{ {
switch( GAMESTATE->GetCoinMode() ) switch( GAMESTATE->GetCoinMode() )
{ {
case COIN_MODE_HOME: case CoinMode_Home:
if( GAMESTATE->PlayersCanJoin() ) if( GAMESTATE->PlayersCanJoin() )
return CREDITS_PRESS_START.GetValue(); return CREDITS_PRESS_START.GetValue();
else else
return CREDITS_NOT_PRESENT.GetValue(); return CREDITS_NOT_PRESENT.GetValue();
case COIN_MODE_PAY: case CoinMode_Pay:
{ {
int Credits = GAMESTATE->m_iCoins / PREFSMAN->m_iCoinsPerCredit; int Credits = GAMESTATE->m_iCoins / PREFSMAN->m_iCoinsPerCredit;
int Coins = 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() ); sCredits += ssprintf(" %d/%d", Coins, PREFSMAN->m_iCoinsPerCredit.Get() );
return sCredits; return sCredits;
} }
case COIN_MODE_FREE: case CoinMode_Free:
if( GAMESTATE->PlayersCanJoin() ) if( GAMESTATE->PlayersCanJoin() )
return CREDITS_FREE_PLAY.GetValue(); return CREDITS_FREE_PLAY.GetValue();
else else