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

This commit is contained in:
Christoph Oelckers 2018-12-06 00:28:05 +01:00
parent e01306d403
commit aef882c137
4 changed files with 62 additions and 30 deletions

View file

@ -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>

View file

@ -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;
}

View file

@ -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)
{
if (on) I_SetMouseCapture();
else I_ReleaseMouseCapture();
}
DEFINE_ACTION_FUNCTION_NATIVE(DMenu, SetMouseCapture, SetMouseCapture)
{
PARAM_PROLOGUE;
PARAM_BOOL(on);
if (on) I_SetMouseCapture();
else I_ReleaseMouseCapture();
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();

View file

@ -1092,7 +1092,7 @@ double GetFriction(const sector_t *self, int plane, double *pMoveFac)
}
}
//===========================================================================
//===========================================================================
//
//
//