]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
don't crash if a quake button entity is on its alternate frames but doesn't actually...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 7 Jun 2006 08:49:56 +0000 (08:49 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 7 Jun 2006 08:49:56 +0000 (08:49 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6435 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 82a25ff27c198b1cc2d2f530bc16ed0c412ce17b..effd5fdde4f75e021a173a278f31551db00a199f 100644 (file)
@@ -2169,7 +2169,14 @@ void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t)
                if (s > 0)
                        t = t + s * model->num_surfaces;
                if (t->animated)
-                       t = t->anim_frames[ent->frame != 0][(t->anim_total[ent->frame != 0] >= 2) ? ((int)(r_refdef.time * 5.0f) % t->anim_total[ent->frame != 0]) : 0];
+               {
+                       // use an alternate animation if the entity's frame is not 0,
+                       // and only if the texture has an alternate animation
+                       if (ent->frame != 0 && t->anim_total[1])
+                               t = t->anim_frames[1][(t->anim_total[1] >= 2) ? ((int)(r_refdef.time * 5.0f) % t->anim_total[1]) : 0];
+                       else
+                               t = t->anim_frames[0][(t->anim_total[0] >= 2) ? ((int)(r_refdef.time * 5.0f) % t->anim_total[0]) : 0];
+               }
                texture->currentframe = t;
        }