From: divverent Date: Wed, 3 Aug 2011 13:34:47 +0000 (+0000) Subject: fix an obvious crash in user controlled wave func handling X-Git-Tag: xonotic-v0.6.0~163^2~287 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5f8d215217667477114b71b148c5c9890380763e;p=xonotic%2Fdarkplaces.git 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 --- 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; }