+ make it support o2mania-style notecharts when playing on beat_single7

+ comments cleanup
This commit is contained in:
Thai Pangsakulyanont
2011-03-18 01:19:06 +07:00
parent 1f2e26790c
commit 87109a1a66
+51 -36
View File
@@ -138,31 +138,10 @@ static RString FindLargestInitialSubstring( const RString &string1, const RStrin
return string1.substr( 0, i );
}
static StepsType DetermineStepsType( int iPlayer, const NoteData &nd, const RString &sPath )
static StepsType DetermineStepsType( int iPlayer, const NoteData &nd, const RString &sPath, const int iNumNonEmptyTracks )
{
ASSERT( NUM_BMS_TRACKS == nd.GetNumTracks() );
bool bTrackHasNote[NUM_NON_AUTO_KEYSOUND_TRACKS];
ZERO( bTrackHasNote );
int iLastRow = nd.GetLastRow();
for( int t=0; t<NUM_NON_AUTO_KEYSOUND_TRACKS; t++ )
{
for( int r=0; r<=iLastRow; r++ )
{
if( nd.GetTapNote(t, r).type != TapNote::empty )
{
bTrackHasNote[t] = true;
break;
}
}
}
int iNumNonEmptyTracks = 0;
for( int t=0; t<NUM_NON_AUTO_KEYSOUND_TRACKS; t++ )
if( bTrackHasNote[t] )
iNumNonEmptyTracks++;
switch( iPlayer )
{
case 1: // "1 player"
@@ -170,6 +149,7 @@ static StepsType DetermineStepsType( int iPlayer, const NoteData &nd, const RStr
* 4 - dance 4-panel
* 5 - pop 5-key
* 6 - dance 6-panel, beat 5-key
* 7 - beat 7-key (scratch unused)
* 8 - beat 7-key
* 9 - popn 9-key */
switch( iNumNonEmptyTracks )
@@ -405,11 +385,9 @@ static void SetTimeSigAdjustments( const MeasureToTimeSig_t &sigs, Song &out, Me
static void ReadTimeSigs( const NameToData_t &mapNameToData, MeasureToTimeSig_t &out )
{
// some convertors change some measure's time signature before any notes are there
// it is required because sometimes the BGA starts before the music and the measure size
// is the difference between the start of first bar and the BGA.
// something like #00002:1.55. that made all subsequent notes 192th.
// here, find the lowest measure for notes, and make this function skip the time signatures before it.
/* some songs have BGA starting before the music, so convertors a put weird time signature
* at first measure, something like #00002:1.55. that made all subsequent notes 192th.
* here, find the lowest measure for notes track, and make it skip the time signatures before it. */
int iStartMeasureNo = 999;
NameToData_t::const_iterator it;
for( it = mapNameToData.lower_bound("#00000"); it != mapNameToData.end(); ++it )
@@ -604,7 +582,28 @@ static bool LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNameTo
}
}
out.m_StepsType = DetermineStepsType( iPlayer, ndNotes, sPath );
bool bTrackHasNote[NUM_NON_AUTO_KEYSOUND_TRACKS];
ZERO( bTrackHasNote );
int iLastRow = ndNotes.GetLastRow();
for( int t=0; t<NUM_NON_AUTO_KEYSOUND_TRACKS; t++ )
{
for( int r=0; r<=iLastRow; r++ )
{
if( ndNotes.GetTapNote(t, r).type != TapNote::empty )
{
bTrackHasNote[t] = true;
break;
}
}
}
int iNumNonEmptyTracks = 0;
for( int t=0; t<NUM_NON_AUTO_KEYSOUND_TRACKS; t++ )
if( bTrackHasNote[t] )
iNumNonEmptyTracks++;
out.m_StepsType = DetermineStepsType( iPlayer, ndNotes, sPath, iNumNonEmptyTracks );
if( out.m_StepsType == StepsType_beat_single5 && GetTagFromMap( mapNameToData, "#title", sData ) )
{
// Hack: guess at 6-panel.
@@ -692,14 +691,30 @@ static bool LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNameTo
iTransformNewToOld[11] = BMS_P2_TURN;
break;
case StepsType_beat_single7:
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_P1_KEY6;
iTransformNewToOld[6] = BMS_P1_KEY7;
iTransformNewToOld[7] = BMS_P1_TURN;
if( !bTrackHasNote[BMS_P1_KEY7] && bTrackHasNote[BMS_P1_TURN] )
{
/* special case for o2mania style charts:
* the turntable is used for first key while the real 7th key is not used. */
iTransformNewToOld[0] = BMS_P1_TURN;
iTransformNewToOld[1] = BMS_P1_KEY1;
iTransformNewToOld[2] = BMS_P1_KEY2;
iTransformNewToOld[3] = BMS_P1_KEY3;
iTransformNewToOld[4] = BMS_P1_KEY4;
iTransformNewToOld[5] = BMS_P1_KEY5;
iTransformNewToOld[6] = BMS_P1_KEY6;
iTransformNewToOld[7] = BMS_P1_KEY7;
}
else
{
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_P1_KEY6;
iTransformNewToOld[6] = BMS_P1_KEY7;
iTransformNewToOld[7] = BMS_P1_TURN;
}
break;
case StepsType_beat_double7:
iTransformNewToOld[0] = BMS_P1_KEY1;