3.0 is close!

This commit is contained in:
Chris Danford
2002-07-02 00:27:58 +00:00
parent f8118fea49
commit 374eb8c6d7
28 changed files with 337 additions and 318 deletions
+11 -7
View File
@@ -44,14 +44,18 @@ bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations )
// Load background animations // Load background animations
// //
CStringArray asBGAnimNames; CStringArray asBGAnimNames;
GetDirListing( BG_ANIMS_DIR+"*.*", asBGAnimNames, true );
SortCStringArray( asBGAnimNames ); // We're going to try to classify songs as trance, pop, or techno based on some data about the song
if( pSong->m_BPMSegments.GetSize() + pSong->m_FreezeSegments.GetSize() >= 3 )
GetDirListing( BG_ANIMS_DIR+"techno*.*", asBGAnimNames, true );
else if( pSong->m_BPMSegments[0].m_fBPM > 160 )
GetDirListing( BG_ANIMS_DIR+"trance*.*", asBGAnimNames, true );
else
GetDirListing( BG_ANIMS_DIR+"pop*.*", asBGAnimNames, true );
// pick 4 random animations from this array
for( int i=0; i<asBGAnimNames.GetSize(); i++ ) for( int i=0; i<asBGAnimNames.GetSize(); i++ )
{ m_BackgroundAnimations.Add( new BackgroundAnimation(BG_ANIMS_DIR + asBGAnimNames[i], pSong) );
if( stricmp(asBGAnimNames[i], "CVS") == 0 ) // if this directory is named CVS, skip it
continue; // skip
m_BackgroundAnimations.Add( new BackgroundAnimation(BG_ANIMS_DIR+asBGAnimNames[i], pSong) );
}
// //
+1 -1
View File
@@ -60,7 +60,7 @@ bool Banner::LoadFromSong( Song* pSong ) // NULL means no song
bool Banner::LoadFromGroup( CString sGroupName ) bool Banner::LoadFromGroup( CString sGroupName )
{ {
m_bScrolling = true; m_bScrolling = false;
CString sGroupBannerPath = SONGMAN->GetGroupBannerPath( sGroupName ); CString sGroupBannerPath = SONGMAN->GetGroupBannerPath( sGroupName );
+1 -1
View File
@@ -113,7 +113,7 @@ inline D3DXCOLOR GetNoteColorFromIndex( int iStepIndex )
return D3DXCOLOR(0.5f,0.5f,0.5f,1); return D3DXCOLOR(0.5f,0.5f,0.5f,1);
}; };
enum RadarCatrgory // starting from 12-o'clock rotating clockwise enum RadarCategory // starting from 12-o'clock rotating clockwise
{ {
RADAR_STREAM = 0, RADAR_STREAM = 0,
RADAR_VOLTAGE, RADAR_VOLTAGE,
+1 -1
View File
@@ -240,7 +240,7 @@ bool IniFile::SetValueI(CString keyname, CString valuename, int value, BOOL crea
bool IniFile::SetValueF(CString keyname, CString valuename, double value, BOOL create) bool IniFile::SetValueF(CString keyname, CString valuename, double value, BOOL create)
{ {
CString temp; CString temp;
temp.Format("%e",value); temp.Format("%f",value);
return SetValue(keyname, valuename, temp, create); return SetValue(keyname, valuename, temp, create);
} }
+2 -1
View File
@@ -116,7 +116,7 @@ WheelItemDisplay::WheelItemDisplay()
{ {
m_GradeDisplay[p].Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SMALL_GRADES) ); m_GradeDisplay[p].Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SMALL_GRADES) );
m_GradeDisplay[p].SetZoom( 1.0f ); m_GradeDisplay[p].SetZoom( 1.0f );
m_GradeDisplay[p].SetXY( 90.0f + p*30.0f, 0 ); m_GradeDisplay[p].SetXY( 86.0f + p*26.0f, 0 );
} }
m_textCourse.Load( THEME->GetPathTo(FONT_TEXT_BANNER) ); m_textCourse.Load( THEME->GetPathTo(FONT_TEXT_BANNER) );
@@ -318,6 +318,7 @@ MusicWheel::MusicWheel()
m_HighScore[p].SetXY( SCORE_X, SCORE_Y[p]*0.97f ); m_HighScore[p].SetXY( SCORE_X, SCORE_Y[p]*0.97f );
m_HighScore[p].SetZoom( 0.6f ); m_HighScore[p].SetZoom( 0.6f );
m_HighScore[p].SetDiffuseColor( PlayerToColor(p) );
m_frameOverlay.AddActor( &m_HighScore[p] ); m_frameOverlay.AddActor( &m_HighScore[p] );
} }
+7 -7
View File
@@ -3,7 +3,7 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: NoteData.cpp File: NoteData.cpp
Desc: A pattern of ColorNotes that past Y==0. Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
@@ -72,7 +72,7 @@ void NoteData::CopyRange( NoteData* pFrom, int iFromIndexBegin, int iFromIndexEn
ASSERT( pFrom->m_iNumTracks == m_iNumTracks ); ASSERT( pFrom->m_iNumTracks == m_iNumTracks );
if( iToIndexBegin == -1 ) if( iToIndexBegin == -1 )
iToIndexBegin = iFromIndexBegin; iToIndexBegin = 0;
pFrom->ConvertHoldNotesTo2sAnd3s(); pFrom->ConvertHoldNotesTo2sAnd3s();
@@ -449,8 +449,8 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
break; break;
} }
NoteData* pNewData = new NoteData; // write into here as we tranform NoteData tempNoteData; // write into here as we tranform
pNewData->m_iNumTracks = m_iNumTracks; tempNoteData.m_iNumTracks = m_iNumTracks;
// transform m_TapNotes // transform m_TapNotes
for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ ) for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ )
@@ -460,7 +460,7 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
int iOldCol = oldColToNewCol[j][0]; int iOldCol = oldColToNewCol[j][0];
int iNewCol = oldColToNewCol[j][1]; int iNewCol = oldColToNewCol[j][1];
pNewData->m_TapNotes[iNewCol][i] = m_TapNotes[iOldCol][i]; tempNoteData.m_TapNotes[iNewCol][i] = m_TapNotes[iOldCol][i];
} }
} }
@@ -477,7 +477,7 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
if( hn.m_iTrack == iOldCol ) if( hn.m_iTrack == iOldCol )
{ {
HoldNote newHN = { iNewCol, hn.m_iStartIndex, hn.m_iEndIndex }; HoldNote newHN = { iNewCol, hn.m_iStartIndex, hn.m_iEndIndex };
pNewData->AddHoldNote( newHN ); tempNoteData.AddHoldNote( newHN );
} }
} }
} }
@@ -485,7 +485,7 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
// //
// copy note data from newData back into this // copy note data from newData back into this
// //
(*this) = *pNewData; (*this) = tempNoteData;
} }
void NoteData::MakeLittle() void NoteData::MakeLittle()
+1 -1
View File
@@ -80,7 +80,7 @@ public:
int GetPossibleDancePoints(); int GetPossibleDancePoints();
// radar values - return between 0.0 and 1.2 // radar values - return between 0.0 and 1.2
float GetRadarValue( RadarCatrgory rv, float fSongSeconds ) float GetRadarValue( RadarCategory rv, float fSongSeconds )
{ {
switch( rv ) switch( rv )
{ {
+1 -1
View File
@@ -29,7 +29,7 @@ struct NoteDataWithScoring : public NoteData
int GetNumSuccessfulHoldNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS ); int GetNumSuccessfulHoldNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
float GetActualRadarValue( RadarCatrgory rv, float fSongSeconds ) float GetActualRadarValue( RadarCategory rv, float fSongSeconds )
{ {
switch( rv ) switch( rv )
{ {
+12 -12
View File
@@ -37,7 +37,7 @@ NoteField::NoteField()
m_fBeginMarker = m_fEndMarker = -1; m_fBeginMarker = m_fEndMarker = -1;
m_fOverrideAlpha = -1; m_fOverrideAdd = -1;
} }
@@ -83,9 +83,7 @@ void NoteField::CreateTapNoteInstance( ColorNoteInstance &cni, const int iCol, c
const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset ); const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset );
const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset ); const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset );
const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat ); const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat );
float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos ); const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos );
if( m_fOverrideAlpha != -1 )
fAlpha = m_fOverrideAlpha;
D3DXCOLOR colorLeading, colorTrailing; // of the color part. Alpha here be overwritten with fAlpha! D3DXCOLOR colorLeading, colorTrailing; // of the color part. Alpha here be overwritten with fAlpha!
if( color.a == -1 ) // indicated "NULL" if( color.a == -1 ) // indicated "NULL"
@@ -93,7 +91,9 @@ void NoteField::CreateTapNoteInstance( ColorNoteInstance &cni, const int iCol, c
else else
colorLeading = colorTrailing = color; colorLeading = colorTrailing = color;
const float fAddAlpha = m_ColorNote[iCol].GetAddAlphaFromDiffuseAlpha( fAlpha ); float fAddAlpha = m_ColorNote[iCol].GetAddAlphaFromDiffuseAlpha( fAlpha );
if( m_fOverrideAdd != -1 )
fAddAlpha = m_fOverrideAdd;
int iGrayPartFrameNo = m_ColorNote[iCol].GetGrayPartFrameNoFromIndexAndBeat( roundf(fIndex), m_fSongBeat ); int iGrayPartFrameNo = m_ColorNote[iCol].GetGrayPartFrameNoFromIndexAndBeat( roundf(fIndex), m_fSongBeat );
@@ -109,9 +109,7 @@ void NoteField::CreateHoldNoteInstance( ColorNoteInstance &cni, const bool bActi
const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset ); const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset );
const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset ); const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset );
const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat ); const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat );
float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos ); const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos );
if( m_fOverrideAlpha != -1 )
fAlpha = m_fOverrideAlpha;
int iGrayPartFrameNo; int iGrayPartFrameNo;
if( bActive && m_Mode == MODE_DANCING ) if( bActive && m_Mode == MODE_DANCING )
@@ -125,7 +123,9 @@ void NoteField::CreateHoldNoteInstance( ColorNoteInstance &cni, const bool bActi
colorLeading.a = 1; colorLeading.a = 1;
D3DXCOLOR colorTrailing = colorLeading; D3DXCOLOR colorTrailing = colorLeading;
const float fAddAlpha = m_ColorNote[iCol].GetAddAlphaFromDiffuseAlpha( fAlpha ); float fAddAlpha = m_ColorNote[iCol].GetAddAlphaFromDiffuseAlpha( fAlpha );
if( m_fOverrideAdd != -1 )
fAddAlpha = m_fOverrideAdd;
ColorNoteInstance instance = { fXPos, fYPos, fRotation, fAlpha, colorLeading, colorTrailing, fAddAlpha, iGrayPartFrameNo }; ColorNoteInstance instance = { fXPos, fYPos, fRotation, fAlpha, colorLeading, colorTrailing, fAddAlpha, iGrayPartFrameNo };
cni = instance; cni = instance;
@@ -169,7 +169,7 @@ void NoteField::DrawBPMText( const int iIndex, const float fBPM )
m_textMeasureNumber.SetDiffuseColor( D3DXCOLOR(1,0,0,1) ); m_textMeasureNumber.SetDiffuseColor( D3DXCOLOR(1,0,0,1) );
m_textMeasureNumber.SetAddColor( D3DXCOLOR(1,1,1,cosf(TIMER->GetTimeSinceStart()*2)/2+0.5f) ); m_textMeasureNumber.SetAddColor( D3DXCOLOR(1,1,1,cosf(TIMER->GetTimeSinceStart()*2)/2+0.5f) );
m_textMeasureNumber.SetText( ssprintf("%.2f", fBPM) ); m_textMeasureNumber.SetText( ssprintf("%.2f", fBPM) );
m_textMeasureNumber.SetXY( -m_rectMeasureBar.GetZoomedWidth()/2 - 50, fYPos ); m_textMeasureNumber.SetXY( -m_rectMeasureBar.GetZoomedWidth()/2 - 60, fYPos );
m_textMeasureNumber.Draw(); m_textMeasureNumber.Draw();
} }
@@ -178,10 +178,10 @@ void NoteField::DrawFreezeText( const int iIndex, const float fSecs )
const float fYOffset = ArrowGetYOffset( m_PlayerOptions, (float)iIndex, m_fSongBeat ); const float fYOffset = ArrowGetYOffset( m_PlayerOptions, (float)iIndex, m_fSongBeat );
const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset ); const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset );
m_textMeasureNumber.SetDiffuseColor( D3DXCOLOR(0,0,0.6f,1) ); m_textMeasureNumber.SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,0,1) );
m_textMeasureNumber.SetAddColor( D3DXCOLOR(1,1,1,cosf(TIMER->GetTimeSinceStart()*2)/2+0.5f) ); m_textMeasureNumber.SetAddColor( D3DXCOLOR(1,1,1,cosf(TIMER->GetTimeSinceStart()*2)/2+0.5f) );
m_textMeasureNumber.SetText( ssprintf("%.2f", fSecs) ); m_textMeasureNumber.SetText( ssprintf("%.2f", fSecs) );
m_textMeasureNumber.SetXY( -m_rectMeasureBar.GetZoomedWidth()/2 - 20, fYPos ); m_textMeasureNumber.SetXY( -m_rectMeasureBar.GetZoomedWidth()/2 - 10, fYPos );
m_textMeasureNumber.Draw(); m_textMeasureNumber.Draw();
} }
+1 -1
View File
@@ -45,7 +45,7 @@ public:
float m_fBeginMarker, m_fEndMarker; // only used with MODE_EDIT float m_fBeginMarker, m_fEndMarker; // only used with MODE_EDIT
float m_fOverrideAlpha; // -1 of not overriding float m_fOverrideAdd; // -1 of not overriding
protected: protected:
inline void CreateTapNoteInstance( ColorNoteInstance &cni, const int iCol, const float fIndex, const D3DXCOLOR color = D3DXCOLOR(-1,-1,-1,-1) ); inline void CreateTapNoteInstance( ColorNoteInstance &cni, const int iCol, const float fIndex, const D3DXCOLOR color = D3DXCOLOR(-1,-1,-1,-1) );
+35 -29
View File
@@ -116,9 +116,9 @@ bool Notes::LoadFromBMSFile( const CString &sPath )
{ {
LOG->WriteLine( "Notes::LoadFromBMSFile( '%s' )", sPath ); LOG->WriteLine( "Notes::LoadFromBMSFile( '%s' )", sPath );
this->GetNoteData(); // make sure NoteData is loaded // make sure NoteData is loaded
ASSERT( m_pNoteData == NULL );
m_pNoteData = new NoteData;
int tempNotes[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ROWS]; int tempNotes[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ROWS];
@@ -618,7 +618,7 @@ void Notes::LoadFromSMTokens(
const CString &sDifficultyClass, const CString &sDifficultyClass,
const CString &sMeter, const CString &sMeter,
const CString &sRadarValues, const CString &sRadarValues,
const CString &sNoteDataOut, const CString &sNoteData,
const bool bLoadNoteData const bool bLoadNoteData
) )
{ {
@@ -644,12 +644,23 @@ void Notes::LoadFromSMTokens(
// //
// Load NoteData // Load NoteData
// //
NoteData *pND = GetNoteData(); if( !bLoadNoteData )
{
SAFE_DELETE( m_pNoteData );
return; // don't continue
}
// else bLoadNoteData...
pND->m_iNumTracks = NotesTypeToNumTracks( m_NotesType ); if( m_pNoteData != NULL ) // already loaded
return;
// else not already loaded...
m_pNoteData = new NoteData();
m_pNoteData->m_iNumTracks = NotesTypeToNumTracks( m_NotesType );
CStringArray asNoteData; CStringArray asNoteData;
split( sNoteDataOut, ",", asNoteData, true ); split( sNoteData, ",", asNoteData, true );
for( int i=0; i<asNoteData.GetSize(); i+=2 ) for( int i=0; i<asNoteData.GetSize(); i+=2 )
{ {
int iNumRowsInMeasure = atoi( asNoteData[i] ); int iNumRowsInMeasure = atoi( asNoteData[i] );
@@ -659,7 +670,7 @@ void Notes::LoadFromSMTokens(
sMeasureString.TrimRight(); sMeasureString.TrimRight();
CStringArray arrayNoteLines; CStringArray arrayNoteLines;
split( sMeasureString, "\n", arrayNoteLines ); split( sMeasureString, "\n", arrayNoteLines, true ); // ignore empty is important here
if( arrayNoteLines.GetSize() != iNumRowsInMeasure ) if( arrayNoteLines.GetSize() != iNumRowsInMeasure )
throw RageException( "Actual number of note rows (%d) doesn't match what tag says (%d).", arrayNoteLines.GetSize(), iNumRowsInMeasure ); throw RageException( "Actual number of note rows (%d) doesn't match what tag says (%d).", arrayNoteLines.GetSize(), iNumRowsInMeasure );
@@ -667,25 +678,24 @@ void Notes::LoadFromSMTokens(
for( int l=0; l<iNumRowsInMeasure; l++ ) for( int l=0; l<iNumRowsInMeasure; l++ )
{ {
const float fPercentIntoMeasure = l/(float)arrayNoteLines.GetSize(); const float fPercentIntoMeasure = l/(float)arrayNoteLines.GetSize();
const float fBeat = (i + fPercentIntoMeasure) * BEATS_PER_MEASURE; const float fBeat = (i/2 + fPercentIntoMeasure) * BEATS_PER_MEASURE;
const int iIndex = BeatToNoteRow( fBeat ); const int iIndex = BeatToNoteRow( fBeat );
CString sNoteLine = arrayNoteLines[l]; CString sNoteLine = arrayNoteLines[l];
sNoteLine.TrimRight(); sNoteLine.TrimRight();
if( pND->m_iNumTracks != sNoteLine.GetLength() ) if( m_pNoteData->m_iNumTracks != sNoteLine.GetLength() )
throw RageException( "Actual number of note columns (%d) is different from the NotesType (%d).", pND->m_iNumTracks, sNoteLine.GetLength() ); throw RageException( "Actual number of note columns (%d) is different from the NotesType (%d).", m_pNoteData->m_iNumTracks, sNoteLine.GetLength() );
for( int c=0; c<sNoteLine.GetLength(); c++ ) for( int c=0; c<sNoteLine.GetLength(); c++ )
pND->m_TapNotes[c][iIndex] = sNoteLine[c]; m_pNoteData->m_TapNotes[c][iIndex] = sNoteLine[c];
} }
} }
} }
void Notes::WriteSMNotesTag( FILE* fp ) void Notes::WriteSMNotesTag( FILE* fp )
{ {
fprintf( fp, "\n//---------------%s - %s----------------\n", NotesTypeToString(m_NotesType), m_sDescription );
fprintf( fp, "#NOTES:\n" ); fprintf( fp, "#NOTES:\n" );
fprintf( fp, " %s:\n", NotesTypeToString(m_NotesType) ); fprintf( fp, " %s:\n", NotesTypeToString(m_NotesType) );
fprintf( fp, " %s:\n", m_sDescription ); fprintf( fp, " %s:\n", m_sDescription );
@@ -702,11 +712,11 @@ void Notes::WriteSMNotesTag( FILE* fp )
// //
// fill in sNoteDataOut // fill in sNoteDataOut
// //
NoteData* pND = GetNoteData(); ASSERT( m_pNoteData != NULL );
pND->ConvertHoldNotesTo2sAnd3s(); m_pNoteData->ConvertHoldNotesTo2sAnd3s();
float fLastBeat = pND->GetLastBeat(); float fLastBeat = m_pNoteData->GetLastBeat();
int iLastMeasure = int( fLastBeat/BEATS_PER_MEASURE ); int iLastMeasure = int( fLastBeat/BEATS_PER_MEASURE );
for( int m=0; m<=iLastMeasure; m++ ) // foreach measure for( int m=0; m<=iLastMeasure; m++ ) // foreach measure
@@ -728,7 +738,7 @@ void Notes::WriteSMNotesTag( FILE* fp )
if( i % iNoteIndexSpacing == 0 ) if( i % iNoteIndexSpacing == 0 )
continue; // skip continue; // skip
if( !pND->IsRowEmpty(i) ) if( !m_pNoteData->IsRowEmpty(i) )
{ {
bFoundSmallerNote = true; bFoundSmallerNote = true;
break; break;
@@ -749,19 +759,19 @@ void Notes::WriteSMNotesTag( FILE* fp )
for( int i=iMeasureStartIndex; i<=iMeasureLastIndex; i+=iNoteIndexSpacing ) for( int i=iMeasureStartIndex; i<=iMeasureLastIndex; i+=iNoteIndexSpacing )
{ {
CString sLineString; CString sLineString;
for( int c=0; c<pND->m_iNumTracks; c++ ) for( int c=0; c<m_pNoteData->m_iNumTracks; c++ )
sLineString += pND->m_TapNotes[c][i]; sLineString += m_pNoteData->m_TapNotes[c][i];
fprintf( fp, "%s", sLineString ); fprintf( fp, "%s", sLineString );
if( i == iMeasureLastIndex ) if( i <= iMeasureLastIndex-iNoteIndexSpacing )
fprintf( fp, ",\n" );
else
fprintf( fp, "\n" ); fprintf( fp, "\n" );
} }
if( m != iLastMeasure )
fprintf( fp, ",\n" );
} }
fprintf( fp, ";\n" ); fprintf( fp, ";\n" );
pND->Convert2sAnd3sToHoldNotes(); m_pNoteData->Convert2sAnd3sToHoldNotes();
} }
@@ -807,11 +817,7 @@ bool Notes::IsNoteDataLoaded()
NoteData* Notes::GetNoteData() NoteData* Notes::GetNoteData()
{ {
if( m_pNoteData != NULL ) ASSERT( m_pNoteData != NULL );
return m_pNoteData;
m_pNoteData = new NoteData;
return m_pNoteData; return m_pNoteData;
} }
-1
View File
@@ -78,7 +78,6 @@ public:
void SetNoteData( NoteData* pNewNoteData ); void SetNoteData( NoteData* pNewNoteData );
void DeleteNoteData(); void DeleteNoteData();
protected:
static DifficultyClass DifficultyClassFromDescriptionAndMeter( CString sDescription, int iMeter ); static DifficultyClass DifficultyClassFromDescriptionAndMeter( CString sDescription, int iMeter );
NoteData* m_pNoteData; NoteData* m_pNoteData;
+13 -8
View File
@@ -76,6 +76,7 @@ void Player::Load( PlayerNumber player_no, StyleDef* pStyleDef, NoteData* pNoteD
{ {
//LOG->WriteLine( "Player::Load()", ); //LOG->WriteLine( "Player::Load()", );
this->CopyAll( pNoteData ); this->CopyAll( pNoteData );
NoteDataWithScoring::Init();
m_PlayerNumber = player_no; m_PlayerNumber = player_no;
m_PlayerOptions = po; m_PlayerOptions = po;
@@ -197,7 +198,8 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
m_frameJudgeAndCombo.Update( fDeltaTime ); m_frameJudgeAndCombo.Update( fDeltaTime );
m_pLifeMeter->SetBeat( fSongBeat ); if( m_pLifeMeter )
m_pLifeMeter->SetBeat( fSongBeat );
m_GrayArrowRow.Update( fDeltaTime, fSongBeat ); m_GrayArrowRow.Update( fDeltaTime, fSongBeat );
m_NoteField.Update( fDeltaTime, fSongBeat ); m_NoteField.Update( fDeltaTime, fSongBeat );
@@ -318,7 +320,7 @@ void Player::HandlePlayerStep( float fSongBeat, int col, float fMaxBeatDiff )
if( fPercentFromPerfect < 0.30f ) score = TNS_PERFECT; if( fPercentFromPerfect < 0.30f ) score = TNS_PERFECT;
else if( fPercentFromPerfect < 0.55f ) score = TNS_GREAT; else if( fPercentFromPerfect < 0.55f ) score = TNS_GREAT;
else if( fPercentFromPerfect < 0.75f ) score = TNS_GOOD; else if( fPercentFromPerfect < 0.78f ) score = TNS_GOOD;
else score = TNS_BOO; else score = TNS_BOO;
@@ -350,7 +352,8 @@ void Player::OnRowDestroyed( float fSongBeat, int col, float fMaxBeatDiff, int i
// update the judgement, score, and life // update the judgement, score, and life
m_Judgement.SetJudgement( score ); m_Judgement.SetJudgement( score );
m_pLifeMeter->ChangeLife( score ); if( m_pLifeMeter )
m_pLifeMeter->ChangeLife( score );
// remove this row from the NoteField // remove this row from the NoteField
@@ -363,7 +366,8 @@ void Player::OnRowDestroyed( float fSongBeat, int col, float fMaxBeatDiff, int i
{ {
m_GhostArrowRow.TapNote( c, score, m_Combo.GetCurrentCombo()>100 ); // show the ghost arrow for this column m_GhostArrowRow.TapNote( c, score, m_Combo.GetCurrentCombo()>100 ); // show the ghost arrow for this column
m_pScore->AddToScore( score, m_Combo.GetCurrentCombo() ); // update score - called once per note in this row if( m_pScore )
m_pScore->AddToScore( score, m_Combo.GetCurrentCombo() ); // update score - called once per note in this row
// update combo - called once per note in this row // update combo - called once per note in this row
switch( score ) switch( score )
@@ -419,7 +423,8 @@ int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat )
bFoundAMissInThisRow = true; bFoundAMissInThisRow = true;
} }
if( bFoundAMissInThisRow ) if( bFoundAMissInThisRow )
m_pLifeMeter->ChangeLife( TNS_MISS ); if( m_pLifeMeter )
m_pLifeMeter->ChangeLife( TNS_MISS );
} }
} }
@@ -493,13 +498,13 @@ GameplayStatistics Player::GetGameplayStatistics()
GSreturn.max_combo = m_Combo.GetMaxCombo(); GSreturn.max_combo = m_Combo.GetMaxCombo();
GSreturn.score = m_pScore ? m_pScore->GetScore() : 0; GSreturn.score = m_pScore ? m_pScore->GetScore() : 0;
GSreturn.failed = this->m_pLifeMeter->HasFailed(); GSreturn.failed = m_pLifeMeter ? m_pLifeMeter->HasFailed() : false;
for( int r=0; r<NUM_RADAR_VALUES; r++ ) for( int r=0; r<NUM_RADAR_VALUES; r++ )
{ {
GSreturn.fRadarPossible[r] = this->GetRadarValue( (RadarCatrgory)r, SONGMAN->GetCurrentSong()->m_fMusicLengthSeconds ); GSreturn.fRadarPossible[r] = this->GetRadarValue( (RadarCategory)r, SONGMAN->GetCurrentSong()->m_fMusicLengthSeconds );
GSreturn.fRadarActual[r] = this->GetActualRadarValue( (RadarCatrgory)r, SONGMAN->GetCurrentSong()->m_fMusicLengthSeconds ); GSreturn.fRadarActual[r] = this->GetActualRadarValue( (RadarCategory)r, SONGMAN->GetCurrentSong()->m_fMusicLengthSeconds );
GSreturn.fRadarPossible[r] = clamp( GSreturn.fRadarPossible[r], 0, 1 ); GSreturn.fRadarPossible[r] = clamp( GSreturn.fRadarPossible[r], 0, 1 );
GSreturn.fRadarActual[r] = clamp( GSreturn.fRadarActual[r], 0, 1 ); GSreturn.fRadarActual[r] = clamp( GSreturn.fRadarActual[r], 0, 1 );
+2 -2
View File
@@ -51,8 +51,8 @@ public:
GameplayStatistics GetGameplayStatistics(); GameplayStatistics GetGameplayStatistics();
void SetOverrideAlpha( float fAlpha ) { m_NoteField.m_fOverrideAlpha = fAlpha; }; void SetOverrideAdd( float fAdd ) { m_NoteField.m_fOverrideAdd = fAdd; };
float GetOverrideAlpha() { return m_NoteField.m_fOverrideAlpha; }; float GetOverrideAdd() { return m_NoteField.m_fOverrideAdd; };
protected: protected:
void OnRowDestroyed( float fSongBeat, int col, float fMaxBeatDiff, int iStepIndex ); void OnRowDestroyed( float fSongBeat, int col, float fMaxBeatDiff, int iStepIndex );
+3 -3
View File
@@ -22,7 +22,7 @@ PrefsManager::PrefsManager()
{ {
m_bWindowed = false; m_bWindowed = false;
m_bHighDetail = true; m_bHighDetail = true;
m_bHighTextureDetail = true; m_bHighTextureDetail = false;
m_bIgnoreJoyAxes = false; m_bIgnoreJoyAxes = false;
m_bShowFPS = false; m_bShowFPS = false;
m_visMode = VIS_MODE_ANIMATION; m_visMode = VIS_MODE_ANIMATION;
@@ -30,7 +30,7 @@ PrefsManager::PrefsManager()
m_bEventMode = false; m_bEventMode = false;
m_iNumArcadeStages = 3; m_iNumArcadeStages = 3;
m_bAutoPlay = false; m_bAutoPlay = false;
m_fJudgeWindow = 0.10f; m_fJudgeWindow = 0.12f;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
m_PreferredDifficultyClass[p] = CLASS_EASY; m_PreferredDifficultyClass[p] = CLASS_EASY;
@@ -78,7 +78,7 @@ void PrefsManager::SavePrefsToDisk()
ini.SetValueB( "Options", "Windowed", m_bWindowed ); ini.SetValueB( "Options", "Windowed", m_bWindowed );
ini.SetValueB( "Options", "HighDetail", m_bHighDetail ); ini.SetValueB( "Options", "HighDetail", m_bHighDetail );
ini.GetValueB( "Options", "HighTextureDetail", m_bHighTextureDetail ); ini.SetValueB( "Options", "HighTextureDetail", m_bHighTextureDetail );
ini.SetValueB( "Options", "IgnoreJoyAxes", m_bIgnoreJoyAxes ); ini.SetValueB( "Options", "IgnoreJoyAxes", m_bIgnoreJoyAxes );
ini.SetValueB( "Options", "ShowFPS", m_bShowFPS ); ini.SetValueB( "Options", "ShowFPS", m_bShowFPS );
ini.SetValueI( "Options", "VisMode", m_visMode ); ini.SetValueI( "Options", "VisMode", m_visMode );
+1 -1
View File
@@ -73,7 +73,7 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, bool bForceR
{ {
pTexture->m_iRefCount++; pTexture->m_iRefCount++;
if( bForceReload ) if( bForceReload )
pTexture->Reload( m_iMaxTextureSize, m_iTextureColorDepth, iMipMaps, iAlphaBits, bDither ); pTexture->Reload( m_iMaxTextureSize, m_iTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch );
LOG->WriteLine( "RageTextureManager: '%s' now has %d references.", sTexturePath, pTexture->m_iRefCount ); LOG->WriteLine( "RageTextureManager: '%s' now has %d references.", sTexturePath, pTexture->m_iRefCount );
} }
+3 -1
View File
@@ -340,7 +340,9 @@ DWORD GetFileSizeInBytes( const CString &sFilePath )
NULL // handle to file with attributes to NULL // handle to file with attributes to
); );
return GetFileSize( hFile, NULL ); DWORD dwSize = GetFileSize( hFile, NULL );
CloseHandle( hFile );
return dwSize;
} }
bool DoesFileExist( const CString &sPath ) bool DoesFileExist( const CString &sPath )
+103 -58
View File
@@ -42,10 +42,12 @@ const float INFO_X = SCREEN_RIGHT - 10 ;
const float INFO_Y = SCREEN_BOTTOM - 10; // bottom aligned const float INFO_Y = SCREEN_BOTTOM - 10; // bottom aligned
const float MENU_WIDTH = 110; const float MENU_WIDTH = 110;
const float EDIT_CENTER_X = CENTER_X + 100; const float EDIT_X = CENTER_X + 100;
const float EDIT_GRAY_Y = CENTER_Y - 2.0f * (float)ARROW_SIZE; const float EDIT_GRAY_Y = CENTER_Y - 2.0f * (float)ARROW_SIZE;
const float PLAYER_X = EDIT_X;
const float PLAYER_Y = SCREEN_TOP;
const CString HELP_TEXT = const CString HELP_TEXT =
"Esc: exit\n" "Esc: exit\n"
"S: save changes\n" "S: save changes\n"
@@ -67,12 +69,13 @@ const CString HELP_TEXT =
"D: Toggle difficulty\n" "D: Toggle difficulty\n"
"Ins: Insert blank beat\n" "Ins: Insert blank beat\n"
"Del: Delete current beat and shift\n" "Del: Delete current beat and shift\n"
"F1,F2/F3,F4: Decrease/increase BPM at cur beat\n" " Hold F keys for faster change:\n"
"F5,F6/F7,F8: Dec/inc freeze secs at cur beat\n" "F7/F8: Decrease/increase BPM at cur beat\n"
"F9,F10/F11,F12: Decrease/increase music offset\n" "F9/F10: Dec/inc freeze secs at cur beat\n"
"NumPad / * - + : Dec/inc music preview start\n" "F11/F12: Decrease/increase music offset\n"
"NumPad 0/period: Dec/inc music length\n" "F1/F2 : Dec/inc sample music start\n"
"M: Play music preview\n"; "NumPad -/+: Dec/inc sample music length\n"
"M: Play sample music\n";
@@ -85,6 +88,14 @@ ScreenEdit::ScreenEdit()
LOG->WriteLine( "ScreenEdit::ScreenEdit()" ); LOG->WriteLine( "ScreenEdit::ScreenEdit()" );
m_pSong = SONGMAN->GetCurrentSong(); m_pSong = SONGMAN->GetCurrentSong();
m_pSong->LoadNoteData();
m_pNotes = SONGMAN->m_pCurNotes[PLAYER_1];
if( m_pNotes == NULL )
{
m_pNotes = new Notes;
m_pSong->m_arrayNotes.Add( m_pNotes );
}
m_Mode = MODE_EDIT; m_Mode = MODE_EDIT;
@@ -95,42 +106,37 @@ ScreenEdit::ScreenEdit()
m_PlayerOptions.m_ColorType = PlayerOptions::COLOR_NOTE; m_PlayerOptions.m_ColorType = PlayerOptions::COLOR_NOTE;
// m_PlayerOptions.m_bShowMeasureBars = true; // m_PlayerOptions.m_bShowMeasureBars = true;
m_DifficultyClass = CLASS_EASY;
m_sprBackground.Load( THEME->GetPathTo( GRAPHIC_EDIT_BACKGROUND ) ); m_sprBackground.Load( THEME->GetPathTo( GRAPHIC_EDIT_BACKGROUND ) );
m_sprBackground.StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) ); m_sprBackground.StretchTo( CRect(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) );
m_GranularityIndicator.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y ); m_GranularityIndicator.SetXY( EDIT_X, EDIT_GRAY_Y );
m_GranularityIndicator.Load(); m_GranularityIndicator.Load();
m_GranularityIndicator.SetZoom( 0.5f ); m_GranularityIndicator.SetZoom( 0.5f );
m_GrayArrowRowEdit.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y ); m_GrayArrowRowEdit.SetXY( EDIT_X, EDIT_GRAY_Y );
m_GrayArrowRowEdit.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions ); m_GrayArrowRowEdit.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions );
m_GrayArrowRowEdit.SetZoom( 0.5f ); m_GrayArrowRowEdit.SetZoom( 0.5f );
NoteData noteData; m_NoteFieldEdit.SetXY( EDIT_X, EDIT_GRAY_Y );
noteData.m_iNumTracks = GAMEMAN->GetCurrentStyleDef()->m_iColsPerPlayer;
if( SONGMAN->m_pCurNotes[PLAYER_1] != NULL )
noteData = *SONGMAN->GetCurrentNotes(PLAYER_1)->GetNoteData();
m_NoteFieldEdit.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y );
m_NoteFieldEdit.SetZoom( 0.5f ); m_NoteFieldEdit.SetZoom( 0.5f );
m_NoteFieldEdit.Load( &noteData, PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions, 10, 12, NoteField::MODE_EDITING ); m_NoteFieldEdit.Load( m_pNotes->GetNoteData(), PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions, 10, 12, NoteField::MODE_EDITING );
m_rectRecordBack.StretchTo( CRect(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) ); m_rectRecordBack.StretchTo( CRect(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) );
m_rectRecordBack.SetDiffuseColor( D3DXCOLOR(0,0,0,0) ); m_rectRecordBack.SetDiffuseColor( D3DXCOLOR(0,0,0,0) );
m_GrayArrowRowRecord.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y ); m_GrayArrowRowRecord.SetXY( EDIT_X, EDIT_GRAY_Y );
m_GrayArrowRowRecord.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions ); m_GrayArrowRowRecord.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions );
m_GrayArrowRowRecord.SetZoom( 1.0f ); m_GrayArrowRowRecord.SetZoom( 1.0f );
m_NoteFieldRecord.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y ); m_NoteFieldRecord.SetXY( EDIT_X, EDIT_GRAY_Y );
m_NoteFieldRecord.SetZoom( 1.0f ); m_NoteFieldRecord.SetZoom( 1.0f );
m_NoteFieldRecord.Load( &noteData, PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions, 2, 5, NoteField::MODE_EDITING ); m_NoteFieldRecord.Load( m_pNotes->GetNoteData(), PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_PlayerOptions, 2, 5, NoteField::MODE_EDITING );
m_Player.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), &noteData, PlayerOptions(), NULL, NULL, 1 ); m_Clipboard.m_iNumTracks = m_NoteFieldEdit.m_iNumTracks;
m_Player.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y );
m_Player.Load( PLAYER_1, GAMEMAN->GetCurrentStyleDef(), m_pNotes->GetNoteData(), PlayerOptions(), NULL, NULL, 1 );
m_Player.SetXY( PLAYER_X, PLAYER_Y );
m_Fade.SetClosed(); m_Fade.SetClosed();
@@ -283,13 +289,15 @@ void ScreenEdit::Update( float fDeltaTime )
"Difficulty = %s\n" "Difficulty = %s\n"
"Description = %s\n" "Description = %s\n"
"Num notes tap: %d, hold: %d\n" "Num notes tap: %d, hold: %d\n"
"MusicOffsetSeconds: %.2f\n"
"Preview start: %.2f, length = %.2f\n", "Preview start: %.2f, length = %.2f\n",
sNoteType, sNoteType,
m_fBeat, m_fBeat,
m_NoteFieldEdit.m_fBeginMarker, m_NoteFieldEdit.m_fEndMarker, m_NoteFieldEdit.m_fBeginMarker, m_NoteFieldEdit.m_fEndMarker,
DifficultyClassToString( m_DifficultyClass ), DifficultyClassToString( m_pNotes->m_DifficultyClass ),
SONGMAN->GetCurrentNotes(PLAYER_1) ? SONGMAN->GetCurrentNotes(PLAYER_1)->m_sDescription : "no description", SONGMAN->GetCurrentNotes(PLAYER_1) ? SONGMAN->GetCurrentNotes(PLAYER_1)->m_sDescription : "no description",
iNumTapNotes, iNumHoldNotes, iNumTapNotes, iNumHoldNotes,
m_pSong->m_fOffsetInSeconds,
m_pSong->m_fMusicSampleStartSeconds, m_pSong->m_fMusicSampleLengthSeconds m_pSong->m_fMusicSampleStartSeconds, m_pSong->m_fMusicSampleLengthSeconds
) ); ) );
} }
@@ -391,6 +399,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
} }
break; break;
case DIK_ESCAPE: case DIK_ESCAPE:
m_pSong->LoadFromSMFile( m_pSong->GetCacheFilePath(), true );
SCREENMAN->SetNewScreen( new ScreenEditMenu ); SCREENMAN->SetNewScreen( new ScreenEditMenu );
break; break;
case DIK_S: case DIK_S:
@@ -582,6 +591,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
case DIK_DELETE: case DIK_DELETE:
{ {
NoteData temp; NoteData temp;
temp.m_iNumTracks = m_NoteFieldEdit.m_iNumTracks;
int iTakeFromRow; int iTakeFromRow;
int iPasteAtRow; int iPasteAtRow;
switch( DeviceI.button ) switch( DeviceI.button )
@@ -629,8 +639,8 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
break; break;
case DIK_V: case DIK_V:
{ {
int iSrcFirstRow = BeatToNoteRow( m_NoteFieldEdit.m_fBeginMarker ); int iSrcFirstRow = 0;
int iSrcLastRow = BeatToNoteRow( m_NoteFieldEdit.m_fEndMarker ); int iSrcLastRow = BeatToNoteRow( m_Clipboard.GetLastBeat() );
int iDestFirstRow = BeatToNoteRow( m_fBeat ); int iDestFirstRow = BeatToNoteRow( m_fBeat );
m_NoteFieldEdit.CopyRange( &m_Clipboard, iSrcFirstRow, iSrcLastRow, iDestFirstRow ); m_NoteFieldEdit.CopyRange( &m_Clipboard, iSrcFirstRow, iSrcLastRow, iDestFirstRow );
@@ -639,25 +649,25 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
case DIK_D: case DIK_D:
{ {
m_DifficultyClass = DifficultyClass( (m_DifficultyClass+1)%NUM_DIFFICULTY_CLASSES ); DifficultyClass &dc = m_pNotes->m_DifficultyClass;
dc = DifficultyClass( (dc+1)%NUM_DIFFICULTY_CLASSES );
} }
break; break;
case DIK_F1: case DIK_F7:
case DIK_F2: case DIK_F8:
case DIK_F3:
case DIK_F4:
{ {
float fBPM = m_pSong->GetBPMAtBeat( m_fBeat ); float fBPM = m_pSong->GetBPMAtBeat( m_fBeat );
float fNewBPM; float fDeltaBPM;
switch( DeviceI.button ) switch( DeviceI.button )
{ {
case DIK_F1: fNewBPM = fBPM - 0.1f; break; case DIK_F7: fDeltaBPM = - 0.025f; break;
case DIK_F2: fNewBPM = fBPM + 0.1f; break; case DIK_F8: fDeltaBPM = + 0.025f; break;
case DIK_F3: fNewBPM = fBPM - 0.01f; break;
case DIK_F4: fNewBPM = fBPM + 0.01f; break;
default: ASSERT(0); default: ASSERT(0);
} }
if( type == IET_FAST_REPEAT )
fDeltaBPM *= 40;
float fNewBPM = fBPM + fDeltaBPM;
for( int i=0; i<m_pSong->m_BPMSegments.GetSize(); i++ ) for( int i=0; i<m_pSong->m_BPMSegments.GetSize(); i++ )
if( m_pSong->m_BPMSegments[i].m_fStartBeat == m_fBeat ) if( m_pSong->m_BPMSegments[i].m_fStartBeat == m_fBeat )
@@ -670,27 +680,25 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
} }
else // BPMSegment being modified is m_BPMSegments[i] else // BPMSegment being modified is m_BPMSegments[i]
{ {
if( i > 0 && m_pSong->m_BPMSegments[i-1].m_fBPM == fNewBPM ) if( i > 0 && fabsf(m_pSong->m_BPMSegments[i-1].m_fBPM - fNewBPM) < 0.025f )
m_pSong->m_BPMSegments.RemoveAt( i ); m_pSong->m_BPMSegments.RemoveAt( i );
else else
m_pSong->m_BPMSegments[i].m_fBPM = fNewBPM; m_pSong->m_BPMSegments[i].m_fBPM = fNewBPM;
} }
} }
break; break;
case DIK_F5: case DIK_F9:
case DIK_F6: case DIK_F10:
case DIK_F7:
case DIK_F8:
{ {
float fFreezeDelta; float fFreezeDelta;
switch( DeviceI.button ) switch( DeviceI.button )
{ {
case DIK_F5: fFreezeDelta = -0.1f; break; case DIK_F9: fFreezeDelta = -0.025f; break;
case DIK_F6: fFreezeDelta = +0.1f; break; case DIK_F10: fFreezeDelta = +0.025f; break;
case DIK_F7: fFreezeDelta = -0.01f; break;
case DIK_F8: fFreezeDelta = +0.01f; break;
default: ASSERT(0); default: ASSERT(0);
} }
if( type == IET_FAST_REPEAT )
fFreezeDelta *= 40;
for( int i=0; i<m_pSong->m_FreezeSegments.GetSize(); i++ ) for( int i=0; i<m_pSong->m_FreezeSegments.GetSize(); i++ )
{ {
@@ -707,27 +715,64 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
else // FreezeSegment being modified is m_FreezeSegments[i] else // FreezeSegment being modified is m_FreezeSegments[i]
{ {
m_pSong->m_FreezeSegments[i].m_fFreezeSeconds += fFreezeDelta; m_pSong->m_FreezeSegments[i].m_fFreezeSeconds += fFreezeDelta;
if( m_pSong->m_FreezeSegments[i].m_fFreezeSeconds < 0 ) if( m_pSong->m_FreezeSegments[i].m_fFreezeSeconds <= 0 )
m_pSong->m_FreezeSegments.RemoveAt( i ); m_pSong->m_FreezeSegments.RemoveAt( i );
} }
} }
break; break;
case DIK_F9: m_pSong->m_fOffsetInSeconds -= 0.1f; break; case DIK_F11:
case DIK_F10: m_pSong->m_fOffsetInSeconds += 0.1f; break; case DIK_F12:
case DIK_F11: m_pSong->m_fOffsetInSeconds -= 0.01f; break; {
case DIK_F12: m_pSong->m_fOffsetInSeconds += 0.01f; break; float fOffsetDelta;
switch( DeviceI.button )
{
case DIK_F11: fOffsetDelta = -0.025f; break;
case DIK_F12: fOffsetDelta = +0.025f; break;
default: ASSERT(0);
}
if( type == IET_FAST_REPEAT )
fOffsetDelta *= 40;
m_pSong->m_fOffsetInSeconds += fOffsetDelta;
}
break;
case DIK_M: case DIK_M:
MUSIC->Load( m_pSong->GetMusicPath() ); MUSIC->Load( m_pSong->GetMusicPath() );
MUSIC->Play( false, m_pSong->m_fMusicSampleStartSeconds, m_pSong->m_fMusicSampleLengthSeconds ); MUSIC->Play( false, m_pSong->m_fMusicSampleStartSeconds, m_pSong->m_fMusicSampleLengthSeconds );
break; break;
case DIK_DIVIDE: m_pSong->m_fMusicSampleStartSeconds -= 0.1f; break; case DIK_F1:
case DIK_MULTIPLY: m_pSong->m_fMusicSampleStartSeconds += 0.1f; break; case DIK_F2:
case DIK_SUBTRACT: m_pSong->m_fMusicSampleStartSeconds -= 0.01f; break; {
case DIK_ADD: m_pSong->m_fMusicSampleStartSeconds += 0.01f; break; float fOffsetDelta;
case DIK_NUMPAD0: m_pSong->m_fMusicSampleLengthSeconds -= 0.1f; break; switch( DeviceI.button )
case DIK_NUMPADPERIOD: m_pSong->m_fMusicSampleLengthSeconds += 0.1f; break; {
case DIK_F1: fOffsetDelta = -0.025f; break;
case DIK_F2: fOffsetDelta = +0.025f; break;
default: ASSERT(0);
}
if( type == IET_FAST_REPEAT )
fOffsetDelta *= 40;
} m_pSong->m_fMusicSampleStartSeconds += fOffsetDelta;
}
break;
case DIK_SUBTRACT:
case DIK_ADD:
{
float fDelta;
switch( DeviceI.button )
{
case DIK_SUBTRACT: fDelta = -0.025f; break;
case DIK_ADD: fDelta = +0.025f; break;
default: ASSERT(0);
}
if( type == IET_FAST_REPEAT )
fDelta *= 40;
m_pSong->m_fMusicSampleLengthSeconds += fDelta;
}
break;
}
} }
} }
+1 -1
View File
@@ -45,6 +45,7 @@ protected:
EditMode m_Mode; EditMode m_Mode;
Song* m_pSong; Song* m_pSong;
Notes* m_pNotes;
PlayerOptions m_PlayerOptions; PlayerOptions m_PlayerOptions;
@@ -61,7 +62,6 @@ protected:
float m_fTrailingBeat; // this approaches m_fBeat float m_fTrailingBeat; // this approaches m_fBeat
float m_fBeat; float m_fBeat;
DifficultyClass m_DifficultyClass;
NoteData m_Clipboard; NoteData m_Clipboard;
RageSoundSample m_soundChangeLine; RageSoundSample m_soundChangeLine;
+7 -59
View File
@@ -76,63 +76,6 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
ASSERT(0); ASSERT(0);
} }
/*
//////////////////////////
// Fill in some fake information for debugging
//////////////////////////
m_ResultMode = RM_ARCADE_SUMMARY;
GAMEMAN->m_CurStyle = STYLE_DANCE_SINGLE;
SONGMAN->SetCurrentSong( SONGMAN->m_pSongs[0] );
for( p=0; p<NUM_PLAYERS; p++ )
{
SONGMAN->SetCurrentNotes((PlayerNumber)p, SONGMAN->GetCurrentSong()->m_arrayNotes[0]);
{
SONGMAN->m_aGameplayStatistics[p].Add( GameplayStatistics() );
GameplayStatistics &GS = SONGMAN->m_aGameplayStatistics[p][SONGMAN->m_aGameplayStatistics[p].GetSize()-1];
GS.pSong = SONGMAN->m_pSongs[0];
GS.dc = CLASS_EASY;
GS.meter = 5;
GS.iPossibleDancePoints = 300;
GS.iActualDancePoints = 255;
GS.failed = false;
GS.perfect = GS.great = GS.good = GS.boo = GS.miss = GS.ok = GS.ng = GS.max_combo = 100;
GS.score = 100;
for( int r=0; r<NUM_RADAR_VALUES; r++ )
GS.fRadarPossible[r] = GS.fRadarActual[r] = 0;
}
{
SONGMAN->m_aGameplayStatistics[p].Add( GameplayStatistics() );
GameplayStatistics &GS = SONGMAN->m_aGameplayStatistics[p][SONGMAN->m_aGameplayStatistics[p].GetSize()-1];
GS.pSong = SONGMAN->m_pSongs[0];
GS.dc = CLASS_EASY;
GS.meter = 5;
GS.iPossibleDancePoints = 300;
GS.iActualDancePoints = 255;
GS.failed = false;
GS.perfect = GS.great = GS.good = GS.boo = GS.miss = GS.ok = GS.ng = GS.max_combo = 100;
GS.score = 100;
for( int r=0; r<NUM_RADAR_VALUES; r++ )
GS.fRadarPossible[r] = GS.fRadarActual[r] = 0;
}
{
SONGMAN->m_aGameplayStatistics[p].Add( GameplayStatistics() );
GameplayStatistics &GS = SONGMAN->m_aGameplayStatistics[p][SONGMAN->m_aGameplayStatistics[p].GetSize()-1];
GS.pSong = SONGMAN->m_pSongs[0];
GS.dc = CLASS_EASY;
GS.meter = 5;
GS.iPossibleDancePoints = 300;
GS.iActualDancePoints = 255;
GS.failed = false;
GS.perfect = GS.great = GS.good = GS.boo = GS.miss = GS.ok = GS.ng = GS.max_combo = 100;
GS.score = 100;
for( int r=0; r<NUM_RADAR_VALUES; r++ )
GS.fRadarPossible[r] = GS.fRadarActual[r] = 0;
}
}
*/
/////////////////////////// ///////////////////////////
@@ -308,15 +251,20 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
GS[p].miss += GSstage.miss; GS[p].miss += GSstage.miss;
GS[p].ok += GSstage.ok; GS[p].ok += GSstage.ok;
GS[p].ng += GSstage.ng; GS[p].ng += GSstage.ng;
GS[p].max_combo += GSstage.max_combo; GS[p].max_combo = max( GS[p].max_combo, GSstage.max_combo );
GS[p].score += GSstage.score; GS[p].score += GSstage.score;
for( int i=0; i<NUM_RADAR_VALUES; i++ ) for( int i=0; i<NUM_RADAR_VALUES; i++ )
{ {
GS[p].fRadarPossible[i] += GSstage.fRadarPossible[i]; GS[p].fRadarPossible[i] += GSstage.fRadarPossible[i];
GS[p].fRadarActual[i] += GSstage.fRadarActual[i]; GS[p].fRadarActual[i] += GSstage.fRadarActual[i];
} }
} }
for( int i=0; i<NUM_RADAR_VALUES; i++ )
{
GS[p].fRadarPossible[i] /= iSongsToShow;
GS[p].fRadarActual[i] /= iSongsToShow;
}
} }
break; break;
} }
+7 -6
View File
@@ -292,6 +292,7 @@ void ScreenGameplay::LoadNextSong()
m_pCurSong = m_apSongQueue[m_apSongQueue.GetSize()-1]; m_pCurSong = m_apSongQueue[m_apSongQueue.GetSize()-1];
m_apSongQueue.RemoveAt(m_apSongQueue.GetSize()-1); m_apSongQueue.RemoveAt(m_apSongQueue.GetSize()-1);
m_pCurSong->LoadNoteData();
Notes* pNotes[NUM_PLAYERS]; Notes* pNotes[NUM_PLAYERS];
for( p=0; p<NUM_PLAYERS; p++ ) for( p=0; p<NUM_PLAYERS; p++ )
@@ -476,7 +477,7 @@ void ScreenGameplay::Update( float fDeltaTime )
// fPositionSeconds ahead // fPositionSeconds ahead
if( PREFSMAN->m_SongOptions.m_AssistType == SongOptions::ASSIST_TICK ) if( PREFSMAN->m_SongOptions.m_AssistType == SongOptions::ASSIST_TICK )
{ {
fPositionSeconds += (SOUND->GetPlayLatency()+0.06f) * m_soundMusic.GetPlaybackRate(); // HACK: Add 0.06 seconds to make them play a tiny bit earlier fPositionSeconds += (SOUND->GetPlayLatency()+0.04f) * m_soundMusic.GetPlaybackRate(); // HACK: Add 0.04 seconds to make them play a tiny bit earlier
m_pCurSong->GetBeatAndBPSFromElapsedTime( fPositionSeconds, fSongBeat, fBPS, bFreeze ); m_pCurSong->GetBeatAndBPSFromElapsedTime( fPositionSeconds, fSongBeat, fBPS, bFreeze );
int iRowNow = BeatToNoteRowNotRounded( fSongBeat ); int iRowNow = BeatToNoteRowNotRounded( fSongBeat );
@@ -512,15 +513,15 @@ void ScreenGameplay::Update( float fDeltaTime )
if( !GAMEMAN->IsPlayerEnabled((PlayerNumber)p) ) if( !GAMEMAN->IsPlayerEnabled((PlayerNumber)p) )
continue; continue;
float fOverrideAlpha = m_Player[p].GetOverrideAlpha(); float fOverrideAdd = m_Player[p].GetOverrideAdd();
if( fOverrideAlpha == -1 ) if( fOverrideAdd == -1 )
{ {
m_Player[p].SetOverrideAlpha( 0 ); m_Player[p].SetOverrideAdd( 0 );
} }
else else
{ {
float fNewAlpha = min( 1, fOverrideAlpha + fDeltaTime ); float fNewAdd = min( 1, fOverrideAdd + fDeltaTime );
m_Player[p].SetOverrideAlpha( fNewAlpha ); m_Player[p].SetOverrideAdd( fNewAdd );
} }
} }
+3 -1
View File
@@ -37,7 +37,6 @@ const float LINE_GAP_Y = 36;
const ScreenMessage SM_PlaySample = ScreenMessage(SM_User-4); const ScreenMessage SM_PlaySample = ScreenMessage(SM_User-4);
const ScreenMessage SM_GoToPrevState = ScreenMessage(SM_User-5); const ScreenMessage SM_GoToPrevState = ScreenMessage(SM_User-5);
const ScreenMessage SM_GoToNextState = ScreenMessage(SM_User-6); const ScreenMessage SM_GoToNextState = ScreenMessage(SM_User-6);
const ScreenMessage SM_JustPressedNext = ScreenMessage(SM_User-7);
ScreenOptions::ScreenOptions( CString sBackgroundPath, CString sTopEdgePath ) ScreenOptions::ScreenOptions( CString sBackgroundPath, CString sTopEdgePath )
@@ -276,6 +275,9 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM )
{ {
switch( SM ) switch( SM )
{ {
case SM_MenuTimer:
this->MenuStart(PLAYER_1);
break;
case SM_GoToPrevState: case SM_GoToPrevState:
this->ExportOptions(); this->ExportOptions();
this->GoToPrevState(); this->GoToPrevState();
+1 -12
View File
@@ -24,10 +24,9 @@
OptionLineData g_SongOptionsLines[] = { OptionLineData g_SongOptionsLines[] = {
{ "Fail", 3, {"ARCADE","END OF SONGMAN","OFF"} }, { "Fail", 3, {"ARCADE","END OF SONG","OFF"} },
{ "Assist", 2, {"OFF","TICK"} }, { "Assist", 2, {"OFF","TICK"} },
{ "Rate", 7, {"70%","80%","90%","100%","110%","120%","130%"} }, { "Rate", 7, {"70%","80%","90%","100%","110%","120%","130%"} },
{ "Pitch", 7, {"-1.5","-1","-0.5","+0","+0.5","+1","+1.5"} },
{ "Bars", 2, {"OFF","ON"} }, { "Bars", 2, {"OFF","ON"} },
}; };
const int NUM_SONG_OPTIONS_LINES = sizeof(g_SongOptionsLines)/sizeof(OptionLineData); const int NUM_SONG_OPTIONS_LINES = sizeof(g_SongOptionsLines)/sizeof(OptionLineData);
@@ -36,7 +35,6 @@ enum {
SO_FAIL = 0, SO_FAIL = 0,
SO_ASSIST, SO_ASSIST,
SO_RATE, SO_RATE,
SO_PITCH,
SO_BARS SO_BARS
}; };
@@ -71,15 +69,6 @@ void ScreenSongOptions::ImportOptions()
else if( so.m_fMusicRate == 1.20f ) m_iSelectedOption[0][SO_RATE] = 5; else if( so.m_fMusicRate == 1.20f ) m_iSelectedOption[0][SO_RATE] = 5;
else if( so.m_fMusicRate == 1.30f ) m_iSelectedOption[0][SO_RATE] = 6; else if( so.m_fMusicRate == 1.30f ) m_iSelectedOption[0][SO_RATE] = 6;
else m_iSelectedOption[0][SO_RATE] = 3; else m_iSelectedOption[0][SO_RATE] = 3;
if( so.m_fMusicRate == -1.5f ) m_iSelectedOption[0][SO_PITCH] = 0;
else if( so.m_fMusicRate == -1.0f ) m_iSelectedOption[0][SO_PITCH] = 1;
else if( so.m_fMusicRate == -0.5f ) m_iSelectedOption[0][SO_PITCH] = 2;
else if( so.m_fMusicRate == 0.0f ) m_iSelectedOption[0][SO_PITCH] = 3;
else if( so.m_fMusicRate == 0.5f ) m_iSelectedOption[0][SO_PITCH] = 4;
else if( so.m_fMusicRate == 1.0f ) m_iSelectedOption[0][SO_PITCH] = 5;
else if( so.m_fMusicRate == 1.5f ) m_iSelectedOption[0][SO_PITCH] = 6;
else m_iSelectedOption[0][SO_PITCH] = 3;
} }
void ScreenSongOptions::ExportOptions() void ScreenSongOptions::ExportOptions()
+1 -1
View File
@@ -94,7 +94,7 @@ ScreenTitleMenu::ScreenTitleMenu()
m_textVersion.Load( THEME->GetPathTo(FONT_NORMAL) ); m_textVersion.Load( THEME->GetPathTo(FONT_NORMAL) );
m_textVersion.SetHorizAlign( Actor::align_right ); m_textVersion.SetHorizAlign( Actor::align_right );
m_textVersion.SetText( "v3.0 compatibility test" ); m_textVersion.SetText( "v3.0 beta 1" );
m_textVersion.SetDiffuseColor( D3DXCOLOR(0.6f,0.6f,0.6f,1) ); // light gray m_textVersion.SetDiffuseColor( D3DXCOLOR(0.6f,0.6f,0.6f,1) ); // light gray
m_textVersion.SetXY( SCREEN_RIGHT-16, SCREEN_BOTTOM-20 ); m_textVersion.SetXY( SCREEN_RIGHT-16, SCREEN_BOTTOM-20 );
m_textVersion.SetZoom( 0.5f ); m_textVersion.SetZoom( 0.5f );
+109 -92
View File
@@ -18,7 +18,7 @@
#include "Song.h" #include "Song.h"
const int FILE_CACHE_VERSION = 11; // increment this when the cache file format changes const int FILE_CACHE_VERSION = 25; // increment this when the SM file format changes
int CompareBPMSegments(const void *arg1, const void *arg2) int CompareBPMSegments(const void *arg1, const void *arg2)
@@ -228,6 +228,16 @@ CString Song::GetCacheFilePath()
return ssprintf( "Cache\\%d", GetHashForString(m_sSongDir) ); return ssprintf( "Cache\\%d", GetHashForString(m_sSongDir) );
} }
CString Song::GetSongFilePath()
{
CStringArray asFileNames;
GetDirListing( m_sSongDir+"*.sm", asFileNames );
if( asFileNames.GetSize() > 0 )
return m_sSongDir + asFileNames[0];
else
return m_sSongDir + GetFullTitle() + ".sm";
}
bool Song::LoadFromSongDir( CString sDir ) bool Song::LoadFromSongDir( CString sDir )
{ {
LOG->WriteLine( "Song::LoadFromSongDir(%s)", sDir ); LOG->WriteLine( "Song::LoadFromSongDir(%s)", sDir );
@@ -239,6 +249,11 @@ bool Song::LoadFromSongDir( CString sDir )
// save song dir // save song dir
m_sSongDir = sDir; m_sSongDir = sDir;
// save group name
CStringArray sDirectoryParts;
split( m_sSongDir, "\\", sDirectoryParts, true );
m_sGroupName = sDirectoryParts[1];
// //
// First look in the cache for this song (without loading NoteData) // First look in the cache for this song (without loading NoteData)
@@ -267,6 +282,15 @@ bool Song::LoadFromSongDir( CString sDir )
if( !DoesFileExist(GetCacheFilePath()) ) if( !DoesFileExist(GetCacheFilePath()) )
goto load_without_cache; goto load_without_cache;
LoadFromSMFile( GetCacheFilePath(), false ); // don't load NoteData LoadFromSMFile( GetCacheFilePath(), false ); // don't load NoteData
// Save length of music
if( GetMusicPath() != "" )
{
RageSoundStream sound;
sound.Load( GetMusicPath() );
m_fMusicLengthSeconds = sound.GetLengthSeconds();
}
LOG->WriteLine( "Loading '%s' from cache file '%s'.", m_sSongDir, GetCacheFilePath() ); LOG->WriteLine( "Loading '%s' from cache file '%s'.", m_sSongDir, GetCacheFilePath() );
return true; return true;
} }
@@ -320,31 +344,12 @@ bool Song::LoadFromBMSDir( CString sDir )
{ {
LOG->WriteLine( "Song::LoadFromBMSDir(%s)", sDir ); LOG->WriteLine( "Song::LoadFromBMSDir(%s)", sDir );
// make sure there is a trailing '\\' at the end of sDir
if( sDir.Right(1) != "\\" )
sDir += "\\";
// save song dir
m_sSongDir = sDir;
// get group name
CStringArray sDirectoryParts;
split( m_sSongDir, "\\", sDirectoryParts, true );
m_sGroupName = sDirectoryParts[1];
CStringArray arrayBMSFileNames; CStringArray arrayBMSFileNames;
GetDirListing( sDir + CString("*.bms"), arrayBMSFileNames ); GetDirListing( sDir + CString("*.bms"), arrayBMSFileNames );
if( arrayBMSFileNames.GetSize() == 0 ) if( arrayBMSFileNames.GetSize() == 0 )
throw RageException( "Couldn't find any BMS files in '%s'", sDir ); throw RageException( "Couldn't find any BMS files in '%s'", sDir );
// Load the Song info from the first BMS file. Silly BMS duplicates the song info in every
// file. So, we read the song data from only the first BMS file and assume that the info
// is identical for every BMS file in the directory.
m_sSongFile = arrayBMSFileNames[0];
// load the Notes from the rest of the BMS files // load the Notes from the rest of the BMS files
for( int i=0; i<arrayBMSFileNames.GetSize(); i++ ) for( int i=0; i<arrayBMSFileNames.GetSize(); i++ )
{ {
@@ -353,11 +358,12 @@ bool Song::LoadFromBMSDir( CString sDir )
m_arrayNotes.Add( pNewNotes ); m_arrayNotes.Add( pNewNotes );
} }
CString sPath = m_sSongDir + arrayBMSFileNames[0];
CStdioFile file; CStdioFile file;
if( !file.Open( GetSongFilePath(), CFile::modeRead|CFile::shareDenyNone ) ) if( !file.Open( sPath, CFile::modeRead|CFile::shareDenyNone ) )
{ {
throw RageException( "Failed to open %s.", GetSongFilePath() ); throw RageException( "Failed to open %s.", sPath );
return false; return false;
} }
@@ -494,9 +500,9 @@ bool Song::LoadFromBMSDir( CString sDir )
// open the song file again and and look for this tag's value // open the song file again and and look for this tag's value
CStdioFile file; CStdioFile file;
if( !file.Open( GetSongFilePath(), CFile::modeRead|CFile::shareDenyNone ) ) if( !file.Open( sPath, CFile::modeRead|CFile::shareDenyNone ) )
{ {
throw RageException( "Failed to open %s.", GetSongFilePath() ); throw RageException( "Failed to open %s.", sPath );
return false; return false;
} }
@@ -537,7 +543,7 @@ bool Song::LoadFromBMSDir( CString sDir )
if( fBPM == -1 ) // we didn't find the line we were looking for if( fBPM == -1 ) // we didn't find the line we were looking for
{ {
LOG->WriteLine( "WARNING: Couldn't find tag '%s' in '%s'.", sTagToLookFor, GetSongFilePath() ); LOG->WriteLine( "WARNING: Couldn't find tag '%s' in '%s'.", sTagToLookFor, sPath );
} }
else else
{ {
@@ -545,6 +551,8 @@ bool Song::LoadFromBMSDir( CString sDir )
AddBPMSegment( newSeg ); AddBPMSegment( newSeg );
LOG->WriteLine( "Inserting new BPM change at beat %f, BPM %f", newSeg.m_fStartBeat, newSeg.m_fBPM ); LOG->WriteLine( "Inserting new BPM change at beat %f, BPM %f", newSeg.m_fStartBeat, newSeg.m_fBPM );
} }
file.Close();
} }
break; break;
case 9: // freeze case 9: // freeze
@@ -558,8 +566,8 @@ bool Song::LoadFromBMSDir( CString sDir )
// open the song file again and and look for this tag's value // open the song file again and and look for this tag's value
CStdioFile file; CStdioFile file;
if( !file.Open( GetSongFilePath(), CFile::modeRead|CFile::shareDenyNone ) ) if( !file.Open( sPath, CFile::modeRead|CFile::shareDenyNone ) )
throw RageException( "Failed to open %s.", GetSongFilePath() ); throw RageException( "Failed to open %s.", sPath );
CString line; CString line;
while( file.ReadString(line) ) // foreach line while( file.ReadString(line) ) // foreach line
@@ -613,7 +621,7 @@ bool Song::LoadFromBMSDir( CString sDir )
if( fFreezeSecs == -1 ) // we didn't find the line we were looking for if( fFreezeSecs == -1 ) // we didn't find the line we were looking for
{ {
LOG->WriteLine( "WARNING: Couldn't find tag '%s' in '%s'.", sTagToLookFor, GetSongFilePath() ); LOG->WriteLine( "WARNING: Couldn't find tag '%s' in '%s'.", sTagToLookFor, sPath );
} }
else else
{ {
@@ -621,6 +629,8 @@ bool Song::LoadFromBMSDir( CString sDir )
AddFreezeSegment( newSeg ); AddFreezeSegment( newSeg );
LOG->WriteLine( "Inserting new Freeze at beat %f, secs %f", newSeg.m_fStartBeat, newSeg.m_fFreezeSeconds ); LOG->WriteLine( "Inserting new Freeze at beat %f, secs %f", newSeg.m_fStartBeat, newSeg.m_fFreezeSeconds );
} }
file.Close();
} }
break; break;
} }
@@ -633,6 +643,7 @@ bool Song::LoadFromBMSDir( CString sDir )
LOG->WriteLine( "There is a BPM change at beat %f, BPM %f, index %d", LOG->WriteLine( "There is a BPM change at beat %f, BPM %f, index %d",
m_BPMSegments[i].m_fStartBeat, m_BPMSegments[i].m_fBPM, i ); m_BPMSegments[i].m_fStartBeat, m_BPMSegments[i].m_fBPM, i );
file.Close();
return TRUE; return TRUE;
} }
@@ -642,29 +653,17 @@ bool Song::LoadFromDWIFile( CString sPath )
{ {
LOG->WriteLine( "Song::LoadFromDWIFile(%s)", sPath ); LOG->WriteLine( "Song::LoadFromDWIFile(%s)", sPath );
// save song dir and file name
CString sDir, sFName, sExt;
splitrelpath(sPath, sDir, sFName, sExt);
m_sSongDir = sDir;
m_sSongFile = sFName+"."+sExt;
// get group name
sDir.MakeLower();
CStringArray sDirectoryParts;
split( m_sSongDir, "\\", sDirectoryParts, true );
m_sGroupName = sDirectoryParts[1];
CStdioFile file; CStdioFile file;
if( !file.Open( GetSongFilePath(), CFile::modeRead|CFile::shareDenyNone ) ) if( !file.Open( sPath, CFile::modeRead|CFile::shareDenyNone ) )
throw RageException( "Error opening DWI file '%s'.", GetSongFilePath() ); throw RageException( "Error opening DWI file '%s'.", sPath );
// read the whole file into a sFileText // read the whole file into a sFileText
CString sFileText; CString sFileText;
CString buffer; CString buffer;
while( file.ReadString(buffer) ) while( file.ReadString(buffer) )
sFileText += buffer; sFileText += buffer + "\n";
file.Close(); file.Close();
// strip comments out of sFileText // strip comments out of sFileText
@@ -692,12 +691,15 @@ bool Song::LoadFromDWIFile( CString sPath )
// split the value string into tokens // split the value string into tokens
CStringArray arrayValueTokens; CStringArray arrayValueTokens;
split( sValueString, ":", arrayValueTokens ); split( sValueString, ":", arrayValueTokens );
for( int j=0; j<arrayValueTokens.GetSize(); j++ )
{
arrayValueTokens[j].TrimLeft();
arrayValueTokens[j].TrimRight();
}
if( arrayValueTokens.GetSize() == 0 ) if( arrayValueTokens.GetSize() == 0 )
continue; continue;
CString sValueName = arrayValueTokens.GetAt( 0 ); CString sValueName = arrayValueTokens.GetAt( 0 );
sValueName.TrimLeft();
// handle the data // handle the data
if( sValueName == "#FILE" ) if( sValueName == "#FILE" )
@@ -788,6 +790,9 @@ bool Song::LoadFromSMFile( CString sPath, bool bLoadNoteData )
{ {
LOG->WriteLine( "Song::LoadFromSMDir(%s, %d)", sPath, bLoadNoteData ); LOG->WriteLine( "Song::LoadFromSMDir(%s, %d)", sPath, bLoadNoteData );
m_BPMSegments.RemoveAll();
m_FreezeSegments.RemoveAll();
int i; int i;
// get group name // get group name
@@ -796,19 +801,16 @@ bool Song::LoadFromSMFile( CString sPath, bool bLoadNoteData )
m_sGroupName = sDirectoryParts[1]; m_sGroupName = sDirectoryParts[1];
m_sSongFile = sPath;
CStdioFile file; CStdioFile file;
if( !file.Open( GetSongFilePath(), CFile::modeRead|CFile::shareDenyNone ) ) if( !file.Open( sPath, CFile::modeRead|CFile::shareDenyNone ) )
throw RageException( "Error opening DWI file '%s'.", GetSongFilePath() ); throw RageException( "Error opening SM file '%s'.", sPath );
// read the whole file into a sFileText // read the whole file into a sFileText
CString sFileText; CString sFileText;
CString buffer; CString buffer;
while( file.ReadString(buffer) ) while( file.ReadString(buffer) )
sFileText += buffer; sFileText += buffer + "\n";
file.Close(); file.Close();
// strip comments out of sFileText // strip comments out of sFileText
@@ -835,21 +837,21 @@ bool Song::LoadFromSMFile( CString sPath, bool bLoadNoteData )
// split the value string into tokens // split the value string into tokens
CStringArray arrayValueTokens; CStringArray arrayValueTokens;
split( sValueString, ":", arrayValueTokens, false ); split( sValueString, ":", arrayValueTokens, false );
for( int j=0; j<arrayValueTokens.GetSize(); j++ )
{
arrayValueTokens[j].TrimLeft();
arrayValueTokens[j].TrimRight();
}
if( arrayValueTokens.GetSize() == 0 ) if( arrayValueTokens.GetSize() == 0 )
continue; continue;
CString sValueName = arrayValueTokens.GetAt( 0 ); CString sValueName = arrayValueTokens.GetAt( 0 );
sValueName.TrimLeft();
// handle the data // handle the data
if( sValueName == "#TITLE" ) if( sValueName == "#TITLE" )
GetMainAndSubTitlesFromFullTitle( arrayValueTokens[1], m_sMainTitle, m_sSubTitle ); GetMainAndSubTitlesFromFullTitle( arrayValueTokens[1], m_sMainTitle, m_sSubTitle );
if( sValueName == "#TITLE" ) else if( sValueName == "#SUBTITLE" )
m_sMainTitle = arrayValueTokens[1];
if( sValueName == "#SUBTITLE" )
m_sSubTitle = arrayValueTokens[1]; m_sSubTitle = arrayValueTokens[1];
else if( sValueName == "#ARTIST" ) else if( sValueName == "#ARTIST" )
@@ -903,8 +905,7 @@ bool Song::LoadFromSMFile( CString sPath, bool bLoadNoteData )
LOG->WriteLine( "Adding a freeze segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fFreezeSeconds ); LOG->WriteLine( "Adding a freeze segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fFreezeSeconds );
m_FreezeSegments.Add( new_seg ); // add to back for now (we'll sort later) AddFreezeSegment( new_seg );
SortFreezeSegmentsArray( m_FreezeSegments );
} }
} }
@@ -924,28 +925,37 @@ bool Song::LoadFromSMFile( CString sPath, bool bLoadNoteData )
new_seg.m_fStartBeat = fBeat; new_seg.m_fStartBeat = fBeat;
new_seg.m_fBPM = fNewBPM; new_seg.m_fBPM = fNewBPM;
// add and sort AddBPMSegment( new_seg );
m_BPMSegments.Add( new_seg );
SortBPMSegmentsArray( m_BPMSegments );
} }
} }
else if( sValueName == "#NOTES" ) else if( sValueName == "#NOTES" )
{ {
Notes* pNewNotes = new Notes; Notes* pNewNotes = NULL;
if( arrayValueTokens.GetSize() != 7 ) // Check to see if this notes already has been allocated
throw RageException( "The song file '%s' is has an incorrect number of parameters in a #NOTES tag.", GetSongFilePath() ); for( int j=0; j<m_arrayNotes.GetSize(); j++ )
if( m_arrayNotes[j]->m_NotesType == StringToNotesType(arrayValueTokens[1]) &&
m_arrayNotes[j]->m_sDescription == arrayValueTokens[2] )
pNewNotes = m_arrayNotes[j];
if( pNewNotes == NULL ) // we didn't find a match that was already loaded
{
pNewNotes = new Notes;
m_arrayNotes.Add( pNewNotes );
}
if( arrayValueTokens.GetSize() != 8 )
throw RageException( "The song file '%s' is has %d in a #NOTES tag, but should have %d.", sPath, arrayValueTokens.GetSize(), 8 );
pNewNotes->LoadFromSMTokens( pNewNotes->LoadFromSMTokens(
arrayValueTokens[0],
arrayValueTokens[1], arrayValueTokens[1],
arrayValueTokens[2], arrayValueTokens[2],
arrayValueTokens[3], arrayValueTokens[3],
arrayValueTokens[4], arrayValueTokens[4],
arrayValueTokens[5], arrayValueTokens[5],
arrayValueTokens[6], arrayValueTokens[6],
bLoadNoteData ); arrayValueTokens[7],
m_arrayNotes.Add( pNewNotes ); bLoadNoteData );
} }
else else
@@ -1064,17 +1074,11 @@ void Song::TidyUpData()
for( int i=0; i<m_arrayNotes.GetSize(); i++ ) for( int i=0; i<m_arrayNotes.GetSize(); i++ )
{ {
Notes* pNM = m_arrayNotes[i]; Notes* pNotes = m_arrayNotes[i];
ASSERT( pNotes->m_pNoteData != NULL );
float fMusicLength = m_fMusicLengthSeconds; for( int r=0; r<NUM_RADAR_VALUES; r++ )
if( fMusicLength == 0 ) pNotes->m_fRadarValues[r] = pNotes->GetNoteData()->GetRadarValue( (RadarCategory)r, m_fMusicLengthSeconds );
fMusicLength = 100;
pNM->m_fRadarValues[RADAR_STREAM] = pNM->GetNoteData()->GetStreamRadarValue( fMusicLength );
pNM->m_fRadarValues[RADAR_VOLTAGE] = pNM->GetNoteData()->GetVoltageRadarValue( fMusicLength );
pNM->m_fRadarValues[RADAR_AIR] = pNM->GetNoteData()->GetAirRadarValue( fMusicLength );
pNM->m_fRadarValues[RADAR_FREEZE] = pNM->GetNoteData()->GetFreezeRadarValue( fMusicLength );
pNM->m_fRadarValues[RADAR_CHAOS] = pNM->GetNoteData()->GetChaosRadarValue( fMusicLength );
} }
} }
@@ -1107,24 +1111,28 @@ void Song::SaveToCacheFile()
void Song::SaveToSMFile( CString sPath ) void Song::SaveToSMFile( CString sPath )
{ {
if( sPath == "" ) if( sPath == "" )
{
sPath = GetSongFilePath(); sPath = GetSongFilePath();
//
// rename all old files to avoid confusion
//
CStringArray arrayOldFileNames;
GetDirListing( m_sSongDir + "*.bms", arrayOldFileNames );
GetDirListing( m_sSongDir + "*.dwi", arrayOldFileNames );
for( int i=0; i<arrayOldFileNames.GetSize(); i++ )
{
CString sOldPath = m_sSongDir + arrayOldFileNames[i];
CString sNewPath = sOldPath + ".old";
MoveFile( sOldPath, sNewPath );
}
}
LOG->WriteLine( "Song::SaveToSMDir('%s')", sPath ); LOG->WriteLine( "Song::SaveToSMDir('%s')", sPath );
int i; int i;
//
// rename all old files to avoid confusion
//
CStringArray arrayOldFileNames;
GetDirListing( m_sSongDir + CString("*.bms"), arrayOldFileNames );
GetDirListing( m_sSongDir + CString("*.dwi"), arrayOldFileNames );
for( i=0; i<arrayOldFileNames.GetSize(); i++ )
{
CString sOldPath = m_sSongDir + arrayOldFileNames[i];
CString sNewPath = sOldPath + ".old";
MoveFile( sOldPath, sNewPath );
}
FILE* fp = fopen( sPath, "w" ); FILE* fp = fopen( sPath, "w" );
if( fp == NULL ) if( fp == NULL )
@@ -1175,6 +1183,16 @@ void Song::SaveToSMFile( CString sPath )
fclose( fp ); fclose( fp );
} }
void Song::LoadNoteData()
{
if( m_arrayNotes.GetSize() > 0 )
{
if( m_arrayNotes[0]->m_pNoteData != NULL ) // if already loaded
return;
LoadFromSMFile( GetCacheFilePath(), true );
}
}
Grade Song::GetGradeForDifficultyClass( NotesType nt, DifficultyClass dc ) Grade Song::GetGradeForDifficultyClass( NotesType nt, DifficultyClass dc )
{ {
CArray<Notes*, Notes*> aNotes; CArray<Notes*, Notes*> aNotes;
@@ -1307,4 +1325,3 @@ void SortSongPointerArrayByMostPlayed( CArray<Song*, Song*> &arraySongPointers )
{ {
qsort( arraySongPointers.GetData(), arraySongPointers.GetSize(), sizeof(Song*), CompareSongPointersByMostPlayed ); qsort( arraySongPointers.GetData(), arraySongPointers.GetSize(), sizeof(Song*), CompareSongPointersByMostPlayed );
} }
+1
View File
@@ -224,6 +224,7 @@ void SongManager::LoadDWISongDir( CString DWIHome )
void SongManager::FreeSongArray() void SongManager::FreeSongArray()
{ {
// Memory is being corrupt somewhere, and this is causing a crash. Bad news. I'll fix it later. Let the OS free it for now.
for( int i=0; i<m_pSongs.GetSize(); i++ ) for( int i=0; i<m_pSongs.GetSize(); i++ )
SAFE_DELETE( m_pSongs[i] ); SAFE_DELETE( m_pSongs[i] );
m_pSongs.RemoveAll(); m_pSongs.RemoveAll();
+1 -2
View File
@@ -70,7 +70,7 @@ const CString g_sAppClassName = "StepMania Class";
HWND g_hWndMain; // Main Window Handle HWND g_hWndMain; // Main Window Handle
HINSTANCE g_hInstance; // The Handle to Window Instance HINSTANCE g_hInstance; // The Handle to Window Instance
HANDLE g_hMutex; // Used to check if an instance of our app is already HANDLE g_hMutex; // Used to check if an instance of our app is already
const DWORD g_dwWindowStyle = WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU; const DWORD g_dwWindowStyle = WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU|WS_THICKFRAME;
BOOL g_bIsActive = FALSE; // Whether the focus is on our app BOOL g_bIsActive = FALSE; // Whether the focus is on our app
@@ -387,7 +387,6 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{ {
// Don't allow the window to be resized smaller than the screen resolution. // Don't allow the window to be resized smaller than the screen resolution.
// This should snap to multiples of the Window size two! // This should snap to multiples of the Window size two!
RECT rcWnd; RECT rcWnd;
SetRect( &rcWnd, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); SetRect( &rcWnd, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
DWORD dwWindowStyle = GetWindowLong( g_hWndMain, GWL_STYLE ); DWORD dwWindowStyle = GetWindowLong( g_hWndMain, GWL_STYLE );
+8 -8
View File
@@ -3,7 +3,7 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: Song Class: Song
Desc: Holds data about a song that is common to several Notes. Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
@@ -47,18 +47,18 @@ public:
void TidyUpData(); // call after loading to clean up invalid data void TidyUpData(); // call after loading to clean up invalid data
void SaveToSMFile( CString sPath = "" ); // no path means save in Song dir void SaveToSMFile( CString sPath = "" ); // no path means save to SongFilePath
CString GetCacheFilePath();
void SaveToCacheFile(); void SaveToCacheFile();
public: CString GetSongFilePath();
CString GetCacheFilePath();
CString m_sSongFile; void LoadNoteData();
public:
CString m_sSongDir; CString m_sSongDir;
CString m_sGroupName; CString m_sGroupName;
CString GetSongFilePath() {return m_sSongDir+m_sSongFile; };
bool m_bChangedSinceSave; bool m_bChangedSinceSave;
@@ -115,7 +115,7 @@ public:
float GetBPMAtBeat( float fBeat ) float GetBPMAtBeat( float fBeat )
{ {
for( int i=0; i<m_BPMSegments.GetSize()-1; i++ ) for( int i=0; i<m_BPMSegments.GetSize()-1; i++ )
if( m_BPMSegments[i+1].m_fStartBeat <= fBeat ) if( m_BPMSegments[i+1].m_fStartBeat > fBeat )
break; break;
return m_BPMSegments[i].m_fBPM; return m_BPMSegments[i].m_fBPM;
}; };