]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_draw.c
added an easteregg (v_psycho), thanks to Zinx Verituse and Ben Winslow for the origin...
[xonotic/darkplaces.git] / gl_draw.c
index 6304fb8e63dd0fd43a00c36ecc3cf94e979026ba..7ba2282e38eb8bc0eff765055c6a3e6abd87ff38 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -328,7 +328,7 @@ void Draw_FreePic(char *picname)
        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;
@@ -427,11 +427,13 @@ void R_DrawQueue(void)
        {
                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);
 
@@ -497,14 +499,32 @@ void R_DrawQueue(void)
                        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 * ((float)vid.realwidth / vid.conwidth);
+                               // OGL uses top to bottom 
+                               y = dq->y * ((float) vid.realheight / vid.conheight);
+                               width = dq->scalex * ((float)vid.realwidth / vid.conwidth);
+                               height = dq->scaley * ((float)vid.realheight / vid.conheight);
+
+                               GL_Scissor(x, y, width, height);
+
+                               GL_ScissorTest(true);
+                       }
+                       break;
+               case DRAWQUEUE_RESETCLIP:
+                       GL_ScissorTest(false);
+                       break;                          
                }
        }