Console related code. More...
#include "cl_console.h"
#include "client.h"
#include "cl_game.h"
#include "input/cl_keys.h"
#include "renderer/r_draw.h"
Go to the source code of this file.
Data Structures | |
struct | console_t |
Defines | |
#define | CONSOLE_CHAR_ALIGN 4 |
#define | NUM_CON_TIMES 8 |
#define | COLORED_TEXT_MASK 128 |
#define | CON_TEXTSIZE 32768 |
#define | CONSOLE_CURSOR_CHAR 11 |
#define | CONSOLE_HISTORY_FILENAME "history" |
Functions | |
static void | Con_DisplayString (int x, int y, const char *s) |
static void | Key_ClearTyping (void) |
void | Con_ToggleConsole_f (void) |
static void | Con_ToggleChat_f (void) |
static void | Con_Clear_f (void) |
Clears the console buffer. | |
void | Con_Scroll (int scroll) |
Scrolls the console. | |
void | Con_ClearNotify (void) |
Clear the notify times to ensure that every message will disappear from screen. | |
static void | Con_MessageModeSay_f (void) |
static void | Con_MessageModeSayTeam_f (void) |
void | Con_CheckResize (void) |
If the line width has changed, reformat the buffer. | |
void | Con_LoadConsoleHistory (void) |
Load the console history. | |
void | Con_SaveConsoleHistory (void) |
Stores the console history. | |
void | Con_Init (void) |
static void | Con_Linefeed (void) |
void | Con_Print (const char *txt) |
Handles cursor positioning, line wrapping, etc All console printing must go through this in order to be logged to disk If no console is visible, the text will appear at the top of the game window. | |
void | Con_Close (void) |
Hide the gameconsole if active. | |
static void | Con_DrawInput (void) |
The input line scrolls horizontally if typing goes beyond the right edge. | |
void | Con_DrawNotify (void) |
Draws the last few lines of output transparently over the game top. | |
void | Con_DrawConsole (float frac) |
Draws the console with the solid background. | |
Variables | |
static console_t | con |
static cvar_t * | con_notifytime |
static cvar_t * | con_history |
static cvar_t * | con_background |
const int | con_fontHeight = 12 |
const int | con_fontWidth = 10 |
const int | con_fontShift = 3 |
Console related code.
Definition in file cl_console.c.
#define COLORED_TEXT_MASK 128 |
Definition at line 37 of file cl_console.c.
#define CON_TEXTSIZE 32768 |
Definition at line 38 of file cl_console.c.
Referenced by Con_CheckResize().
#define CONSOLE_CHAR_ALIGN 4 |
Definition at line 35 of file cl_console.c.
Referenced by Con_DrawConsole(), and Con_DrawInput().
#define CONSOLE_CURSOR_CHAR 11 |
Definition at line 39 of file cl_console.c.
Referenced by Con_DrawInput().
#define CONSOLE_HISTORY_FILENAME "history" |
Definition at line 40 of file cl_console.c.
Referenced by Con_LoadConsoleHistory(), and Con_SaveConsoleHistory().
#define NUM_CON_TIMES 8 |
Definition at line 36 of file cl_console.c.
Referenced by Con_ClearNotify(), Con_DrawNotify(), and Con_Print().
void Con_CheckResize | ( | void | ) |
If the line width has changed, reformat the buffer.
Definition at line 162 of file cl_console.c.
References Con_ClearNotify(), con_fontShift, CON_TEXTSIZE, console_t::currentLine, console_t::displayLine, i, console_t::lineWidth, console_t::text, console_t::totalLines, viddef, and viddef_t::width.
Referenced by SCR_DrawConsole().
static void Con_Clear_f | ( | void | ) | [static] |
Clears the console buffer.
Definition at line 110 of file cl_console.c.
References console_t::text.
Referenced by Con_Init().
void Con_ClearNotify | ( | void | ) |
Clear the notify times to ensure that every message will disappear from screen.
Definition at line 131 of file cl_console.c.
References i, NUM_CON_TIMES, and console_t::times.
Referenced by Con_CheckResize(), Con_ToggleChat_f(), Con_ToggleConsole_f(), and SCR_EndLoadingPlaque().
void Con_Close | ( | void | ) |
Hide the gameconsole if active.
Definition at line 376 of file cl_console.c.
References cls, key_console, key_game, Key_SetDest(), and client_static_s::keyDest.
static void Con_DisplayString | ( | int | x, | |
int | y, | |||
const char * | s | |||
) | [static] |
Definition at line 67 of file cl_console.c.
References con_fontWidth, and R_DrawChar().
Referenced by Con_DrawNotify().
void Con_DrawConsole | ( | float | frac | ) |
Draws the console with the solid background.
[in] | frac |
Definition at line 484 of file cl_console.c.
References Com_sprintf(), Con_DrawInput(), con_fontHeight, con_fontShift, con_fontWidth, CONSOLE_CHAR_ALIGN, CONSOLE_COLORED_TEXT_MASK, console_t::currentLine, console_t::displayLine, viddef_t::height, i, cvar_s::integer, it_pic, len, console_t::lineWidth, R_DrawChar(), R_DrawStretchImage(), R_FindImage(), console_t::text, console_t::totalLines, UFO_VERSION, viddef, viddef_t::virtualHeight, viddef_t::virtualWidth, console_t::visLines, and viddef_t::width.
Referenced by SCR_DrawConsole().
static void Con_DrawInput | ( | void | ) | [static] |
The input line scrolls horizontally if typing goes beyond the right edge.
Definition at line 385 of file cl_console.c.
References ca_active, CL_Milliseconds(), cls, con_fontHeight, con_fontShift, CONSOLE_CHAR_ALIGN, CONSOLE_COLORED_TEXT_MASK, CONSOLE_CURSOR_CHAR, editLine, i, key_console, client_static_s::keyDest, keyLinePos, keyLines, console_t::lineWidth, MAXCMDLINE, Q_strncpyz(), R_DrawChar(), client_static_s::state, and console_t::visLines.
Referenced by Con_DrawConsole().
void Con_DrawNotify | ( | void | ) |
Draws the last few lines of output transparently over the game top.
Definition at line 425 of file cl_console.c.
References CL_Milliseconds(), cls, Con_DisplayString(), con_fontHeight, con_fontShift, CONSOLE_COLORED_TEXT_MASK, console_t::currentLine, developer, i, cvar_s::integer, key_message, client_static_s::keyDest, console_t::lineWidth, MSG_SAY, MSG_SAY_TEAM, msgBuffer, msgBufferLen, msgMode, NUM_CON_TIMES, qfalse, qtrue, R_DrawChar(), viddef_t::rx, viddef_t::ry, console_t::text, console_t::times, console_t::totalLines, viddef, and viddef_t::width.
Referenced by SCR_DrawConsole().
void Con_Init | ( | void | ) |
Definition at line 264 of file cl_console.c.
References _, Cmd_AddCommand(), Com_Printf(), Con_Clear_f(), con_fontWidth, Con_LoadConsoleHistory(), Con_MessageModeSay_f(), Con_MessageModeSayTeam_f(), Con_ToggleChat_f(), Con_ToggleConsole_f(), CVAR_ARCHIVE, Cvar_Get(), console_t::initialized, console_t::lineWidth, qtrue, console_t::text, console_t::totalLines, and VID_NORM_WIDTH.
Referenced by CL_Init().
static void Con_Linefeed | ( | void | ) | [static] |
Definition at line 291 of file cl_console.c.
References console_t::currentLine, console_t::displayLine, console_t::lineWidth, console_t::pos, console_t::text, and console_t::totalLines.
Referenced by Con_Print().
void Con_LoadConsoleHistory | ( | void | ) |
Load the console history.
Definition at line 204 of file cl_console.c.
References CONSOLE_HISTORY_FILENAME, editLine, qFILE_s::f, f, FILE_READ, FS_CloseFile(), FS_OpenFile(), historyLine, cvar_s::integer, keyLines, MAXCMDLINE, MAXKEYLINES, and Q_strncpyz().
Referenced by Con_Init().
static void Con_MessageModeSay_f | ( | void | ) | [static] |
Definition at line 139 of file cl_console.c.
References CL_OnBattlescape(), GAME_IsSingleplayer, key_message, Key_SetDest(), MSG_SAY, and msgMode.
Referenced by Con_Init().
static void Con_MessageModeSayTeam_f | ( | void | ) | [static] |
Definition at line 149 of file cl_console.c.
References CL_OnBattlescape(), GAME_IsSingleplayer, key_message, Key_SetDest(), MSG_SAY_TEAM, and msgMode.
Referenced by Con_Init().
void Con_Print | ( | const char * | txt | ) |
Handles cursor positioning, line wrapping, etc All console printing must go through this in order to be logged to disk If no console is visible, the text will appear at the top of the game window.
Definition at line 306 of file cl_console.c.
Referenced by Com_vPrintf().
void Con_SaveConsoleHistory | ( | void | ) |
Stores the console history.
Definition at line 235 of file cl_console.c.
References Com_Printf(), CONSOLE_HISTORY_FILENAME, qFILE_s::f, f, FILE_WRITE, FS_CloseFile(), FS_OpenFile(), FS_Write(), historyLine, i, cvar_s::integer, keyLines, and MAXCMDLINE.
Referenced by CL_Shutdown().
void Con_Scroll | ( | int | scroll | ) |
Scrolls the console.
[in] | scroll | Lines to scroll |
Definition at line 119 of file cl_console.c.
References console_t::currentLine, and console_t::displayLine.
Referenced by Key_Console().
static void Con_ToggleChat_f | ( | void | ) | [static] |
Definition at line 94 of file cl_console.c.
References ca_active, cls, Con_ClearNotify(), Key_ClearTyping(), key_console, key_game, Key_SetDest(), client_static_s::keyDest, and client_static_s::state.
Referenced by Con_Init().
void Con_ToggleConsole_f | ( | void | ) |
Definition at line 82 of file cl_console.c.
References cls, Con_ClearNotify(), Key_ClearTyping(), key_console, key_game, Key_SetDest(), and client_static_s::keyDest.
Referenced by Con_Init(), IN_Frame(), and Key_Event().
static void Key_ClearTyping | ( | void | ) | [static] |
Definition at line 76 of file cl_console.c.
References editLine, keyLinePos, and keyLines.
Referenced by Con_ToggleChat_f(), and Con_ToggleConsole_f().
Definition at line 59 of file cl_console.c.
cvar_t* con_background [static] |
Definition at line 62 of file cl_console.c.
const int con_fontHeight = 12 |
Definition at line 63 of file cl_console.c.
Referenced by Con_DrawConsole(), Con_DrawInput(), Con_DrawNotify(), and R_DrawChar().
const int con_fontShift = 3 |
Definition at line 65 of file cl_console.c.
Referenced by Con_CheckResize(), Con_DrawConsole(), Con_DrawInput(), and Con_DrawNotify().
const int con_fontWidth = 10 |
Definition at line 64 of file cl_console.c.
Referenced by Con_DisplayString(), Con_DrawConsole(), Con_Init(), R_DrawChar(), SCR_DrawString(), and SCR_UpdateScreen().
cvar_t* con_history [static] |
Definition at line 61 of file cl_console.c.
cvar_t* con_notifytime [static] |
Definition at line 60 of file cl_console.c.