From 9fd78e90addcff9d5ece94ec37043bc385806643 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 6 Jan 2018 19:59:49 -0500 Subject: [PATCH] - export 'GetChecksum' as part of FLevelLocals in ZScript --- src/p_setup.cpp | 13 +++++++++++++ wadsrc/static/zscript/base.txt | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index b87bf6b87..a0d0f1842 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -116,6 +116,7 @@ #include "events.h" #include "types.h" #include "i_time.h" +#include "scripting/vm/vm.h" #include "fragglescript/t_fs.h" @@ -552,6 +553,18 @@ void MapData::GetChecksum(uint8_t cksum[16]) md5.Final(cksum); } +DEFINE_ACTION_FUNCTION(FLevelLocals, GetChecksum) +{ + PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals); + char md5string[33]; + + for(int j = 0; j < 16; ++j) + { + sprintf(md5string + j * 2, "%02x", level.md5[j]); + } + + ACTION_RETURN_STRING((const char*)md5string); +} //=========================================================================== // diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 01e2af795..fe776fcbc 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -555,6 +555,8 @@ struct LevelLocals native native static clearscope vector2 Vec2Diff(vector2 v1, vector2 v2); native static clearscope vector3 Vec3Diff(vector3 v1, vector3 v2); + + native String GetChecksum() const; String TimeFormatted(bool totals = false) {