Closer by FAR to usuable!!!

This commit is contained in:
Zephaniah E. Hull 2000-09-30 09:30:55 +00:00
parent b5bf9eb32c
commit ac3c6aabcc
3 changed files with 100 additions and 42 deletions

View file

@ -202,7 +202,8 @@ CL_Quit_f
*/
void CL_Quit_f (void)
{
if (1 /* key_dest != key_console */ /* && cls.state != ca_dedicated */)
//if (1 /* key_dest != key_console */ /* && cls.state != ca_dedicated */)
if (0 /* key_dest != key_console */ /* && cls.state != ca_dedicated */)
{
M_Menu_Quit_f ();
return;

View file

@ -260,38 +260,6 @@ void Con_CheckResize (void)
}
/*
================
Con_Init
================
*/
void Con_Init (void)
{
con_debuglog = COM_CheckParm("-condebug");
con = &con_main;
con_linewidth = -1;
Con_CheckResize ();
Con_Printf ("Console initialized.\n");
//
// register our commands
//
con_notifytime = Cvar_Get("con_notifytime", "3", CVAR_NONE, "None");
cl_chatmode = Cvar_Get ("cl_chatmode", "2", 0,
"Controls when console text will be treated as a chat message\n"
"0 - never, 1 - always, 2 - smart");
Cmd_AddCommand ("toggleconsole", Con_ToggleConsole_f);
Cmd_AddCommand ("togglechat", Con_ToggleChat_f);
Cmd_AddCommand ("messagemode", Con_MessageMode_f);
Cmd_AddCommand ("messagemode2", Con_MessageMode2_f);
Cmd_AddCommand ("clear", Con_Clear_f);
con_initialized = true;
}
/*
===============
@ -883,3 +851,51 @@ Con_EndOfLine_f(void)
key_linepos = strlen(key_lines[edit_line]);
}
/*
================
Con_Init
================
*/
void Con_Init (void)
{
con_debuglog = COM_CheckParm("-condebug");
con = &con_main;
con_linewidth = -1;
Con_CheckResize ();
Con_Printf ("Console initialized.\n");
//
// register our commands
//
con_notifytime = Cvar_Get("con_notifytime", "3", CVAR_NONE, "None");
cl_chatmode = Cvar_Get ("cl_chatmode", "2", 0,
"Controls when console text will be treated as a chat message\n"
"0 - never, 1 - always, 2 - smart");
Cmd_AddCommand ("toggleconsole", Con_ToggleConsole_f);
Cmd_AddCommand ("togglechat", Con_ToggleChat_f);
Cmd_AddCommand ("messagemode", Con_MessageMode_f);
Cmd_AddCommand ("messagemode2", Con_MessageMode2_f);
Cmd_AddCommand ("clear", Con_Clear_f);
Cmd_AddCommand ("con_insert_char", Con_Insert_Char_f);
Cmd_AddCommand ("con_backspace", Con_Backspace_f);
Cmd_AddCommand ("con_enter", Con_Enter_f);
Cmd_AddCommand ("con_delete_char", Con_Delete_Char_f);
Cmd_AddCommand ("con_cursor_left", Con_Cursor_Left_f);
Cmd_AddCommand ("con_cursor_right", Con_Cursor_Right_f);
Cmd_AddCommand ("con_curser_up", Con_Cursor_Up_f);
Cmd_AddCommand ("con_curser_down", Con_Cursor_Down_f);
Cmd_AddCommand ("con_page_up", Con_Page_Up_f);
Cmd_AddCommand ("con_page_down", Con_Page_Down_f);
Cmd_AddCommand ("con_beginningofbuffer", Con_BeginningOfBuffer_f);
Cmd_AddCommand ("con_endofbuffer", Con_EndOfBuffer_f);
Cmd_AddCommand ("con_beginningofline", Con_BeginningOfLine_f);
Cmd_AddCommand ("con_endofline", Con_EndOfLine_f);
con_initialized = true;
}

View file

@ -331,6 +331,40 @@ Key_Bind_f
*/
void
Key_Bind_f ( void )
{
int i, c, b;
char cmd[1024];
c = Cmd_Argc();
if (c < 2) {
Con_Printf("bind <key> [command] :attach a command to a key\n");
return;
}
b = Key_StringToKeynum (Cmd_Argv(1));
if (b == -1) {
Con_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1));
return;
}
// copy the rest of the command line
cmd[0] = 0; // start out with a null string
for (i = 2 ; i < c ; i++) {
strcat (cmd, Cmd_Argv(i));
if (i != (c-1))
strcat (cmd, " ");
}
Key_SetBinding (BIND_ALL, b, cmd);
}
/*
===================
Key_SBind_f
===================
*/
void
Key_SBind_f ( void )
{
int i, c, b;
char cmd[1024];
@ -339,19 +373,24 @@ Key_Bind_f ( void )
c = Cmd_Argc();
if (c < 3) {
Con_Printf("bind <state> <key> [command] :attach a command to a key\n");
return;
}
b = Key_StringToKeynum (Cmd_Argv(2));
if (b == -1) {
Con_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1));
Con_Printf("sbind <state> <key> [command] :attach a command to a key\n");
return;
}
state = WIC_StrToInt(Cmd_Argv(1), bindnames);
if (state == -1) {
Con_Printf ("\"%s\" isn't a valid state\n", Cmd_Argv(1));
return;
}
b = Key_StringToKeynum (Cmd_Argv(2));
if (b == -1) {
Con_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(2));
return;
}
// copy the rest of the command line
cmd[0] = 0; // start out with a null string
for (i = 2 ; i < c ; i++) {
for (i = 3 ; i < c ; i++) {
strcat (cmd, Cmd_Argv(i));
if (i != (c-1))
strcat (cmd, " ");
@ -419,6 +458,7 @@ Key_Init ( void )
// register our functions
//
Cmd_AddCommand ("bind", Key_Bind_f);
Cmd_AddCommand ("sbind", Key_SBind_f);
Cmd_AddCommand ("unbind", Key_Unbind_f);
Cmd_AddCommand ("unbindall", Key_Unbindall_f);
}
@ -446,10 +486,11 @@ Key_Event ( int key, qboolean down )
snprintf (cmd, sizeof(cmd), "%s %i\n", kb, key);
if (!down)
cmd[0] = '-';
} else {
snprintf(cmd, sizeof(cmd), "%s\n", kb);
}
Cbuf_AddText (cmd);
} else if (down) {
snprintf(cmd, sizeof(cmd), "%s\n", kb);
Cbuf_AddText (cmd);
}
}
}