From 29402ff6857c7ee91f9fe88b8674ddd6595b9ee2 Mon Sep 17 00:00:00 2001 From: ZZYZX Date: Wed, 19 Apr 2017 12:01:56 +0300 Subject: [PATCH] ZScript version of SetCameraToTexture --- src/r_utility.cpp | 13 +++++++++++++ wadsrc/static/zscript/base.txt | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/r_utility.cpp b/src/r_utility.cpp index f700afe79..7a90a03ec 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -65,6 +65,7 @@ #include "p_maputl.h" #include "sbar.h" #include "math/cmath.h" +#include "vm.h" // EXTERNAL DATA DECLARATIONS ---------------------------------------------- @@ -983,6 +984,18 @@ void FCanvasTextureInfo::Add (AActor *viewpoint, FTextureID picnum, int fov) List = probe; } +// [ZZ] expose this to ZScript +DEFINE_ACTION_FUNCTION(_TexMan, SetCameraToTexture) +{ + PARAM_PROLOGUE; + PARAM_OBJECT(viewpoint, AActor); + PARAM_STRING(texturename); // [ZZ] there is no point in having this as FTextureID because it's easier to refer to a cameratexture by name and it isn't executed too often to cache it. + PARAM_INT(fov); + FTextureID textureid = TexMan.CheckForTexture(texturename, FTexture::TEX_Wall, FTextureManager::TEXMAN_Overridable); + FCanvasTextureInfo::Add(viewpoint, textureid, fov); + return 0; +} + //========================================================================== // // FCanvasTextureInfo :: UpdateAll diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index bb941b414..7b920f524 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -93,6 +93,8 @@ struct TexMan native static Vector2 GetScaledSize(TextureID tex); native static Vector2 GetScaledOffset(TextureID tex); native static int CheckRealHeight(TextureID tex); + + native static void SetCameraToTexture(Actor viewpoint, String texture, int fov); } enum DrawTextureTags