1 // Emacs style mode select   -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id: doomincl.h 835 2011-05-27 00:49:51Z wesleyjohnson $
5 //
6 // Copyright (C) 1993-1996 by id Software, Inc.
7 // Copyright (C) 1998-2016 by DooM Legacy Team.
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License
11 // as published by the Free Software Foundation; either version 2
12 // of the License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 //
20 // DESCRIPTION:
21 //      Internally used data structures for virtually everything,
22 //      key definitions, lots of other stuff.
23 //      Not used in headers.
24 //
25 //-----------------------------------------------------------------------------
26 
27 #ifndef DOOMINCL_H
28 #define DOOMINCL_H
29 
30 #include <stdarg.h>
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include <string.h>
34 #include <math.h>
35 #include <sys/types.h>
36 #include <sys/stat.h>
37 #include <ctype.h>
38 
39 #if defined( __DJGPP__ )
40 #include <io.h>
41 #endif
42 
43 #ifdef SMIF_PC_DOS
44 #include <conio.h>
45 #endif
46 
47 #include "doomdef.h"
48 #include "doomtype.h"
49 
50 
51 // commonly used routines - moved here for include convenience
52 
53 // [WDJ] Message types, subject to routing and output controls.
54 // Many choices so can be individually configured.
55 // There are tables indexed by EMSG_cat in console.c.
56 typedef enum {
57    EMSG_cat = 0x0F, // mask category subject to display enables
58  // one of the following categories
59    EMSG_CONS = 0x00,  // existing unclassified CONS_Printf messages.
60    EMSG_playmsg = 0x01,
61    EMSG_playmsg2 = 0x02,
62    EMSG_console = 0x05,  // console interactive
63    EMSG_hud = 0x06,  // interactive messages, network
64    EMSG_7,
65    EMSG_info = 0x08,
66    EMSG_ver = 0x09,  // verbose
67    EMSG_debug = 0x0A,
68    EMSG_dev = 0x0B,
69    EMSG_warn = 0x0C,
70    EMSG_errlog = 0x0D,  // stderr and log, but not console
71    EMSG_error = 0x0E,
72    EMSG_error2 = 0x0F,  // severe error
73  // additional flags
74    EMSG_now  = 0x40, // immediate update
75    EMSG_all = 0x80
76 } EMSG_e;
77 
78 // [WDJ] Enables for messages to various outputs
79 // Many choices so can be individually configured.
80 typedef enum {
81    EOUT_hud = 0x01,   // hud message lines
82    EOUT_con = 0x04,   // console
83    EOUT_text = 0x10,  // stderr
84    EOUT_log  = 0x20,  // log file
85    EOUT_all = EOUT_text|EOUT_con|EOUT_log,
86 } EOUT_e;
87 
88 extern  byte  EOUT_flags;  // EOUT_e
89 extern  byte  fatal_error;
90 
91 // console.h
92 // Global param: EOUT_flags
93 void  CONS_Printf (const char *fmt, ...);
94 // For info, debug, dev, verbose messages
95 // print to text, console, and logs
96 //  emsg : EMSG_e
97 void  GenPrintf (const byte emsg, const char *fmt, ...);
98 void  GenPrintf_va (const byte emsg, const char *fmt, va_list ap );
99 // Console interaction printf interface.
100 void  con_Printf (const char *fmt, ...);
101 // Debug printf interface.
102 void  debug_Printf (const char *fmt, ...);
103 
104 // i_system.h
105 void  I_Error (const char *error, ...);
106 void  I_SoftError (const char *errmsg, ...);
107 
108 // m_misc.h
109 char  *va(const char *format, ...);
110 char  *Z_StrDup (const char *in);
111 
112 // Network
113 extern  boolean  dedicated;  // dedicated server
114 
115 // g_game.h
116 extern  byte    verbose;   // 1, 2
117 extern  byte    devparm;   // 1, 2, 3  // development mode (-devparm)
118 
119 // demo version when playback demo, or the current VERSION
120 // used to enable/disable selected features for backward compatibility
121 // (where possible)
122 extern  byte    demoversion;
123 extern  uint16_t  demoversion_rev;  // VERREV(demoversion, revision)
124 #define  VERREV(v,r)   (((int)(v)<<8)+(r))
125 
126 // version numbering
127 // [WDJ] For separate libs that cannot access VERSION var
128 // 1.48
129 #define DOOMLEGACY_COMPONENT_VERSION   14800
130 
131 extern const int  VERSION;
132 extern const int  REVISION;
133 extern char VERSION_BANNER[];
134 
135 // =======================
136 // Log and Debug stuff
137 // =======================
138 
139 // File handling stuff.
140 //#define DEBUGFILE
141 #ifdef DEBUGFILE
142 #define DEBFILE(msg) { if(debugfile) fputs(msg,debugfile); }
143 extern  FILE*           debugfile;
144 #else
145 #define DEBFILE(msg) {}
146 //extern  FILE*           debugfile;
147 #endif
148 
149 #ifdef LOGMESSAGES
150 extern  FILE  *logstream;
151 #endif
152 
153 
154 #endif  /* DOOMINCL_H */
155 
156