header for command.cc

master
Daniel Kolesa 2020-06-22 23:45:20 +02:00
parent d45b066e5d
commit 089c896411
25 changed files with 73 additions and 43 deletions

View File

@ -1,4 +1,5 @@
#include "blend.hh"
#include "console.hh" /* conoutf */
#include "octaedit.hh"
#include "rendergl.hh" /* has* */
#include "renderva.hh"

View File

@ -2,6 +2,9 @@
// is largely backwards compatible with the quake console language.
#include "command.hh"
#include "console.hh"
#include "engine.hh"
hashnameset<ident> idents; // contains ALL vars/commands/aliases

View File

@ -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<cline, MAXCONLINES> 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<fileskey, filesval *> completefiles;
static hashtable<char *, filesval *> 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)

View File

@ -0,0 +1,33 @@
#ifndef ENGINE_CONSOLE_HH
#define ENGINE_CONSOLE_HH
#include <shared/tools.hh>
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

View File

@ -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

View File

@ -1,4 +1,5 @@
#include "blend.hh"
#include "console.hh" /* conoutf */
#include "main.hh" // renderbackground
#include "octa.hh"
#include "octaedit.hh" // commitchanges

View File

@ -4,6 +4,7 @@
#include "blend.hh"
#include "command.hh" // checksleep, writecfg
#include "console.hh"
#include "movie.hh"
#include "octaedit.hh"
#include "rendergl.hh"

View File

@ -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"

View File

@ -2,6 +2,7 @@
#include "octa.hh"
#include "console.hh" /* conoutf */
#include "main.hh" // renderprogress
#include "octaedit.hh"
#include "world.hh"

View File

@ -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"

View File

@ -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"

View File

@ -5,6 +5,7 @@
#include "physics.hh"
#include "console.hh" /* conoutf */
#include "rendermodel.hh"
#include "octa.hh"
#include "world.hh"

View File

@ -1,5 +1,6 @@
#include "pvs.hh"
#include "console.hh" /* conoutf */
#include "main.hh" // numcpus, interceptkey, renderbackground
#include "octa.hh"

View File

@ -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"

View File

@ -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"

View File

@ -1,5 +1,6 @@
// renderparticles.cpp
#include "console.hh" /* conoutf */
#include "main.hh" // initing, minimized, loadprogress
#include "renderparticles.hh"
#include "octaedit.hh" // editmode

View File

@ -1,3 +1,4 @@
#include "console.hh" /* conoutf */
#include "octaedit.hh" // editmode
#include "rendergl.hh"
#include "renderlights.hh"

View File

@ -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

View File

@ -1,3 +1,4 @@
#include "console.hh" /* conoutf */
#include "main.hh" // initing, loadprogress
#include "material.hh"
#include "rendergl.hh"

View File

@ -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"

View File

@ -2,6 +2,7 @@
#include "blend.hh"
#include "command.hh"
#include "console.hh" /* conoutf */
#include "main.hh" // clearmainmenu
#include "octa.hh"
#include "octaedit.hh"

View File

@ -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

View File

@ -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);

View File

@ -1,3 +1,5 @@
#include <engine/console.hh> /* conoutf */
#include "cube.hh"
///////////////////////// character conversion ///////////////

View File

@ -1,3 +1,5 @@
#include <engine/console.hh> /* conoutf */
#include "cube.hh"
enum