MDenhams fixes for pop'n music BMS loading

This commit is contained in:
Andrew Livy
2003-12-12 05:37:52 +00:00
parent 441f6769c3
commit 0ef0f0633e
+47 -28
View File
@@ -25,14 +25,15 @@
// Right 16-56
//
// Notice that 15 and 25 have double meanings! What were they thinking???
// While reading in, use the 6 panel mapping. After reading in, detect if only 4 notes
// While reading in, use the 6 panel mapping. After reading in, detect if
//only 4 notes
// are used. If so, shift the Up+Right column back to the Up column
//
// MD 10/26/03 - Hey, folks, BMSes are used for things BESIDES DDR steps,
// and so we're borking up BMSes that are for pnm/bm/etc.
//
// pnm-nine: 11-15,21-24
// pnm-nine: 11-15,22-25
// pnm-five: 13-15,21-22
// bm-single: 11-16
// bm-double: 11-16,21-26
@@ -81,7 +82,8 @@ StepsType BMSLoader::CheckTracksMagic( void ) {
return STEPS_TYPE_DANCE_SOLO;
case 8:
// Could also be couple or 7-key.
if (iTracks[7] == 0 && iTracks[8] == 0 && iTracks[1] == 0 && iTracks[3] == 0)
if (iTracks[7] == 0 && iTracks[8] == 0 && iTracks[1] == 0 && iTracks[3] ==
0)
// these four tracks are IIDX-related
return STEPS_TYPE_DANCE_DOUBLE;
else
@@ -97,7 +99,8 @@ StepsType BMSLoader::CheckTracksMagic( void ) {
}
}
void BMSLoader::mapBMSTrackToDanceNote( int iBMSTrack, int &iDanceColOut, char &cNoteCharOut )
void BMSLoader::mapBMSTrackToDanceNote( int iBMSTrack, int &iDanceColOut,
char &cNoteCharOut )
{
if( iBMSTrack > 40 )
{
@@ -158,7 +161,8 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Steps &out )
RageFile file(sPath);
if (!file.IsOpen())
RageException::Throw("Failed to open %s for reading.", sPath.c_str());
RageException::Throw("Failed to open %s for reading.",
sPath.c_str());
while (!file.AtEOF())
{
CString line = file.GetLine();
@@ -196,7 +200,8 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Steps &out )
{
case 1: // 4 or 6 single
out.m_StepsType = STEPS_TYPE_DANCE_SINGLE;
// if the mode should be solo, then we'll update m_DanceStyle below when we read in step data
// if the mode should be solo, then we'll update m_DanceStyle below when
// we read in step data
break;
case 2: // couple/battle
out.m_StepsType = STEPS_TYPE_DANCE_COUPLE;
@@ -224,7 +229,8 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Steps &out )
iPosCloseBracket = value_data.Find( ")" );
if( iPosOpenBracket != -1 && iPosCloseBracket != -1 )
value_data = value_data.substr( iPosOpenBracket+1, iPosCloseBracket-iPosOpenBracket-1 );
value_data = value_data.substr( iPosOpenBracket+1,
iPosCloseBracket-iPosOpenBracket-1 );
LOG->Trace( "Steps description found to be '%s'", value_data.c_str() );
out.SetDescription(value_data);
@@ -292,7 +298,8 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Steps &out )
/* We fix this later, since we're not moving columns around right now.
if( out.m_StepsType == STEPS_TYPE_DANCE_SINGLE ||
out.m_StepsType == STEPS_TYPE_DANCE_DOUBLE ||
out.m_StepsType == STEPS_TYPE_DANCE_COUPLE) // if there are 4 panels, then the Up+Right track really contains the notes for Up
out.m_StepsType == STEPS_TYPE_DANCE_COUPLE) // if there are 4 panels, then
the Up+Right track really contains the notes for Up
{
pNoteData->MoveTapNoteTrack(DANCE_NOTE_PAD1_UP, DANCE_NOTE_PAD1_UPRIGHT);
}
@@ -347,19 +354,21 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Steps &out )
iTransformNewToOld[0] = BMS_P1_KEY3;
iTransformNewToOld[1] = BMS_P1_KEY4;
iTransformNewToOld[2] = BMS_P1_KEY5;
iTransformNewToOld[3] = BMS_P2_KEY1;
iTransformNewToOld[4] = BMS_P2_KEY2;
// fix these columns!
iTransformNewToOld[3] = BMS_P2_KEY2;
iTransformNewToOld[4] = BMS_P2_KEY3;
break;
case STEPS_TYPE_PNM_NINE:
iTransformNewToOld[0] = BMS_P1_KEY1;
iTransformNewToOld[1] = BMS_P1_KEY2;
iTransformNewToOld[2] = BMS_P1_KEY3;
iTransformNewToOld[3] = BMS_P1_KEY4;
iTransformNewToOld[4] = BMS_P1_KEY5;
iTransformNewToOld[5] = BMS_P2_KEY1;
iTransformNewToOld[6] = BMS_P2_KEY2;
iTransformNewToOld[7] = BMS_P2_KEY3;
iTransformNewToOld[8] = BMS_P2_KEY4;
iTransformNewToOld[0] = BMS_P1_KEY1; // lwhite
iTransformNewToOld[1] = BMS_P1_KEY2; // lyellow
iTransformNewToOld[2] = BMS_P1_KEY3; // lgreen
iTransformNewToOld[3] = BMS_P1_KEY4; // lblue
iTransformNewToOld[4] = BMS_P1_KEY5; // red
// fix these columns!
iTransformNewToOld[5] = BMS_P2_KEY2; // rblue
iTransformNewToOld[6] = BMS_P2_KEY3; // rgreen
iTransformNewToOld[7] = BMS_P2_KEY4; // ryellow
iTransformNewToOld[8] = BMS_P2_KEY5; // rwhite
break;
// MD 10/26/03 - uncomment this section when we get around to BM support outside 5-key
// 10/29/03 - helps if I actually do what I suggest.
@@ -411,7 +420,8 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Steps &out )
NoteData* pNoteData2 = new NoteData;
pNoteData2->SetNumTracks( iNumNewTracks );
pNoteData2->LoadTransformed( pNoteData, iNumNewTracks, iTransformNewToOld );
pNoteData2->LoadTransformed( pNoteData, iNumNewTracks, iTransformNewToOld
);
out.SetNoteData(pNoteData2);
@@ -445,7 +455,8 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
{
Steps* pNewNotes = new Steps;
const bool ok = LoadFromBMSFile( out.GetSongDir() + arrayBMSFileNames[i], *pNewNotes );
const bool ok = LoadFromBMSFile( out.GetSongDir() + arrayBMSFileNames[i],
*pNewNotes );
if( ok )
out.m_apNotes.push_back( pNewNotes );
else
@@ -501,7 +512,8 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
if( iIndex != value_data.npos )
{
value_data = value_data.Left( iIndex );
GetMainAndSubTitlesFromFullTitle( value_data, out.m_sMainTitle, out.m_sSubTitle );
GetMainAndSubTitlesFromFullTitle( value_data, out.m_sMainTitle,
out.m_sSubTitle );
}
else
out.m_sMainTitle = value_data;
@@ -585,13 +597,15 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
// open the song file again and and look for this tag's value
/* I don't like this. I think we should just seek back to the beginning
* rather than open the file again. However, I'm not changing the logic,
* rather than open the file again. However, I'm not changing the
logic,
* only the implementation. -- Steve
*/
RageFile file(sPath);//Why doesn't VC6 bitch here but it does with int??
if (!file.IsOpen())
RageException::Throw( "Failed to open %s for reading.", sPath.c_str() );
RageException::Throw( "Failed to open %s for reading.", sPath.c_str()
);
while (!file.AtEOF())
{
CString line = file.GetLine();
@@ -627,12 +641,14 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
}
if( fBPM == -1 ) // we didn't find the line we were looking for
LOG->Trace( "WARNING: Couldn't find tag '%s' in '%s'.", sTagToLookFor.c_str(), sPath.c_str() );
LOG->Trace( "WARNING: Couldn't find tag '%s' in '%s'.",
sTagToLookFor.c_str(), sPath.c_str() );
else
{
BPMSegment newSeg( NoteRowToBeat(iStepIndex), fBPM );
out.AddBPMSegment( newSeg );
LOG->Trace( "Inserting new BPM change at beat %f, BPM %f", newSeg.m_fStartBeat, newSeg.m_fBPM );
LOG->Trace( "Inserting new BPM change at beat %f, BPM %f",
newSeg.m_fStartBeat, newSeg.m_fBPM );
}
break;
@@ -703,13 +719,15 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
if( fFreezeSecs == -1 ) // we didn't find the line we were looking for
{
LOG->Trace( "WARNING: Couldn't find tag '%s' in '%s'.", sTagToLookFor.c_str(), sPath.c_str() );
LOG->Trace( "WARNING: Couldn't find tag '%s' in '%s'.",
sTagToLookFor.c_str(), sPath.c_str() );
}
else
{
StopSegment newSeg( fFreezeStartBeat, fFreezeSecs );
out.AddStopSegment( newSeg );
LOG->Trace( "Inserting new Freeze at beat %f, secs %f", newSeg.m_fStartBeat, newSeg.m_fStopSeconds );
LOG->Trace( "Inserting new Freeze at beat %f, secs %f",
newSeg.m_fStartBeat, newSeg.m_fStopSeconds );
}
break;
@@ -726,3 +744,4 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
return true;
}