From f07b58c9067a98df38dbf7f6dfb509979daa933c Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 8 Nov 2009 18:45:59 +0000 Subject: [PATCH] fix bug with alt textures (pressed buttons in q1bsp) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9457 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 5 ++++- render.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gl_rmain.c b/gl_rmain.c index 5e7bcb1a..e44f24cb 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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) diff --git a/render.h b/render.h index a8936258..85e22850 100644 --- 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; -- 2.39.2