From 3e4e26dd95b98347925efdd6c1e58d69726b10db Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 28 Jun 2003 02:15:27 +0000 Subject: [PATCH] fix crash with very long hold notes --- stepmania/src/NoteDisplay.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index 1c95f16b55..b1f4cc7296 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -411,7 +411,8 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float /* The body and caps should have no overlap, so their order doesn't matter. * Draw the head last, so it appears on top. */ - static RageVertex queue[4096]; + const int size = 4096; + static RageVertex queue[size]; // // Draw the bottom cap (always wavy) @@ -476,6 +477,8 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float v[2].p = RageVector3(fXBottomRight,fYBottom,0); v[2].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordRight, fTexCoordBottom); v[3].p = RageVector3(fXBottomLeft, fYBottom,0); v[3].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[3].t = RageVector2(fTexCoordLeft, fTexCoordBottom); v+=4; + if( v-queue >= size ) + break; } DISPLAY->DrawQuads( queue, v-queue ); } @@ -556,6 +559,8 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float v[2].p = RageVector3(fXBottomRight,fYBottom,0); v[2].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordRight, fTexCoordBottom); v[3].p = RageVector3(fXBottomLeft, fYBottom,0); v[3].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[3].t = RageVector2(fTexCoordLeft, fTexCoordBottom); v+=4; + if( v-queue >= size ) + break; } DISPLAY->DrawQuads( queue, v-queue ); } @@ -622,6 +627,8 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float v[2].p = RageVector3(fXBottomRight,fYBottom,0); v[2].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[2].t = RageVector2(fTexCoordRight, fTexCoordBottom); v[3].p = RageVector3(fXBottomLeft, fYBottom,0); v[3].c = bDrawGlowOnly ? colorGlowBottom : colorDiffuseBottom; v[3].t = RageVector2(fTexCoordLeft, fTexCoordBottom); v+=4; + if( v-queue >= size ) + break; } DISPLAY->DrawQuads( queue, v-queue ); }