Skip to content

Commit

Permalink
ZScript version of SetCameraToTexture
Browse files Browse the repository at this point in the history
  • Loading branch information
ZZYZX authored and coelckers committed Apr 19, 2017
1 parent 316af5a commit 29402ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/r_utility.cpp
Expand Up @@ -65,6 +65,7 @@
#include "p_maputl.h"
#include "sbar.h"
#include "math/cmath.h"
#include "vm.h"


// EXTERNAL DATA DECLARATIONS ----------------------------------------------
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions wadsrc/static/zscript/base.txt
Expand Up @@ -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
Expand Down

0 comments on commit 29402ff

Please sign in to comment.