diff --git a/src/engine/blend.cc b/src/engine/blend.cc index 83a1922..2137884 100644 --- a/src/engine/blend.cc +++ b/src/engine/blend.cc @@ -1,4 +1,5 @@ #include "blend.hh" +#include "console.hh" /* conoutf */ #include "octaedit.hh" #include "rendergl.hh" /* has* */ #include "renderva.hh" diff --git a/src/engine/command.cc b/src/engine/command.cc index 4158f3f..46909db 100644 --- a/src/engine/command.cc +++ b/src/engine/command.cc @@ -2,6 +2,9 @@ // is largely backwards compatible with the quake console language. #include "command.hh" + +#include "console.hh" + #include "engine.hh" hashnameset idents; // contains ALL vars/commands/aliases diff --git a/src/engine/console.cc b/src/engine/console.cc index d7949f9..56be9e5 100644 --- a/src/engine/console.cc +++ b/src/engine/console.cc @@ -1,5 +1,7 @@ // console.cpp: the console buffer, its display, and command line control +#include "console.hh" + #include "command.hh" // idents, identflags #include "main.hh" #include "octaedit.hh" // editmode @@ -7,6 +9,9 @@ #include "engine.hh" +static void resetcomplete(); +static void complete(char *s, int maxlen, const char *cmdprefix); + #define MAXCONLINES 1000 struct cline { char *line; int type, outtime; }; reversequeue conlines; @@ -204,11 +209,13 @@ COMMAND(keymap, "is"); keym *keypressed = NULL; char *keyaction = NULL; -const char *getkeyname(int code) +#if 0 +static const char *getkeyname(int code) { keym *km = keyms.access(code); return km ? km->name : NULL; } +#endif void searchbinds(char *action, int type) { @@ -689,12 +696,12 @@ static inline uint hthash(const fileskey &k) static hashtable completefiles; static hashtable completions; -int completesize = 0; -char *lastcomplete = NULL; +static int completesize = 0; +static char *lastcomplete = NULL; -void resetcomplete() { completesize = 0; } +static void resetcomplete() { completesize = 0; } -void addcomplete(char *command, int type, char *dir, char *ext) +static void addcomplete(char *command, int type, char *dir, char *ext) { if(identflags&IDF_OVERRIDDEN) { @@ -732,12 +739,12 @@ void addcomplete(char *command, int type, char *dir, char *ext) else completions[newstring(command)] = *val; } -void addfilecomplete(char *command, char *dir, char *ext) +static void addfilecomplete(char *command, char *dir, char *ext) { addcomplete(command, FILES_DIR, dir, ext); } -void addlistcomplete(char *command, char *list) +static void addlistcomplete(char *command, char *list) { addcomplete(command, FILES_LIST, list, NULL); } @@ -745,7 +752,7 @@ void addlistcomplete(char *command, char *list) COMMANDN(complete, addfilecomplete, "sss"); COMMANDN(listcomplete, addlistcomplete, "ss"); -void complete(char *s, int maxlen, const char *cmdprefix) +static void complete(char *s, int maxlen, const char *cmdprefix) { int cmdlen = 0; if(cmdprefix) diff --git a/src/engine/console.hh b/src/engine/console.hh new file mode 100644 index 0000000..7ee18d9 --- /dev/null +++ b/src/engine/console.hh @@ -0,0 +1,33 @@ +#ifndef ENGINE_CONSOLE_HH +#define ENGINE_CONSOLE_HH + +#include + +struct tagval; /* command.hh */ +struct ident; + +void processkey(int code, bool isdown, int modstate = 0); +void processtextinput(const char *str, int len); +float rendercommand(float x, float y, float w); +float renderfullconsole(float w, float h); +float renderconsole(float w, float h, float abovehud); +const char *addreleaseaction(char *s); +tagval *addreleaseaction(ident *id, int numargs); +void writebinds(stream *f); +void writecompletions(stream *f); + +enum +{ + CON_INFO = 1<<0, + CON_WARN = 1<<1, + CON_ERROR = 1<<2, + CON_DEBUG = 1<<3, + CON_INIT = 1<<4, + CON_ECHO = 1<<5 +}; + +void conoutf(const char *s, ...) PRINTFARGS(1, 2); +void conoutf(int type, const char *s, ...) PRINTFARGS(2, 3); +void conoutfv(int type, const char *fmt, va_list args); + +#endif diff --git a/src/engine/engine.hh b/src/engine/engine.hh index 0e032b0..0c47ce3 100644 --- a/src/engine/engine.hh +++ b/src/engine/engine.hh @@ -80,23 +80,5 @@ extern void destroyva(vtxarray *va, bool reparent = true); extern void updatevabb(vtxarray *va, bool force = false); extern void updatevabbs(bool force = false); -// console -extern float conscale; - -extern void processkey(int code, bool isdown, int modstate = 0); -extern void processtextinput(const char *str, int len); -extern float rendercommand(float x, float y, float w); -extern float renderfullconsole(float w, float h); -extern float renderconsole(float w, float h, float abovehud); -extern void conoutf(const char *s, ...) PRINTFARGS(1, 2); -extern void conoutf(int type, const char *s, ...) PRINTFARGS(2, 3); -extern void resetcomplete(); -extern void complete(char *s, int maxlen, const char *cmdprefix); -const char *getkeyname(int code); -extern const char *addreleaseaction(char *s); -extern tagval *addreleaseaction(ident *id, int numargs); -extern void writebinds(stream *f); -extern void writecompletions(stream *f); - #endif diff --git a/src/engine/light.cc b/src/engine/light.cc index b76fdb9..e286a28 100644 --- a/src/engine/light.cc +++ b/src/engine/light.cc @@ -1,4 +1,5 @@ #include "blend.hh" +#include "console.hh" /* conoutf */ #include "main.hh" // renderbackground #include "octa.hh" #include "octaedit.hh" // commitchanges diff --git a/src/engine/main.cc b/src/engine/main.cc index d9d0e61..abed65d 100644 --- a/src/engine/main.cc +++ b/src/engine/main.cc @@ -4,6 +4,7 @@ #include "blend.hh" #include "command.hh" // checksleep, writecfg +#include "console.hh" #include "movie.hh" #include "octaedit.hh" #include "rendergl.hh" diff --git a/src/engine/movie.cc b/src/engine/movie.cc index 42496dc..9507f3d 100644 --- a/src/engine/movie.cc +++ b/src/engine/movie.cc @@ -9,6 +9,7 @@ #include "movie.hh" +#include "console.hh" /* conoutf */ #include "main.hh" // getfps, getclockmillis, screenw/h, inbetweenframes, renderedframe #include "rendergl.hh" #include "rendertext.hh" diff --git a/src/engine/octa.cc b/src/engine/octa.cc index eca9f55..2581cc5 100644 --- a/src/engine/octa.cc +++ b/src/engine/octa.cc @@ -2,6 +2,7 @@ #include "octa.hh" +#include "console.hh" /* conoutf */ #include "main.hh" // renderprogress #include "octaedit.hh" #include "world.hh" diff --git a/src/engine/octaedit.cc b/src/engine/octaedit.cc index 39bd183..641e98c 100644 --- a/src/engine/octaedit.cc +++ b/src/engine/octaedit.cc @@ -1,6 +1,7 @@ #include "octaedit.hh" #include "blend.hh" +#include "console.hh" /* conoutf */ #include "main.hh" // mainmenu, keyrepeat, renderedframe #include "material.hh" #include "octa.hh" diff --git a/src/engine/octarender.cc b/src/engine/octarender.cc index ed316dd..50fb11f 100644 --- a/src/engine/octarender.cc +++ b/src/engine/octarender.cc @@ -1,6 +1,7 @@ // octarender.cpp: fill vertex arrays with different cube surfaces. #include "blend.hh" +#include "console.hh" /* conoutf */ #include "grass.hh" #include "main.hh" // mainmenu, laodprogress #include "material.hh" diff --git a/src/engine/physics.cc b/src/engine/physics.cc index 7ebd8f1..1fbb815 100644 --- a/src/engine/physics.cc +++ b/src/engine/physics.cc @@ -5,6 +5,7 @@ #include "physics.hh" +#include "console.hh" /* conoutf */ #include "rendermodel.hh" #include "octa.hh" #include "world.hh" diff --git a/src/engine/pvs.cc b/src/engine/pvs.cc index c910a7b..b134454 100644 --- a/src/engine/pvs.cc +++ b/src/engine/pvs.cc @@ -1,5 +1,6 @@ #include "pvs.hh" +#include "console.hh" /* conoutf */ #include "main.hh" // numcpus, interceptkey, renderbackground #include "octa.hh" diff --git a/src/engine/rendergl.cc b/src/engine/rendergl.cc index f957110..1ef332f 100644 --- a/src/engine/rendergl.cc +++ b/src/engine/rendergl.cc @@ -2,6 +2,7 @@ #include "aa.hh" #include "blend.hh" +#include "console.hh" #include "grass.hh" #include "main.hh" // mainmenu, renderbackground, getfps, getclockmillis, screenw/h, inbetweenframes, renderedframe #include "material.hh" diff --git a/src/engine/rendermodel.cc b/src/engine/rendermodel.cc index f5729dc..6410907 100644 --- a/src/engine/rendermodel.cc +++ b/src/engine/rendermodel.cc @@ -2,6 +2,7 @@ #include "aa.hh" #include "command.hh" // identflags +#include "console.hh" /* conoutf */ #include "main.hh" // loadprogress, renderprogress #include "pvs.hh" #include "rendergl.hh" diff --git a/src/engine/renderparticles.cc b/src/engine/renderparticles.cc index e0607b6..e666dcc 100644 --- a/src/engine/renderparticles.cc +++ b/src/engine/renderparticles.cc @@ -1,5 +1,6 @@ // renderparticles.cpp +#include "console.hh" /* conoutf */ #include "main.hh" // initing, minimized, loadprogress #include "renderparticles.hh" #include "octaedit.hh" // editmode diff --git a/src/engine/rendersky.cc b/src/engine/rendersky.cc index 122a829..880a4dd 100644 --- a/src/engine/rendersky.cc +++ b/src/engine/rendersky.cc @@ -1,3 +1,4 @@ +#include "console.hh" /* conoutf */ #include "octaedit.hh" // editmode #include "rendergl.hh" #include "renderlights.hh" diff --git a/src/engine/shader.cc b/src/engine/shader.cc index 6d1a4bd..41e6c7b 100644 --- a/src/engine/shader.cc +++ b/src/engine/shader.cc @@ -3,6 +3,7 @@ #include "shader.hh" #include "command.hh" // identflags +#include "console.hh" /* conoutf */ #include "main.hh" // loadprogress, renderprogress #include "rendergl.hh" #include "rendermodel.hh" // cleanupmodels diff --git a/src/engine/stain.cc b/src/engine/stain.cc index 0be7203..42c4d29 100644 --- a/src/engine/stain.cc +++ b/src/engine/stain.cc @@ -1,3 +1,4 @@ +#include "console.hh" /* conoutf */ #include "main.hh" // initing, loadprogress #include "material.hh" #include "rendergl.hh" diff --git a/src/engine/texture.cc b/src/engine/texture.cc index 3c328ae..11503cc 100644 --- a/src/engine/texture.cc +++ b/src/engine/texture.cc @@ -3,6 +3,7 @@ #include "texture.hh" #include "command.hh" // identflags +#include "console.hh" /* conoutf */ #include "main.hh" // initwarning, loadprogress, renderprogress, screenw/h, renderedframe #include "material.hh" #include "octaedit.hh" diff --git a/src/engine/world.cc b/src/engine/world.cc index cb3526d..3bcb0b7 100644 --- a/src/engine/world.cc +++ b/src/engine/world.cc @@ -2,6 +2,7 @@ #include "blend.hh" #include "command.hh" +#include "console.hh" /* conoutf */ #include "main.hh" // clearmainmenu #include "octa.hh" #include "octaedit.hh" diff --git a/src/engine/worldio.cc b/src/engine/worldio.cc index a771bea..1fa033b 100644 --- a/src/engine/worldio.cc +++ b/src/engine/worldio.cc @@ -2,6 +2,7 @@ #include "blend.hh" #include "command.hh" // idents, identflags +#include "console.hh" /* conoutf */ #include "main.hh" // clearmainmenu, renderbackground #include "octa.hh" #include "octaedit.hh" // texmru diff --git a/src/shared/iengine.hh b/src/shared/iengine.hh index 32aafe1..ac2832c 100644 --- a/src/shared/iengine.hh +++ b/src/shared/iengine.hh @@ -84,23 +84,6 @@ extern void loopend(ident *id, identstack &stack); #define loopstart(id, stack) if((id)->type != ID_ALIAS) return; identstack stack; static inline void loopiter(ident *id, identstack &stack, int i) { tagval v; v.setint(i); loopiter(id, stack, v); } static inline void loopiter(ident *id, identstack &stack, float f) { tagval v; v.setfloat(f); loopiter(id, stack, v); } -static inline void loopiter(ident *id, identstack &stack, const char *s) { tagval v; v.setstr(newstring(s)); loopiter(id, stack, v); } - -// console - -enum -{ - CON_INFO = 1<<0, - CON_WARN = 1<<1, - CON_ERROR = 1<<2, - CON_DEBUG = 1<<3, - CON_INIT = 1<<4, - CON_ECHO = 1<<5 -}; - -extern void conoutf(const char *s, ...) PRINTFARGS(1, 2); -extern void conoutf(int type, const char *s, ...) PRINTFARGS(2, 3); -extern void conoutfv(int type, const char *fmt, va_list args); // main extern void fatal(const char *s, ...) PRINTFARGS(1, 2); diff --git a/src/shared/stream.cc b/src/shared/stream.cc index 89fbc01..36fa26f 100644 --- a/src/shared/stream.cc +++ b/src/shared/stream.cc @@ -1,3 +1,5 @@ +#include /* conoutf */ + #include "cube.hh" ///////////////////////// character conversion /////////////// diff --git a/src/shared/zip.cc b/src/shared/zip.cc index 7317e54..0726a62 100644 --- a/src/shared/zip.cc +++ b/src/shared/zip.cc @@ -1,3 +1,5 @@ +#include /* conoutf */ + #include "cube.hh" enum