mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 20:20:43 +00:00
the beginnings of the console lib (using plugins for the client/server type
consoles). Currently, doesn't affect anybody other than the need to re-bootstrap.
This commit is contained in:
parent
0576dec1e2
commit
104701a8c5
15 changed files with 257 additions and 8 deletions
|
@ -1371,6 +1371,7 @@ AC_OUTPUT(
|
|||
libs/audio/Makefile
|
||||
libs/audio/cd/Makefile
|
||||
libs/audio/targets/Makefile
|
||||
libs/console/Makefile
|
||||
libs/gamecode/Makefile
|
||||
libs/gib/Makefile
|
||||
libs/models/Makefile
|
||||
|
|
|
@ -59,7 +59,7 @@ 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_Init (const char *plugin_name);
|
||||
void Con_Shutdown (void);
|
||||
void Con_Init_Cvars (void);
|
||||
void Con_ProcessInput (void);
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include <QF/qtypes.h>
|
||||
#include <QF/plugin/cd.h>
|
||||
#include <QF/plugin/console.h>
|
||||
#include <QF/plugin/general.h>
|
||||
#include <QF/plugin/input.h>
|
||||
#include <QF/plugin/sound.h>
|
||||
|
@ -44,6 +45,7 @@ typedef enum {
|
|||
qfp_input, // Input (pointing devices, joysticks, etc)
|
||||
qfp_cd, // CD Audio
|
||||
qfp_sound, // Wave output (OSS, ALSA, Win32)
|
||||
qfp_console, // Console `driver'
|
||||
} plugin_type_t;
|
||||
|
||||
typedef struct plugin_funcs_s {
|
||||
|
@ -51,6 +53,7 @@ typedef struct plugin_funcs_s {
|
|||
input_funcs_t *input;
|
||||
cd_funcs_t *cd;
|
||||
sound_funcs_t *sound;
|
||||
console_funcs_t *console;
|
||||
} plugin_funcs_t;
|
||||
|
||||
typedef struct plugin_data_s {
|
||||
|
@ -58,6 +61,7 @@ typedef struct plugin_data_s {
|
|||
input_data_t *input;
|
||||
// cd_data_t *cd;
|
||||
sound_data_t *sound;
|
||||
console_data_t *console;
|
||||
} plugin_data_t;
|
||||
|
||||
typedef struct plugin_s {
|
||||
|
|
50
include/QF/plugin/console.h
Normal file
50
include/QF/plugin/console.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
QF/plugin/console.h
|
||||
|
||||
General plugin data and structures
|
||||
|
||||
Copyright (C) 2001 Jeff Teunissen <deek@quakeforge.net>
|
||||
|
||||
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:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef __QF_plugin_console_h_
|
||||
#define __QF_plugin_console_h_
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <QF/qtypes.h>
|
||||
#include <QF/plugin.h>
|
||||
|
||||
typedef void (QFPLUGIN *P_C_Init) (void);
|
||||
typedef void (QFPLUGIN *P_C_Shutdown) (void);
|
||||
typedef void (QFPLUGIN *P_C_Print) (const char *fmt, va_list args);
|
||||
|
||||
typedef struct console_func_s {
|
||||
P_C_Init pC_Init;
|
||||
P_C_Shutdown pC_Shutdown;
|
||||
P_C_Print pC_Print;
|
||||
} console_funcs_t;
|
||||
|
||||
typedef struct console_data_s {
|
||||
} console_data_t;
|
||||
|
||||
#endif // __QF_plugin_console_h_
|
|
@ -1,4 +1,4 @@
|
|||
SUBDIRS= audio gamecode gib models video util
|
||||
SUBDIRS= audio console gamecode gib models video util
|
||||
|
||||
clean-local:
|
||||
rm -f *.a
|
||||
|
|
7
libs/console/.gitignore
vendored
Normal file
7
libs/console/.gitignore
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
*.la
|
||||
*.lo
|
||||
.deps
|
||||
.libs
|
||||
.vimrc
|
||||
Makefile
|
||||
Makefile.in
|
13
libs/console/Makefile.am
Normal file
13
libs/console/Makefile.am
Normal file
|
@ -0,0 +1,13 @@
|
|||
SUBDIRS=
|
||||
INCLUDES= -I$(top_srcdir)/include
|
||||
|
||||
lib_LTLIBRARIES = libQFconsole.la
|
||||
|
||||
common_SOURCES = console.c list.c
|
||||
|
||||
libQFconsole_la_LDFLAGS = -version-info 1:0:0
|
||||
libQFconsole_la_LIBADD =
|
||||
libQFconsole_la_SOURCES = $(common_SOURCES)
|
||||
libQFconsole_la_DEPENDENCIES =
|
||||
|
||||
LIBLIST = libQFconsole.la
|
90
libs/console/console.c
Normal file
90
libs/console/console.c
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
console.c
|
||||
|
||||
console api
|
||||
|
||||
Copyright (C) 2001 Bill Currie <bill@taniwha.org>
|
||||
|
||||
Author: Bill Currie <bill@taniwha.org>
|
||||
Date: 2001/7/16
|
||||
|
||||
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:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/plugin.h"
|
||||
|
||||
static plugin_t *con_module;
|
||||
|
||||
void
|
||||
Con_Init (const char *plugin_name)
|
||||
{
|
||||
con_module = PI_LoadPlugin ("console", plugin_name);
|
||||
if (con_module) {
|
||||
con_module->functions->console->pC_Init ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Con_Init_Cvars (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Con_Shutdown (void)
|
||||
{
|
||||
if (con_module) {
|
||||
con_module->functions->console->pC_Shutdown ();
|
||||
PI_UnloadPlugin (con_module);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Con_Printf (const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, fmt);
|
||||
if (con_module)
|
||||
con_module->functions->console->pC_Print (fmt, args);
|
||||
else
|
||||
vfprintf (stdout, fmt, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
Con_DPrintf (const char *fmt, ...)
|
||||
{
|
||||
if (developer && developer->int_val) {
|
||||
va_list args;
|
||||
va_start (args, fmt);
|
||||
if (con_module)
|
||||
con_module->functions->console->pC_Print (fmt, args);
|
||||
else
|
||||
vfprintf (stdout, fmt, args);
|
||||
va_end (args);
|
||||
}
|
||||
}
|
84
libs/console/list.c
Normal file
84
libs/console/list.c
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
list.c
|
||||
|
||||
pretty print a list of strings to the console
|
||||
|
||||
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:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/console.h"
|
||||
|
||||
/*
|
||||
Con_DisplayList
|
||||
|
||||
New function for tab-completion system
|
||||
Added by EvilTypeGuy
|
||||
MEGA Thanks to Taniwha
|
||||
|
||||
*/
|
||||
void
|
||||
Con_DisplayList(const char **list, int con_linewidth)
|
||||
{
|
||||
int i = 0;
|
||||
int pos = 0;
|
||||
int len = 0;
|
||||
int maxlen = 0;
|
||||
int width = (con_linewidth - 4);
|
||||
const char **walk = list;
|
||||
|
||||
while (*walk) {
|
||||
len = strlen(*walk);
|
||||
if (len > maxlen)
|
||||
maxlen = len;
|
||||
walk++;
|
||||
}
|
||||
maxlen += 1;
|
||||
|
||||
while (*list) {
|
||||
len = strlen(*list);
|
||||
if (pos + maxlen >= width) {
|
||||
Con_Printf("\n");
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
Con_Printf("%s", *list);
|
||||
for (i = 0; i < (maxlen - len); i++)
|
||||
Con_Printf(" ");
|
||||
|
||||
pos += maxlen;
|
||||
list++;
|
||||
}
|
||||
|
||||
if (pos)
|
||||
Con_Printf("\n\n");
|
||||
}
|
|
@ -217,7 +217,7 @@ Con_CheckResize (void)
|
|||
|
||||
|
||||
void
|
||||
Con_Init (void)
|
||||
Con_Init (const char *plugin_name)
|
||||
{
|
||||
con_debuglog = COM_CheckParm ("-condebug");
|
||||
|
||||
|
|
|
@ -958,7 +958,7 @@ Host_Init (quakeparms_t *parms)
|
|||
Host_InitLocal ();
|
||||
W_LoadWadFile ("gfx.wad");
|
||||
Key_Init ();
|
||||
Con_Init ();
|
||||
Con_Init ("client");
|
||||
// FIXME: MENUCODE
|
||||
// M_Init ();
|
||||
PR_Init ();
|
||||
|
|
|
@ -1630,7 +1630,7 @@ Host_Init (void)
|
|||
|
||||
W_LoadWadFile ("gfx.wad");
|
||||
Key_Init ();
|
||||
Con_Init ();
|
||||
Con_Init ("client");
|
||||
Mod_Init ();
|
||||
|
||||
// Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
|
||||
|
|
|
@ -217,7 +217,7 @@ Con_CheckResize (void)
|
|||
|
||||
|
||||
void
|
||||
Con_Init (void)
|
||||
Con_Init (const char *plugin_name)
|
||||
{
|
||||
con_debuglog = COM_CheckParm ("-condebug");
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ static const byte attr_map[256] = {
|
|||
};
|
||||
|
||||
void
|
||||
Con_Init (void)
|
||||
Con_Init (const char *plugin_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
@ -2030,7 +2030,7 @@ SV_Init (void)
|
|||
|
||||
PI_Init ();
|
||||
|
||||
Con_Init ();
|
||||
Con_Init ("server");
|
||||
|
||||
COM_Filesystem_Init_Cvars ();
|
||||
Game_Init_Cvars ();
|
||||
|
|
Loading…
Reference in a new issue