Fixed super shuffle generating impossible HoldNote patterns.

This commit is contained in:
Chris Danford
2002-10-20 21:39:13 +00:00
parent fedb7b0c92
commit 6674d2a9a1
4 changed files with 55 additions and 35 deletions
+1
View File
@@ -28,6 +28,7 @@ CHANGE: AutoGen now only generated dance->pump and pump->dance to cut
CHANGE: Texure cache disabled because of performance problems on low memory CHANGE: Texure cache disabled because of performance problems on low memory
systems. If you have >= 128MB memory, you may want re-enable it by systems. If you have >= 128MB memory, you may want re-enable it by
setting UnloadTextureDelaySeconds=1800. setting UnloadTextureDelaySeconds=1800.
BUG FIX: Fixed super shuffle generating impossible HoldNote patterns
------------------------CVS after 3.00 beta 6---------------- ------------------------CVS after 3.00 beta 6----------------
CHANGE: Missing a jump with the Oni life meter now subtracts only 1 life. CHANGE: Missing a jump with the Oni life meter now subtracts only 1 life.
+1
View File
@@ -2,6 +2,7 @@
Fix Fix
///////////////////////// /////////////////////////
super shuffle doesn't correctly handle holds (Ayla Part 2)
There's a major Oni course bug (at least in Pump mode): There's a major Oni course bug (at least in Pump mode):
+45 -29
View File
@@ -566,6 +566,7 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
} }
break; break;
case PlayerOptions::TURN_SHUFFLE: case PlayerOptions::TURN_SHUFFLE:
case PlayerOptions::TURN_SUPER_SHUFFLE: // use this code to shuffle the HoldNotes
{ {
CArray<int,int> aiTracksLeftToMap; CArray<int,int> aiTracksLeftToMap;
for( t=0; t<m_iNumTracks; t++ ) for( t=0; t<m_iNumTracks; t++ )
@@ -580,7 +581,6 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
} }
} }
break; break;
case PlayerOptions::TURN_SUPER_SHUFFLE:
// handle this below // handle this below
break; break;
default: default:
@@ -597,42 +597,55 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
for( int r=0; r<MAX_TAP_NOTE_ROWS; r++ ) for( int r=0; r<MAX_TAP_NOTE_ROWS; r++ )
tempNoteData.m_TapNotes[t][r] = m_TapNotes[iTakeFromTrack[t]][r]; tempNoteData.m_TapNotes[t][r] = m_TapNotes[iTakeFromTrack[t]][r];
this->CopyAll( &tempNoteData ); // copy note data from newData back into this
this->Convert2sAnd3sToHoldNotes();
if( tt == PlayerOptions::TURN_SUPER_SHUFFLE ) if( tt == PlayerOptions::TURN_SUPER_SHUFFLE )
{ {
this->Convert2sAnd3sToHoldNotes(); // so we don't super-shuffle HoldNotes // We already did the normal shuffling code above, which did a good job
for( int r=0; r<this->GetLastRow(); r++ ) // foreach row // of shuffling HoldNotes without creating impossible patterns.
// Now, go in and shuffle the TapNotes some more.
// clear tempNoteData because we're going to use it as a scratch buffer again
tempNoteData.Init();
tempNoteData.m_iNumTracks = this->m_iNumTracks;
// copy all HoldNotes before copying taps
for( int i=0; i<this->m_iNumHoldNotes; i++ )
tempNoteData.AddHoldNote( this->m_HoldNotes[i] );
this->ConvertHoldNotesTo4s();
for( int r=0; r<=this->GetLastRow(); r++ ) // foreach row
{ {
if( !this->IsRowEmpty(r) ) if( this->IsRowEmpty(r) )
continue; // no need to super shuffle this row
// shuffle this row
CArray<int,int> aiTracksThatCouldHaveTapNotes;
for( t=0; t<m_iNumTracks; t++ )
if( m_TapNotes[t][r] != '4' ) // any point that isn't part of a hold
aiTracksThatCouldHaveTapNotes.Add( t );
for( t=0; t<m_iNumTracks; t++ )
{ {
// shuffle this row if( m_TapNotes[t][r] != '4' && m_TapNotes[t][r] != '0' ) // there is a tap note here (and not a HoldNote)
CArray<int,int> aiTracksLeftToMap;
for( t=0; t<m_iNumTracks; t++ )
aiTracksLeftToMap.Add( t );
for( t=0; t<m_iNumTracks; t++ )
{ {
int iRandTrackIndex = rand()%aiTracksLeftToMap.GetSize(); int iRandIndex = rand() % aiTracksThatCouldHaveTapNotes.GetSize();
int iRandTrack = aiTracksLeftToMap[iRandTrackIndex]; int iTo = aiTracksThatCouldHaveTapNotes[ iRandIndex ];
aiTracksLeftToMap.RemoveAt( iRandTrackIndex ); aiTracksThatCouldHaveTapNotes.RemoveAt( iRandIndex );
iTakeFromTrack[t] = iRandTrack;
}
for( t=0; t<m_iNumTracks; t++ ) tempNoteData.m_TapNotes[iTo][r] = m_TapNotes[t][r];
tempNoteData.m_TapNotes[t][r] = m_TapNotes[iTakeFromTrack[t]][r]; }
} }
} }
for( int i=0; i<this->m_iNumHoldNotes; i++ )
{
HoldNote& hn = this->m_HoldNotes[i];
HoldNote newHN = hn;
hn.m_iTrack = rand() % m_iNumTracks;
tempNoteData.AddHoldNote( newHN );
}
}
this->CopyAll( &tempNoteData ); // copy note data from newData back into this this->CopyAll( &tempNoteData ); // copy note data from newData back into this
this->Convert2sAnd3sToHoldNotes(); }
} }
void NoteData::MakeLittle() void NoteData::MakeLittle()
@@ -661,11 +674,14 @@ void NoteData::MakeLittle()
* this to do this. -glenn * this to do this. -glenn
* *
* This code intentially leaves the '2' behind because a hold head is
* treated exactly like a tap note for scoring purposes.
*/ */
void NoteData::Convert2sAnd3sToHoldNotes() void NoteData::Convert2sAnd3sToHoldNotes()
{ {
// Any note will end a hold (not just a '3'). This makes parsing DWIs much easier, // Any note will end a hold (not just a '3'). This makes parsing DWIs much easier.
// plus we don't want tap notes in the middle of a hold! // Plus, allowing tap notes in the middle of a hold doesn't make sense!
for( int col=0; col<m_iNumTracks; col++ ) // foreach column for( int col=0; col<m_iNumTracks; col++ ) // foreach column
{ {
+4 -2
View File
@@ -410,9 +410,11 @@ void Player::Step( int col )
bDestroyedNote = (score >= TNS_GOOD); bDestroyedNote = (score >= TNS_GOOD);
LOG->Trace("(%2d/%2d)Note offset: %f, Score: %i", m_iOffsetSample, SAMPLE_COUNT, fNoteOffset, score); LOG->Trace("(%2d/%2d)Note offset: %f, Score: %i", m_iOffsetSample, SAMPLE_COUNT, fNoteOffset, score);
if (GAMESTATE->m_SongOptions.m_AutoAdjust == SongOptions::ADJUST_ON) { if (GAMESTATE->m_SongOptions.m_AutoAdjust == SongOptions::ADJUST_ON)
{
m_fOffset[m_iOffsetSample++] = fNoteOffset; m_fOffset[m_iOffsetSample++] = fNoteOffset;
if (m_iOffsetSample >= SAMPLE_COUNT) { if (m_iOffsetSample >= SAMPLE_COUNT)
{
float stddev = 0.0f, mean = 0.0f; float stddev = 0.0f, mean = 0.0f;
int i; int i;