From 5648ea4628805cef3e6b14fde5a29dfcfebb3593 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 11 Feb 2005 05:38:37 +0000 Subject: [PATCH] slight safety improvement in frameblend generation, may fix a crash Willis reported in Nexuiz git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5013 d7cf8633-e32d-0410-b094-e92efae38249 --- r_lerpanim.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/r_lerpanim.c b/r_lerpanim.c index b9f30a7f..f736a11c 100644 --- a/r_lerpanim.c +++ b/r_lerpanim.c @@ -68,13 +68,8 @@ void R_LerpAnimation(entity_render_t *r) sub1 = (sub1 % scene->framecount); sub2 = (sub2 % scene->framecount); } - else - { - sub1 = bound(0, sub1, (scene->framecount - 1)); - sub2 = bound(0, sub2, (scene->framecount - 1)); - } - sub1 += scene->firstframe; - sub2 += scene->firstframe; + sub1 = bound(0, sub1, (scene->framecount - 1)) + scene->firstframe; + sub2 = bound(0, sub2, (scene->framecount - 1)) + scene->firstframe; f = sub1; d = (1 - sublerp) * lerp; #define FRAMEBLENDINSERT\ @@ -128,13 +123,8 @@ void R_LerpAnimation(entity_render_t *r) sub1 = (sub1 % scene->framecount); sub2 = (sub2 % scene->framecount); } - else - { - sub1 = bound(0, sub1, (scene->framecount - 1)); - sub2 = bound(0, sub2, (scene->framecount - 1)); - } - sub1 += scene->firstframe; - sub2 += scene->firstframe; + sub1 = bound(0, sub1, (scene->framecount - 1)) + scene->firstframe; + sub2 = bound(0, sub2, (scene->framecount - 1)) + scene->firstframe; f = sub1; d = (1 - sublerp) * lerp; FRAMEBLENDINSERT -- 2.39.2