From 03c8da8a440b524d9935b862ead19c5c30518b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Sun, 10 Jul 2022 18:39:01 -0300 Subject: [PATCH] Expose Print Flags to ZScript --- src/common/scripting/interface/vmnatives.cpp | 10 ++++++++++ wadsrc/static/zscript/engine/base.zs | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/common/scripting/interface/vmnatives.cpp b/src/common/scripting/interface/vmnatives.cpp index 079cd78ae9..51b7e796ce 100644 --- a/src/common/scripting/interface/vmnatives.cpp +++ b/src/common/scripting/interface/vmnatives.cpp @@ -1009,6 +1009,16 @@ DEFINE_ACTION_FUNCTION(_Console, Printf) return 0; } +DEFINE_ACTION_FUNCTION(_Console, PrintString) +{ + PARAM_PROLOGUE; + PARAM_INT(printlevel); + PARAM_STRING(str); + + Printf(printlevel,"%s\n", str.GetChars()); + return 0; +} + static void StopAllSounds() { soundEngine->StopAllChannels(); diff --git a/wadsrc/static/zscript/engine/base.zs b/wadsrc/static/zscript/engine/base.zs index 83ad9fdfac..c46c1612aa 100644 --- a/wadsrc/static/zscript/engine/base.zs +++ b/wadsrc/static/zscript/engine/base.zs @@ -600,6 +600,22 @@ struct Console native { native static void HideConsole(); native static vararg void Printf(string fmt, ...); + + enum EPrintLevel { + 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. + PRINT_NONOTIFY = 1024, // Flag - do not add to notify buffer + PRINT_NOLOG = 2048, // Flag - do not print to log file + PRINT_NOTIFY = 4096, // Flag - add to game-native notify display - messages without this only go to the generic notification buffer. + }; + + native static void PrintString(int printlevel, string str); } struct CVar native