From 9a74a05e5e7c5e91e63ade74068f65b86deea015 Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 29 Jul 2002 13:23:05 +0000 Subject: [PATCH] slight simplification/optimzation/readability enhancement/whatever to animating textures git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2119 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rsurf.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/gl_rsurf.c b/gl_rsurf.c index 16ab5c58..8a56010f 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -1931,7 +1931,7 @@ Cshader_t *Cshaders[5] = void R_PrepareSurfaces(void) { - int i, entframe, texframe, framecount; + int i, alttextures, texframe, framecount; texture_t *t; model_t *model; msurface_t *surf; @@ -1940,7 +1940,7 @@ void R_PrepareSurfaces(void) Cshaders[i]->chain = NULL; model = currentrenderentity->model; - entframe = currentrenderentity->frame; + alttextures = currentrenderentity->frame != 0; texframe = (int)(cl.time * 5.0f); for (i = 0;i < model->nummodelsurfaces;i++) @@ -1955,22 +1955,11 @@ void R_PrepareSurfaces(void) t = surf->texinfo->texture; if (t->animated) { - if (entframe) - { - framecount = t->anim_total[1]; - if (framecount >= 2) - surf->currenttexture = t->anim_frames[1][texframe % framecount]; - else - surf->currenttexture = t->anim_frames[1][0]; - } + framecount = t->anim_total[alttextures]; + if (framecount >= 2) + surf->currenttexture = t->anim_frames[alttextures][texframe % framecount]; else - { - framecount = t->anim_total[0]; - if (framecount >= 2) - surf->currenttexture = t->anim_frames[0][texframe % framecount]; - else - surf->currenttexture = t->anim_frames[0][0]; - } + surf->currenttexture = t->anim_frames[alttextures][0]; } else surf->currenttexture = t; -- 2.39.2