+ // display the text
+ 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;
+ }
+}
+
+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)
+{
+ rmeshstate_t m;
+ float floats[36];
+
+ if (!r_refdef.draw2dstage)
+ {
+ Con_Printf("DrawQ_SuperPic: not in 2d rendering stage!\n");
+ return;
+ }
+
+ if (!r_render.integer)
+ return;
+
+ if(flags == DRAWFLAG_ADDITIVE)
+ GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
+ else if(flags == DRAWFLAG_MODULATE)
+ GL_BlendFunc(GL_DST_COLOR, GL_ZERO);
+ else if(flags == DRAWFLAG_2XMODULATE)
+ GL_BlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
+ else
+ GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ memset(&m, 0, sizeof(m));
+ m.pointer_vertex = floats;
+ m.pointer_color = floats + 20;
+ if (pic)
+ {
+ if (width == 0)
+ width = pic->width;
+ if (height == 0)
+ height = pic->height;
+ m.tex[0] = R_GetTexture(pic->tex);
+ m.pointer_texcoord[0] = 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;
+ }
+ R_Mesh_State(&m);
+
+ 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)
+{
+ rmeshstate_t m;
+
+ if (!r_refdef.draw2dstage)
+ {
+ Con_Printf("DrawQ_Mesh: not in 2d rendering stage!\n");
+ return;
+ }
+
+ if (!r_render.integer)
+ return;
+
+ if(flags == DRAWFLAG_ADDITIVE)
+ GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
+ else if(flags == DRAWFLAG_MODULATE)
+ GL_BlendFunc(GL_DST_COLOR, GL_ZERO);
+ else if(flags == DRAWFLAG_2XMODULATE)
+ GL_BlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
+ else
+ GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ memset(&m, 0, sizeof(m));
+ m.pointer_vertex = mesh->data_vertex3f;
+ m.pointer_color = mesh->data_color4f;
+ m.tex[0] = R_GetTexture(mesh->texture);
+ if (m.tex[0])
+ m.pointer_texcoord[0] = mesh->data_texcoord2f;
+ R_Mesh_State(&m);
+
+ 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;
+
+ if (!r_refdef.draw2dstage)
+ {
+ Con_Printf("DrawQ_LineLoop: not in 2d rendering stage!\n");
+ return;
+ }
+
+ if (!r_render.integer)
+ return;
+
+ if(flags == DRAWFLAG_ADDITIVE)
+ GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
+ else if(flags == DRAWFLAG_MODULATE)
+ GL_BlendFunc(GL_DST_COLOR, GL_ZERO);
+ else if(flags == DRAWFLAG_2XMODULATE)
+ GL_BlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
+ else
+ GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ GL_Color(1,1,1,1);
+ 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();
+}
+
+//LordHavoc: FIXME: this is nasty!
+void DrawQ_LineWidth (float width)
+{
+ if (!r_refdef.draw2dstage)
+ {
+ Con_Printf("DrawQ_LineWidth: not in 2d rendering stage!\n");
+ return;
+ }
+ qglLineWidth(width);
+}
+
+//[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)
+{
+ if (!r_refdef.draw2dstage)
+ {
+ Con_Printf("DrawQ_Line: not in 2d rendering stage!\n");
+ return;