1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
/*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __CL_CONSOLE_H
#define __CL_CONSOLE_H
//
// console
//
/**************************************************************************/
/* CONSTANTS */
/**************************************************************************/
/* Maximal length of a command line */
#define MAXCMDLINE 256
/* Maximal amount of lines in the console's buffer */
#define CON_MAX_LINES 4096
/* Length of a line in the console's buffer */
#define CON_LINE_LENGTH 128
/* Maximal amount of in-game notifications */
#define CON_MAX_NOTIFY 4
/**************************************************************************/
/* DATA STRUCTURES */
/**************************************************************************/
/*
* The console's main data structure.
*
* It includes the console's buffers, notification timestamps, and display
* status.
*/
struct CON_console_s
{
/* Indicates that the console has been initialised */
qboolean initialised;
/* Text in the console buffer */
char text[ CON_MAX_LINES ][ CON_LINE_LENGTH ];
int lCount[ CON_MAX_LINES ];
/* Height of the various lines */
int heights[ CON_MAX_LINES ];
/* Amount of lines in the console buffer */
int lines;
/* Current line */
int curLine;
/* Offset in the current line */
int offset;
/* Time at which the last lines were generated - used for notifications */
float times[ CON_MAX_NOTIFY ];
int curTime;
/* Previous display parameters, if any */
int pWidth;
char pFace[ FNT_FACE_NAME_MAX ];
unsigned int pSize;
/* Offset from which the console is being displayed */
int displayOffset;
};
/* The console's main structure */
extern struct CON_console_s CON_console;
/**************************************************************************/
/* CONSOLE FUNCTIONS */
/**************************************************************************/
/*
* Initialise the console.
*
* This function prepares the console for text storage, and registers CVars
* and commands associated with both the console and the in-game chat line.
*/
void CON_Initialise( );
/*
* Add text to the console.
*
* This function prints text to the console's buffer. Notification timestamps
* are updated, and line heights are set to 0 for modified lines.
*
* Parameters:
* text the text to add
*/
void CON_Print( const char * text );
/*
* Clear the console.
*
* This function resets the console's buffer as well as notification
* timestamps.
*/
void CON_Clear( );
/*
* Draw the console.
*
* Parameters:
* relSize vertical size of the console relative to the screen's
* size
*/
void CON_DrawConsole( float relSize );
/*
* Show or hide the console
*/
void CON_ToggleConsole( );
/**************************************************************************/
/* NOTIFICATION FUNCTIONS */
/**************************************************************************/
/*
* Clear notification timestamps.
*
* This function resets the console's notification timestamps without
* affecting the rest of the console's data.
*/
void CON_ClearNotify( );
/*
* Draw the few last lines of the console transparently over the game.
*/
void CON_DrawNotify( );
/**************************************************************************/
/* CONSOLE LINE EDITION DATA */
/**************************************************************************/
extern char key_lines[32][MAXCMDLINE];
extern int edit_line;
extern int key_linepos;
extern int key_linelen;
#endif // __CL_CONSOLE_H
|