mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-10 01:31:14 +00:00
console.c:Con_DrawInput(): some changes for correctness and simplicity
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@603 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
6960e71279
commit
296dc11b52
1 changed files with 7 additions and 13 deletions
|
@ -1139,31 +1139,25 @@ void Con_DrawInput (void)
|
||||||
extern qpic_t *pic_ovr, *pic_ins; //johnfitz -- new cursor handling
|
extern qpic_t *pic_ovr, *pic_ins; //johnfitz -- new cursor handling
|
||||||
extern double key_blinktime;
|
extern double key_blinktime;
|
||||||
extern int key_insert;
|
extern int key_insert;
|
||||||
int i, len;
|
int i, ofs;
|
||||||
char c[MAXCMDLINE+1] /* extra space == +1 */, *text;
|
|
||||||
|
|
||||||
if (key_dest != key_console && !con_forcedup)
|
if (key_dest != key_console && !con_forcedup)
|
||||||
return; // don't draw anything
|
return; // don't draw anything
|
||||||
|
|
||||||
text = strcpy(c, key_lines[edit_line]);
|
|
||||||
|
|
||||||
// pad with one space so we can draw one past the string (in case the cursor is there)
|
|
||||||
len = strlen(key_lines[edit_line]);
|
|
||||||
text[len] = ' ';
|
|
||||||
text[len+1] = 0;
|
|
||||||
|
|
||||||
// prestep if horizontally scrolling
|
// prestep if horizontally scrolling
|
||||||
if (key_linepos >= con_linewidth)
|
if (key_linepos >= con_linewidth)
|
||||||
text += key_linepos - con_linewidth;
|
ofs = 1 + key_linepos - con_linewidth;
|
||||||
|
else
|
||||||
|
ofs = 0;
|
||||||
|
|
||||||
// draw input string
|
// draw input string
|
||||||
for (i = 0; i < q_min((int)strlen(text), con_linewidth + 1); i++) //only write enough letters to go from *text to cursor
|
for (i = 0; key_lines[edit_line][i+ofs] && i < con_linewidth; i++)
|
||||||
Draw_Character ((i+1)<<3, vid.conheight - 16, text[i]);
|
Draw_Character ((i+1)<<3, vid.conheight - 16, key_lines[edit_line][i+ofs]);
|
||||||
|
|
||||||
// johnfitz -- new cursor handling
|
// johnfitz -- new cursor handling
|
||||||
if (!((int)((realtime-key_blinktime)*con_cursorspeed) & 1))
|
if (!((int)((realtime-key_blinktime)*con_cursorspeed) & 1))
|
||||||
{
|
{
|
||||||
i = key_linepos < con_linewidth ? key_linepos : con_linewidth;
|
i = key_linepos - ofs;
|
||||||
Draw_Pic ((i+1)<<3, vid.conheight - 16, key_insert ? pic_ins : pic_ovr);
|
Draw_Pic ((i+1)<<3, vid.conheight - 16, key_insert ? pic_ins : pic_ovr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue