improved editor playback performance by not drawing unncessary Actors
fixed crash in Big transform fixed ugly area highlight alignment
This commit is contained in:
+13
-8
@@ -360,22 +360,27 @@ void Actor::ScaleTo( const RectI &rect, StretchType st )
|
|||||||
SetZoom( fNewZoom );
|
SetZoom( fNewZoom );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Actor::StretchTo( const RectI &r )
|
||||||
|
{
|
||||||
|
RectF r2( (float)r.left, (float)r.top, (float)r.right, (float)r.bottom );
|
||||||
|
StretchTo( r2 );
|
||||||
|
}
|
||||||
|
|
||||||
void Actor::StretchTo( const RectI &rect )
|
void Actor::StretchTo( const RectF &r )
|
||||||
{
|
{
|
||||||
// width and height of rectangle
|
// width and height of rectangle
|
||||||
int rect_width = rect.GetWidth();
|
float width = r.GetWidth();
|
||||||
int rect_height = rect.GetHeight();
|
float height = r.GetHeight();
|
||||||
|
|
||||||
// center of the rectangle
|
// center of the rectangle
|
||||||
float rect_cx = rect.left + rect_width/2.0f;
|
float cx = r.left + width/2.0f;
|
||||||
float rect_cy = rect.top + rect_height/2.0f;
|
float cy = r.top + height/2.0f;
|
||||||
|
|
||||||
// zoom fActor needed to scale the Actor to fill the rectangle
|
// zoom fActor needed to scale the Actor to fill the rectangle
|
||||||
float fNewZoomX = rect_width / m_size.x;
|
float fNewZoomX = width / m_size.x;
|
||||||
float fNewZoomY = rect_height / m_size.y;
|
float fNewZoomY = height / m_size.y;
|
||||||
|
|
||||||
SetXY( (float)rect_cx, (float)rect_cy );
|
SetXY( cx, cy );
|
||||||
SetZoomX( fNewZoomX );
|
SetZoomX( fNewZoomX );
|
||||||
SetZoomY( fNewZoomY );
|
SetZoomY( fNewZoomY );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ public:
|
|||||||
void ScaleTo( const RectI &rect, StretchType st );
|
void ScaleTo( const RectI &rect, StretchType st );
|
||||||
|
|
||||||
void StretchTo( const RectI &rect );
|
void StretchTo( const RectI &rect );
|
||||||
|
void StretchTo( const RectF &rect );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -81,12 +81,8 @@ float ArrowGetXPos( PlayerNumber pn, int iColNum, float fYPos )
|
|||||||
if( GAMESTATE->m_PlayerOptions[pn].m_bEffects[PlayerOptions::EFFECT_TORNADO] )
|
if( GAMESTATE->m_PlayerOptions[pn].m_bEffects[PlayerOptions::EFFECT_TORNADO] )
|
||||||
{
|
{
|
||||||
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
||||||
float fMaxX = -100000, fMinX = +100000;
|
float fMinX, fMaxX;
|
||||||
for( int i=0; i<pStyleDef->m_iColsPerPlayer; i++ )
|
pStyleDef->GetMinAndMaxColX( pn, fMinX, fMaxX );
|
||||||
{
|
|
||||||
fMaxX = max( fMaxX, pStyleDef->m_ColumnInfo[pn][i].fXOffset );
|
|
||||||
fMinX = min( fMinX, pStyleDef->m_ColumnInfo[pn][i].fXOffset );
|
|
||||||
}
|
|
||||||
|
|
||||||
float fPositionBetween = SCALE( fPixelOffsetFromCenter, fMinX, fMaxX, -1, 1 );
|
float fPositionBetween = SCALE( fPixelOffsetFromCenter, fMinX, fMaxX, -1, 1 );
|
||||||
float fRads = acosf( fPositionBetween );
|
float fRads = acosf( fPositionBetween );
|
||||||
|
|||||||
@@ -1023,14 +1023,14 @@ void NoteDataUtil::Big( NoteData &in )
|
|||||||
// add a note determinitsitcally
|
// add a note determinitsitcally
|
||||||
int iBeat = (int)roundf( NoteRowToBeat(i) );
|
int iBeat = (int)roundf( NoteRowToBeat(i) );
|
||||||
int iTrackOfNote = in.GetFirstNonEmptyTrack(i);
|
int iTrackOfNote = in.GetFirstNonEmptyTrack(i);
|
||||||
int iTrackToAdd = iTrackOfNote + (iBeat%4)-2;
|
int iTrackToAdd = iTrackOfNote + (iBeat%5)-2; // won't be more than 2 tracks away from the existing note
|
||||||
CLAMP( iTrackToAdd, 0, in.GetNumTracks() );
|
CLAMP( iTrackToAdd, 0, in.GetNumTracks()-1 );
|
||||||
if( iTrackToAdd == iTrackOfNote )
|
if( iTrackToAdd == iTrackOfNote )
|
||||||
iTrackToAdd++;
|
iTrackToAdd++;
|
||||||
CLAMP( iTrackToAdd, 0, in.GetNumTracks() );
|
CLAMP( iTrackToAdd, 0, in.GetNumTracks()-1 );
|
||||||
if( iTrackToAdd == iTrackOfNote )
|
if( iTrackToAdd == iTrackOfNote )
|
||||||
iTrackToAdd--;
|
iTrackToAdd--;
|
||||||
CLAMP( iTrackToAdd, 0, in.GetNumTracks() );
|
CLAMP( iTrackToAdd, 0, in.GetNumTracks()-1 );
|
||||||
|
|
||||||
if( in.GetTapNote(iTrackToAdd, i) != TAP_EMPTY )
|
if( in.GetTapNote(iTrackToAdd, i) != TAP_EMPTY )
|
||||||
{
|
{
|
||||||
|
|||||||
+17
-15
@@ -75,9 +75,13 @@ void NoteField::Update( float fDeltaTime )
|
|||||||
m_fPercentFadeToFail = min( m_fPercentFadeToFail + fDeltaTime/1.5f, 1 ); // take 1.5 seconds to totally fade
|
m_fPercentFadeToFail = min( m_fPercentFadeToFail + fDeltaTime/1.5f, 1 ); // take 1.5 seconds to totally fade
|
||||||
}
|
}
|
||||||
|
|
||||||
int NoteField::GetWidth()
|
float NoteField::GetWidth()
|
||||||
{
|
{
|
||||||
return (GetNumTracks()+1) * ARROW_SIZE;
|
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
||||||
|
float fMinX, fMaxX;
|
||||||
|
pStyleDef->GetMinAndMaxColX( m_PlayerNumber, fMinX, fMaxX );
|
||||||
|
|
||||||
|
return fMaxX - fMinX + ARROW_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteField::DrawBeatBar( const float fBeat )
|
void NoteField::DrawBeatBar( const float fBeat )
|
||||||
@@ -105,16 +109,16 @@ void NoteField::DrawBeatBar( const float fBeat )
|
|||||||
}
|
}
|
||||||
CLAMP( fBrightness, 0, 1 );
|
CLAMP( fBrightness, 0, 1 );
|
||||||
|
|
||||||
int iWidth = GetWidth();
|
float fWidth = GetWidth();
|
||||||
for( int i=-iWidth/2; i<+iWidth/2; )
|
for( float f=-fWidth/2; f<+fWidth/2; )
|
||||||
{
|
{
|
||||||
m_rectMeasureBar.StretchTo( RectI(i,0,i+iSegWidth,0) );
|
m_rectMeasureBar.StretchTo( RectF(f,0,f+iSegWidth,0) );
|
||||||
m_rectMeasureBar.SetY( fYPos );
|
m_rectMeasureBar.SetY( fYPos );
|
||||||
m_rectMeasureBar.SetZoomY( bIsMeasure ? 6.f : 3.f );
|
m_rectMeasureBar.SetZoomY( bIsMeasure ? 6.f : 3.f );
|
||||||
m_rectMeasureBar.SetDiffuse( RageColor(1,1,1,0.5f*fBrightness) );
|
m_rectMeasureBar.SetDiffuse( RageColor(1,1,1,0.5f*fBrightness) );
|
||||||
m_rectMeasureBar.Draw();
|
m_rectMeasureBar.Draw();
|
||||||
|
|
||||||
i += iSegWidth + iSpaceWidth;
|
f += iSegWidth + iSpaceWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( bIsMeasure )
|
if( bIsMeasure )
|
||||||
@@ -122,19 +126,18 @@ void NoteField::DrawBeatBar( const float fBeat )
|
|||||||
m_textMeasureNumber.SetDiffuse( RageColor(1,1,1,1) );
|
m_textMeasureNumber.SetDiffuse( RageColor(1,1,1,1) );
|
||||||
m_textMeasureNumber.SetGlow( RageColor(1,1,1,0) );
|
m_textMeasureNumber.SetGlow( RageColor(1,1,1,0) );
|
||||||
m_textMeasureNumber.SetText( ssprintf("%d", iMeasureNoDisplay) );
|
m_textMeasureNumber.SetText( ssprintf("%d", iMeasureNoDisplay) );
|
||||||
m_textMeasureNumber.SetXY( -iWidth/2.f + 10, fYPos );
|
m_textMeasureNumber.SetXY( -fWidth/2.f + 10, fYPos );
|
||||||
m_textMeasureNumber.Draw();
|
m_textMeasureNumber.Draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteField::DrawMarkerBar( const float fBeat )
|
void NoteField::DrawMarkerBar( const float fBeat )
|
||||||
{
|
{
|
||||||
const float fYOffset = ArrowGetYOffset( m_PlayerNumber, fBeat );
|
const float fYOffset = ArrowGetYOffset( m_PlayerNumber, fBeat );
|
||||||
const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset );
|
const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset );
|
||||||
|
|
||||||
m_rectMarkerBar.SetXY( 0, fYPos );
|
|
||||||
m_rectMarkerBar.SetZoomX( (float)(GetNumTracks()+1) * ARROW_SIZE );
|
m_rectMarkerBar.StretchTo( RectF(-GetWidth()/2, fYPos-ARROW_SIZE/2, GetWidth()/2, fYPos+ARROW_SIZE/2) );
|
||||||
m_rectMarkerBar.SetZoomY( (float)ARROW_SIZE );
|
|
||||||
m_rectMarkerBar.Draw();
|
m_rectMarkerBar.Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,8 +152,7 @@ void NoteField::DrawAreaHighlight( const float fStartBeat, const float fEndBeat
|
|||||||
fYStartPos = max( fYStartPos, -1000 );
|
fYStartPos = max( fYStartPos, -1000 );
|
||||||
fYEndPos = min( fYEndPos, +5000 );
|
fYEndPos = min( fYEndPos, +5000 );
|
||||||
|
|
||||||
m_rectAreaHighlight.StretchTo( RectI(0, (int)fYStartPos-ARROW_SIZE/2, 1, (int)fYEndPos+ARROW_SIZE/2) );
|
m_rectAreaHighlight.StretchTo( RectF(-GetWidth()/2, fYStartPos-ARROW_SIZE/2, GetWidth()/2, fYEndPos+ARROW_SIZE/2) );
|
||||||
m_rectAreaHighlight.SetZoomX( (float)(GetNumTracks()+1) * ARROW_SIZE );
|
|
||||||
m_rectAreaHighlight.SetDiffuse( RageColor(1,0,0,0.3f) );
|
m_rectAreaHighlight.SetDiffuse( RageColor(1,0,0,0.3f) );
|
||||||
m_rectAreaHighlight.Draw();
|
m_rectAreaHighlight.Draw();
|
||||||
}
|
}
|
||||||
@@ -159,7 +161,7 @@ void NoteField::DrawAreaHighlight( const float fStartBeat, const float fEndBeat
|
|||||||
|
|
||||||
void NoteField::DrawBPMText( const float fBeat, const float fBPM )
|
void NoteField::DrawBPMText( const float fBeat, const float fBPM )
|
||||||
{
|
{
|
||||||
const float fYOffset = ArrowGetYOffset( m_PlayerNumber, fBeat );
|
const float fYOffset = ArrowGetYOffset( m_PlayerNumber, fBeat );
|
||||||
const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset );
|
const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset );
|
||||||
|
|
||||||
m_textMeasureNumber.SetDiffuse( RageColor(1,0,0,1) );
|
m_textMeasureNumber.SetDiffuse( RageColor(1,0,0,1) );
|
||||||
@@ -203,7 +205,7 @@ void NoteField::DrawPrimitives()
|
|||||||
// change this probing to binary search
|
// change this probing to binary search
|
||||||
|
|
||||||
// probe for first note on the screen
|
// probe for first note on the screen
|
||||||
float fFirstBeatToDraw = fSongBeat-2; // Adjust to balance of performance and showing enough notes.
|
float fFirstBeatToDraw = fSongBeat-4; // Adjust to balance of performance and showing enough notes.
|
||||||
while( fFirstBeatToDraw<fSongBeat )
|
while( fFirstBeatToDraw<fSongBeat )
|
||||||
{
|
{
|
||||||
float fYOffset = ArrowGetYOffset(m_PlayerNumber, fFirstBeatToDraw);
|
float fYOffset = ArrowGetYOffset(m_PlayerNumber, fFirstBeatToDraw);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ protected:
|
|||||||
void DrawBPMText( const float fBeat, const float fBPM );
|
void DrawBPMText( const float fBeat, const float fBPM );
|
||||||
void DrawFreezeText( const float fBeat, const float fBPM );
|
void DrawFreezeText( const float fBeat, const float fBPM );
|
||||||
void DrawBGChangeText( const float fBeat, const CString sNewBGName );
|
void DrawBGChangeText( const float fBeat, const CString sNewBGName );
|
||||||
int GetWidth();
|
float GetWidth();
|
||||||
|
|
||||||
float m_fPercentFadeToFail; // -1 of not fading to fail
|
float m_fPercentFadeToFail; // -1 of not fading to fail
|
||||||
|
|
||||||
|
|||||||
@@ -166,10 +166,10 @@ public:
|
|||||||
Rect() {};
|
Rect() {};
|
||||||
Rect(T l, T t, T r, T b) { left = l, top = t, right = r, bottom = b; };
|
Rect(T l, T t, T r, T b) { left = l, top = t, right = r, bottom = b; };
|
||||||
|
|
||||||
int GetWidth() const { return right-left; };
|
T GetWidth() const { return right-left; };
|
||||||
int GetHeight() const { return bottom-top; };
|
T GetHeight() const { return bottom-top; };
|
||||||
int GetCenterX() const { return (left+right)/2; };
|
T GetCenterX() const { return (left+right)/2; };
|
||||||
int GetCenterY() const { return (top+bottom)/2; };
|
T GetCenterY() const { return (top+bottom)/2; };
|
||||||
|
|
||||||
T left, top, right, bottom;
|
T left, top, right, bottom;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ ScreenEdit::ScreenEdit()
|
|||||||
|
|
||||||
m_NoteFieldEdit.SetXY( EDIT_X, EDIT_GRAY_Y );
|
m_NoteFieldEdit.SetXY( EDIT_X, EDIT_GRAY_Y );
|
||||||
m_NoteFieldEdit.SetZoom( 0.5f );
|
m_NoteFieldEdit.SetZoom( 0.5f );
|
||||||
m_NoteFieldEdit.Load( ¬eData, PLAYER_1, -220, 800 );
|
m_NoteFieldEdit.Load( ¬eData, PLAYER_1, -240, 800 );
|
||||||
|
|
||||||
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) );
|
||||||
@@ -493,34 +493,40 @@ void ScreenEdit::Update( float fDeltaTime )
|
|||||||
|
|
||||||
void ScreenEdit::DrawPrimitives()
|
void ScreenEdit::DrawPrimitives()
|
||||||
{
|
{
|
||||||
m_BGAnimation.Draw();
|
// m_rectRecordBack.Draw();
|
||||||
m_SnapDisplay.Draw();
|
|
||||||
m_GrayArrowRowEdit.Draw();
|
|
||||||
|
|
||||||
// HACK: Make NoteFieldEdit draw using the trailing beat
|
switch( m_EditMode )
|
||||||
float fSongBeat = GAMESTATE->m_fSongBeat; // save song beat
|
|
||||||
GAMESTATE->m_fSongBeat = m_fTrailingBeat; // put trailing beat in effect
|
|
||||||
m_NoteFieldEdit.Draw();
|
|
||||||
GAMESTATE->m_fSongBeat = fSongBeat; // restore real song beat
|
|
||||||
|
|
||||||
m_sprHelp.Draw();
|
|
||||||
m_textHelp.Draw();
|
|
||||||
m_sprInfo.Draw();
|
|
||||||
m_textInfo.Draw();
|
|
||||||
m_Fade.Draw();
|
|
||||||
|
|
||||||
|
|
||||||
m_rectRecordBack.Draw();
|
|
||||||
|
|
||||||
if( m_EditMode == MODE_RECORDING )
|
|
||||||
{
|
{
|
||||||
|
case MODE_EDITING:
|
||||||
|
{
|
||||||
|
m_BGAnimation.Draw();
|
||||||
|
m_SnapDisplay.Draw();
|
||||||
|
m_GrayArrowRowEdit.Draw();
|
||||||
|
|
||||||
|
// HACK: Make NoteFieldEdit draw using the trailing beat
|
||||||
|
float fSongBeat = GAMESTATE->m_fSongBeat; // save song beat
|
||||||
|
GAMESTATE->m_fSongBeat = m_fTrailingBeat; // put trailing beat in effect
|
||||||
|
m_NoteFieldEdit.Draw();
|
||||||
|
GAMESTATE->m_fSongBeat = fSongBeat; // restore real song beat
|
||||||
|
|
||||||
|
m_sprHelp.Draw();
|
||||||
|
m_textHelp.Draw();
|
||||||
|
m_sprInfo.Draw();
|
||||||
|
m_textInfo.Draw();
|
||||||
|
m_Fade.Draw();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MODE_RECORDING:
|
||||||
|
m_BGAnimation.Draw();
|
||||||
m_GrayArrowRowRecord.Draw();
|
m_GrayArrowRowRecord.Draw();
|
||||||
m_NoteFieldRecord.Draw();
|
m_NoteFieldRecord.Draw();
|
||||||
}
|
break;
|
||||||
|
case MODE_PLAYING:
|
||||||
if( m_EditMode == MODE_PLAYING )
|
m_BGAnimation.Draw();
|
||||||
{
|
|
||||||
m_Player.Draw();
|
m_Player.Draw();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Screen::DrawPrimitives();
|
Screen::DrawPrimitives();
|
||||||
|
|||||||
@@ -89,3 +89,13 @@ bool StyleDef::MatchesNotesType( NotesType type ) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StyleDef::GetMinAndMaxColX( PlayerNumber pn, float& fMixXOut, float& fMaxXOut ) const
|
||||||
|
{
|
||||||
|
fMixXOut = +100000;
|
||||||
|
fMaxXOut = -100000;
|
||||||
|
for( int i=0; i<m_iColsPerPlayer; i++ )
|
||||||
|
{
|
||||||
|
fMixXOut = min( fMixXOut, m_ColumnInfo[pn][i].fXOffset );
|
||||||
|
fMaxXOut = max( fMaxXOut, m_ColumnInfo[pn][i].fXOffset );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ public:
|
|||||||
void GetTransformedNoteDataForStyle( PlayerNumber pn, NoteData* pOriginal, NoteData* pNoteDataOut ) const;
|
void GetTransformedNoteDataForStyle( PlayerNumber pn, NoteData* pOriginal, NoteData* pNoteDataOut ) const;
|
||||||
|
|
||||||
bool MatchesNotesType( NotesType type ) const;
|
bool MatchesNotesType( NotesType type ) const;
|
||||||
|
|
||||||
|
void GetMinAndMaxColX( PlayerNumber pn, float& fMixXOut, float& fMaxXOut ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user