Permalink
Browse files

- more direct native stuff, this is a week old but was almost forgotten.

  • Loading branch information...
coelckers committed Dec 5, 2018
1 parent e01306d commit aef882c1378f2f0d07cf62eff8fa6c22fbe6c75f
Showing with 62 additions and 30 deletions.
  1. +9 −9 src/g_level.cpp
  2. +19 −10 src/hwrenderer/postprocessing/hw_postprocessshader.cpp
  3. +33 −10 src/menu/menu.cpp
  4. +1 −1 src/p_sectors.cpp
@@ -2031,9 +2031,9 @@ void FLevelLocals::SetMusicVolume(float f)
//==========================================================================
bool IsPointInMap(DVector3 p)
int IsPointInMap(double x, double y, double z)
{
subsector_t *subsector = R_PointInSubsector(FLOAT2FIXED(p.X), FLOAT2FIXED(p.Y));
subsector_t *subsector = R_PointInSubsector(FLOAT2FIXED(x), FLOAT2FIXED(y));
if (!subsector) return false;
for (uint32_t i = 0; i < subsector->numlines; i++)
@@ -2044,26 +2044,26 @@ bool IsPointInMap(DVector3 p)
divline_t dline;
P_MakeDivline(seg->linedef, &dline);
bool pol = P_PointOnDivlineSide(p.XY(), &dline) < 1;
bool pol = P_PointOnDivlineSide(x, y, &dline) < 1;
if (!pol) return false;
}
double ceilingZ = subsector->sector->ceilingplane.ZatPoint(p.X, p.Y);
if (p.Z > ceilingZ) return false;
double ceilingZ = subsector->sector->ceilingplane.ZatPoint(x, y);
if (z > ceilingZ) return false;
double floorZ = subsector->sector->floorplane.ZatPoint(p.X, p.Y);
if (p.Z < floorZ) return false;
double floorZ = subsector->sector->floorplane.ZatPoint(x, y);
if (z < floorZ) return false;
return true;
}
DEFINE_ACTION_FUNCTION(FLevelLocals, IsPointInMap)
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, IsPointInMap, IsPointInMap)
{
PARAM_PROLOGUE;
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_FLOAT(z);
ACTION_RETURN_BOOL(IsPointInMap(DVector3(x,y,z)));
ACTION_RETURN_BOOL(IsPointInMap(x, y, z));
}
template <typename T>
@@ -35,13 +35,8 @@ static bool IsConsolePlayer(player_t *player)
return int(activator->player - players) == consoleplayer;
}
DEFINE_ACTION_FUNCTION(_Shader, SetEnabled)
static void ShaderSetEnabled(player_t *player, const FString &shaderName, bool value)
{
PARAM_PROLOGUE;
PARAM_POINTER(player, player_t);
PARAM_STRING(shaderName);
PARAM_BOOL(value);
if (IsConsolePlayer(player))
{
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
@@ -51,17 +46,21 @@ DEFINE_ACTION_FUNCTION(_Shader, SetEnabled)
shader.Enabled = value;
}
}
return 0;
}
DEFINE_ACTION_FUNCTION(_Shader, SetUniform1f)
DEFINE_ACTION_FUNCTION_NATIVE(_Shader, SetEnabled, ShaderSetEnabled)
{
PARAM_PROLOGUE;
PARAM_POINTER(player, player_t);
PARAM_STRING(shaderName);
PARAM_STRING(uniformName);
PARAM_FLOAT(value);
PARAM_BOOL(value);
ShaderSetEnabled(player, shaderName, value);
return 0;
}
static void ShaderSetUniform1f(player_t *player, const FString &shaderName, const FString &uniformName, double value)
{
if (IsConsolePlayer(player))
{
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
@@ -77,6 +76,16 @@ DEFINE_ACTION_FUNCTION(_Shader, SetUniform1f)
}
}
}
}
DEFINE_ACTION_FUNCTION_NATIVE(_Shader, SetUniform1f, ShaderSetUniform1f)
{
PARAM_PROLOGUE;
PARAM_POINTER(player, player_t);
PARAM_STRING(shaderName);
PARAM_STRING(uniformName);
PARAM_FLOAT(value);
ShaderSetUniform1f(player, shaderName, uniformName, value);
return 0;
}
@@ -83,13 +83,22 @@ CVAR(Color, dimcolor, 0xffd700, CVAR_ARCHIVE)
DEFINE_ACTION_FUNCTION(DMenu, GetCurrentMenu)
static DMenu *GetCurrentMenu()
{
return CurrentMenu;
}
DEFINE_ACTION_FUNCTION_NATIVE(DMenu, GetCurrentMenu, GetCurrentMenu)
{
ACTION_RETURN_OBJECT(CurrentMenu);
}
static int GetMenuTime()
{
return MenuTime;
}
DEFINE_ACTION_FUNCTION(DMenu, MenuTime)
DEFINE_ACTION_FUNCTION_NATIVE(DMenu, MenuTime, GetMenuTime)
{
ACTION_RETURN_INT(MenuTime);
}
@@ -123,13 +132,17 @@ IMPLEMENT_CLASS(DMenuDescriptor, false, false)
IMPLEMENT_CLASS(DListMenuDescriptor, false, false)
IMPLEMENT_CLASS(DOptionMenuDescriptor, false, false)
DEFINE_ACTION_FUNCTION(DMenuDescriptor, GetDescriptor)
DMenuDescriptor *GetMenuDescriptor(int name)
{
DMenuDescriptor **desc = MenuDescriptors.CheckKey(ENamedName(name));
return desc ? *desc : nullptr;
}
DEFINE_ACTION_FUNCTION_NATIVE(DMenuDescriptor, GetDescriptor, GetMenuDescriptor)
{
PARAM_PROLOGUE;
PARAM_NAME(name);
DMenuDescriptor **desc = MenuDescriptors.CheckKey(name);
auto retn = desc ? *desc : nullptr;
ACTION_RETURN_OBJECT(retn);
ACTION_RETURN_OBJECT(GetMenuDescriptor(name));
}
size_t DListMenuDescriptor::PropagateMark()
@@ -240,12 +253,16 @@ bool DMenu::CallMenuEvent(int mkey, bool fromcontroller)
//
//=============================================================================
DEFINE_ACTION_FUNCTION(DMenu, SetMouseCapture)
static void SetMouseCapture(bool on)
{
PARAM_PROLOGUE;
PARAM_BOOL(on);
if (on) I_SetMouseCapture();
else I_ReleaseMouseCapture();
}
DEFINE_ACTION_FUNCTION_NATIVE(DMenu, SetMouseCapture, SetMouseCapture)
{
PARAM_PROLOGUE;
PARAM_BOOL(on);
SetMouseCapture(on);
return 0;
}
@@ -271,7 +288,13 @@ void DMenu::Close ()
}
}
DEFINE_ACTION_FUNCTION(DMenu, Close)
static void Close(DMenu *menu)
{
menu->Close();
}
DEFINE_ACTION_FUNCTION_NATIVE(DMenu, Close, Close)
{
PARAM_SELF_PROLOGUE(DMenu);
self->Close();
@@ -1092,7 +1092,7 @@ double GetFriction(const sector_t *self, int plane, double *pMoveFac)
}
}
//===========================================================================
//===========================================================================
//
//
//

0 comments on commit aef882c

Please sign in to comment.