diff --git a/src/r_utility.cpp b/src/r_utility.cpp index f700afe79ec..7a90a03ec58 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 bb941b41482..7b920f524cd 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