From 6b3da26a4c8bd9495ab4913e0b46a9da062c9304 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Wed, 2 Jun 2010 15:43:56 -0500 Subject: [PATCH] [GameCommand] Don't allow battle/rave with Routine (StyleType_TwoPlayersSharedSides). also cleanup [RageTypes] remove glowmode stub stuff [RageDisplayOGL] update comments slightly --- src/GameCommand.cpp | 63 ++++++++++++++++++++--------------------- src/RageDisplay_OGL.cpp | 12 ++++---- src/RageTypes.cpp | 8 ------ src/RageTypes.h | 17 +++-------- 4 files changed, 41 insertions(+), 59 deletions(-) diff --git a/src/GameCommand.cpp b/src/GameCommand.cpp index 41781eb7c1..b19aa2d0c2 100644 --- a/src/GameCommand.cpp +++ b/src/GameCommand.cpp @@ -168,7 +168,7 @@ void GameCommand::LoadOne( const Command& cmd ) RString sName = cmd.GetName(); if( sName.empty() ) return; - + RString sValue; for( unsigned i = 1; i < cmd.m_vsArgs.size(); ++i ) { @@ -208,7 +208,7 @@ void GameCommand::LoadOne( const Command& cmd ) { m_sAnnouncer = sValue; } - + else if( sName == "name" ) { m_sName = sValue; @@ -232,19 +232,19 @@ void GameCommand::LoadOne( const Command& cmd ) m_sStageModifiers += ","; m_sStageModifiers += sValue; } - + else if( sName == "lua" ) { m_LuaFunction.SetFromExpression( sValue ); ASSERT_M( !m_LuaFunction.IsNil(), ssprintf("\"%s\" evaluated to nil", sValue.c_str()) ); } - + else if( sName == "screen" ) { m_sScreen = sValue; m_bPushScreen = false; } - + else if( sName == "song" ) { m_pSong = SONGMAN->FindSong( sValue ); @@ -391,7 +391,7 @@ void GameCommand::LoadOne( const Command& cmd ) m_bApplyDefaultOptions = true; } - /* sm-ssc additions begin: */ + // sm-ssc additions begin: else if( sName == "urlnoexit" ) { m_sUrl = sValue; @@ -420,7 +420,7 @@ void GameCommand::LoadOne( const Command& cmd ) else if( sName == "fademusic" ) { - // todo: parse for shit. + // todo: parse things correctly. -aj if( cmd.m_vsArgs.size() == 3 ) { m_bFadeMusic = true; @@ -478,13 +478,14 @@ static bool AreStyleAndPlayModeCompatible( const Style *style, PlayMode pm ) case PLAY_MODE_RAVE: // Can't play rave if there isn't enough room for two players. // This is correct for dance (ie, no rave for solo and doubles), - // and should be okay for pump .. not sure about other game types. + // and should be okay for pump.. not sure about other game types. // Techno Motion scales down versus arrows, though, so allow this. if( style->m_iColsPerPlayer >= 6 && RString(GAMESTATE->m_pCurGame->m_szName) != "techno" ) return false; - - /* Don't allow battle modes if the style takes both sides. */ - if( style->m_StyleType==StyleType_OnePlayerTwoSides ) + + // Don't allow battle modes if the style takes both sides. + if( style->m_StyleType==StyleType_OnePlayerTwoSides || + style->m_StyleType==StyleType_TwoPlayersSharedSides ) return false; } @@ -510,13 +511,13 @@ bool GameCommand::IsPlayable( RString *why ) const { case CoinMode_Home: case CoinMode_Free: - iCredits = NUM_PLAYERS; /* not iNumCreditsPaid */ + iCredits = NUM_PLAYERS; // not iNumCreditsPaid } - /* With PREFSMAN->m_bDelayedCreditsReconcile disabled, enough credits must be - * paid. (This means that enough sides must be joined.) Enabled, simply having - * enough credits lying in the machine is sufficient; we'll deduct the extra in - * Apply(). */ + /* With PREFSMAN->m_bDelayedCreditsReconcile disabled, enough credits must + * be paid. (This means that enough sides must be joined.) Enabled, simply + * having enough credits lying in the machine is sufficient; we'll deduct the + * extra in Apply(). */ int iNumCreditsAvailable = iNumCreditsPaid; if( PREFSMAN->m_bDelayedCreditsReconcile ) iNumCreditsAvailable += iCredits; @@ -528,10 +529,10 @@ bool GameCommand::IsPlayable( RString *why ) const return false; } - /* If you've paid too much already, don't allow the mode. (If we allow this, + /* If you've paid too much already, don't allow the mode. (If we allow this, * the credits will be "refunded" in Apply(), but that's confusing.) */ /* Do allow the mode if they've already joined in more credits than - * are required. Otherwise, people who put in two credits to play + * are required. Otherwise, people who put in two credits to play * doubles on a doubles-premium machiune will get locked out. * the refund logic isn't that awkward because you never see the * credits number jump up - the credits display is hidden if both @@ -545,8 +546,8 @@ bool GameCommand::IsPlayable( RString *why ) const } */ - /* If both sides are joined, disallow singles modes, since easy to select them - * accidentally, instead of versus mode. */ + /* If both sides are joined, disallow singles modes, since easy to select + * them accidentally, instead of versus mode. */ if( m_pStyle->m_StyleType == StyleType_OnePlayerOneSide && GAMESTATE->GetNumSidesJoined() > 1 ) { @@ -642,7 +643,7 @@ void GameCommand::Apply( const vector &vpns ) const { if( m_Commands.v.size() ) { - // We were filled using a GameCommand from metrics. Apply the options in order. + // We were filled using a GameCommand from metrics. Apply the options in order. FOREACH_CONST( Command, m_Commands.v, cmd ) { GameCommand gc; @@ -654,7 +655,7 @@ void GameCommand::Apply( const vector &vpns ) const } else { - // We were filled by an OptionRowHandler in code. m_Commands isn't filled, + // We were filled by an OptionRowHandler in code. m_Commands isn't filled, // so just apply the values that are already set in this. this->ApplySelf( vpns ); } @@ -671,10 +672,9 @@ void GameCommand::ApplySelf( const vector &vpns ) const { GAMESTATE->SetCurrentStyle( m_pStyle ); - // It's possible to choose a style that didn't have enough - // 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. + // It's possible to choose a style that didn't have enough 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() == CoinMode_Pay ) { int iNumCreditsRequired = GetCreditsRequiredToPlayStyle(m_pStyle); @@ -685,9 +685,8 @@ void GameCommand::ApplySelf( const vector &vpns ) const iNumCreditsOwed * PREFSMAN->m_iCoinsPerCredit, GAMESTATE->m_iCoins.Get() ); } - - // If only one side is joined and we picked a style - // that requires both sides, join the other side. + // If only one side is joined and we picked a style that requires both + // sides, join the other side. switch( m_pStyle->m_StyleType ) { case StyleType_OnePlayerOneSide: @@ -791,8 +790,8 @@ void GameCommand::ApplySelf( const vector &vpns ) const ScreenPrompt::Prompt( SM_None, COULD_NOT_LAUNCH_BROWSER ); } - /* If we're going to stop music, do so before preparing new screens, so we don't - * stop music between preparing screens and loading screens. */ + /* If we're going to stop music, do so before preparing new screens, so we + * don't stop music between preparing screens and loading screens. */ if( m_bStopMusic ) SOUND->StopMusic(); if( m_bFadeMusic ) @@ -823,7 +822,7 @@ void GameCommand::ApplySelf( const vector &vpns ) const GAMESTATE->GetDefaultSongOptions( so ); GAMESTATE->m_SongOptions.Assign( ModsLevel_Stage, so ); } - // HACK: Set life type to BATTERY just once here so it happens once and + // HACK: Set life type to BATTERY just once here so it happens once and // we don't override the user's changes if they back out. if( GAMESTATE->m_PlayMode == PLAY_MODE_ONI && GAMESTATE->m_PlayMode != OldPlayMode && diff --git a/src/RageDisplay_OGL.cpp b/src/RageDisplay_OGL.cpp index 8bb1b9385e..34fb16127a 100644 --- a/src/RageDisplay_OGL.cpp +++ b/src/RageDisplay_OGL.cpp @@ -1593,22 +1593,22 @@ void RageDisplay_OGL::SetTextureMode( TextureUnit tu, TextureMode tm ) glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD ); break; case TextureMode_Glow: - // the below function is brighten: + // the below function is glowmode,brighten: if( !GLExt.m_bARB_texture_env_combine && !GLExt.m_bEXT_texture_env_combine ) { - /* This is changing blend state, instead of texture state, which isn't - * great, but it's better than doing nothing. */ + /* This is changing blend state, instead of texture state, which + * isn't great, but it's better than doing nothing. */ glBlendFunc( GL_SRC_ALPHA, GL_ONE ); return; } - // and this is whiten: - /* Source color is the diffuse color only: */ + // and this is glowmode,whiten: + // Source color is the diffuse color only: glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT ); glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_COMBINE_RGB_EXT), GL_REPLACE ); glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_SOURCE0_RGB_EXT), GL_PRIMARY_COLOR_EXT ); - /* Source alpha is texture alpha * diffuse alpha: */ + // Source alpha is texture alpha * diffuse alpha: glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_COMBINE_ALPHA_EXT), GL_MODULATE ); glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_OPERAND0_ALPHA_EXT), GL_SRC_ALPHA ); glTexEnvi( GL_TEXTURE_ENV, GLenum(GL_SOURCE0_ALPHA_EXT), GL_PRIMARY_COLOR_EXT ); diff --git a/src/RageTypes.cpp b/src/RageTypes.cpp index 0aef73d7eb..7da4a26153 100644 --- a/src/RageTypes.cpp +++ b/src/RageTypes.cpp @@ -155,14 +155,6 @@ static const char *ZTestModeNames[] = XToString( ZTestMode ); LuaXType( ZTestMode ); -static const char *GlowModeNames[] = -{ - "Brighten", - "Whiten", -}; -XToString( GlowMode ); -LuaXType( GlowMode ); - static const char *TextGlowModeNames[] = { "Inner", diff --git a/src/RageTypes.h b/src/RageTypes.h index aa4b8a314c..991e2e15a3 100644 --- a/src/RageTypes.h +++ b/src/RageTypes.h @@ -25,14 +25,14 @@ LuaDeclareType( BlendMode ); enum TextureMode { - /* Affects one texture stage. Texture is modulated with the diffuse color. */ + // Affects one texture stage. Texture is modulated with the diffuse color. TextureMode_Modulate, - /* Affects one texture stage. Color is replaced with white, leaving alpha. Used - * with BLEND_ADD to add glow. */ + /* Affects one texture stage. Color is replaced with white, leaving alpha. + * Used with BLEND_ADD to add glow. */ TextureMode_Glow, - /* Affects one texture stage. Color is added to the previous texture stage. */ + // Affects one texture stage. Color is added to the previous texture stage. TextureMode_Add, NUM_TextureMode, @@ -85,15 +85,6 @@ enum PolygonMode }; LuaDeclareType( PolygonMode ); -enum GlowMode -{ - GlowMode_Brighten, - GlowMode_Whiten, - NUM_GlowMode, - GlowMode_Invalid -}; -LuaDeclareType( GlowMode ); - enum TextGlowMode { TextGlowMode_Inner,