]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix an obvious crash in user controlled wave func handling
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 3 Aug 2011 13:34:47 +0000 (13:34 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 3 Aug 2011 13:34:47 +0000 (13:34 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11265 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 383be057ae417f403760ac50762617ac41f91748..e4f7d6b6e347c7239313237fe2dc56f1cfa26fbe 100644 (file)
@@ -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;
 }