Exported DPrintf

Allows for custom debug message handling using the built-in
This commit is contained in:
Boondorl 2024-09-29 17:31:06 -04:00 committed by Rachael Alexanderson
parent 96ec9b9dbd
commit 1e96ed31aa
2 changed files with 21 additions and 0 deletions

View file

@ -1162,6 +1162,17 @@ DEFINE_ACTION_FUNCTION(_Console, PrintfEx)
return 0;
}
DEFINE_ACTION_FUNCTION(_Console, DebugPrintf)
{
PARAM_PROLOGUE;
PARAM_INT(debugLevel);
PARAM_VA_POINTER(va_reginfo);
FString s = FStringFormat(VM_ARGS_NAMES, 1);
DPrintf(debugLevel, "%s\n", s.GetChars());
return 0;
}
static void StopAllSounds()
{
soundEngine->StopAllChannels();

View file

@ -143,6 +143,15 @@ enum EPrintLevel
PRINT_NOLOG = 2048, // Flag - do not print to log file
};
enum EDebugLevel
{
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.
};
enum EConsoleState
{
c_up = 0,
@ -665,6 +674,7 @@ struct Console native
native static void HideConsole();
native static vararg void Printf(string fmt, ...);
native static vararg void PrintfEx(int printlevel, string fmt, ...);
native static vararg void DebugPrintf(int debuglevel, string fmt, ...);
}
struct CVar native