2004-08-23 00:15:46 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-1997 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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
//
|
|
|
|
// console
|
|
|
|
//
|
|
|
|
|
2006-01-01 09:01:15 +00:00
|
|
|
#define MAXCONCOLOURS 16
|
2004-08-23 00:15:46 +00:00
|
|
|
typedef struct {
|
2006-01-01 09:01:15 +00:00
|
|
|
float fr, fg, fb;
|
2004-08-23 00:15:46 +00:00
|
|
|
} consolecolours_t;
|
2006-01-01 09:01:15 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
extern consolecolours_t consolecolours[MAXCONCOLOURS];
|
|
|
|
|
2006-01-01 09:01:15 +00:00
|
|
|
#define MAXQ3COLOURS 10
|
|
|
|
extern conchar_t q3codemasks[MAXQ3COLOURS];
|
|
|
|
|
|
|
|
#define CON_NONCLEARBG 0x00800000
|
|
|
|
#define CON_BLINKTEXT 0x00400000
|
|
|
|
#define CON_2NDCHARSETTEXT 0x00200000
|
|
|
|
#define CON_HALFALPHA 0x00100000
|
|
|
|
#define CON_HIGHCHARSMASK 0x00000080 // Quake's alternative mask
|
|
|
|
|
2009-06-21 17:45:33 +00:00
|
|
|
#define CON_FLAGSMASK 0xFFF00000
|
|
|
|
#define CON_UNUSEDMASK 0x000F0000
|
|
|
|
#define CON_CHARMASK 0x0000FFFF
|
2006-01-01 09:01:15 +00:00
|
|
|
|
|
|
|
#define CON_FGMASK 0x0F000000
|
|
|
|
#define CON_BGMASK 0xF0000000
|
|
|
|
#define CON_FGSHIFT 24
|
|
|
|
#define CON_BGSHIFT 28
|
|
|
|
|
|
|
|
#define CON_Q3MASK 0x0F100000
|
|
|
|
#define CON_WHITEMASK 0x0F000000 // must be constant. things assume this
|
|
|
|
|
2006-01-21 03:10:16 +00:00
|
|
|
#define CON_DEFAULTCHAR (CON_WHITEMASK | 32)
|
|
|
|
|
2006-01-01 09:01:15 +00:00
|
|
|
// RGBI standard colors
|
|
|
|
#define COLOR_BLACK 0
|
|
|
|
#define COLOR_DARKBLUE 1
|
|
|
|
#define COLOR_DARKGREEN 2
|
|
|
|
#define COLOR_DARKCYAN 3
|
|
|
|
#define COLOR_DARKRED 4
|
|
|
|
#define COLOR_DARKMAGENTA 5
|
|
|
|
#define COLOR_BROWN 6
|
|
|
|
#define COLOR_GREY 7
|
|
|
|
#define COLOR_DARKGREY 8
|
|
|
|
#define COLOR_BLUE 9
|
|
|
|
#define COLOR_GREEN 10
|
|
|
|
#define COLOR_CYAN 11
|
|
|
|
#define COLOR_RED 12
|
|
|
|
#define COLOR_MAGENTA 13
|
|
|
|
#define COLOR_YELLOW 14
|
|
|
|
#define COLOR_WHITE 15
|
2004-12-25 01:34:51 +00:00
|
|
|
|
|
|
|
#define S_COLOR_BLACK "^0"
|
2004-08-23 00:15:46 +00:00
|
|
|
#define S_COLOR_RED "^1"
|
|
|
|
#define S_COLOR_GREEN "^2"
|
|
|
|
#define S_COLOR_YELLOW "^3"
|
|
|
|
#define S_COLOR_BLUE "^4"
|
2006-01-09 01:49:06 +00:00
|
|
|
#define S_COLOR_CYAN "^5"
|
|
|
|
#define S_COLOR_MAGENTA "^6"
|
2004-12-25 01:34:51 +00:00
|
|
|
#define S_COLOR_WHITE "^7"
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2007-09-23 15:28:06 +00:00
|
|
|
#define CON_WARNING "^&E0"
|
|
|
|
#define CON_ERROR "^&C0"
|
|
|
|
#define CON_NOTICE "^&-1"
|
2006-02-22 01:24:22 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#define CON_TEXTSIZE 16384
|
2006-01-01 09:01:15 +00:00
|
|
|
|
2006-04-06 08:42:24 +00:00
|
|
|
#define isextendedcode(x) ((x >= '0' && x <= '9') || (x >= 'A' && x <= 'F') || x == '-')
|
2007-12-30 19:00:48 +00:00
|
|
|
#define ishexcode(x) ((x >= '0' && x <= '9') || (x >= 'A' && x <= 'F') || (x >= 'a' && x <= 'f'))
|
2006-01-11 07:23:31 +00:00
|
|
|
|
2009-07-05 18:45:53 +00:00
|
|
|
typedef struct conline_s {
|
|
|
|
struct conline_s *older;
|
|
|
|
unsigned int length;
|
|
|
|
struct conline_s *newer;
|
|
|
|
} conline_t;
|
|
|
|
|
2005-01-13 16:50:37 +00:00
|
|
|
typedef struct console_s
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2005-01-13 16:50:37 +00:00
|
|
|
char name[64];
|
2009-07-05 18:45:53 +00:00
|
|
|
int linecount;
|
|
|
|
conline_t *oldest;
|
|
|
|
conline_t *current; // line where next message will be printed
|
2004-08-23 00:15:46 +00:00
|
|
|
int x; // offset in current line for next print
|
2009-07-05 18:45:53 +00:00
|
|
|
conline_t *display; // bottom of console displays this line
|
|
|
|
int vislines; // pixel lines
|
|
|
|
int linesprinted; // for notify times
|
2005-12-20 23:33:20 +00:00
|
|
|
qboolean unseentext;
|
2005-03-10 03:55:18 +00:00
|
|
|
int commandcompletion; //allows tab completion of quake console commands
|
|
|
|
void (*linebuffered) (struct console_s *con, char *line); //if present, called on enter, causes the standard console input to appear.
|
2008-01-28 13:27:30 +00:00
|
|
|
void (*redirect) (struct console_s *con, int key); //if present, called every character.
|
2005-01-13 16:50:37 +00:00
|
|
|
void *userdata;
|
|
|
|
struct console_s *next;
|
2004-08-23 00:15:46 +00:00
|
|
|
} console_t;
|
|
|
|
|
|
|
|
extern console_t con_main;
|
2005-01-13 16:50:37 +00:00
|
|
|
extern console_t *con_current; // point to either con_main or con_chat
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2005-04-16 16:21:27 +00:00
|
|
|
extern int scr_chatmode;
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
//extern int con_totallines;
|
|
|
|
extern qboolean con_initialized;
|
|
|
|
extern qbyte *con_chars;
|
|
|
|
extern int con_notifylines; // scan lines to clear for notify lines
|
|
|
|
|
|
|
|
void Con_DrawCharacter (int cx, int line, int num);
|
|
|
|
|
|
|
|
void Con_CheckResize (void);
|
|
|
|
void Con_Init (void);
|
|
|
|
void Con_DrawConsole (int lines, qboolean noback);
|
|
|
|
void Con_Print (char *txt);
|
|
|
|
void VARGS Con_Printf (const char *fmt, ...);
|
|
|
|
void VARGS Con_TPrintf (translation_t text, ...);
|
|
|
|
void VARGS Con_DPrintf (char *fmt, ...);
|
|
|
|
void VARGS Con_SafePrintf (char *fmt, ...);
|
|
|
|
void Con_Clear_f (void);
|
|
|
|
void Con_DrawNotify (void);
|
|
|
|
void Con_ClearNotify (void);
|
|
|
|
void Con_ToggleConsole_f (void);
|
|
|
|
|
2005-03-10 03:55:18 +00:00
|
|
|
void Con_ExecuteLine(console_t *con, char *line); //takes normal console commands
|
|
|
|
|
2005-01-13 16:50:37 +00:00
|
|
|
|
|
|
|
void Con_CycleConsole (void);
|
|
|
|
qboolean Con_IsActive (console_t *con);
|
|
|
|
void Con_Destroy (console_t *con);
|
2006-02-11 14:51:36 +00:00
|
|
|
void Con_SetActive (console_t *con);
|
|
|
|
qboolean Con_NameForNum(int num, char *buffer, int buffersize);
|
2005-01-13 16:50:37 +00:00
|
|
|
console_t *Con_FindConsole(char *name);
|
|
|
|
console_t *Con_Create(char *name);
|
|
|
|
void Con_SetVisible (console_t *con);
|
|
|
|
void Con_PrintCon (console_t *con, char *txt);
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
void Con_NotifyBox (char *text); // during startup for sound / cd warnings
|
|
|
|
|
2004-10-07 13:00:48 +00:00
|
|
|
#ifdef CRAZYDEBUGGING
|
2004-10-19 16:10:14 +00:00
|
|
|
#define TRACE(x) Con_Printf x
|
2004-10-07 13:00:48 +00:00
|
|
|
#else
|
|
|
|
#define TRACE(x)
|
|
|
|
#endif
|