From bd885977e88a230d07fa9e6245691c2bb66e9aab Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 29 Apr 2022 00:47:06 +0200 Subject: [PATCH] - added MSTimef script function This also deprecates MSTime due to value range / overflow issues. --- src/common/objects/dobject.cpp | 5 +++++ wadsrc/static/zscript/engine/base.zs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/objects/dobject.cpp b/src/common/objects/dobject.cpp index 2ed8279da..9f9de3695 100644 --- a/src/common/objects/dobject.cpp +++ b/src/common/objects/dobject.cpp @@ -493,6 +493,11 @@ DEFINE_ACTION_FUNCTION(DObject, MSTime) ACTION_RETURN_INT((uint32_t)I_msTime()); } +DEFINE_ACTION_FUNCTION_NATIVE(DObject, MSTimef, I_msTimeF) +{ + ACTION_RETURN_INT((double)I_msTimeF()); +} + void *DObject::ScriptVar(FName field, PType *type) { auto cls = GetClass(); diff --git a/wadsrc/static/zscript/engine/base.zs b/wadsrc/static/zscript/engine/base.zs index 8c7e54368..58f510c4e 100644 --- a/wadsrc/static/zscript/engine/base.zs +++ b/wadsrc/static/zscript/engine/base.zs @@ -587,7 +587,8 @@ class Object native private native static Class BuiltinNameToClass(Name nm, Class filter); private native static Object BuiltinClassCast(Object inptr, Class test); - native static uint MSTime(); + deprecated("4.8", "Use MSTimeF instead") native static uint MSTime(); + native static double MSTimeF(); native vararg static void ThrowAbortException(String fmt, ...); native virtualscope void Destroy();