hashkey = ((crc >> 8) ^ crc) % CACHEPICHASHSIZE;
for (pic = cachepichash[hashkey];pic;pic = pic->chain)
{
- if (!strcmp (picname, pic->name))
+ if (!strcmp (picname, pic->name) && pic->tex)
{
R_FreeTexture(pic->tex);
pic->width = 0;
int quadelements[768];
void R_DrawQueue(void)
{
- int pos, num, chartexnum, overbright, texnum, batch;
+ int pos, num, chartexnum, texnum, batch;
float x, y, w, h, s, t, u, v, *av, *at, c[4];
cachepic_t *pic;
drawqueue_t *dq;
texnum = 0;
color = 0;
- overbright = v_overbrightbits.integer;
batch = false;
batchcount = 0;
for (pos = 0;pos < r_refdef.drawqueuesize;pos += ((drawqueue_t *)(r_refdef.drawqueue + pos))->size)
dq = (drawqueue_t *)(r_refdef.drawqueue + pos);
color = dq->color;
- if(dq->flags & DRAWFLAG_ADDITIVE)
+ if(dq->flags == DRAWFLAG_ADDITIVE)
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
- else if(dq->flags & DRAWFLAG_MODULATE)
+ else if(dq->flags == DRAWFLAG_MODULATE)
GL_BlendFunc(GL_DST_COLOR, GL_ZERO);
+ else if(dq->flags == DRAWFLAG_2XMODULATE)
+ GL_BlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
else
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
+
GL_DepthMask(true);
GL_DepthTest(false);
- c[0] = (float) ((color >> 24) & 0xFF) * (1.0f / 255.0f) * r_colorscale;
- c[1] = (float) ((color >> 16) & 0xFF) * (1.0f / 255.0f) * r_colorscale;
- c[2] = (float) ((color >> 8) & 0xFF) * (1.0f / 255.0f) * r_colorscale;
+ c[0] = (float) ((color >> 24) & 0xFF) * (1.0f / 255.0f);
+ c[1] = (float) ((color >> 16) & 0xFF) * (1.0f / 255.0f);
+ c[2] = (float) ((color >> 8) & 0xFF) * (1.0f / 255.0f);
c[3] = (float) ( color & 0xFF) * (1.0f / 255.0f);
x = dq->x;
y = dq->y;
break;
case DRAWQUEUE_MESH:
mesh = (void *)(dq + 1);
- GL_VertexPointer(mesh->vertex3f);
- GL_ColorPointer(mesh->color4f);
+ GL_VertexPointer(mesh->data_vertex3f);
+ GL_ColorPointer(mesh->data_color4f);
m.tex[0] = R_GetTexture(mesh->texture);
- m.pointer_texcoord[0] = mesh->texcoord2f;
+ m.pointer_texcoord[0] = mesh->data_texcoord2f;
R_Mesh_State_Texture(&m);
- R_Mesh_Draw(mesh->numvertices, mesh->numtriangles, mesh->element3i);
+ R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
currentpic = "\0";
break;
+ case DRAWQUEUE_SETCLIP:
+ {
+ // We have to convert the con coords into real coords
+ int x , y, width, height;
+ x = dq->x * (vid.realwidth / vid.conwidth) + vid.realx;
+ // OGL uses top to bottom
+ y = (dq->y + dq->scaley) * (vid.realheight / vid.conheight) + vid.realy;
+ width = dq->scalex * (vid.realwidth / vid.conwidth);
+ height = dq->scaley * (vid.realheight / vid.conheight);
+
+ GL_Scissor(x, y, width, height);
+
+ GL_ScissorTest(true);
+ }
+ break;
+ case DRAWQUEUE_RESETCLIP:
+ GL_ScissorTest(false);
+ break;
}
}
}
else
c[0] = c[1] = c[2] = v_contrast.value;
- VectorScale(c, (float) (1 << v_overbrightbits.integer), c);
if (c[0] >= 1.01f || c[1] >= 1.01f || c[2] >= 1.01f)
{
GL_BlendFunc(GL_DST_COLOR, GL_ONE);