fix FixImpossibleRows()
fix misaligned editor NoteFields
This commit is contained in:
@@ -521,3 +521,25 @@ void NoteData::SetTapNote(int track, int row, TapNote t)
|
|||||||
PadTapNotes(row);
|
PadTapNotes(row);
|
||||||
m_TapNotes[track][row]=t;
|
m_TapNotes[track][row]=t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NoteData::EliminateAllButOneTap(int row)
|
||||||
|
{
|
||||||
|
if(row < 0) return;
|
||||||
|
|
||||||
|
PadTapNotes(row);
|
||||||
|
|
||||||
|
for(int track = 0; track < m_iNumTracks; ++track)
|
||||||
|
{
|
||||||
|
if( m_TapNotes[track][row] == TAP_TAP )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
track++;
|
||||||
|
|
||||||
|
for( ; track < m_iNumTracks; ++track)
|
||||||
|
{
|
||||||
|
if( m_TapNotes[track][row] == TAP_TAP )
|
||||||
|
m_TapNotes[track][row] = TAP_EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,8 +137,7 @@ public:
|
|||||||
// True if no notes in row that aren't true in the mask
|
// True if no notes in row that aren't true in the mask
|
||||||
bool RowPassesValidMask( int row, bool bValidMask[] );
|
bool RowPassesValidMask( int row, bool bValidMask[] );
|
||||||
|
|
||||||
// Remove all tap notes that fail this mask
|
void EliminateAllButOneTap( int row );
|
||||||
void EliminateNonPassingTaps( int row, bool bValidMask[] );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -916,35 +916,53 @@ const ValidRow g_ValidRows[] =
|
|||||||
|
|
||||||
void NoteDataUtil::FixImpossibleRows( NoteData &in, StepsType st )
|
void NoteDataUtil::FixImpossibleRows( NoteData &in, StepsType st )
|
||||||
{
|
{
|
||||||
for( unsigned i=0; i<ARRAYSIZE(g_ValidRows); i++ )
|
vector<const ValidRow*> vpValidRowsToCheck;
|
||||||
|
for( int i=0; i<ARRAYSIZE(g_ValidRows); i++ )
|
||||||
{
|
{
|
||||||
const ValidRow vr = g_ValidRows[i];
|
if( g_ValidRows[i].st == st )
|
||||||
if( vr.st != st )
|
vpValidRowsToCheck.push_back( &g_ValidRows[i] );
|
||||||
continue; // skip
|
}
|
||||||
|
|
||||||
|
// bail early if there's nothing to validate against
|
||||||
|
if( vpValidRowsToCheck.empty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// each row must pass at least one valid mask
|
||||||
for( int r=0; r<=in.GetLastRow(); r++ )
|
for( int r=0; r<=in.GetLastRow(); r++ )
|
||||||
if( !NoteDataUtil::RowPassesValidMask(in,r,vr.bValidMask) ) // failed mask
|
{
|
||||||
NoteDataUtil::EliminateNonPassingTaps(in,r,vr.bValidMask);
|
// only check rows with jumps
|
||||||
|
if( in.GetNumTapNonEmptyTracks(r) < 2 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bool bPassedOneMask = false;
|
||||||
|
for( unsigned i=0; i<vpValidRowsToCheck.size(); i++ )
|
||||||
|
{
|
||||||
|
const ValidRow &vr = *vpValidRowsToCheck[i];
|
||||||
|
if( NoteDataUtil::RowPassesValidMask(in,r,vr.bValidMask) )
|
||||||
|
{
|
||||||
|
bPassedOneMask = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
int skjdksjd = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !bPassedOneMask )
|
||||||
|
in.EliminateAllButOneTap(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NoteDataUtil::RowPassesValidMask( NoteData &in, int row, const bool bValidMask[] )
|
bool NoteDataUtil::RowPassesValidMask( NoteData &in, int row, const bool bValidMask[] )
|
||||||
{
|
{
|
||||||
for( int t=0; t<in.GetNumTracks(); t++ )
|
for( int t=0; t<in.GetNumTracks(); t++ )
|
||||||
|
{
|
||||||
if( !bValidMask[t] && in.GetTapNote(t,row) != TAP_EMPTY )
|
if( !bValidMask[t] && in.GetTapNote(t,row) != TAP_EMPTY )
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::EliminateNonPassingTaps( NoteData &in, int row, const bool bValidMask[] )
|
|
||||||
{
|
|
||||||
for( int t=0; t<in.GetNumTracks(); t++ )
|
|
||||||
if( !bValidMask[t] && in.GetTapNote(t,row) != TAP_EMPTY )
|
|
||||||
in.SetTapNote(t,row,TAP_EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void NoteDataUtil::ConvertAdditionsToRegular( NoteData &in )
|
void NoteDataUtil::ConvertAdditionsToRegular( NoteData &in )
|
||||||
{
|
{
|
||||||
for( int r=0; r<=in.GetLastRow(); r++ )
|
for( int r=0; r<=in.GetLastRow(); r++ )
|
||||||
|
|||||||
@@ -73,9 +73,6 @@ namespace NoteDataUtil
|
|||||||
// True if no notes in row that aren't true in the mask
|
// True if no notes in row that aren't true in the mask
|
||||||
bool RowPassesValidMask( NoteData &in, int row, const bool bValidMask[] );
|
bool RowPassesValidMask( NoteData &in, int row, const bool bValidMask[] );
|
||||||
|
|
||||||
// Remove all tap notes that fail this mask
|
|
||||||
void EliminateNonPassingTaps( NoteData &in, int row, const bool bValidMask[] );
|
|
||||||
|
|
||||||
void TransformNoteData( NoteData &nd, PlayerOptions &po, StepsType st );
|
void TransformNoteData( NoteData &nd, PlayerOptions &po, StepsType st );
|
||||||
|
|
||||||
void Scale( NoteData &nd, float fScale );
|
void Scale( NoteData &nd, float fScale );
|
||||||
|
|||||||
@@ -42,41 +42,42 @@ const float RECORD_HOLD_SECONDS = 0.3f;
|
|||||||
// Defines specific to GameScreenTitleMenu
|
// Defines specific to GameScreenTitleMenu
|
||||||
//
|
//
|
||||||
|
|
||||||
const float MAX_SECONDS_CAN_BE_OFF_BY = 0.20f;
|
#define DEBUG_X (SCREEN_LEFT + 10)
|
||||||
const float GRAY_ARROW_Y = ARROW_SIZE * 1.5;
|
#define DEBUG_Y (CENTER_Y-100)
|
||||||
|
|
||||||
const float DEBUG_X = SCREEN_LEFT + 10;
|
#define SHORTCUTS_X (CENTER_X - 150)
|
||||||
const float DEBUG_Y = CENTER_Y-100;
|
#define SHORTCUTS_Y (CENTER_Y)
|
||||||
|
|
||||||
const float SHORTCUTS_X = CENTER_X - 150;
|
#define HELP_X (SCREEN_LEFT)
|
||||||
const float SHORTCUTS_Y = CENTER_Y;
|
#define HELP_Y (CENTER_Y)
|
||||||
|
|
||||||
const float HELP_X = SCREEN_LEFT;
|
#define HELP_TEXT_X (SCREEN_LEFT + 4)
|
||||||
const float HELP_Y = CENTER_Y;
|
#define HELP_TEXT_Y (40)
|
||||||
|
|
||||||
const float HELP_TEXT_X = SCREEN_LEFT + 4;
|
#define INFO_X (SCREEN_RIGHT)
|
||||||
const float HELP_TEXT_Y = 40;
|
#define INFO_Y (CENTER_Y)
|
||||||
|
|
||||||
const float INFO_X = SCREEN_RIGHT;
|
#define INFO_TEXT_X (SCREEN_RIGHT - 114)
|
||||||
const float INFO_Y = CENTER_Y;
|
#define INFO_TEXT_Y (40)
|
||||||
|
|
||||||
const float INFO_TEXT_X = SCREEN_RIGHT - 114;
|
#define MENU_WIDTH (110)
|
||||||
const float INFO_TEXT_Y = 40;
|
#define EDIT_X (CENTER_X)
|
||||||
|
#define EDIT_GRAY_Y_STANDARD (SCREEN_TOP+60)
|
||||||
|
#define EDIT_GRAY_Y_REVERSE (SCREEN_BOTTOM-60)
|
||||||
|
|
||||||
const float MENU_WIDTH = 110;
|
#define PLAYER_X (CENTER_X)
|
||||||
const float EDIT_X = CENTER_X;
|
#define PLAYER_Y (CENTER_Y)
|
||||||
const float EDIT_GRAY_Y = GRAY_ARROW_Y;
|
#define PLAYER_HEIGHT (360)
|
||||||
|
#define PLAYER_Y_STANDARD (PLAYER_Y-PLAYER_HEIGHT/2)
|
||||||
|
#define PLAYER_Y_REVERSE (PLAYER_Y+PLAYER_HEIGHT/2)
|
||||||
|
|
||||||
const float PLAYER_X = CENTER_X;
|
#define ACTION_MENU_ITEM_X (CENTER_X-200)
|
||||||
const float PLAYER_Y = SCREEN_TOP;
|
#define ACTION_MENU_ITEM_START_Y (SCREEN_TOP + 24)
|
||||||
|
#define ACTION_MENU_ITEM_SPACING_Y (18)
|
||||||
|
|
||||||
const float ACTION_MENU_ITEM_X = CENTER_X-200;
|
#define NAMING_MENU_ITEM_X (CENTER_X-200)
|
||||||
const float ACTION_MENU_ITEM_START_Y = SCREEN_TOP + 24;
|
#define NAMING_MENU_ITEM_START_Y (SCREEN_TOP + 24)
|
||||||
const float ACTION_MENU_ITEM_SPACING_Y = 18;
|
#define NAMING_MENU_ITEM_SPACING_Y (18)
|
||||||
|
|
||||||
const float NAMING_MENU_ITEM_X = CENTER_X-200;
|
|
||||||
const float NAMING_MENU_ITEM_START_Y = SCREEN_TOP + 24;
|
|
||||||
const float NAMING_MENU_ITEM_SPACING_Y = 18;
|
|
||||||
|
|
||||||
CachedThemeMetricF TICK_EARLY_SECONDS ("ScreenGameplay","TickEarlySeconds");
|
CachedThemeMetricF TICK_EARLY_SECONDS ("ScreenGameplay","TickEarlySeconds");
|
||||||
|
|
||||||
@@ -248,26 +249,28 @@ ScreenEdit::ScreenEdit() : Screen("ScreenEdit")
|
|||||||
m_BGAnimation.LoadFromAniDir( THEME->GetPathToB("ScreenEdit background") );
|
m_BGAnimation.LoadFromAniDir( THEME->GetPathToB("ScreenEdit background") );
|
||||||
|
|
||||||
shiftAnchor = -1;
|
shiftAnchor = -1;
|
||||||
m_SnapDisplay.SetXY( EDIT_X, EDIT_GRAY_Y );
|
|
||||||
|
|
||||||
|
m_SnapDisplay.SetXY( EDIT_X, PLAYER_Y_STANDARD );
|
||||||
m_SnapDisplay.Load( PLAYER_1 );
|
m_SnapDisplay.Load( PLAYER_1 );
|
||||||
m_SnapDisplay.SetZoom( 0.5f );
|
m_SnapDisplay.SetZoom( 0.5f );
|
||||||
|
|
||||||
m_GrayArrowRowEdit.SetXY( EDIT_X, EDIT_GRAY_Y );
|
m_GrayArrowRowEdit.SetXY( EDIT_X, PLAYER_Y_STANDARD );
|
||||||
m_GrayArrowRowEdit.Load( PLAYER_1 );
|
m_GrayArrowRowEdit.Load( PLAYER_1 );
|
||||||
m_GrayArrowRowEdit.SetZoom( 0.5f );
|
m_GrayArrowRowEdit.SetZoom( 0.5f );
|
||||||
|
|
||||||
m_NoteFieldEdit.SetXY( EDIT_X, EDIT_GRAY_Y );
|
m_NoteFieldEdit.SetXY( EDIT_X, PLAYER_Y );
|
||||||
m_NoteFieldEdit.SetZoom( 0.5f );
|
m_NoteFieldEdit.SetZoom( 0.5f );
|
||||||
m_NoteFieldEdit.Load( ¬eData, PLAYER_1, -240, 800, 800 );
|
m_NoteFieldEdit.Load( ¬eData, PLAYER_1, -240, 800, PLAYER_HEIGHT*2 );
|
||||||
|
|
||||||
m_rectRecordBack.StretchTo( RectI(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) );
|
m_rectRecordBack.StretchTo( RectI(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) );
|
||||||
m_rectRecordBack.SetDiffuse( RageColor(0,0,0,0) );
|
m_rectRecordBack.SetDiffuse( RageColor(0,0,0,0) );
|
||||||
|
|
||||||
m_GrayArrowRowRecord.SetXY( EDIT_X, EDIT_GRAY_Y );
|
m_GrayArrowRowRecord.SetXY( EDIT_X, PLAYER_Y );
|
||||||
m_GrayArrowRowRecord.Load( PLAYER_1 );
|
m_GrayArrowRowRecord.Load( PLAYER_1 );
|
||||||
m_GrayArrowRowRecord.SetZoom( 1.0f );
|
m_GrayArrowRowRecord.SetZoom( 1.0f );
|
||||||
|
|
||||||
m_NoteFieldRecord.SetXY( EDIT_X, EDIT_GRAY_Y );
|
m_NoteFieldRecord.SetXY( EDIT_X, PLAYER_Y );
|
||||||
m_NoteFieldRecord.SetZoom( 1.0f );
|
m_NoteFieldRecord.SetZoom( 1.0f );
|
||||||
m_NoteFieldRecord.Load( ¬eData, PLAYER_1, -150, 350, 350 );
|
m_NoteFieldRecord.Load( ¬eData, PLAYER_1, -150, 350, 350 );
|
||||||
|
|
||||||
|
|||||||
+12
-8
@@ -900,27 +900,31 @@ void Song::TranslateTitles()
|
|||||||
|
|
||||||
void Song::ReCalculateRadarValuesAndLastBeat()
|
void Song::ReCalculateRadarValuesAndLastBeat()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// calculate radar values and first/last beat
|
|
||||||
//
|
|
||||||
for( unsigned i=0; i<m_apNotes.size(); i++ )
|
for( unsigned i=0; i<m_apNotes.size(); i++ )
|
||||||
{
|
{
|
||||||
Steps* pNotes = m_apNotes[i];
|
Steps* pNotes = m_apNotes[i];
|
||||||
|
|
||||||
|
/* If it's autogen, radar vals and first/last beat will come from the parent. */
|
||||||
if( pNotes->IsAutogen() )
|
if( pNotes->IsAutogen() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// calculate radar values
|
||||||
|
//
|
||||||
NoteData tempNoteData;
|
NoteData tempNoteData;
|
||||||
pNotes->GetNoteData( &tempNoteData );
|
pNotes->GetNoteData( &tempNoteData );
|
||||||
|
|
||||||
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
|
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
|
||||||
{
|
{
|
||||||
/* If it's autogen, radar vals come from the parent. */
|
float fVal = NoteDataUtil::GetRadarValue( tempNoteData, (RadarCategory)r, m_fMusicLengthSeconds );
|
||||||
if(pNotes->IsAutogen())
|
pNotes->SetRadarValue(r, fVal);
|
||||||
continue;
|
|
||||||
|
|
||||||
pNotes->SetRadarValue(r, NoteDataUtil::GetRadarValue( tempNoteData, (RadarCategory)r, m_fMusicLengthSeconds ));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// calculate first/last beat
|
||||||
|
//
|
||||||
/* Many songs have stray, empty song patterns. Ignore them, so
|
/* Many songs have stray, empty song patterns. Ignore them, so
|
||||||
* they don't force the first beat of the whole song to 0. XXX Should
|
* they don't force the first beat of the whole song to 0. XXX Should
|
||||||
* we just delete them, now that new patterns can be created quickly
|
* we just delete them, now that new patterns can be created quickly
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ void Steps::Decompress() const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
notes->LoadTransformedSlidingWindow( &pdata, notes->GetNumTracks() );
|
notes->LoadTransformedSlidingWindow( &pdata, notes->GetNumTracks() );
|
||||||
NoteDataUtil::FixImpossibleRows( pdata, m_StepsType );
|
NoteDataUtil::FixImpossibleRows( *notes, m_StepsType );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!notes_comp)
|
else if(!notes_comp)
|
||||||
|
|||||||
Reference in New Issue
Block a user