add AttractSoundFrequency option

remove AttractSound and DemonstrationSound options
This commit is contained in:
Chris Danford
2003-12-28 19:46:50 +00:00
parent 625b25b050
commit 5aa2a3dff4
8 changed files with 37 additions and 21 deletions
+3 -4
View File
@@ -3542,12 +3542,11 @@ TimerSeconds=0
PrevScreen=ScreenOptionsMenu@ScreenOptionsMaster
NextScreen=ScreenOptionsMenu@ScreenOptionsMaster
OptionMenuFlags=rows,5;together;explanations
OptionMenuFlags=rows,4;together;explanations
Line1=conf,PreloadSounds
Line2=conf,ResamplingQuality
Line3=conf,AttractSound
Line4=conf,DemonstrationSound
Line5=conf,SoundVolume
Line3=conf,AttractSoundFrequency
Line4=conf,SoundVolume
[ScreenIntroMovie]
NextScreen=ScreenDemonstration
+12
View File
@@ -56,6 +56,8 @@ GameState::GameState()
m_pUnlockingSys = new UnlockSystem;
ReloadCharacters();
m_iNumTimesThroughAttract = -1; // initial screen will bump this up to 0
}
GameState::~GameState()
@@ -161,6 +163,8 @@ void GameState::BeginGame()
m_timeGameStarted = time(NULL);
m_vpsNamesThatWereFilled.clear();
m_iNumTimesThroughAttract = 0;
}
void GameState::EndGame()
@@ -1210,3 +1214,11 @@ bool GameState::OneIsHot() const
return true;
return false;
}
bool GameState::IsTimeToPlayAttractSounds()
{
if( PREFSMAN->m_iAttractSoundFrequency == 0 ) // never
return false;
m_iNumTimesThroughAttract %= PREFSMAN->m_iAttractSoundFrequency;
return m_iNumTimesThroughAttract==0;
}
+6
View File
@@ -254,6 +254,12 @@ public:
// Arrow positioning
//
NoteFieldPositioning *m_pPosition;
//
// Attract stuff
//
int m_iNumTimesThroughAttract;
bool IsTimeToPlayAttractSounds();
};
+3 -6
View File
@@ -155,8 +155,7 @@ PrefsManager::PrefsManager()
m_fCenterImageScaleX = 1;
m_fCenterImageScaleY = 1;
m_bAttractSound = true;
m_bDemonstrationSound = true;
m_iAttractSoundFrequency = 4;
m_bAllowExtraStage = true;
g_bAutoRestart = false;
@@ -376,8 +375,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk()
ini.GetValue( "Options", "CenterImageTranslateY", m_iCenterImageTranslateY );
ini.GetValue( "Options", "CenterImageScaleX", m_fCenterImageScaleX );
ini.GetValue( "Options", "CenterImageScaleY", m_fCenterImageScaleY );
ini.GetValue( "Options", "AttractSound", m_bAttractSound );
ini.GetValue( "Options", "DemonstrationSound", m_bDemonstrationSound );
ini.GetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
ini.GetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
ini.GetValue( "Options", "AutoRestart", g_bAutoRestart );
@@ -534,8 +532,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
ini.SetValue( "Options", "CenterImageTranslateY", m_iCenterImageTranslateY );
ini.SetValue( "Options", "CenterImageScaleX", m_fCenterImageScaleX );
ini.SetValue( "Options", "CenterImageScaleY", m_fCenterImageScaleY );
ini.SetValue( "Options", "AttractSound", m_bAttractSound );
ini.SetValue( "Options", "DemonstrationSound", m_bDemonstrationSound );
ini.SetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
ini.SetValue( "Options", "AutoRestart", g_bAutoRestart );
ini.SetValue( "Options", "SoundWriteAhead", m_iSoundWriteAhead );
+1 -2
View File
@@ -128,8 +128,7 @@ public:
int m_iCenterImageTranslateY;
float m_fCenterImageScaleX;
float m_fCenterImageScaleY;
bool m_bAttractSound;
bool m_bDemonstrationSound;
int m_iAttractSoundFrequency; // 0 = never, 1 = every time
bool m_bAllowExtraStage;
// course ranking
+7 -2
View File
@@ -26,13 +26,18 @@
#include "SDL_utils.h"
#include "RageSounds.h"
#define NEXT_SCREEN THEME->GetMetric(m_sName,"NextScreen")
#define NEXT_SCREEN THEME->GetMetric(m_sName,"NextScreen")
#define INITIAL_SCREEN THEME->GetMetric("Common","InitialScreen")
ScreenAttract::ScreenAttract( CString sClassName ) : Screen( sClassName )
{
LOG->Trace( "ScreenAttract::ScreenAttract(%s)", sClassName.c_str() );
// increment times through attract count
if( sClassName == INITIAL_SCREEN )
GAMESTATE->m_iNumTimesThroughAttract++;
GAMESTATE->Reset();
// We have to do initialization in the first update because this->GetElementName() won't
@@ -51,7 +56,7 @@ ScreenAttract::ScreenAttract( CString sClassName ) : Screen( sClassName )
m_soundStart.Load( THEME->GetPathToS("Common start") );
if( PREFSMAN->m_bAttractSound )
if( GAMESTATE->IsTimeToPlayAttractSounds() )
SOUND->PlayMusic( THEME->GetPathToS(m_sName + " music") );
else
SOUND->PlayMusic( "" ); // stop music
+3 -3
View File
@@ -73,7 +73,7 @@ ScreenDemonstration::ScreenDemonstration( CString sName ) : ScreenJukebox( sName
m_DancingState = STATE_DANCING;
this->PostScreenMessage( SM_BeginFadingOut, SECONDS_TO_SHOW );
if( !PREFSMAN->m_bDemonstrationSound )
if( !GAMESTATE->IsTimeToPlayAttractSounds() )
SOUNDMAN->SetPrefs( 0 ); // slient
}
@@ -103,7 +103,7 @@ void ScreenDemonstration::Input( const DeviceInput& DeviceI, const InputEventTyp
break; // don't fall through
m_soundMusic.Stop();
if( !PREFSMAN->m_bDemonstrationSound )
if( !GAMESTATE->IsTimeToPlayAttractSounds() )
SOUNDMAN->SetPrefs( PREFSMAN->m_fSoundVolume ); // turn volume back on
break;
@@ -124,7 +124,7 @@ void ScreenDemonstration::HandleScreenMessage( const ScreenMessage SM )
return;
case SM_GoToNextScreen:
m_soundMusic.Stop();
if( !PREFSMAN->m_bDemonstrationSound )
if( !GAMESTATE->IsTimeToPlayAttractSounds() )
SOUNDMAN->SetPrefs( PREFSMAN->m_fSoundVolume ); // turn volume back on
GAMESTATE->Reset();
+2 -4
View File
@@ -391,8 +391,7 @@ static void RefreshRate( int &sel, bool ToSel, const CStringArray &choices )
/* Sound options */
MOVE( PreloadSounds, PREFSMAN->m_bSoundPreloadAll );
MOVE( ResamplingQuality, PREFSMAN->m_iSoundResampleQuality );
MOVE( AttractSound, PREFSMAN->m_bAttractSound );
MOVE( DemonstrationSound, PREFSMAN->m_bDemonstrationSound );
MOVE( AttractSoundFrequency,PREFSMAN->m_iAttractSoundFrequency );
static void SoundVolume( int &sel, bool ToSel, const CStringArray &choices )
{
@@ -484,8 +483,7 @@ static const ConfOption g_ConfOptions[] =
/* Sound options */
ConfOption( "Preload\nSounds", PreloadSounds, "NO","YES" ),
ConfOption( "Resampling\nQuality", ResamplingQuality, "FAST","NORMAL","HIGH QUALITY" ),
ConfOption( "Attract\nSound", AttractSound, "OFF","ON" ),
ConfOption( "Demonstration\nSound", DemonstrationSound, "OFF","ON" ),
ConfOption( "Attract\nSound Frequency", AttractSoundFrequency, "NEVER","ALWAYS","2 TIMES","3 TIMES","4 TIMES","5 TIMES" ),
ConfOption( "Sound\nVolume", SoundVolume, "0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%","10%" ),
ConfOption( "", NULL ) // end marker
};