+ if( start != current ) {
+ // draw the string
+ DrawQ_String( x, y, start, current - start, scalex, scaley, basered * color[0], basegreen * color[1], baseblue * color[2], basealpha * color[3], flags );
+ // update x to be at the new start position
+ x += (current - start) * scalex;
+ // set start accordingly
+ start = current;
+ }
+
+ // return the last colorindex
+ if( outcolor ) {
+ *outcolor = colorindex;
+ }
+
+ // return the new x position
+ return x;
+}
+
+void DrawQ_SuperPic(float x, float y, cachepic_t *pic, float width, float height, float s1, float t1, float r1, float g1, float b1, float a1, float s2, float t2, float r2, float g2, float b2, float a2, float s3, float t3, float r3, float g3, float b3, float a3, float s4, float t4, float r4, float g4, float b4, float a4, int flags)
+{
+ float floats[36];
+
+ _DrawQ_ProcessDrawFlag(flags);
+
+ R_Mesh_VertexPointer(floats);
+ R_Mesh_ColorPointer(floats + 20);
+ R_Mesh_ResetTextureState();
+ if (pic)
+ {
+ if (width == 0)
+ width = pic->width;
+ if (height == 0)
+ height = pic->height;
+ R_Mesh_TexBind(0, R_GetTexture(pic->tex));
+ R_Mesh_TexCoordPointer(0, 2, floats + 12);
+ floats[12] = s1;floats[13] = t1;
+ floats[14] = s2;floats[15] = t2;
+ floats[16] = s4;floats[17] = t4;
+ floats[18] = s3;floats[19] = t3;
+ }
+
+ floats[2] = floats[5] = floats[8] = floats[11] = 0;
+ floats[0] = floats[9] = x;
+ floats[1] = floats[4] = y;
+ floats[3] = floats[6] = x + width;
+ floats[7] = floats[10] = y + height;
+ floats[20] = r1;floats[21] = g1;floats[22] = b1;floats[23] = a1;
+ floats[24] = r2;floats[25] = g2;floats[26] = b2;floats[27] = a2;
+ floats[28] = r4;floats[29] = g4;floats[30] = b4;floats[31] = a4;
+ floats[32] = r3;floats[33] = g3;floats[34] = b3;floats[35] = a3;
+
+ R_Mesh_Draw(0, 4, 2, polygonelements);
+}
+
+void DrawQ_Mesh (drawqueuemesh_t *mesh, int flags)
+{
+ _DrawQ_ProcessDrawFlag(flags);
+
+ R_Mesh_VertexPointer(mesh->data_vertex3f);
+ R_Mesh_ColorPointer(mesh->data_color4f);
+ R_Mesh_ResetTextureState();
+ R_Mesh_TexBind(0, R_GetTexture(mesh->texture));
+ R_Mesh_TexCoordPointer(0, 2, mesh->data_texcoord2f);
+
+ GL_LockArrays(0, mesh->num_vertices);
+ R_Mesh_Draw(0, mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
+ GL_LockArrays(0, 0);
+}
+
+void DrawQ_LineLoop (drawqueuemesh_t *mesh, int flags)
+{
+ int num;
+
+ _DrawQ_ProcessDrawFlag(flags);
+
+ GL_Color(1,1,1,1);
+ CHECKGLERROR
+ qglBegin(GL_LINE_LOOP);
+ for (num = 0;num < mesh->num_vertices;num++)
+ {
+ if (mesh->data_color4f)
+ GL_Color(mesh->data_color4f[num*4+0], mesh->data_color4f[num*4+1], mesh->data_color4f[num*4+2], mesh->data_color4f[num*4+3]);
+ qglVertex2f(mesh->data_vertex3f[num*3+0], mesh->data_vertex3f[num*3+1]);
+ }
+ qglEnd();
+ CHECKGLERROR
+}
+
+//[515]: this is old, delete
+void DrawQ_Line (float width, float x1, float y1, float x2, float y2, float r, float g, float b, float alpha, int flags)
+{
+ _DrawQ_ProcessDrawFlag(flags);
+
+ CHECKGLERROR
+ qglLineWidth(width);CHECKGLERROR
+
+ GL_Color(r,g,b,alpha);
+ CHECKGLERROR
+ qglBegin(GL_LINES);
+ qglVertex2f(x1, y1);
+ qglVertex2f(x2, y2);
+ qglEnd();
+ CHECKGLERROR
+}
+
+void DrawQ_SetClipArea(float x, float y, float width, float height)
+{
+ _DrawQ_Setup();
+
+ // We have to convert the con coords into real coords
+ // OGL uses top to bottom
+ GL_Scissor((int)(x * ((float)vid.width / vid_conwidth.integer)), (int)(y * ((float) vid.height / vid_conheight.integer)), (int)(width * ((float)vid.width / vid_conwidth.integer)), (int)(height * ((float)vid.height / vid_conheight.integer)));
+
+ GL_ScissorTest(true);
+}
+
+void DrawQ_ResetClipArea(void)
+{
+ _DrawQ_Setup();
+ GL_ScissorTest(false);
+}
+
+void DrawQ_Finish(void)
+{
+ r_refdef.draw2dstage = false;
+}
+
+static float blendvertex3f[9] = {-5000, -5000, 10, 10000, -5000, 10, -5000, 10000, 10};
+void R_DrawGamma(void)
+{
+ float c[4];