+float DrawQ_String(float startx, float starty, const char *text, int maxlen, float w, float h, float basered, float basegreen, float baseblue, float basealpha, int flags, int *outcolor, qboolean ignorecolorcodes)
+{
+ int i, num, shadow, colorindex = STRING_COLOR_DEFAULT;
+ float x = startx, y, s, t, u, v;
+ float *av, *at, *ac;
+ float color[4];
+ int batchcount;
+ float vertex3f[QUADELEMENTS_MAXQUADS*4*3];
+ float texcoord2f[QUADELEMENTS_MAXQUADS*4*2];
+ float color4f[QUADELEMENTS_MAXQUADS*4*4];
+
+ if (maxlen < 1)
+ maxlen = 1<<30;
+
+ _DrawQ_ProcessDrawFlag(flags);
+
+ R_Mesh_ColorPointer(color4f, 0, 0);
+ R_Mesh_ResetTextureState();
+ R_Mesh_TexBind(0, R_GetTexture(char_texture));
+ R_Mesh_TexCoordPointer(0, 2, texcoord2f, 0, 0);
+ R_Mesh_VertexPointer(vertex3f, 0, 0);
+
+ ac = color4f;
+ at = texcoord2f;
+ av = vertex3f;
+ batchcount = 0;
+
+ for (shadow = r_textshadow.value != 0;shadow >= 0;shadow--)
+ {
+ if (!outcolor || *outcolor == -1)
+ colorindex = STRING_COLOR_DEFAULT;
+ else
+ colorindex = *outcolor;
+ DrawQ_GetTextColor(color, colorindex, basered, basegreen, baseblue, basealpha, shadow);
+
+ x = startx;
+ y = starty;
+ if (shadow)
+ {
+ x += r_textshadow.value;
+ y += r_textshadow.value;
+ }
+ for (i = 0;i < maxlen && text[i];i++, x += w)
+ {
+ if (text[i] == ' ')
+ continue;
+ if (text[i] == STRING_COLOR_TAG && !ignorecolorcodes && i + 1 < maxlen)
+ {
+ if (text[i+1] == STRING_COLOR_TAG)
+ {
+ i++;
+ if (text[i] == ' ')
+ continue;
+ }
+ else if (text[i+1] >= '0' && text[i+1] <= '9')
+ {
+ colorindex = text[i+1] - '0';
+ DrawQ_GetTextColor(color, colorindex, basered, basegreen, baseblue, basealpha, shadow);
+ i++;
+ x -= w;
+ continue;
+ }