final 1.64 checkin

This commit is contained in:
Chris Danford
2002-03-10 10:30:45 +00:00
parent 876b28d5db
commit 353fd47f85
9 changed files with 220 additions and 32 deletions
+4 -4
View File
@@ -19,7 +19,7 @@
#include "BitmapText.h"
#include "Rectangle.h"
#include "TextBanner.h"
#include "SoundSet.h"
#include "RandomSample.h"
#include "GradeDisplay.h"
#include "RageSoundStream.h"
#include "GameTypes.h"
@@ -147,9 +147,9 @@ protected:
// having sounds here causes a crash in Bass. What the heck!?!?!
SoundSet m_soundChangeMusic;
SoundSet m_soundChangeSort;
SoundSet m_soundExpand;
RandomSample m_soundChangeMusic;
RandomSample m_soundChangeSort;
RandomSample m_soundExpand;
+10 -1
View File
@@ -249,7 +249,16 @@ void Player::RenderPrimitives()
bool Player::IsThereANoteAtIndex( int iIndex )
{
return m_TapStepsOriginal[iIndex] != STEP_NONE;
if( m_TapStepsOriginal[iIndex] != STEP_NONE )
return true;
for( int i=0; i<m_iNumHoldSteps; i++ ) // for each HoldStep
{
if( m_HoldSteps[i].m_iStartIndex == iIndex )
return true;
}
return false;
}
+1 -1
View File
@@ -24,7 +24,7 @@
#include "HoldGhostArrow.h"
#include "Player.h"
#include "ActorFrame.h"
#include "SoundSet.h"
#include "RandomSample.h"
#include "ScoreDisplayRollingWithFrame.h"
#include "LifeMeterPills.h"
#include "Judgement.h"
+4 -4
View File
@@ -88,10 +88,10 @@ void PrefsManager::ReadPrefsFromDisk()
if( name_string == "TextureColor" ) m_GameOptions.m_iTextureColor = atoi( value_string );
if( name_string == "FilterTextures" ) m_GameOptions.m_bFilterTextures = ( value_string == "1" );
if( name_string == "Shadows" ) m_GameOptions.m_bShadows = ( value_string == "1" );
if( name_string == "IgnoreJoyDirs" ) m_GameOptions.m_bIgnoreJoyDirs = ( value_string == "1" );
if( name_string == "IgnoreJoyAxes" ) m_GameOptions.m_bIgnoreJoyAxes = ( value_string == "1" );
if( name_string == "ShowFPS" ) m_GameOptions.m_bShowFPS = ( value_string == "1" );
if( name_string == "UseRandomVis" ) m_GameOptions.m_bUseRandomVis = ( value_string == "1" );
if( name_string == "ShowCaution" ) m_GameOptions.m_bShowCaution = ( value_string == "1" );
if( name_string == "SkipCaution" ) m_GameOptions.m_bSkipCaution = ( value_string == "1" );
if( name_string == "Announcer" ) m_GameOptions.m_bAnnouncer = ( value_string == "1" );
}
}
@@ -129,10 +129,10 @@ void PrefsManager::SavePrefsToDisk()
ini.SetValue( "GameOptions", "TextureColor", ssprintf("%d", m_GameOptions.m_iTextureColor) );
ini.SetValue( "GameOptions", "FilterTextures", m_GameOptions.m_bFilterTextures ? "1":"0" );
ini.SetValue( "GameOptions", "Shadows", m_GameOptions.m_bShadows ? "1":"0" );
ini.SetValue( "GameOptions", "IgnoreJoyDirs", m_GameOptions.m_bIgnoreJoyDirs ? "1":"0" );
ini.SetValue( "GameOptions", "IgnoreJoyAxes", m_GameOptions.m_bIgnoreJoyAxes ? "1":"0" );
ini.SetValue( "GameOptions", "ShowFPS", m_GameOptions.m_bShowFPS ? "1":"0" );
ini.SetValue( "GameOptions", "UseRandomVis", m_GameOptions.m_bUseRandomVis ? "1":"0" );
ini.SetValue( "GameOptions", "ShowCaution", m_GameOptions.m_bShowCaution ? "1":"0" );
ini.SetValue( "GameOptions", "SkipCaution", m_GameOptions.m_bSkipCaution ? "1":"0" );
ini.SetValue( "GameOptions", "Announcer", m_GameOptions.m_bAnnouncer ? "1":"0" );
+112
View File
@@ -0,0 +1,112 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
File: RandomSample.h
Desc: Holds multiple sounds samples and can play a random sound easily.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "RandomSample.h"
#include "RageUtil.h"
RandomSample::RandomSample()
{
m_iIndexLastPlayed = -1;
}
RandomSample::~RandomSample()
{
for( int i=0; i<m_pSamples.GetSize(); i++ )
SAFE_DELETE( m_pSamples[i] );
}
bool RandomSample::LoadSoundDir( CString sDir )
{
// make sure there's a backslash at the end of this path
if( sDir[sDir.GetLength()-1] != '\\' )
sDir += "\\";
CStringArray arraySoundFiles;
GetDirListing( sDir + "*.mp3", arraySoundFiles );
GetDirListing( sDir + "*.wav", arraySoundFiles );
for( int i=0; i<arraySoundFiles.GetSize(); i++ )
LoadSound( sDir + arraySoundFiles[i] );
return true;
}
bool RandomSample::LoadRandomSample( CString sSetFilePath )
{
CStdioFile file;
if( !file.Open(sSetFilePath, CFile::modeRead|CFile::shareDenyNone) )
RageError( ssprintf("Error opening sound set file '%s'.", sSetFilePath) );
// Split for the directory of the sound set file. We'll need it below
CString sDir, sFileName, sExtension;
splitrelpath( sSetFilePath, sDir, sFileName, sExtension );
CString line;
while( file.ReadString(line) )
{
if( line != "" )
LoadSound( sDir + line );
}
return true;
}
bool RandomSample::LoadSound( CString sSoundFilePath )
{
RageLog( "RandomSample::LoadSound( %s )", sSoundFilePath );
RageLog( "Made it here - A" );
RageSoundSample* pSS = new RageSoundSample;
RageLog( "Made it here - B" );
pSS->Load( sSoundFilePath );
m_pSamples.Add( pSS );
RageLog( "Made it here - C" );
return true;
}
void RandomSample::PlayRandom()
{
// play one of the samples
if( m_pSamples.GetSize() == 0 )
{
RageLog( "WARNING: Tried to play a RandomSample that has 0 sounds loaded." );
}
else
{
int iIndexToPlay = rand() % m_pSamples.GetSize();
m_pSamples[iIndexToPlay]->Play();
m_iIndexLastPlayed = iIndexToPlay;
}
}
void RandomSample::Pause()
{
m_pSamples[m_iIndexLastPlayed]->Pause();
}
void RandomSample::Stop()
{
if( m_iIndexLastPlayed == -1 ) // nothing is currently playing
return;
m_pSamples[m_iIndexLastPlayed]->Stop();
}
+57
View File
@@ -0,0 +1,57 @@
/*
-----------------------------------------------------------------------------
File: RandomSample.h
Desc: Holds multiple sounds samples and can play a random sound easily.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _RandomSample_H_
#define _RandomSample_H_
#include "RageSound.h"
#include "RageSoundSample.h"
#include "RageUtil.h"
class RandomSample
{
public:
RandomSample();
~RandomSample();
virtual bool Load( CString sFilePath )
{
CString sDir, sFName, sExt;
splitrelpath( sFilePath, sDir, sFName, sExt );
sExt.MakeLower();
if( sExt == "" )
return LoadSoundDir( sFilePath );
else if( sExt == "set" )
return LoadRandomSample( sFilePath );
else
return LoadSound( sFilePath );
};
void PlayRandom();
void Pause();
void Stop();
private:
bool LoadSoundDir( CString sDir );
bool LoadRandomSample( CString sSetFilePath );
bool LoadSound( CString sSoundFilePath );
CArray<RageSoundSample*, RageSoundSample*> m_pSamples;
int m_iIndexLastPlayed;
};
#endif
+14 -12
View File
@@ -485,11 +485,6 @@ HRESULT CreateObjects( HWND hWnd )
// switch the screen resolution according to user's prefs
SwitchDisplayMode();
// go.m_bWindowed,
// go.m_iResolution,
// go.m_iResolution==640 ? 480 : 240,
// go.m_iDisplayColor
// );
TM = new RageTextureManager( SCREEN );
THEME = new ThemeManager;
@@ -498,11 +493,6 @@ HRESULT CreateObjects( HWND hWnd )
// Ugly... Switch the screen resolution again so that the system message will display
SwitchDisplayMode();
// go.m_bWindowed,
// go.m_iResolution,
// go.m_iResolution==640 ? 480 : 240,
// go.m_iDisplayColor
// );
WM->SystemMessage( ssprintf("Found %d songs.", SONGS->m_pSongs.GetSize()) );
@@ -717,7 +707,19 @@ BOOL SwitchDisplayMode()//( BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD
GameOptions &go = PREFS->m_GameOptions;
bool bWindowed = go.m_bWindowed;
DWORD dwWidth = go.m_iResolution;
DWORD dwHeight = go.m_iResolution==640 ? 480 : 240;
DWORD dwHeight;
// fill in dwHeight
switch( dwWidth )
{
case 320: dwHeight = 240; break;
case 400: dwHeight = 300; break;
case 512: dwHeight = 384; break;
case 640: dwHeight = 480; break;
case 800: dwHeight = 600; break;
case 1024: dwHeight = 768; break;
case 1280: dwHeight = 1024; break;
default: dwHeight = 480; break;
}
DWORD dwBPP = go.m_iDisplayColor;
@@ -738,7 +740,7 @@ BOOL SwitchDisplayMode()//( BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD
dwHeight = 480;
if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwBPP ) )
{
// Failed again. Try 640x480
// Failed again. Try 320x240
dwWidth = 320;
dwHeight = 240;
if( !SCREEN->SwitchDisplayMode( bWindowed, dwWidth, dwHeight, dwBPP ) )
+16 -8
View File
@@ -424,6 +424,22 @@ SOURCE=.\PrefsManager.h
# End Source File
# Begin Source File
SOURCE=.\RandomSample.cpp
# End Source File
# Begin Source File
SOURCE=.\RandomSample.h
# End Source File
# Begin Source File
SOURCE=.\RandomStream.cpp
# End Source File
# Begin Source File
SOURCE=.\RandomStream.h
# End Source File
# Begin Source File
SOURCE=.\Song.cpp
# End Source File
# Begin Source File
@@ -440,14 +456,6 @@ SOURCE=.\SongManager.h
# End Source File
# Begin Source File
SOURCE=.\SoundSet.cpp
# End Source File
# Begin Source File
SOURCE=.\SoundSet.h
# End Source File
# Begin Source File
SOURCE=.\Steps.cpp
# End Source File
# Begin Source File
+2 -2
View File
@@ -17,10 +17,10 @@
#include "Window.h"
#include "WindowManager.h"
#include "Actor.h"
#include "SoundSet.h"
#include "RandomSample.h"
const float DEFAULT_TRANSITION_TIME = 0.75f;
const float DEFAULT_TRANSITION_TIME = 0.40f;
class Transition : public Actor