start getting the shared console code working

This commit is contained in:
Bill Currie 2002-01-16 16:27:56 +00:00
parent 0dcfc6dfb4
commit 9dedd21158
5 changed files with 58 additions and 47 deletions

View file

@ -137,6 +137,10 @@
#undef SERVER_PLUGIN_LIST
#undef SERVER_PLUGIN_PROTOS
/* list of client plugins and prototypes */
#undef CLIENT_PLUGIN_LIST
#undef CLIENT_PLUGIN_PROTOS
/* list of cd plugins and prototypes */
#undef CD_PLUGIN_LIST
#undef CD_PLUGIN_PROTOS

View file

@ -1605,6 +1605,8 @@ fi
PLUGIN_RPATH='-rpath $(plugindir)'
SERVER_PLUGIN_TARGETS="libconsole_server.la"
SERVER_PLUGIN_STATIC=""
CLIENT_PLUGIN_TARGETS="libconsole_client.la"
CLIENT_PLUGIN_STATIC=""
CD_PLUGIN_STATIC=""
SND_PLUGIN_STATIC=""
SND_REND_STATIC=""
@ -1619,6 +1621,8 @@ if test "x$static_plugins" = xyes; then
PLUGIN_RPATH=''
SERVER_PLUGIN_STATIC="$SERVER_PLUGIN_TARGETS"
SERVER_PLUGIN_TARGETS=""
CLIENT_PLUGIN_STATIC="$CLIENT_PLUGIN_TARGETS"
CLIENT_PLUGIN_TARGETS=""
CD_PLUGIN_STATIC="$CD_PLUGIN_TARGETS"
CD_PLUGIN_TARGETS=""
SND_PLUGIN_STATIC="$SND_PLUGIN_TARGETS"
@ -1631,14 +1635,17 @@ if test "x$static_plugins" = xyes; then
fi
fi
SERVER_PLUGIN_STATIC_LIBS=""
CLIENT_PLUGIN_STATIC_LIBS=""
CD_PLUGIN_STATIC_LIBS=""
SND_PLUGIN_STATIC_LIBS=""
SND_REND_STATIC_LIBS=""
SERVER_PLUGIN_LIST="{0, 0}"
CLIENT_PLUGIN_LIST="{0, 0}"
CD_PLUGIN_LIST="{0, 0}"
SND_OUTPUT_LIST="{0, 0}"
SND_RENDER_LIST="{0, 0}"
SERVER_PLUGIN_PROTOS=""
CLIENT_PLUGIN_PROTOS=""
CD_PLUGIN_PROTOS=""
SND_OUTPUT_PROTOS=""
SND_RENDER_PROTOS=""
@ -1648,6 +1655,12 @@ for l in $SERVER_PLUGIN_STATIC; do
SERVER_PLUGIN_LIST='{"'"$n"'"'", ${n}_PluginInfo},$SERVER_PLUGIN_LIST"
SERVER_PLUGIN_PROTOS="$SERVER_PLUGIN_PROTOS extern QFPLUGIN plugin_t *${n}_PluginInfo (void);"
done
for l in $CLIENT_PLUGIN_STATIC; do
CLIENT_PLUGIN_STATIC_LIBS="$CLIENT_PLUGIN_STATIC_LIBS "'$(top_builddir)'"/libs/console/$l"
n="`echo $l | sed -e 's/.*lib\(.*\)\.la/\1/'`"
CLIENT_PLUGIN_LIST='{"'"$n"'"'", ${n}_PluginInfo},$CLIENT_PLUGIN_LIST"
CLIENT_PLUGIN_PROTOS="$CLIENT_PLUGIN_PROTOS extern QFPLUGIN plugin_t *${n}_PluginInfo (void);"
done
for l in $CD_PLUGIN_STATIC; do
CD_PLUGIN_STATIC_LIBS="$CD_PLUGIN_STATIC_LIBS cd/$l"
n="`echo $l | sed -e 's/lib\(.*\)\.la/\1/'`"
@ -1668,6 +1681,8 @@ for l in $SND_REND_STATIC; do
done
AC_DEFINE_UNQUOTED(SERVER_PLUGIN_LIST, $SERVER_PLUGIN_LIST)
AC_DEFINE_UNQUOTED(SERVER_PLUGIN_PROTOS, $SERVER_PLUGIN_PROTOS)
AC_DEFINE_UNQUOTED(CLIENT_PLUGIN_LIST, $CLIENT_PLUGIN_LIST)
AC_DEFINE_UNQUOTED(CLIENT_PLUGIN_PROTOS, $CLIENT_PLUGIN_PROTOS)
AC_DEFINE_UNQUOTED(CD_PLUGIN_LIST, $CD_PLUGIN_LIST)
AC_DEFINE_UNQUOTED(CD_PLUGIN_PROTOS, $CD_PLUGIN_PROTOS)
AC_DEFINE_UNQUOTED(SND_OUTPUT_LIST, $SND_OUTPUT_LIST)
@ -1681,6 +1696,9 @@ AC_SUBST(PLUGIN_RPATH)
AC_SUBST(SERVER_PLUGIN_STATIC)
AC_SUBST(SERVER_PLUGIN_STATIC_LIBS)
AC_SUBST(SERVER_PLUGIN_TARGETS)
AC_SUBST(CLIENT_PLUGIN_STATIC)
AC_SUBST(CLIENT_PLUGIN_STATIC_LIBS)
AC_SUBST(CLIENT_PLUGIN_TARGETS)
AC_SUBST(CD_PLUGIN_STATIC)
AC_SUBST(CD_PLUGIN_STATIC_LIBS)
AC_SUBST(CD_PLUGIN_TARGETS)

View file

@ -46,6 +46,7 @@ typedef struct console_data_s {
const char *dl_name;
int dl_percent;
double realtime;
int force_commandline;
} console_data_t;
#endif // __QF_plugin_console_h_

View file

@ -3,9 +3,9 @@ AUTOMAKE_OPTIONS= foreign
INCLUDES= -I$(top_srcdir)/include
lib_LTLIBRARIES= libQFconsole.la
plugin_LTLIBRARIES= @SERVER_PLUGIN_TARGETS@ #libconsole_client.la
noinst_LTLIBRARIES= @SERVER_PLUGIN_STATIC@
EXTRA_LTLIBRARIES= libconsole_server.la
plugin_LTLIBRARIES= @SERVER_PLUGIN_TARGETS@ @CLIENT_PLUGIN_TARGETS@
noinst_LTLIBRARIES= @SERVER_PLUGIN_STATIC@ @CLIENT_PLUGIN_STATIC@
EXTRA_LTLIBRARIES= libconsole_server.la libconsole_client.la
common_sources= buffer.c complete.c console.c inputline.c list.c filelist.c
client_sources= client.c
@ -15,8 +15,8 @@ libQFconsole_la_LDFLAGS= $(plugin_LDFLAGS) -version-info 1:0:0
libQFconsole_la_LIBADD= $(plugin_LIBADD)
libQFconsole_la_SOURCES= $(common_sources)
#libconsole_client_la_LDFLAGS= -version-info 1:0:0
#libconsole_client_la_SOURCES= $(client_sources)
libconsole_client_la_LDFLAGS= -version-info 1:0:0
libconsole_client_la_SOURCES= $(client_sources)
libconsole_server_la_LDFLAGS= $(plugin_LDFLAGS) -version-info 1:0:0 $(PLUGIN_RPATH)
libconsole_server_la_LIBADD= $(CURSES_LIBS) $(plugin_LIBADD)

View file

@ -59,14 +59,6 @@ static general_data_t plugin_info_general_data;
static console_data_t plugin_info_console_data;
#define con_data plugin_info_console_data
int con_ormask;
console_t con_main;
console_t con_chat;
console_t *con; // point to either con_main or con_chat
int con_totallines; // total lines in console scrollback
float con_cursorspeed = 4;
cvar_t *con_notifytime; // seconds
@ -86,17 +78,28 @@ qboolean con_debuglog;
qboolean con_initialized;
void
Con_ClearNotify (void)
{
int i;
for (i = 0; i < NUM_CON_TIMES; i++)
con_times[i] = 0;
}
void
Con_ToggleConsole_f (void)
{
Key_ClearTyping ();
/*XXX
if (key_dest == key_console) {
if (cls.state == ca_active)
if (con_data.force_commandline)
key_dest = key_console;
else
key_dest = key_game;
} else
key_dest = key_console;
*/
Con_ClearNotify ();
}
@ -106,11 +109,13 @@ Con_ToggleChat_f (void)
Key_ClearTyping ();
if (key_dest == key_console) {
/*XXX
if (cls.state == ca_active)
*/
if (con_data.force_commandline) {
key_dest = key_console;
game_target = IMT_CONSOLE;
} else {
key_dest = key_game;
game_target = IMT_0;
}
} else {
key_dest = key_console;
game_target = IMT_CONSOLE;
@ -129,22 +134,11 @@ Con_Clear_f (void)
con_main.display = con_main.current;
}
void
Con_ClearNotify (void)
{
int i;
for (i = 0; i < NUM_CON_TIMES; i++)
con_times[i] = 0;
}
void
Con_MessageMode_f (void)
{
/*XXX
if (cls.state != ca_active)
if (con_data.force_commandline)
return;
*/
chat_team = false;
key_dest = key_message;
}
@ -152,14 +146,13 @@ Con_MessageMode_f (void)
void
Con_MessageMode2_f (void)
{
/*XXX
if (cls.state != ca_active)
if (con_data.force_commandline)
return;
*/
chat_team = true;
key_dest = key_message;
}
/*
void
Con_Resize (console_t *con)
{
@ -208,6 +201,7 @@ Con_Resize (console_t *con)
con->current = con_totallines - 1;
con->display = con->current;
}
*/
/*
Con_CheckResize
@ -217,13 +211,17 @@ Con_Resize (console_t *con)
void
Con_CheckResize (void)
{
Con_Resize (&con_main);
Con_Resize (&con_chat);
//XXX Con_Resize (&con_main);
//XXX Con_Resize (&con_chat);
}
static void
C_Init (void)
{
con_notifytime = Cvar_Get ("con_notifytime", "3", CVAR_NONE, NULL,
"How long in seconds messages are displayed "
"on screen");
con_debuglog = COM_CheckParm ("-condebug");
con = &con_main;
@ -250,14 +248,6 @@ C_Shutdown (void)
{
}
void
Con_Init_Cvars (void)
{
con_notifytime = Cvar_Get ("con_notifytime", "3", CVAR_NONE, NULL,
"How long in seconds messages are displayed "
"on screen");
}
void
Con_Linefeed (void)
{
@ -374,10 +364,8 @@ Con_DrawInput (void)
char temp[MAXCMDLINE];
char *text;
/*XXX
if (key_dest != key_console && cls.state == ca_active)
if (key_dest != key_console && !con_data.force_commandline)
return; // don't draw anything (always draw if not active)
*/
text = strcpy (temp, key_lines[edit_line]);