Backscrolling fix.

This commit is contained in:
Anton E. Gavrilov 2000-04-02 22:01:39 +00:00
parent 9e4cee29a2
commit 37859bbd4e
3 changed files with 18 additions and 13 deletions

View File

@ -128,6 +128,10 @@ void Con_Clear_f (void)
{
Q_memset (con_main.text, ' ', CON_TEXTSIZE);
Q_memset (con_chat.text, ' ', CON_TEXTSIZE);
con_main.numlines = 0;
con_chat.numlines = 0;
con_main.display = con_main.current;
con_chat.display = con_chat.current;
}
@ -288,6 +292,8 @@ void Con_Linefeed (void)
if (con->display == con->current)
con->display++;
con->current++;
if (con->numlines < con_totallines)
con->numlines++;
Q_memset (&con->text[(con->current%con_totallines)*con_linewidth]
, ' ', con_linewidth);
}
@ -400,6 +406,7 @@ void Con_Printf (char *fmt, ...)
// write it to the scrollable buffer
Con_Print (msg);
#if 0
// update the screen immediately if the console is displayed
if (cls.state != ca_active)
{
@ -412,6 +419,7 @@ void Con_Printf (char *fmt, ...)
inupdate = false;
}
}
#endif
}
/*

View File

@ -42,6 +42,7 @@ typedef struct
int current; // line where next message will be printed
int x; // offset in current line for next print
int display; // bottom of console displays this line
int numlines; // number of non-blank text lines, used for backscroling
} console_t;
extern console_t con_main;

View File

@ -56,8 +56,6 @@ cvar_t *cl_constyle;
#define MAXCMDLINE 256
char key_lines[32][MAXCMDLINE];
int key_linepos;
int shift_down=false;
int ctrl_down=false;
int key_lastpress;
int edit_line=0;
@ -365,6 +363,7 @@ no_lf:
case K_MWHEELUP:
case KP_PGUP:
case K_PGUP:
if (con->display - con->current + con->numlines > 2)
con->display -= 2;
return;
@ -378,15 +377,18 @@ no_lf:
case KP_HOME:
case K_HOME:
if (ctrl_down)
con->display = con->current - con_totallines + 10;
if (keydown[K_CTRL])
{
if (con->numlines > 10)
con->display = con->current - con->numlines + 10;
}
else
key_linepos = 1;
return;
case KP_END:
case K_END:
if (ctrl_down)
if (keydown[K_CTRL])
con->display = con->current;
else
key_linepos = strlen(key_lines[edit_line]);
@ -817,12 +819,6 @@ void Key_Event (int key, qboolean down)
Con_Printf ("%s is unbound, hit F4 to set.\n", Key_KeynumToString (key) );
}
if (key == K_SHIFT)
shift_down = down;
if (key == K_CTRL)
ctrl_down = down;
if (key_dest == key_message && cls.state != ca_active)
key_dest = key_console;
@ -917,7 +913,7 @@ void Key_Event (int key, qboolean down)
if (!down)
return; // other systems only care about key down events
if (shift_down)
if (keydown[K_SHIFT])
key = keyshift[key];
switch (key_dest)