]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
remove redundant _Size suffix from textwidth functions, as now all of them would...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 30 Dec 2009 09:14:48 +0000 (09:14 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 30 Dec 2009 09:14:48 +0000 (09:14 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9741 d7cf8633-e32d-0410-b094-e92efae38249

cl_screen.c
console.c
draw.h
gl_draw.c
sbar.c

index 52d395b925a4ab56f99b7079945c19949843344a..8208ad0db1dbd81d0a26b66c7850c3ead71e37d9 100644 (file)
@@ -159,7 +159,7 @@ void SCR_DrawCenterString (void)
                // scan the number of characters on the line, not counting color codes
                char *newline = strchr(start, '\n');
                int l = newline ? (newline - start) : (int)strlen(start);
-               float width = DrawQ_TextWidth_Font_Size(start, l, 8, 8, false, FONT_CENTERPRINT);
+               float width = DrawQ_TextWidth_Font(start, l, 8, 8, false, FONT_CENTERPRINT);
 
                x = (int) (vid_conwidth.integer - width)/2;
                if (l > 0)
@@ -468,7 +468,7 @@ static int SCR_DrawQWDownload(int offset)
        else
                dpsnprintf(temp, sizeof(temp), "Downloading %s %3i%% (%i/%i) at %i bytes/s\n", cls.qw_downloadname, cls.qw_downloadpercent, cls.qw_downloadmemorycursize, cls.qw_downloadmemorymaxsize, cls.qw_downloadspeedrate);
        len = (int)strlen(temp);
-       x = (vid_conwidth.integer - DrawQ_TextWidth_Font_Size(temp, len, size, size, true, FONT_INFOBAR)) / 2;
+       x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, size, size, true, FONT_INFOBAR)) / 2;
        y = vid_conheight.integer - size - offset;
        DrawQ_Fill(0, y, vid_conwidth.integer, size, 0, 0, 0, cls.signon == SIGNONS ? 0.5 : 1, 0);
        DrawQ_String_Font(x, y, temp, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
@@ -486,7 +486,7 @@ static int SCR_DrawInfobarString(int offset)
        float size = 8;
 
        len = (int)strlen(scr_infobarstring);
-       x = (vid_conwidth.integer - DrawQ_TextWidth_Font_Size(scr_infobarstring, len, size, size, false, FONT_INFOBAR)) / 2;
+       x = (vid_conwidth.integer - DrawQ_TextWidth_Font(scr_infobarstring, len, size, size, false, FONT_INFOBAR)) / 2;
        y = vid_conheight.integer - size - offset;
        DrawQ_Fill(0, y, vid_conwidth.integer, size, 0, 0, 0, cls.signon == SIGNONS ? 0.5 : 1, 0);
        DrawQ_String_Font(x, y, scr_infobarstring, len, size, size, 1, 1, 1, 1, 0, NULL, false, FONT_INFOBAR);
@@ -519,7 +519,7 @@ static int SCR_DrawCurlDownload(int offset)
        if(addinfo)
        {
                len = (int)strlen(addinfo);
-               x = (vid_conwidth.integer - DrawQ_TextWidth_Font_Size(addinfo, len, size, size, true, FONT_INFOBAR)) / 2;
+               x = (vid_conwidth.integer - DrawQ_TextWidth_Font(addinfo, len, size, size, true, FONT_INFOBAR)) / 2;
                DrawQ_Fill(0, y - size, vid_conwidth.integer, size, 1, 1, 1, cls.signon == SIGNONS ? 0.8 : 1, 0);
                DrawQ_String_Font(x, y - size, addinfo, len, size, size, 0, 0, 0, 1, 0, NULL, true, FONT_INFOBAR);
        }
@@ -533,7 +533,7 @@ static int SCR_DrawCurlDownload(int offset)
                else
                        dpsnprintf(temp, sizeof(temp), "Downloading %s ...  %5.1f%% @ %.1f KiB/s\n", downinfo[i].filename, 100.0 * downinfo[i].progress, downinfo[i].speed / 1024.0);
                len = (int)strlen(temp);
-               x = (vid_conwidth.integer - DrawQ_TextWidth_Font_Size(temp, len, size, size, true, FONT_INFOBAR)) / 2;
+               x = (vid_conwidth.integer - DrawQ_TextWidth_Font(temp, len, size, size, true, FONT_INFOBAR)) / 2;
                DrawQ_Fill(0, y + i * size, vid_conwidth.integer, size, 0, 0, 0, cls.signon == SIGNONS ? 0.5 : 1, 0);
                DrawQ_String_Font(x, y + i * size, temp, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
        }
@@ -1817,7 +1817,7 @@ static float SCR_DrawLoadingStack_r(loadingscreenstack_t *s, float y)
                if(!s->prev || strcmp(s->msg, s->prev->msg))
                {
                        len = strlen(s->msg);
-                       x = (vid_conwidth.integer - DrawQ_TextWidth_Font_Size(s->msg, len, size, size, true, FONT_INFOBAR)) / 2;
+                       x = (vid_conwidth.integer - DrawQ_TextWidth_Font(s->msg, len, size, size, true, FONT_INFOBAR)) / 2;
                        y -= size;
                        DrawQ_Fill(0, y, vid_conwidth.integer, size, 0, 0, 0, 1, 0);
                        DrawQ_String_Font(x, y, s->msg, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
@@ -1828,7 +1828,7 @@ static float SCR_DrawLoadingStack_r(loadingscreenstack_t *s, float y)
        if(s)
        {
                len = strlen(s->msg);
-               x = (vid_conwidth.integer - DrawQ_TextWidth_Font_Size(s->msg, len, size, size, true, FONT_INFOBAR)) / 2;
+               x = (vid_conwidth.integer - DrawQ_TextWidth_Font(s->msg, len, size, size, true, FONT_INFOBAR)) / 2;
                y -= size;
                DrawQ_Fill(0, y, vid_conwidth.integer, size, 0, 0, 0, 1, 0);
                DrawQ_String_Font(x, y, s->msg, len, size, size, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
index 45ac0280f1ae5e588bcf64544c4538744bad2efa..a20486c4641b0b61e01e3a0494b11bafa206eea9 100644 (file)
--- a/console.c
+++ b/console.c
@@ -1410,7 +1410,7 @@ void Con_DrawInput (void)
 
 //     text[key_linepos + 1] = 0;
 
-       x = vid_conwidth.value * 0.95 - DrawQ_TextWidth_Font_Size(text, key_linepos, con_textsize.value, con_textsize.value, false, FONT_CONSOLE);
+       x = vid_conwidth.value * 0.95 - DrawQ_TextWidth_Font(text, key_linepos, con_textsize.value, con_textsize.value, false, FONT_CONSOLE);
        if(x >= 0)
                x = 0;
 
@@ -1448,7 +1448,7 @@ float Con_WordWidthFunc(void *passthrough, const char *w, size_t *length, float
        if(maxWidth >= 0)
                return DrawQ_TextWidth_Font_UntilWidth_Size(w, length, ti->fontsize, ti->fontsize, false, ti->font, -maxWidth); // -maxWidth: we want at least one char
        else if(maxWidth == -1)
-               return DrawQ_TextWidth_Font_Size(w, *length, ti->fontsize, ti->fontsize, false, ti->font);
+               return DrawQ_TextWidth_Font(w, *length, ti->fontsize, ti->fontsize, false, ti->font);
        else
        {
                printf("Con_WordWidthFunc: can't get here (maxWidth should never be %f)\n", maxWidth);
@@ -1653,7 +1653,7 @@ void Con_DrawNotify (void)
 
                // FIXME word wrap
                inputsize = (numChatlines ? con_chatsize : con_notifysize).value;
-               x = vid_conwidth.value - DrawQ_TextWidth_Font_Size(temptext, 0, inputsize, inputsize, false, FONT_CHAT);
+               x = vid_conwidth.value - DrawQ_TextWidth_Font(temptext, 0, inputsize, inputsize, false, FONT_CHAT);
                if(x > 0)
                        x = 0;
                DrawQ_String_Font(x, v, temptext, 0, inputsize, inputsize, 1.0, 1.0, 1.0, 1.0, 0, &colorindex, false, FONT_CHAT);
@@ -1780,7 +1780,7 @@ void Con_DrawConsole (int lines)
 
 // draw the background
        DrawQ_Pic(0, lines - vid_conheight.integer, scr_conbrightness.value >= 0.01f ? Draw_CachePic ("gfx/conback") : NULL, vid_conwidth.integer, vid_conheight.integer, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, cls.signon == SIGNONS ? scr_conalpha.value : 1.0, 0); // always full alpha when not in game
-       DrawQ_String_Font(vid_conwidth.integer - DrawQ_TextWidth_Font_Size(engineversion, con_textsize.value, con_textsize.value, 0, false, FONT_CONSOLE), lines - con_textsize.value, engineversion, 0, con_textsize.value, con_textsize.value, 1, 0, 0, 1, 0, NULL, true, FONT_CONSOLE);
+       DrawQ_String_Font(vid_conwidth.integer - DrawQ_TextWidth_Font(engineversion, con_textsize.value, con_textsize.value, 0, false, FONT_CONSOLE), lines - con_textsize.value, engineversion, 0, con_textsize.value, con_textsize.value, 1, 0, 0, 1, 0, NULL, true, FONT_CONSOLE);
 
 // draw the text
 #if 0
diff --git a/draw.h b/draw.h
index bdb08f1108eac11ce9da4c63fad0cb079dc5b079..aeeb39edf33994ebc68c712e77d86931478acd6b 100644 (file)
--- a/draw.h
+++ b/draw.h
@@ -146,14 +146,10 @@ void DrawQ_Fill(float x, float y, float width, float height, float red, float gr
 float DrawQ_String(float x, float y, const char *text, size_t maxlen, float scalex, float scaley, float basered, float basegreen, float baseblue, float basealpha, int flags, int *outcolor, qboolean ignorecolorcodes);
 float DrawQ_String_Font(float x, float y, const char *text, size_t maxlen, float scalex, float scaley, float basered, float basegreen, float baseblue, float basealpha, int flags, int *outcolor, qboolean ignorecolorcodes, const dp_font_t *fnt);
 float DrawQ_String_Font_Scale(float x, float y, const char *text, size_t maxlen, float sizex, float sizey, float scalex, float scaley, float basered, float basegreen, float baseblue, float basealpha, int flags, int *outcolor, qboolean ignorecolorcodes, const dp_font_t *fnt);
-// you are STRONGLY DISCOURAGED to use a version without the _Size suffix!!!
-// /* don't use: */float DrawQ_TextWidth_Font(const char *text, size_t maxlen, qboolean ignorecolorcodes, const dp_font_t *fnt);
-/* use this:  */float DrawQ_TextWidth_Font_Size(const char *text, size_t maxlen, float w, float h, qboolean ignorecolorcodes, const dp_font_t *fnt);
-// /* don't use: */float DrawQ_TextWidth_Font_UntilWidth(const char *text, size_t *maxlen, qboolean ignorecolorcodes, const dp_font_t *fnt, float maxWidth);
-/* use this:  */float DrawQ_TextWidth_Font_UntilWidth_Size(const char *text, size_t *maxlen, float w, float h, qboolean ignorecolorcodes, const dp_font_t *fnt, float maxWidth);
-// /* don't use: */float DrawQ_TextWidth_Font_UntilWidth_TrackColors(const char *text, size_t *maxlen, int *outcolor, qboolean ignorecolorcodes, const dp_font_t *fnt, float maxwidth);
-/* use this:  */float DrawQ_TextWidth_Font_UntilWidth_TrackColors_Size(const char *text, size_t *maxlen, float w, float h, int *outcolor, qboolean ignorecolorcodes, const dp_font_t *fnt, float maxwidth);
-/* use this:  */float DrawQ_TextWidth_Font_UntilWidth_TrackColors_Size_Scale(const char *text, size_t *maxlen, float w, float h, float sw, float sh, int *outcolor, qboolean ignorecolorcodes, const dp_font_t *fnt, float maxwidth);
+float DrawQ_TextWidth_Font(const char *text, size_t maxlen, float w, float h, qboolean ignorecolorcodes, const dp_font_t *fnt);
+float DrawQ_TextWidth_Font_UntilWidth(const char *text, size_t *maxlen, float w, float h, qboolean ignorecolorcodes, const dp_font_t *fnt, float maxWidth);
+float DrawQ_TextWidth_Font_UntilWidth_TrackColors(const char *text, size_t *maxlen, float w, float h, int *outcolor, qboolean ignorecolorcodes, const dp_font_t *fnt, float maxwidth);
+float DrawQ_TextWidth_Font_UntilWidth_TrackColors_Scale(const char *text, size_t *maxlen, float w, float h, float sw, float sh, int *outcolor, qboolean ignorecolorcodes, const dp_font_t *fnt, float maxwidth);
 // draw a very fancy pic (per corner texcoord/color control), the order is tl, tr, bl, br
 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);
 // draw a triangle mesh
index ee605fcfc5e08ea769e8b06c63b55e4ea32f3c48..7a4cad352402321e3081aaa81bddc038607901e1 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -1620,31 +1620,16 @@ float DrawQ_TextWidth_Font_UntilWidth_TrackColors_Size(const char *text, size_t
        return DrawQ_TextWidth_Font_UntilWidth_TrackColors_Size_Scale(text, maxlen, w, h, 1, 1, outcolor, ignorecolorcodes, fnt, maxwidth);
 }
 
-//float DrawQ_TextWidth_Font(const char *text, size_t maxlen, qboolean ignorecolorcodes, const dp_font_t *fnt)
-//{
-//     return DrawQ_TextWidth_Font_UntilWidth(text, &maxlen, ignorecolorcodes, fnt, 1000000000);
-//}
-
-float DrawQ_TextWidth_Font_Size(const char *text, size_t maxlen, float w, float h, qboolean ignorecolorcodes, const dp_font_t *fnt)
+float DrawQ_TextWidth_Font(const char *text, size_t maxlen, float w, float h, qboolean ignorecolorcodes, const dp_font_t *fnt)
 {
        return DrawQ_TextWidth_Font_UntilWidth_Size(text, &maxlen, w, h, ignorecolorcodes, fnt, 1000000000);
 }
 
-//float DrawQ_TextWidth_Font_UntilWidth(const char *text, size_t *maxlen, qboolean ignorecolorcodes, const dp_font_t *fnt, float maxWidth)
-//{
-//     return DrawQ_TextWidth_Font_UntilWidth_TrackColors(text, maxlen, NULL, ignorecolorcodes, fnt, maxWidth);
-//}
-
 float DrawQ_TextWidth_Font_UntilWidth_Size(const char *text, size_t *maxlen, float w, float h, qboolean ignorecolorcodes, const dp_font_t *fnt, float maxWidth)
 {
        return DrawQ_TextWidth_Font_UntilWidth_TrackColors_Size(text, maxlen, w, h, NULL, ignorecolorcodes, fnt, maxWidth);
 }
 
-//float DrawQ_TextWidth_Font_UntilWidth_TrackColors(const char *text, size_t *maxlen, int *outcolor, qboolean ignorecolorcodes, const dp_font_t *fnt, float maxwidth)
-//{
-//     return DrawQ_TextWidth_Font_UntilWidth_TrackColors_Size(text, maxlen, 0, 0, outcolor, ignorecolorcodes, fnt, maxwidth);
-//}
-
 #if 0
 // not used
 // no ^xrgb management
diff --git a/sbar.c b/sbar.c
index 1d766fd11a803c3cc258fca42b03e1d96f2e9434..6672aa0f92984ecb5163d128723d0a732ee3e565 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -1202,14 +1202,14 @@ void Sbar_ShowFPS(void)
                fps_y = vid_conheight.integer - sbar_info_pos.integer - fps_height;
                if (soundstring[0])
                {
-                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font_Size(soundstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
+                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font(soundstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
                        DrawQ_Fill(fps_x, fps_y, vid_conwidth.integer - fps_x, fps_scaley, 0, 0, 0, 0.5, 0);
                        DrawQ_String_Font(fps_x, fps_y, soundstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
                        fps_y += fps_scaley;
                }
                if (fpsstring[0])
                {
-                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font_Size(fpsstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
+                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font(fpsstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
                        DrawQ_Fill(fps_x, fps_y, vid_conwidth.integer - fps_x, fps_scaley, 0, 0, 0, 0.5, 0);
                        if (red)
                                DrawQ_String_Font(fps_x, fps_y, fpsstring, 0, fps_scalex, fps_scaley, 1, 0, 0, 1, 0, NULL, true, FONT_INFOBAR);
@@ -1219,49 +1219,49 @@ void Sbar_ShowFPS(void)
                }
                if (timedemostring1[0])
                {
-                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font_Size(timedemostring1, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
+                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font(timedemostring1, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
                        DrawQ_Fill(fps_x, fps_y, vid_conwidth.integer - fps_x, fps_scaley, 0, 0, 0, 0.5, 0);
                        DrawQ_String_Font(fps_x, fps_y, timedemostring1, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
                        fps_y += fps_scaley;
                }
                if (timedemostring2[0])
                {
-                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font_Size(timedemostring2, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
+                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font(timedemostring2, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
                        DrawQ_Fill(fps_x, fps_y, vid_conwidth.integer - fps_x, fps_scaley, 0, 0, 0, 0.5, 0);
                        DrawQ_String_Font(fps_x, fps_y, timedemostring2, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
                        fps_y += fps_scaley;
                }
                if (timestring[0])
                {
-                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font_Size(timestring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
+                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font(timestring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
                        DrawQ_Fill(fps_x, fps_y, vid_conwidth.integer - fps_x, fps_scaley, 0, 0, 0, 0.5, 0);
                        DrawQ_String_Font(fps_x, fps_y, timestring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
                        fps_y += fps_scaley;
                }
                if (datestring[0])
                {
-                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font_Size(datestring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
+                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font(datestring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
                        DrawQ_Fill(fps_x, fps_y, vid_conwidth.integer - fps_x, fps_scaley, 0, 0, 0, 0.5, 0);
                        DrawQ_String_Font(fps_x, fps_y, datestring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
                        fps_y += fps_scaley;
                }
                if (speedstring[0])
                {
-                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font_Size(speedstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
+                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font(speedstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
                        DrawQ_Fill(fps_x, fps_y, vid_conwidth.integer - fps_x, fps_scaley, 0, 0, 0, 0.5, 0);
                        DrawQ_String_Font(fps_x, fps_y, speedstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
                        fps_y += fps_scaley;
                }
                if (topspeedstring[0])
                {
-                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font_Size(topspeedstring, 0, fps_scalex, fps_scaley, false, FONT_INFOBAR);
+                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font(topspeedstring, 0, fps_scalex, fps_scaley, false, FONT_INFOBAR);
                        DrawQ_Fill(fps_x, fps_y, vid_conwidth.integer - fps_x, fps_scaley, 0, 0, 0, 0.5, 0);
                        DrawQ_String_Font(fps_x, fps_y, topspeedstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, false, FONT_INFOBAR);
                        fps_y += fps_scaley;
                }
                if (blurstring[0])
                {
-                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font_Size(blurstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
+                       fps_x = vid_conwidth.integer - DrawQ_TextWidth_Font(blurstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
                        DrawQ_Fill(fps_x, fps_y, vid_conwidth.integer - fps_x, fps_scaley, 0, 0, 0, 0.5, 0);
                        DrawQ_String_Font(fps_x, fps_y, blurstring, 0, fps_scalex, fps_scaley, 1, 1, 1, 1, 0, NULL, true, FONT_INFOBAR);
                        fps_y += fps_scaley;