The patch that I submit today seems to be useless, however, I'm sure that some people whom are bored by ioquake3 basic console will enjoy these features:
- It allows people to change console style from "default" to "custom", which accepts to use special colors for console.
- Color values are stocked in cl_consoleColor<Color>.
- Transparency is also managed & stocked in cl_consoleColorAlpha.
- All those things are managed by /color command which works like this : "/console [color ([red] [green] [blue] [Alpha]) | type ([default|custom])]"
That's all. I think I'll add visual effects while console is opened or closed & a vim-alike mode.
Damn, I was going to forget it... Here is the patch :
- Code: Select all
Index: code/client/client.h
===================================================================
--- code/client/client.h (révision 260)
+++ code/client/client.h (copie de travail)
@@ -526,6 +526,16 @@
//
// console
//
+
+#ifdef SMOKINGUNS
+extern cvar_t *cl_consoleType;
+extern void Con_CustomizeConsole_f( void );
+char *Con_FindColorForNumber( int color );
+extern cvar_t *cl_consoleColor[3];
+extern int numColors;
+#endif /* SMOKINGUNS */
+
void Con_DrawCharacter (int cx, int line, int num);
void Con_CheckResize (void);
Index: code/client/cl_main.c
===================================================================
--- code/client/cl_main.c (révision 260)
+++ code/client/cl_main.c (copie de travail)
@@ -97,7 +97,12 @@
cvar_t *cl_guidServerUniq;
+//Console part
cvar_t *cl_consoleKeys;
+#ifdef SMOKINGUNS
+cvar_t *cl_consoleType;
+cvar_t *cl_consoleColor[3];
+#endif
clientActive_t cl;
clientConnection_t clc;
@@ -3074,6 +3079,9 @@
====================
*/
void CL_Init( void ) {
+#ifdef SMOKINGUNS
+ int i;
+#endif
Com_Printf( "----- Client Initialization -----\n" );
Con_Init ();
@@ -3169,6 +3177,13 @@
// ~ and `, as keys and characters
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE);
+#ifdef SMOKINGUNS
+ cl_consoleType = Cvar_Get( "cl_consoleType", "0", CVAR_ARCHIVE );
+ for( i = 0; i <= 3; i++ )
+ {
+ cl_consoleColor[i] = Cvar_Get( va( "cl_consoleColor%s", Con_FindColorForNumber( i ) ), "0", CVAR_ARCHIVE );
+ }
+#endif
// userinfo
Cvar_Get ("name", "UnnamedPlayer", CVAR_USERINFO | CVAR_ARCHIVE );
@@ -3234,6 +3249,9 @@
//
// register our commands
//
+#ifdef SMOKINGUNS
+ Cmd_AddCommand( "console", Con_CustomizeConsole_f );
+#endif
Cmd_AddCommand ("cmd", CL_ForwardToServer_f);
Cmd_AddCommand ("configstrings", CL_Configstrings_f);
Cmd_AddCommand ("clientinfo", CL_Clientinfo_f);
Index: code/client/cl_console.c
===================================================================
--- code/client/cl_console.c (révision 260)
+++ code/client/cl_console.c (copie de travail)
@@ -585,6 +585,102 @@
/*
================
+Con_CustomizeConsole_f
+
+Command that gives to user the power to
+customize his/her console.
+
+Available commands:
+ - /console color [red] [green] [blue] [Alpha]
+ - /console type [default|custom]
+================
+*/
+#ifdef SMOKINGUNS
+
+typedef struct colorArray_s
+{
+ int color;
+ char *name;
+} colorArray_t;
+
+colorArray_t colorArray[]=
+{
+ {
+ 0,
+ "Red",
+ },
+ {
+ 1,
+ "Green",
+ },
+ {
+ 2,
+ "Blue",
+ },
+ {
+ 3,
+ "Alpha",
+ },
+};
+
+int numColors = sizeof( colorArray ) / sizeof( colorArray[0] );
+
+//Save typing ( To use with conditions )
+#define ARG_DNTEXISTS( x ) (!argv[x] || !Q_stricmp( argv[x], "" ))
+void Con_CustomizeConsole_f( void )
+{
+ int argc = Cmd_Argc( );
+ int i;
+ char *argv[argc];
+
+ for( i = 0; i <= argc; i++ )
+ {
+ argv[i] = Cmd_Argv( i );
+ }
+
+ if( ARG_DNTEXISTS( 1 ) )
+ Com_Printf( "^3usage:^7 /console ^3[^7color ^5(^3[^7red^3] [^7green^3] [^7blue^3] [^7Alpha^3]^5)^7 | type ^5(^3[^7default|custom^3]^5)" );
+ else
+ {
+ if( !Q_stricmp( argv[1], "color" ) )
+ {
+ if( argv[5] )
+ {
+ for( i = 0; i <= 3; i++ )
+ {
+ //cl_consoleColor[i]->value = atof( argv[i+2] );
+ Cvar_Set( va( "cl_consoleColor%s", Con_FindColorForNumber( i ) ), va( "%f", atof( argv[i+2] ) ) );
+ }
+ }
+ }
+ else if( !Q_stricmp( argv[1], "type" ) )
+ {
+ if( !Q_stricmp( argv[2], "default" ) )
+ //cl_consoleType->integer = 0;
+ Cvar_Set( "cl_consoleType", "0" );
+ else if( !Q_stricmp( argv[2], "custom" ) )
+ //cl_consoleType->integer = 1;
+ Cvar_Set( "cl_consoleType", "1" );
+ }
+ }
+}
+
+char *Con_FindColorForNumber( int color )
+{
+ int i;
+
+ for( i = 0; i < numColors; i++ )
+ {
+ if( i == color )
+ {
+ return colorArray[i].name;
+ }
+ }
+}
+#endif /* SMOKINGUNS */
+
+/*
+================
Con_DrawSolidConsole
Draws the console with the solid background
@@ -599,6 +695,9 @@
// qhandle_t conShader;
int currentColor;
vec4_t color;
+#ifdef SMOKINGUNS
+ vec4_t consoleColor;
+#endif
lines = cls.glconfig.vidHeight * frac;
if (lines <= 0)
@@ -613,20 +712,36 @@
// draw the background
y = frac * SCREEN_HEIGHT;
+
+#ifdef SMOKINGUNS
+ for( i = 0; i <= 3; i++ )
+ {
+ consoleColor[i] = cl_consoleColor[i]->value;
+ }
+#endif /* SMOKINGUNS */
+
if ( y < 1 ) {
y = 0;
}
else {
+#ifndef SMOKINGUNS
SCR_DrawPic( 0, 0, SCREEN_WIDTH, y, cls.consoleShader );
+#else
+ if( cl_consoleType->integer == 1 )
+ SCR_FillRect( 0, 0, SCREEN_WIDTH, y, consoleColor );
+ else
+ SCR_DrawPic( 0, 0, SCREEN_WIDTH, y, cls.consoleShader );
+#endif
}
color[0] = 1;
color[1] = 0;
color[2] = 0;
- color[3] = 1;
- SCR_FillRect( 0, y, SCREEN_WIDTH, 2, color );
+ color[3] = 0.8;
+ SCR_FillRect( 0, y, SCREEN_WIDTH, 1, color );
+
// draw the version number
re.SetColor( g_color_table[ColorIndex(COLOR_RED)] );