fix Can't use turns as battle attacks
This commit is contained in:
@@ -383,16 +383,14 @@ void NoteDataUtil::RemoveMines(NoteData &in, float fStartBeat, float fEndBeat )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NoteDataUtil::Turn( NoteData &in, StepsType st, TurnType tt )
|
static void GetTurnMapping( StepsType st, NoteDataUtil::TurnType tt, int NumTracks, int *iTakeFromTrack )
|
||||||
{
|
{
|
||||||
int iTakeFromTrack[MAX_NOTE_TRACKS]; // New track "t" will take from old track iTakeFromTrack[t]
|
|
||||||
|
|
||||||
int t;
|
int t;
|
||||||
|
|
||||||
switch( tt )
|
switch( tt )
|
||||||
{
|
{
|
||||||
case left:
|
case NoteDataUtil::left:
|
||||||
case right:
|
case NoteDataUtil::right:
|
||||||
// Is there a way to do this withoutn handling each StepsType? -Chris
|
// Is there a way to do this withoutn handling each StepsType? -Chris
|
||||||
// Identity transform for ones not handled below. What should we do here?
|
// Identity transform for ones not handled below. What should we do here?
|
||||||
for( t = 0; t < MAX_NOTE_TRACKS; ++t )
|
for( t = 0; t < MAX_NOTE_TRACKS; ++t )
|
||||||
@@ -455,7 +453,7 @@ void NoteDataUtil::Turn( NoteData &in, StepsType st, TurnType tt )
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( tt == right )
|
if( tt == NoteDataUtil::right )
|
||||||
{
|
{
|
||||||
/* Invert. */
|
/* Invert. */
|
||||||
int iTrack[MAX_NOTE_TRACKS];
|
int iTrack[MAX_NOTE_TRACKS];
|
||||||
@@ -468,18 +466,18 @@ void NoteDataUtil::Turn( NoteData &in, StepsType st, TurnType tt )
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case mirror:
|
case NoteDataUtil::mirror:
|
||||||
for( t=0; t<in.GetNumTracks(); t++ )
|
for( t=0; t<NumTracks; t++ )
|
||||||
iTakeFromTrack[t] = in.GetNumTracks()-t-1;
|
iTakeFromTrack[t] = NumTracks-t-1;
|
||||||
break;
|
break;
|
||||||
case shuffle:
|
case NoteDataUtil::shuffle:
|
||||||
case super_shuffle: // use shuffle code to mix up HoldNotes without creating impossible patterns
|
case NoteDataUtil::super_shuffle: // use shuffle code to mix up HoldNotes without creating impossible patterns
|
||||||
{
|
{
|
||||||
vector<int> aiTracksLeftToMap;
|
vector<int> aiTracksLeftToMap;
|
||||||
for( t=0; t<in.GetNumTracks(); t++ )
|
for( t=0; t<NumTracks; t++ )
|
||||||
aiTracksLeftToMap.push_back( t );
|
aiTracksLeftToMap.push_back( t );
|
||||||
|
|
||||||
for( t=0; t<in.GetNumTracks(); t++ )
|
for( t=0; t<NumTracks; t++ )
|
||||||
{
|
{
|
||||||
int iRandTrackIndex = rand()%aiTracksLeftToMap.size();
|
int iRandTrackIndex = rand()%aiTracksLeftToMap.size();
|
||||||
int iRandTrack = aiTracksLeftToMap[iRandTrackIndex];
|
int iRandTrack = aiTracksLeftToMap[iRandTrackIndex];
|
||||||
@@ -492,47 +490,33 @@ void NoteDataUtil::Turn( NoteData &in, StepsType st, TurnType tt )
|
|||||||
default:
|
default:
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
NoteData tempNoteData; // write into here as we tranform
|
|
||||||
tempNoteData.Config(in);
|
|
||||||
|
|
||||||
in.ConvertHoldNotesTo2sAnd3s();
|
|
||||||
|
|
||||||
// transform notes
|
|
||||||
int max_row = in.GetLastRow();
|
|
||||||
for( t=0; t<in.GetNumTracks(); t++ )
|
|
||||||
for( int r=0; r<=max_row; r++ )
|
|
||||||
tempNoteData.SetTapNote(t, r, in.GetTapNote(iTakeFromTrack[t], r));
|
|
||||||
|
|
||||||
in.CopyAll( &tempNoteData ); // copy note data from newData back into this
|
|
||||||
in.Convert2sAnd3sToHoldNotes();
|
|
||||||
|
|
||||||
if( tt == super_shuffle )
|
|
||||||
SuperShuffleTaps( in );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::SuperShuffleTaps( NoteData &in )
|
static void SuperShuffleTaps( NoteData &in, int iStartIndex, int iEndIndex )
|
||||||
{
|
{
|
||||||
// We already did the normal shuffling code above, which did a good job
|
/* We already did the normal shuffling code above, which did a good job
|
||||||
// of shuffling HoldNotes without creating impossible patterns.
|
* of shuffling HoldNotes without creating impossible patterns.
|
||||||
// Now, go in and shuffle the TapNotes per-row.
|
* Now, go in and shuffle the TapNotes per-row.
|
||||||
in.ConvertHoldNotesTo4s();
|
*
|
||||||
|
* This is only called by NoteDataUtil::Turn. "in" is in 4s, and iStartIndex
|
||||||
int max_row = in.GetLastRow();
|
* and iEndIndex are in range. */
|
||||||
for( int r=0; r<=max_row; r++ )
|
for( int r=iStartIndex; r<=iEndIndex; r++ )
|
||||||
{
|
{
|
||||||
for( int t1=0; t1<in.GetNumTracks(); t1++ )
|
for( int t1=0; t1<in.GetNumTracks(); t1++ )
|
||||||
{
|
{
|
||||||
TapNote tn1 = in.GetTapNote(t1, r);
|
TapNote tn1 = in.GetTapNote(t1, r);
|
||||||
if( tn1!=TAP_HOLD ) // a tap that is not part of a hold
|
if( tn1==TAP_HOLD )
|
||||||
{
|
continue;
|
||||||
|
|
||||||
|
// a tap that is not part of a hold
|
||||||
// probe for a spot to swap with
|
// probe for a spot to swap with
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
int t2 = rand() % in.GetNumTracks();
|
const int t2 = rand() % in.GetNumTracks();
|
||||||
TapNote tn2 = in.GetTapNote(t2, r);
|
TapNote tn2 = in.GetTapNote(t2, r);
|
||||||
if( tn2!=TAP_HOLD ) // a tap that is not part of a hold
|
if( tn2==TAP_HOLD ) // a tap that is not part of a hold
|
||||||
{
|
continue;
|
||||||
|
|
||||||
// swap
|
// swap
|
||||||
in.SetTapNote(t1, r, tn2);
|
in.SetTapNote(t1, r, tn2);
|
||||||
in.SetTapNote(t2, r, tn1);
|
in.SetTapNote(t2, r, tn1);
|
||||||
@@ -540,9 +524,44 @@ void NoteDataUtil::SuperShuffleTaps( NoteData &in )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
in.Convert4sToHoldNotes();
|
|
||||||
|
void NoteDataUtil::Turn( NoteData &in, StepsType st, TurnType tt, float fStartBeat, float fEndBeat )
|
||||||
|
{
|
||||||
|
int iTakeFromTrack[MAX_NOTE_TRACKS]; // New track "t" will take from old track iTakeFromTrack[t]
|
||||||
|
GetTurnMapping( st, tt, in.GetNumTracks(), iTakeFromTrack );
|
||||||
|
|
||||||
|
if( fEndBeat == -1 )
|
||||||
|
fEndBeat = in.GetMaxBeat();
|
||||||
|
|
||||||
|
int iStartIndex = BeatToNoteRow( fStartBeat );
|
||||||
|
int iEndIndex = BeatToNoteRow( fEndBeat );
|
||||||
|
|
||||||
|
/* Clamp to known-good ranges. */
|
||||||
|
iStartIndex = max( iStartIndex, 0 );
|
||||||
|
iEndIndex = min( iEndIndex, in.GetMaxRow()-1 );
|
||||||
|
|
||||||
|
/* XXX: We could do this without an extra temporary NoteData: calculate
|
||||||
|
* a list of "swaps". For example, the 4-track mapping 1 0 2 3 is swaps
|
||||||
|
* 1, -1, -1, -1: track 0 swaps with track 1, track 1 doesn't swap (it's
|
||||||
|
* already in place--due to the first swap), and track 2 and 3 don't swap
|
||||||
|
* (they were already in place to begin with). */
|
||||||
|
|
||||||
|
NoteData tempNoteData;
|
||||||
|
tempNoteData.To4s( in );
|
||||||
|
NoteData tempNoteDataOut; // write into here as we tranform
|
||||||
|
tempNoteDataOut.Config( in );
|
||||||
|
|
||||||
|
// transform notes
|
||||||
|
for( int t=0; t<in.GetNumTracks(); t++ )
|
||||||
|
for( int r=iStartIndex; r<=iEndIndex; r++ )
|
||||||
|
tempNoteDataOut.SetTapNote(t, r, tempNoteData.GetTapNote(iTakeFromTrack[t], r));
|
||||||
|
|
||||||
|
if( tt == super_shuffle )
|
||||||
|
SuperShuffleTaps( tempNoteDataOut, iStartIndex, iEndIndex ); /* expects 4s */
|
||||||
|
|
||||||
|
in.From4s( tempNoteDataOut );
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::Backwards( NoteData &in )
|
void NoteDataUtil::Backwards( NoteData &in )
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace NoteDataUtil
|
|||||||
void RemoveHoldNotes( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
void RemoveHoldNotes( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
||||||
void RemoveMines( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
void RemoveMines( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
||||||
enum TurnType { left, right, mirror, shuffle, super_shuffle, NUM_TURN_TYPES };
|
enum TurnType { left, right, mirror, shuffle, super_shuffle, NUM_TURN_TYPES };
|
||||||
void Turn( NoteData &in, StepsType st, TurnType tt );
|
void Turn( NoteData &in, StepsType st, TurnType tt, float fStartBeat = 0, float fEndBeat = -1 );
|
||||||
void Little( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
void Little( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
||||||
void Wide( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
void Wide( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
||||||
void Big( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
void Big( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
||||||
@@ -55,7 +55,6 @@ namespace NoteDataUtil
|
|||||||
void Stomp( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
void Stomp( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
||||||
void Twister( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
void Twister( NoteData &in, float fStartBeat = 0, float fEndBeat = 99999 );
|
||||||
void ConvertTapsToHolds( NoteData &in, int iSimultaneousHolds, float fStartBeat = 0, float fEndBeat = 99999 );
|
void ConvertTapsToHolds( NoteData &in, int iSimultaneousHolds, float fStartBeat = 0, float fEndBeat = 99999 );
|
||||||
void SuperShuffleTaps( NoteData &in );
|
|
||||||
|
|
||||||
// change all TAP_ADDITIONs to TAP_TAPs
|
// change all TAP_ADDITIONs to TAP_TAPs
|
||||||
void ConvertAdditionsToRegular( NoteData &in );
|
void ConvertAdditionsToRegular( NoteData &in );
|
||||||
|
|||||||
@@ -402,8 +402,6 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
* notes. CopyRange below converts through 4s, which means the hold note
|
* notes. CopyRange below converts through 4s, which means the hold note
|
||||||
* array will be reconstructed; if hold notes end up in a different order,
|
* array will be reconstructed; if hold notes end up in a different order,
|
||||||
* they won't align with this->m_HoldNoteScores. */
|
* they won't align with this->m_HoldNoteScores. */
|
||||||
if( po.m_Turn != PlayerOptions::TURN_NONE )
|
|
||||||
RageException::Throw("Can't use turns as battle attacks");
|
|
||||||
if( po.m_bTransforms[PlayerOptions::TRANSFORM_NOHOLDS] )
|
if( po.m_bTransforms[PlayerOptions::TRANSFORM_NOHOLDS] )
|
||||||
RageException::Throw("Can't use NoHolds as a battle attack");
|
RageException::Throw("Can't use NoHolds as a battle attack");
|
||||||
if( po.m_bTransforms[PlayerOptions::TRANSFORM_NOMINES] )
|
if( po.m_bTransforms[PlayerOptions::TRANSFORM_NOMINES] )
|
||||||
|
|||||||
Reference in New Issue
Block a user