From 4947d7429260ddca538af71ce89369accf58014a Mon Sep 17 00:00:00 2001 From: divverent Date: Wed, 3 Aug 2011 13:34:47 +0000 Subject: [PATCH] fix an obvious crash in user controlled wave func handling git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11265 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=5f8d215217667477114b71b148c5c9890380763e --- gl_rmain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index 383be057..e4f7d6b6 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -7504,7 +7504,7 @@ static qboolean R_TestQ3WaveFunc(q3wavefunc_t func, const float *parms) if(parms[0] == 0 && parms[1] == 0) return false; if(func >> Q3WAVEFUNC_USER_SHIFT) // assumes rsurface to be set! - if(rsurface.userwavefunc_param[bound(0, (func >> Q3WAVEFUNC_USER_SHIFT) - 1, Q3WAVEFUNC_USER_COUNT)] == 0) + if(rsurface.userwavefunc_param[bound(0, (func >> Q3WAVEFUNC_USER_SHIFT) - 1, Q3WAVEFUNC_USER_COUNT - 1)] == 0) return false; return true; } @@ -7543,7 +7543,7 @@ static float R_EvaluateQ3WaveFunc(q3wavefunc_t func, const float *parms) } f = parms[0] + parms[1] * f; if(func >> Q3WAVEFUNC_USER_SHIFT) // assumes rsurface to be set! - f *= rsurface.userwavefunc_param[bound(0, (func >> Q3WAVEFUNC_USER_SHIFT) - 1, Q3WAVEFUNC_USER_COUNT)]; + f *= rsurface.userwavefunc_param[bound(0, (func >> Q3WAVEFUNC_USER_SHIFT) - 1, Q3WAVEFUNC_USER_COUNT - 1)]; return (float) f; } -- 2.39.2