]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Autocompletion by # SHIFT-TAB: display players names left aligned in the infobar
authorterencehill <piuntn@gmail.com>
Fri, 27 Sep 2024 21:07:51 +0000 (23:07 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 27 Sep 2024 21:07:51 +0000 (23:07 +0200)
cl_screen.c
cl_screen.h
console.c

index cb14dbb5cc5a99b55c9b5fe1a4e14920b7a02951..72e0d8525d37459511f409ccd85b96e09aab5576 100644 (file)
@@ -132,6 +132,7 @@ int                 scr_erase_lines;
 int                    scr_erase_center;
 char        scr_infobarstring[MAX_INPUTLINE];
 float       scr_infobartime_off;
+qbool       scr_infobartime_left_align;
 
 /*
 ==============
@@ -582,7 +583,10 @@ static int SCR_DrawInfobarString(int offset)
        float size = scr_infobar_height.value;
 
        len = (int)strlen(scr_infobarstring);
-       x = (vid_conwidth.integer - DrawQ_TextWidth(scr_infobarstring, len, size, size, false, FONT_INFOBAR)) / 2;
+       if (scr_infobartime_left_align)
+               x = 0;
+       else
+               x = (vid_conwidth.integer - DrawQ_TextWidth(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(x, y, scr_infobarstring, len, size, size, 1, 1, 1, 1, 0, NULL, false, FONT_INFOBAR);
@@ -684,10 +688,11 @@ static int SCR_InfobarHeight(void)
        return offset;
 }
 
-int SCR_Infobar(float bartime, char *barstring)
+void SCR_Infobar(float bartime, char *barstring, qbool left_align)
 {
        scr_infobartime_off = bartime;
        dp_strlcpy(scr_infobarstring, barstring, sizeof(scr_infobarstring));
+       scr_infobartime_left_align = left_align;
 }
 
 
@@ -702,6 +707,7 @@ static void SCR_InfoBar_f(cmd_state_t *cmd)
        {
                scr_infobartime_off = atof(Cmd_Argv(cmd, 1));
                dp_strlcpy(scr_infobarstring, Cmd_Argv(cmd, 2), sizeof(scr_infobarstring));
+               scr_infobartime_left_align = false;
        }
        else
        {
index 798861e76e12fa7ec3b8c598b7e1e687f4d451de..c431a9d7ecceb3daa169fb727eb415ffcbf39fa5 100644 (file)
@@ -27,7 +27,7 @@ void CL_UpdateScreen(void);
 qbool R_Stereo_Active(void);
 qbool R_Stereo_ColorMasking(void);
 
-int SCR_Infobar(float bartime, char *barstring);
+void SCR_Infobar(float bartime, char *barstring, qbool left_align);
 
 #endif
 
index 3667204fc9ce27f017aef0b109a15df713bebbdc..22ba40feaa8fadac77b0e63afd23a319cc1c5372 100644 (file)
--- a/console.c
+++ b/console.c
@@ -2644,7 +2644,7 @@ static void Cmd_CompleteNicksPrint(int count, int hash_completion, qbool infobar
                        }
                }
 
-               SCR_Infobar(2, pl_list);
+               SCR_Infobar(2, pl_list, true);
                return;
        }