2019-10-05 17:39:41 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-11-05 18:57:48 +00:00
|
|
|
// This header collects all things printf.
|
|
|
|
// EDuke32 had two totally separate output paths and all the added code from G/ZDoom uses yet another means.
|
|
|
|
// Everything goes to the console now, but to avoid changing everything, this redirects all output to the console, with the proper settings.
|
|
|
|
// Changing all this would mean altering over 1000 lines of code which would add a needless complication to merging from upstream.
|
|
|
|
|
2019-10-05 17:39:41 +00:00
|
|
|
|
|
|
|
#if defined __GNUC__ || defined __clang__
|
|
|
|
# define ATTRIBUTE(attrlist) __attribute__(attrlist)
|
|
|
|
#else
|
|
|
|
# define ATTRIBUTE(attrlist)
|
|
|
|
#endif
|
|
|
|
|
2019-11-05 18:57:48 +00:00
|
|
|
// game print flags
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PRINT_LOW, // pickup messages
|
|
|
|
PRINT_MEDIUM, // death messages
|
|
|
|
PRINT_HIGH, // critical messages
|
|
|
|
PRINT_CHAT, // chat messages
|
|
|
|
PRINT_TEAMCHAT, // chat messages from a teammate
|
|
|
|
PRINT_LOG, // only to logfile
|
|
|
|
PRINT_BOLD = 200, // What Printf_Bold used
|
|
|
|
PRINT_TYPES = 1023, // Bitmask.
|
2019-12-04 20:35:35 +00:00
|
|
|
PRINT_NOTIFY = 1024, // Flag - add to notify buffer
|
2019-11-05 18:57:48 +00:00
|
|
|
PRINT_NOLOG = 2048, // Flag - do not print to log file
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
DMSG_OFF, // no developer messages.
|
|
|
|
DMSG_ERROR, // general notification messages
|
|
|
|
DMSG_WARNING, // warnings
|
|
|
|
DMSG_NOTIFY, // general notification messages
|
|
|
|
DMSG_SPAMMY, // for those who want to see everything, regardless of its usefulness.
|
|
|
|
};
|
|
|
|
|
2019-10-05 17:39:41 +00:00
|
|
|
|
2019-10-23 23:20:58 +00:00
|
|
|
void I_Error(const char *fmt, ...) ATTRIBUTE((format(printf,1,2)));
|
2019-12-22 19:55:47 +00:00
|
|
|
void I_FatalError(const char* fmt, ...) ATTRIBUTE((format(printf, 1, 2)));
|
2019-10-05 17:39:41 +00:00
|
|
|
|
2019-12-02 23:57:03 +00:00
|
|
|
// This really could need some cleanup - the main problem is that it'd create
|
|
|
|
// lots of potential for merge conflicts.
|
|
|
|
|
2019-11-05 18:57:48 +00:00
|
|
|
int PrintString (int iprintlevel, const char *outline);
|
2019-11-24 09:03:19 +00:00
|
|
|
int VPrintf(int printlevel, const char* format, va_list parms);
|
2019-11-05 18:57:48 +00:00
|
|
|
int Printf (int printlevel, const char *format, ...) ATTRIBUTE((format(printf,2,3)));
|
|
|
|
int Printf (const char *format, ...) ATTRIBUTE((format(printf,1,2)));
|
|
|
|
int DPrintf (int level, const char *format, ...) ATTRIBUTE((format(printf,2,3)));
|
|
|
|
|
|
|
|
|
|
|
|
void OSD_Printf(const char *format, ...) ATTRIBUTE((format(printf,1,2)));
|
|
|
|
|
|
|
|
template<class... Args>
|
2019-12-02 23:57:03 +00:00
|
|
|
inline void initprintf(const char *format, Args&&... args) //ATTRIBUTE((format(printf,1,2)))
|
2019-11-05 18:57:48 +00:00
|
|
|
{
|
|
|
|
OSD_Printf(format, std::forward<Args>(args)...);
|
|
|
|
}
|
|
|
|
|
|
|
|
// This was a define before - which should be avoided. Used by Shadow Warrior
|
|
|
|
template<class... Args>
|
2019-12-02 23:57:03 +00:00
|
|
|
inline void buildprintf(const char *format, Args&&... args) //ATTRIBUTE((format(printf,1,2)))
|
2019-11-05 18:57:48 +00:00
|
|
|
{
|
|
|
|
OSD_Printf(format, std::forward<Args>(args)...);
|
|
|
|
}
|
|
|
|
|
2019-12-02 23:57:03 +00:00
|
|
|
|
|
|
|
|
2019-11-05 18:57:48 +00:00
|
|
|
inline void initputs(const char *s)
|
|
|
|
{
|
|
|
|
PrintString(PRINT_HIGH, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void buildputs(const char *s)
|
|
|
|
{
|
|
|
|
PrintString(PRINT_HIGH, s);
|
|
|
|
}
|
2019-11-20 19:07:33 +00:00
|
|
|
|
|
|
|
void debugprintf(const char* f, ...); // Prints to the debugger's log.
|