Debian Codegraph @

code/client/cl_console.c

raw symbols SCIP
1 /*
2 ===========================================================================
3 Copyright (C) 1999-2005 Id Software, Inc.
4
5 This file is part of Quake III Arena source code.
6
7 Quake III Arena source code is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the License,
10 or (at your option) any later version.
11
12 Quake III Arena source code is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Quake III Arena source code; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 ===========================================================================
21 */
22 // console.c
23
24 #include "client.h"
25
26
27 #define DEFAULT_CONSOLE_WIDTH 78
28 int g_console_field_width = DEFAULT_CONSOLE_WIDTH;
29 int g_smallchar_width = SMALLCHAR_WIDTH;
30 int g_smallchar_height = SMALLCHAR_HEIGHT;
31
32 #define NUM_CON_TIMES 17
33
34 #define CON_TEXTSIZE 32768
35 typedef struct {
36 qboolean initialized;
37
38 short text[CON_TEXTSIZE];
39 int current; // line where next message will be printed
40 int x; // offset in current line for next print
41 int display; // bottom of console displays this line
42
43 int linewidth; // characters across screen
44 int totallines; // total lines in console scrollback
45
46 float xadjust; // for wide aspect screens
47
48 float displayFrac; // aproaches finalFrac at scr_conspeed
49 float finalFrac; // 0.0 to 1.0 lines of console to display
50
51 int vislines; // in scanlines
52
53 int times[NUM_CON_TIMES]; // cls.realtime time the line was generated
54 // for transparent notify lines
55 vec4_t color;
56 } console_t;
57
58 console_t con;
59
60 cvar_t *con_conspeed;
61 cvar_t *con_autoclear;
62 cvar_t *con_notifytime;
63 cvar_t *con_notifylines;
64 cvar_t *con_scale;
65
66
67
68 /*
69 ================
70 Con_ToggleConsole_f
71 ================
72 */
73 void Con_ToggleConsole_f (void) {
74 // Can't toggle the console when it's the only thing available
75 if ( clc.state == CA_DISCONNECTED && Key_GetCatcher( ) == KEYCATCH_CONSOLE ) {
76 return;
77 }
78
79 if ( con_autoclear->integer ) {
80 Field_Clear( &g_consoleField );
81 }
82
83 g_consoleField.widthInChars = g_console_field_width;
84
85 Con_ClearNotify ();
86 Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_CONSOLE );
87 }
88
89 /*
90 ===================
91 Con_ToggleMenu_f
92 ===================
93 */
94 void Con_ToggleMenu_f( void ) {
95 CL_KeyEvent( K_ESCAPE, qtrue, Sys_Milliseconds() );
96 CL_KeyEvent( K_ESCAPE, qfalse, Sys_Milliseconds() );
97 }
98
99 /*
100 ================
101 Con_MessageMode_f
102 ================
103 */
104 void Con_MessageMode_f (void) {
105 chat_playerNum = -1;
106 chat_team = qfalse;
107 Field_Clear( &chatField );
108 chatField.widthInChars = 30;
109
110 Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_MESSAGE );
111 }
112
113 /*
114 ================
115 Con_MessageMode2_f
116 ================
117 */
118 void Con_MessageMode2_f (void) {
119 chat_playerNum = -1;
120 chat_team = qtrue;
121 Field_Clear( &chatField );
122 chatField.widthInChars = 25;
123 Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_MESSAGE );
124 }
125
126 /*
127 ================
128 Con_MessageMode3_f
129 ================
130 */
131 void Con_MessageMode3_f (void) {
132 chat_playerNum = VM_Call( cgvm, CG_CROSSHAIR_PLAYER );
133 if ( chat_playerNum < 0 || chat_playerNum >= MAX_CLIENTS ) {
134 chat_playerNum = -1;
135 return;
136 }
137 chat_team = qfalse;
138 Field_Clear( &chatField );
139 chatField.widthInChars = 30;
140 Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_MESSAGE );
141 }
142
143 /*
144 ================
145 Con_MessageMode4_f
146 ================
147 */
148 void Con_MessageMode4_f (void) {
149 chat_playerNum = VM_Call( cgvm, CG_LAST_ATTACKER );
150 if ( chat_playerNum < 0 || chat_playerNum >= MAX_CLIENTS ) {
151 chat_playerNum = -1;
152 return;
153 }
154 chat_team = qfalse;
155 Field_Clear( &chatField );
156 chatField.widthInChars = 30;
157 Key_SetCatcher( Key_GetCatcher( ) ^ KEYCATCH_MESSAGE );
158 }
159
160 /*
161 ================
162 Con_Clear_f
163 ================
164 */
165 void Con_Clear_f (void) {
166 int i;
167
168 for ( i = 0 ; i < CON_TEXTSIZE ; i++ ) {
169 con.text[i] = (ColorIndex(COLOR_WHITE)<<8) | ' ';
170 }
171
172 Con_Bottom(); // go to end
173 }
174
175
176 /*
177 ================
178 Con_Dump_f
179
180 Save the console contents out to a file
181 ================
182 */
183 void Con_Dump_f (void)
184 {
185 int l, x, i;
186 short *line;
187 fileHandle_t f;
188 int bufferlen;
189 char *buffer;
190 char filename[MAX_QPATH];
191
192 if (Cmd_Argc() != 2)
193 {
194 Com_Printf ("usage: condump <filename>\n");
195 return;
196 }
197
198 Q_strncpyz( filename, Cmd_Argv( 1 ), sizeof( filename ) );
199 COM_DefaultExtension( filename, sizeof( filename ), ".txt" );
200
201 if (!COM_CompareExtension(filename, ".txt"))
202 {
203 Com_Printf("Con_Dump_f: Only the \".txt\" extension is supported by this command!\n");
204 return;
205 }
206
207 f = FS_FOpenFileWrite_HomeData( filename );
208 if (!f)
209 {
210 Com_Printf ("ERROR: couldn't open %s.\n", filename);
211 return;
212 }
213
214 Com_Printf ("Dumped console text to %s.\n", filename );
215
216 // skip empty lines
217 for (l = con.current - con.totallines + 1 ; l <= con.current ; l++)
218 {
219 line = con.text + (l%con.totallines)*con.linewidth;
220 for (x=0 ; x<con.linewidth ; x++)
221 if ((line[x] & 0xff) != ' ')
222 break;
223 if (x != con.linewidth)
224 break;
225 }
226
227 #ifdef _WIN32
228 bufferlen = con.linewidth + 3 * sizeof ( char );
229 #else
230 bufferlen = con.linewidth + 2 * sizeof ( char );
231 #endif
232
233 buffer = Hunk_AllocateTempMemory( bufferlen );
234
235 // write the remaining lines
236 buffer[bufferlen-1] = 0;
237 for ( ; l <= con.current ; l++)
238 {
239 line = con.text + (l%con.totallines)*con.linewidth;
240 for(i=0; i<con.linewidth; i++)
241 buffer[i] = line[i] & 0xff;
242 for (x=con.linewidth-1 ; x>=0 ; x--)
243 {
244 if (buffer[x] == ' ')
245 buffer[x] = 0;
246 else
247 break;
248 }
249 #ifdef _WIN32
250 Q_strcat(buffer, bufferlen, "\r\n");
251 #else
252 Q_strcat(buffer, bufferlen, "\n");
253 #endif
254 FS_Write(buffer, strlen(buffer), f);
255 }
256
257 Hunk_FreeTempMemory( buffer );
258 FS_FCloseFile( f );
259 }
260
261
262 /*
263 ================
264 Con_ClearNotify
265 ================
266 */
267 void Con_ClearNotify( void ) {
268 int i;
269
270 for ( i = 0 ; i < NUM_CON_TIMES ; i++ ) {
271 con.times[i] = 0;
272 }
273 }
274
275
276
277 /*
278 ================
279 Con_CheckResize
280
281 If the line width has changed, reformat the buffer.
282 ================
283 */
284 void Con_CheckResize (void)
285 {
286 int i, j, width, oldwidth, oldtotallines, numlines, numchars;
287 short tbuf[CON_TEXTSIZE];
288
289 if (con_scale != NULL)
290 {
291 g_smallchar_width = (int)((float)SMALLCHAR_WIDTH * con_scale->value);
292 g_smallchar_height = (int)((float)SMALLCHAR_HEIGHT * con_scale->value);
293 }
294
295 width = (cls.glconfig.vidWidth / g_smallchar_width) - 2;
296
297 if (width == con.linewidth)
298 return;
299
300 if (width < 1) // video hasn't been initialized yet
301 {
302 width = DEFAULT_CONSOLE_WIDTH;
303 con.linewidth = width;
304 con.totallines = CON_TEXTSIZE / con.linewidth;
305 for(i=0; i<CON_TEXTSIZE; i++)
306
307 con.text[i] = (ColorIndex(COLOR_WHITE)<<8) | ' ';
308 }
309 else
310 {
311 oldwidth = con.linewidth;
312 con.linewidth = width;
313 oldtotallines = con.totallines;
314 con.totallines = CON_TEXTSIZE / con.linewidth;
315 numlines = oldtotallines;
316
317 if (con.totallines < numlines)
318 numlines = con.totallines;
319
320 numchars = oldwidth;
321
322 if (con.linewidth < numchars)
323 numchars = con.linewidth;
324
325 Com_Memcpy (tbuf, con.text, CON_TEXTSIZE * sizeof(short));
326 for(i=0; i<CON_TEXTSIZE; i++)
327
328 con.text[i] = (ColorIndex(COLOR_WHITE)<<8) | ' ';
329
330
331 for (i=0 ; i<numlines ; i++)
332 {
333 for (j=0 ; j<numchars ; j++)
334 {
335 con.text[(con.totallines - 1 - i) * con.linewidth + j] =
336 tbuf[((con.current - i + oldtotallines) %
337 oldtotallines) * oldwidth + j];
338 }
339 }
340
341 Con_ClearNotify ();
342 }
343
344 con.current = con.totallines - 1;
345 con.display = con.current;
346 }
347
348 /*
349 ==================
350 Cmd_CompleteTxtName
351 ==================
352 */
353 void Cmd_CompleteTxtName( char *args, int argNum ) {
354 if( argNum == 2 ) {
355 Field_CompleteFilename( "", "txt", NULL, qfalse, qtrue );
356 }
357 }
358
359
360 /*
361 ================
362 Con_Init
363 ================
364 */
365 void Con_Init (void) {
366 int i;
367
368 con_notifytime = Cvar_Get ("con_notifytime", "3", CVAR_ARCHIVE);
369 con_notifylines = Cvar_Get ("con_notifylines", "3", CVAR_ARCHIVE);
370 Cvar_CheckRange(con_notifylines, 1, NUM_CON_TIMES - 1, qtrue);
371 con_conspeed = Cvar_Get ("scr_conspeed", "3", CVAR_ARCHIVE);
372 con_autoclear = Cvar_Get("con_autoclear", "1", CVAR_ARCHIVE);
373 con_scale = Cvar_Get("con_scale", "1", CVAR_ARCHIVE);
374 Cvar_CheckRange(con_scale, 1.0f, 4.0f, qfalse);
375
376 Field_Clear( &g_consoleField );
377 g_consoleField.widthInChars = g_console_field_width;
378 for ( i = 0 ; i < COMMAND_HISTORY ; i++ ) {
379 Field_Clear( &historyEditLines[i] );
380 historyEditLines[i].widthInChars = g_console_field_width;
381 }
382 CL_LoadConsoleHistory( );
383
384 Cmd_AddCommand ("toggleconsole", Con_ToggleConsole_f);
385 Cmd_AddCommand ("togglemenu", Con_ToggleMenu_f);
386 Cmd_AddCommand ("messagemode", Con_MessageMode_f);
387 Cmd_AddCommand ("messagemode2", Con_MessageMode2_f);
388 Cmd_AddCommand ("messagemode3", Con_MessageMode3_f);
389 Cmd_AddCommand ("messagemode4", Con_MessageMode4_f);
390 Cmd_AddCommand ("clear", Con_Clear_f);
391 Cmd_AddCommand ("condump", Con_Dump_f);
392 Cmd_SetCommandCompletionFunc( "condump", Cmd_CompleteTxtName );
393 }
394
395 /*
396 ================
397 Con_Shutdown
398 ================
399 */
400 void Con_Shutdown(void)
401 {
402 Cmd_RemoveCommand("toggleconsole");
403 Cmd_RemoveCommand("togglemenu");
404 Cmd_RemoveCommand("messagemode");
405 Cmd_RemoveCommand("messagemode2");
406 Cmd_RemoveCommand("messagemode3");
407 Cmd_RemoveCommand("messagemode4");
408 Cmd_RemoveCommand("clear");
409 Cmd_RemoveCommand("condump");
410 }
411
412 /*
413 ===============
414 Con_Linefeed
415 ===============
416 */
417 void Con_Linefeed (qboolean skipnotify)
418 {
419 int i;
420
421 // mark time for transparent overlay
422 if (con.current >= 0)
423 {
424 if (skipnotify)
425 con.times[con.current % NUM_CON_TIMES] = 0;
426 else
427 con.times[con.current % NUM_CON_TIMES] = cls.realtime;
428 }
429
430 con.x = 0;
431 if (con.display == con.current)
432 con.display++;
433 con.current++;
434 for(i=0; i<con.linewidth; i++)
435 con.text[(con.current%con.totallines)*con.linewidth+i] = (ColorIndex(COLOR_WHITE)<<8) | ' ';
436 }
437
438 /*
439 ================
440 CL_ConsolePrint
441
442 Handles cursor positioning, line wrapping, etc
443 All console printing must go through this in order to be logged to disk
444 If no console is visible, the text will appear at the top of the game window
445 ================
446 */
447 void CL_ConsolePrint( char *txt ) {
448 int y, l;
449 unsigned char c;
450 unsigned short color;
451 qboolean skipnotify = qfalse; // NERVE - SMF
452 int prev; // NERVE - SMF
453
454 // TTimo - prefix for text that shows up in console but not in notify
455 // backported from RTCW
456 if ( !Q_strncmp( txt, "[skipnotify]", 12 ) ) {
457 skipnotify = qtrue;
458 txt += 12;
459 }
460
461 // for some demos we don't want to ever show anything on the console
462 if ( cl_noprint && cl_noprint->integer ) {
463 return;
464 }
465
466 if (!con.initialized) {
467 con.color[0] =
468 con.color[1] =
469 con.color[2] =
470 con.color[3] = 1.0f;
471 con.linewidth = -1;
472 Con_CheckResize ();
473 con.initialized = qtrue;
474 }
475
476 color = ColorIndex(COLOR_WHITE);
477
478 while ( (c = *((unsigned char *) txt)) != 0 ) {
479 if ( Q_IsColorString( txt ) ) {
480 color = ColorIndex( *(txt+1) );
481 txt += 2;
482 continue;
483 }
484
485 // count word length
486 for (l=0 ; l< con.linewidth ; l++) {
487 if ( txt[l] <= ' ') {
488 break;
489 }
490
491 }
492
493 // word wrap
494 if (l != con.linewidth && (con.x + l >= con.linewidth) ) {
495 Con_Linefeed(skipnotify);
496
497 }
498
499 txt++;
500
501 switch (c)
502 {
503 case '\n':
504 Con_Linefeed (skipnotify);
505 break;
506 case '\r':
507 con.x = 0;
508 break;
509 default: // display character and advance
510 y = con.current % con.totallines;
511 con.text[y*con.linewidth+con.x] = (color << 8) | c;
512 con.x++;
513 if(con.x >= con.linewidth)
514 Con_Linefeed(skipnotify);
515 break;
516 }
517 }
518
519
520 // mark time for transparent overlay
521 if (con.current >= 0) {
522 // NERVE - SMF
523 if ( skipnotify ) {
524 prev = con.current % NUM_CON_TIMES - 1;
525 if ( prev < 0 )
526 prev = NUM_CON_TIMES - 1;
527 con.times[prev] = 0;
528 }
529 else
530 // -NERVE - SMF
531 con.times[con.current % NUM_CON_TIMES] = cls.realtime;
532 }
533 }
534
535
536 /*
537 ==============================================================================
538
539 DRAWING
540
541 ==============================================================================
542 */
543
544
545 /*
546 ================
547 Con_DrawInput
548
549 Draw the editline after a ] prompt
550 ================
551 */
552 void Con_DrawInput (void) {
553 int y;
554
555 if ( clc.state != CA_DISCONNECTED && !(Key_GetCatcher( ) & KEYCATCH_CONSOLE ) ) {
556 return;
557 }
558
559 y = con.vislines - ( g_smallchar_height * 2 );
560
561 re.SetColor( con.color );
562
563 SCR_DrawSmallChar( con.xadjust + 1 * g_smallchar_width, y, ']' );
564
565 Field_Draw( &g_consoleField, con.xadjust + 2 * g_smallchar_width, y,
566 SCREEN_WIDTH - 3 * g_smallchar_width, qtrue, qtrue );
567 }
568
569
570 /*
571 ================
572 Con_DrawNotify
573
574 Draws the last few lines of output transparently over the game top
575 ================
576 */
577 void Con_DrawNotify (void)
578 {
579 int x, v;
580 short *text;
581 int i;
582 int time;
583 int skip;
584 int currentColor;
585
586 currentColor = 7;
587 re.SetColor( g_color_table[currentColor] );
588
589 v = 0;
590 for (i= con.current-con_notifylines->integer ; i<=con.current ; i++)
591 {
592 int linelength = 0;
593
594 if (i < 0)
595 continue;
596 time = con.times[i % NUM_CON_TIMES];
597 if (time == 0)
598 continue;
599 time = cls.realtime - time;
600 if (time > con_notifytime->value*1000)
601 continue;
602 text = con.text + (i % con.totallines)*con.linewidth;
603
604 if (cl.snap.ps.pm_type != PM_INTERMISSION && Key_GetCatcher( ) & (KEYCATCH_UI | KEYCATCH_CGAME) ) {
605 continue;
606 }
607
608 for (x = 0 ; x < con.linewidth ; x++) {
609 if ( ( text[x] & 0xff ) == ' ' ) {
610 continue;
611 }
612 if ( ColorIndexForNumber( text[x]>>8 ) != currentColor ) {
613 currentColor = ColorIndexForNumber( text[x]>>8 );
614 re.SetColor( g_color_table[currentColor] );
615 }
616 SCR_DrawSmallChar( cl_conXOffset->integer + con.xadjust + (x+1)*g_smallchar_width, v, text[x] & 0xff );
617 linelength++;
618 }
619
620 if (linelength > 0) {
621 v += g_smallchar_height;
622 }
623 }
624
625 // v is in native coordinates, convert to 640x480 for SCR_DrawBigString
626 v *= 480.0f / cls.glconfig.vidHeight;
627 v += 8;
628
629 re.SetColor( NULL );
630
631 if (Key_GetCatcher( ) & (KEYCATCH_UI | KEYCATCH_CGAME) ) {
632 return;
633 }
634
635 // draw the chat line
636 if ( Key_GetCatcher( ) & KEYCATCH_MESSAGE )
637 {
638 if (chat_team)
639 {
640 SCR_DrawBigString (8, v, "say_team:", 1.0f, qfalse );
641 skip = 10;
642 }
643 else
644 {
645 SCR_DrawBigString (8, v, "say:", 1.0f, qfalse );
646 skip = 5;
647 }
648
649 Field_BigDraw( &chatField, skip * BIGCHAR_WIDTH, v,
650 SCREEN_WIDTH - ( skip + 1 ) * BIGCHAR_WIDTH, qtrue, qtrue );
651 }
652
653 }
654
655 /*
656 ================
657 Con_DrawSolidConsole
658
659 Draws the console with the solid background
660 ================
661 */
662 void Con_DrawSolidConsole( float frac ) {
663 int i, x, y;
664 int rows;
665 short *text;
666 int row;
667 int lines;
668 // qhandle_t conShader;
669 int currentColor;
670 vec4_t color;
671
672 lines = cls.glconfig.vidHeight * frac;
673 if (lines <= 0)
674 return;
675
676 if (lines > cls.glconfig.vidHeight )
677 lines = cls.glconfig.vidHeight;
678
679 // on wide screens, we will center the text
680 con.xadjust = 0;
681 SCR_AdjustFrom640( &con.xadjust, NULL, NULL, NULL );
682
683 // draw the background
684 y = frac * SCREEN_HEIGHT;
685 if ( y < 1 ) {
686 y = 0;
687 }
688 else {
689 SCR_DrawPic( 0, 0, SCREEN_WIDTH, y, cls.consoleShader );
690 }
691
692 color[0] = 1;
693 color[1] = 0;
694 color[2] = 0;
695 color[3] = 1;
696 SCR_FillRect( 0, y, SCREEN_WIDTH, 2, color );
697
698
699 // draw the version number
700
701 re.SetColor( g_color_table[ColorIndex(COLOR_RED)] );
702
703 i = strlen( Q3_VERSION );
704
705 for (x=0 ; x<i ; x++) {
706 SCR_DrawSmallChar( cls.glconfig.vidWidth - ( i - x + 1 ) * g_smallchar_width,
707 lines - g_smallchar_height, Q3_VERSION[x] );
708 }
709
710
711 // draw the text
712 con.vislines = lines;
713 rows = (lines-g_smallchar_height)/g_smallchar_height; // rows of text to draw
714
715 y = lines - (g_smallchar_height*3);
716
717 // draw from the bottom up
718 if (con.display != con.current)
719 {
720 // draw arrows to show the buffer is backscrolled
721 re.SetColor( g_color_table[ColorIndex(COLOR_RED)] );
722 for (x=0 ; x<con.linewidth ; x+=4)
723 SCR_DrawSmallChar( con.xadjust + (x+1)*g_smallchar_width, y, '^' );
724 y -= g_smallchar_height;
725 rows--;
726 }
727
728 row = con.display;
729
730 if ( con.x == 0 ) {
731 row--;
732 }
733
734 currentColor = 7;
735 re.SetColor( g_color_table[currentColor] );
736
737 for (i=0 ; i<rows ; i++, y -= g_smallchar_height, row--)
738 {
739 if (row < 0)
740 break;
741 if (con.current - row >= con.totallines) {
742 // past scrollback wrap point
743 continue;
744 }
745
746 text = con.text + (row % con.totallines)*con.linewidth;
747
748 for (x=0 ; x<con.linewidth ; x++) {
749 if ( ( text[x] & 0xff ) == ' ' ) {
750 continue;
751 }
752
753 if ( ColorIndexForNumber( text[x]>>8 ) != currentColor ) {
754 currentColor = ColorIndexForNumber( text[x]>>8 );
755 re.SetColor( g_color_table[currentColor] );
756 }
757 SCR_DrawSmallChar( con.xadjust + (x+1)*g_smallchar_width, y, text[x] & 0xff );
758 }
759 }
760
761 // draw the input prompt, user text, and cursor if desired
762 Con_DrawInput ();
763
764 re.SetColor( NULL );
765 }
766
767
768
769 /*
770 ==================
771 Con_DrawConsole
772 ==================
773 */
774 void Con_DrawConsole( void ) {
775 // check for console width changes from a vid mode change
776 Con_CheckResize ();
777
778 // if disconnected, render console full screen
779 if ( clc.state == CA_DISCONNECTED ) {
780 if ( !( Key_GetCatcher( ) & (KEYCATCH_UI | KEYCATCH_CGAME)) ) {
781 Con_DrawSolidConsole( 1.0 );
782 return;
783 }
784 }
785
786 if ( con.displayFrac ) {
787 Con_DrawSolidConsole( con.displayFrac );
788 } else {
789 // draw notify lines
790 if ( clc.state == CA_ACTIVE ) {
791 Con_DrawNotify ();
792 }
793 }
794 }
795
796 //================================================================
797
798 /*
799 ==================
800 Con_RunConsole
801
802 Scroll it up or down
803 ==================
804 */
805 void Con_RunConsole (void) {
806 // decide on the destination height of the console
807 if ( Key_GetCatcher( ) & KEYCATCH_CONSOLE )
808 con.finalFrac = 0.5; // half screen
809 else
810 con.finalFrac = 0; // none visible
811
812 // scroll towards the destination height
813 if (con.finalFrac < con.displayFrac)
814 {
815 con.displayFrac -= con_conspeed->value*cls.realFrametime*0.001;
816 if (con.finalFrac > con.displayFrac)
817 con.displayFrac = con.finalFrac;
818
819 }
820 else if (con.finalFrac > con.displayFrac)
821 {
822 con.displayFrac += con_conspeed->value*cls.realFrametime*0.001;
823 if (con.finalFrac < con.displayFrac)
824 con.displayFrac = con.finalFrac;
825 }
826
827 }
828
829
830 void Con_PageUp( void ) {
831 con.display -= 2;
832 if ( con.current - con.display >= con.totallines ) {
833 con.display = con.current - con.totallines + 1;
834 }
835 }
836
837 void Con_PageDown( void ) {
838 con.display += 2;
839 if (con.display > con.current) {
840 con.display = con.current;
841 }
842 }
843
844 void Con_Top( void ) {
845 con.display = con.totallines;
846 if ( con.current - con.display >= con.totallines ) {
847 con.display = con.current - con.totallines + 1;
848 }
849 }
850
851 void Con_Bottom( void ) {
852 con.display = con.current;
853 }
854
855
856 void Con_Close( void ) {
857 if ( !com_cl_running->integer ) {
858 return;
859 }
860 Field_Clear( &g_consoleField );
861 Con_ClearNotify ();
862 Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_CONSOLE );
863 con.finalFrac = 0; // none visible
864 con.displayFrac = 0;
865 }