]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_draw.c
made reconnect command reconnect to the last server you were on, even if it was an...
[xonotic/darkplaces.git] / gl_draw.c
index a1374cd3d0c0d3dbd2709059bd1a2aac275872c9..9b13f17d079a691a41fa9135037177a7da5bcd43 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "cl_video.h"
 
-cvar_t r_textshadow = {0, "r_textshadow", "0", "draws a shadow on all text to improve readability"};
+cvar_t r_textshadow = {CVAR_SAVE, "r_textshadow", "0", "draws a shadow on all text to improve readability"};
 
 static rtexture_t *char_texture;
 cachepic_t *r_crosshairs[NUMCROSSHAIRS+1];
@@ -511,6 +511,9 @@ static void gl_draw_start(void)
        char_texture = Draw_CachePic("gfx/conchars", true)->tex;
        for (i = 1;i <= NUMCROSSHAIRS;i++)
                r_crosshairs[i] = Draw_CachePic(va("gfx/crosshair%i", i), true);
+
+       // draw the loading screen so people have something to see in the newly opened window
+       SCR_UpdateLoadingScreen(true);
 }
 
 static void gl_draw_shutdown(void)
@@ -643,8 +646,12 @@ void DrawQ_String_Real(float x, float y, const char *string, int maxlen, float w
 
 void DrawQ_String(float x, float y, const char *string, int maxlen, float scalex, float scaley, float red, float green, float blue, float alpha, int flags)
 {
-       if (r_textshadow.integer)
-               DrawQ_String_Real(x+scalex*0.25,y+scaley*0.25,string,maxlen,scalex,scaley,0,0,0,alpha*0.8,flags);
+       float shadow;
+       if (r_textshadow.integer) {
+               shadow = (1-((red+green+blue)));
+               shadow = bound(0, shadow, 1);
+               DrawQ_String_Real(x+scalex*0.25,y+scaley*0.25,string,maxlen,scalex,scaley,shadow,shadow,shadow,alpha*0.8,flags);
+       }
 
        DrawQ_String_Real(x,y,string,maxlen,scalex,scaley,red,green,blue,alpha,flags);
 }
@@ -680,7 +687,7 @@ static vec4_t string_colors[] =
 #define STRING_COLORS_COUNT    (sizeof(string_colors) / sizeof(vec4_t))
 
 // color is read and changed in the end
-void DrawQ_ColoredString( float x, float y, const char *text, int maxlen, float scalex, float scaley, float basered, float basegreen, float baseblue, float basealpha, int flags, int *outcolor )
+float DrawQ_ColoredString( float x, float y, const char *text, int maxlen, float scalex, float scaley, float basered, float basegreen, float baseblue, float basealpha, int flags, int *outcolor )
 {
        vec_t *color;
        int len;
@@ -751,10 +758,22 @@ void DrawQ_ColoredString( float x, float y, const char *text, int maxlen, float
                }
        }
 
+       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)