]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix bug with alt textures (pressed buttons in q1bsp)
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 8 Nov 2009 18:45:59 +0000 (18:45 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 8 Nov 2009 18:45:59 +0000 (18:45 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9457 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
render.h

index 5e7bcb1a7849ef5f4e8f3c999c5ef3335b8388ea..e44f24cbdb81669f436222fc778aff2a631f8ff2 100644 (file)
@@ -5688,7 +5688,7 @@ texture_t *R_GetCurrentTexture(texture_t *t)
                {
                        // use an alternate animation if the entity's frame is not 0,
                        // and only if the texture has an alternate animation
-                       if (rsurface.frameblend[0].subframe != 0 && t->anim_total[1])
+                       if (rsurface.ent_alttextures && t->anim_total[1])
                                t = t->anim_frames[1][(t->anim_total[1] >= 2) ? ((int)(r_refdef.scene.time * 5.0f) % t->anim_total[1]) : 0];
                        else
                                t = t->anim_frames[0][(t->anim_total[0] >= 2) ? ((int)(r_refdef.scene.time * 5.0f) % t->anim_total[0]) : 0];
@@ -5963,6 +5963,7 @@ void RSurf_ActiveWorldEntity(void)
        VectorSet(rsurface.glowmod, 1, 1, 1);
        memset(rsurface.frameblend, 0, sizeof(rsurface.frameblend));
        rsurface.frameblend[0].lerp = 1;
+       rsurface.ent_alttextures = false;
        rsurface.basepolygonfactor = r_refdef.polygonfactor;
        rsurface.basepolygonoffset = r_refdef.polygonoffset;
        rsurface.modelvertex3f  = model->surfmesh.data_vertex3f;
@@ -6041,6 +6042,7 @@ void RSurf_ActiveModelEntity(const entity_render_t *ent, qboolean wantnormals, q
        VectorCopy(ent->colormap_shirtcolor, rsurface.colormap_shirtcolor);
        VectorCopy(ent->glowmod, rsurface.glowmod);
        memcpy(rsurface.frameblend, ent->frameblend, sizeof(ent->frameblend));
+       rsurface.ent_alttextures = ent->framegroupblend[0].frame != 0;
        rsurface.basepolygonfactor = r_refdef.polygonfactor;
        rsurface.basepolygonoffset = r_refdef.polygonoffset;
        if (ent->model->brush.submodel)
@@ -6170,6 +6172,7 @@ void RSurf_ActiveCustomEntity(const matrix4x4_t *matrix, const matrix4x4_t *inve
        VectorSet(rsurface.glowmod, 1, 1, 1);
        memset(rsurface.frameblend, 0, sizeof(rsurface.frameblend));
        rsurface.frameblend[0].lerp = 1;
+       rsurface.ent_alttextures = false;
        rsurface.basepolygonfactor = r_refdef.polygonfactor;
        rsurface.basepolygonoffset = r_refdef.polygonoffset;
        if (wanttangents)
index a8936258522324677e9c52b37ea114c78839b079..85e228504368b5c573379c202f76d9c45913c718 100644 (file)
--- a/render.h
+++ b/render.h
@@ -307,6 +307,7 @@ typedef struct rsurfacestate_s
        int ent_flags;
        float ent_shadertime;
        float ent_color[4];
+       int ent_alttextures; // used by q1bsp animated textures (pressed buttons)
        // transform matrices to render this entity and effects on this entity
        matrix4x4_t matrix;
        matrix4x4_t inversematrix;