mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-13 07:57:51 +00:00
- more direct native stuff, this is a week old but was almost forgotten.
This commit is contained in:
parent
e01306d403
commit
aef882c137
4 changed files with 62 additions and 30 deletions
|
@ -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;
|
if (!subsector) return false;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < subsector->numlines; i++)
|
for (uint32_t i = 0; i < subsector->numlines; i++)
|
||||||
|
@ -2044,26 +2044,26 @@ bool IsPointInMap(DVector3 p)
|
||||||
|
|
||||||
divline_t dline;
|
divline_t dline;
|
||||||
P_MakeDivline(seg->linedef, &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;
|
if (!pol) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
double ceilingZ = subsector->sector->ceilingplane.ZatPoint(p.X, p.Y);
|
double ceilingZ = subsector->sector->ceilingplane.ZatPoint(x, y);
|
||||||
if (p.Z > ceilingZ) return false;
|
if (z > ceilingZ) return false;
|
||||||
|
|
||||||
double floorZ = subsector->sector->floorplane.ZatPoint(p.X, p.Y);
|
double floorZ = subsector->sector->floorplane.ZatPoint(x, y);
|
||||||
if (p.Z < floorZ) return false;
|
if (z < floorZ) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(FLevelLocals, IsPointInMap)
|
DEFINE_ACTION_FUNCTION_NATIVE(FLevelLocals, IsPointInMap, IsPointInMap)
|
||||||
{
|
{
|
||||||
PARAM_PROLOGUE;
|
PARAM_PROLOGUE;
|
||||||
PARAM_FLOAT(x);
|
PARAM_FLOAT(x);
|
||||||
PARAM_FLOAT(y);
|
PARAM_FLOAT(y);
|
||||||
PARAM_FLOAT(z);
|
PARAM_FLOAT(z);
|
||||||
ACTION_RETURN_BOOL(IsPointInMap(DVector3(x,y,z)));
|
ACTION_RETURN_BOOL(IsPointInMap(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
@ -35,13 +35,8 @@ static bool IsConsolePlayer(player_t *player)
|
||||||
return int(activator->player - players) == consoleplayer;
|
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))
|
if (IsConsolePlayer(player))
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
|
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
|
||||||
|
@ -51,17 +46,21 @@ DEFINE_ACTION_FUNCTION(_Shader, SetEnabled)
|
||||||
shader.Enabled = value;
|
shader.Enabled = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(_Shader, SetUniform1f)
|
DEFINE_ACTION_FUNCTION_NATIVE(_Shader, SetEnabled, ShaderSetEnabled)
|
||||||
{
|
{
|
||||||
PARAM_PROLOGUE;
|
PARAM_PROLOGUE;
|
||||||
PARAM_POINTER(player, player_t);
|
PARAM_POINTER(player, player_t);
|
||||||
PARAM_STRING(shaderName);
|
PARAM_STRING(shaderName);
|
||||||
PARAM_STRING(uniformName);
|
PARAM_BOOL(value);
|
||||||
PARAM_FLOAT(value);
|
ShaderSetEnabled(player, shaderName, value);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ShaderSetUniform1f(player_t *player, const FString &shaderName, const FString &uniformName, double value)
|
||||||
|
{
|
||||||
if (IsConsolePlayer(player))
|
if (IsConsolePlayer(player))
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
|
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;
|
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);
|
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);
|
ACTION_RETURN_INT(MenuTime);
|
||||||
}
|
}
|
||||||
|
@ -123,13 +132,17 @@ IMPLEMENT_CLASS(DMenuDescriptor, false, false)
|
||||||
IMPLEMENT_CLASS(DListMenuDescriptor, false, false)
|
IMPLEMENT_CLASS(DListMenuDescriptor, false, false)
|
||||||
IMPLEMENT_CLASS(DOptionMenuDescriptor, 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_PROLOGUE;
|
||||||
PARAM_NAME(name);
|
PARAM_NAME(name);
|
||||||
DMenuDescriptor **desc = MenuDescriptors.CheckKey(name);
|
ACTION_RETURN_OBJECT(GetMenuDescriptor(name));
|
||||||
auto retn = desc ? *desc : nullptr;
|
|
||||||
ACTION_RETURN_OBJECT(retn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t DListMenuDescriptor::PropagateMark()
|
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_PROLOGUE;
|
||||||
PARAM_BOOL(on);
|
PARAM_BOOL(on);
|
||||||
if (on) I_SetMouseCapture();
|
SetMouseCapture(on);
|
||||||
else I_ReleaseMouseCapture();
|
|
||||||
return 0;
|
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);
|
PARAM_SELF_PROLOGUE(DMenu);
|
||||||
self->Close();
|
self->Close();
|
||||||
|
|
|
@ -1092,7 +1092,7 @@ double GetFriction(const sector_t *self, int plane, double *pMoveFac)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue