]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - console.c
change representation of string offsets for allocated strings and engine
[xonotic/darkplaces.git] / console.c
index 7f814c26bdd488d321754b905b43ba326be1a036..455b6c330acd901cf76a466ea1d2b4e747400754 100644 (file)
--- a/console.c
+++ b/console.c
@@ -1383,9 +1383,9 @@ void Con_DrawInput (void)
 
        y = (int)strlen(text);
 
-// fill out remainder with spaces
-       for (i = y; i < (int)sizeof(editlinecopy)-1; i++)
-               text[i] = ' ';
+       // append enoug nul-bytes to cover the utf8-versions of the cursor too
+       for (i = y; i < y + 4 && i < (int)sizeof(editlinecopy); ++i)
+               text[i] = 0;
 
        // add the cursor frame
        if ((int)(realtime*con_cursorspeed) & 1)                // cursor is visible
@@ -1415,7 +1415,7 @@ void Con_DrawInput (void)
                x = 0;
 
        // draw it
-       DrawQ_String(x, con_vislines - con_textsize.value*2, text, 0, con_textsize.value, con_textsize.value, 1.0, 1.0, 1.0, 1.0, 0, NULL, false, FONT_CONSOLE );
+       DrawQ_String(x, con_vislines - con_textsize.value*2, text, y + 3, con_textsize.value, con_textsize.value, 1.0, 1.0, 1.0, 1.0, 0, NULL, false, FONT_CONSOLE );
 
        // remove cursor
 //     key_line[key_linepos] = 0;
@@ -1769,6 +1769,7 @@ void Con_DrawConsole (int lines)
 {
        int mask_must = 0;
        int mask_mustnot = developer.integer ? 0 : CON_MASK_DEVELOPER;
+       cachepic_t *conbackpic;
 
        if (lines <= 0)
                return;
@@ -1779,8 +1780,12 @@ void Con_DrawConsole (int lines)
        con_vislines = 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(vid_conwidth.integer - DrawQ_TextWidth(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);
+       conbackpic = scr_conbrightness.value >= 0.01f ? Draw_CachePic("gfx/conback") : NULL;
+       if (conbackpic && conbackpic->tex != r_texture_notexture)
+               DrawQ_Pic(0, lines - vid_conheight.integer, conbackpic, vid_conwidth.integer, vid_conheight.integer, scr_conbrightness.value, scr_conbrightness.value, scr_conbrightness.value, cls.signon == SIGNONS ? scr_conalpha.value : 1.0f, 0); // always full alpha when not in game
+       else
+               DrawQ_Fill(0, lines - vid_conheight.integer, vid_conwidth.integer, vid_conheight.integer, 0.0f, 0.0f, 0.0f, cls.signon == SIGNONS ? scr_conalpha.value : 1.0f, 0); // always full alpha when not in game
+       DrawQ_String(vid_conwidth.integer - DrawQ_TextWidth(engineversion, 0, con_textsize.value, con_textsize.value, 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
@@ -2166,7 +2171,6 @@ int Nicks_CompleteCountPossible(char *line, int pos, char *s, qboolean isCon)
 {
        char name[128];
        int i, p;
-       int length;
        int match;
        int spos;
        int count = 0;
@@ -2190,7 +2194,6 @@ int Nicks_CompleteCountPossible(char *line, int pos, char *s, qboolean isCon)
                if(!name[0])
                        continue;
 
-               length = strlen(name);
                match = -1;
                spos = pos - 1; // no need for a minimum of characters :)
 
@@ -2748,7 +2751,7 @@ void Con_CompleteCommandLine (void)
        a = Cmd_CompleteAliasCountPossible(s);
        if (a)
        {
-               Con_Printf("\n%i possible aliases%s\n", a, (a > 1) ? "s: " : ":");
+               Con_Printf("\n%i possible alias%s\n", a, (a > 1) ? "es: " : ":");
                Cmd_CompleteAliasPrint(s);
        }
        n = Nicks_CompleteCountPossible(key_line, key_linepos, s, true);