mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
Generalized event handler definition; removed excessive VM calls when we don't have override defined.
This commit is contained in:
parent
f5c29ec3e2
commit
841c7c9712
1 changed files with 18 additions and 65 deletions
|
@ -109,33 +109,26 @@ DEFINE_ACTION_FUNCTION(DEventHandler, Unregister)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DEventHandler, MapLoaded)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DEventHandler);
|
||||
// do nothing
|
||||
return 0;
|
||||
#define DEFINE_EVENT_HANDLER(cls, funcname) DEFINE_ACTION_FUNCTION(cls, funcname) \
|
||||
{ \
|
||||
PARAM_SELF_PROLOGUE(cls); \
|
||||
return 0; \
|
||||
} \
|
||||
void cls::funcname() \
|
||||
{ \
|
||||
IFVIRTUAL(cls, funcname) \
|
||||
{ \
|
||||
if (func == cls##_##funcname##_VMPtr) \
|
||||
return; \
|
||||
VMValue params[1] = { (cls*)this }; \
|
||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr); \
|
||||
} \
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DEventHandler, MapUnloading)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DEventHandler);
|
||||
// do nothing
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DEventHandler, RenderFrame)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DEventHandler);
|
||||
// do nothing
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DEventHandler, RenderCamera)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DEventHandler);
|
||||
// do nothing
|
||||
return 0;
|
||||
}
|
||||
DEFINE_EVENT_HANDLER(DEventHandler, MapLoaded)
|
||||
DEFINE_EVENT_HANDLER(DEventHandler, MapUnloading)
|
||||
DEFINE_EVENT_HANDLER(DEventHandler, RenderFrame)
|
||||
DEFINE_EVENT_HANDLER(DEventHandler, RenderCamera)
|
||||
|
||||
//
|
||||
void DEventHandler::OnDestroy()
|
||||
|
@ -144,46 +137,6 @@ void DEventHandler::OnDestroy()
|
|||
DObject::OnDestroy();
|
||||
}
|
||||
|
||||
void DEventHandler::MapLoaded()
|
||||
{
|
||||
IFVIRTUAL(DEventHandler, MapLoaded)
|
||||
{
|
||||
// Without the type cast this picks the 'void *' assignment...
|
||||
VMValue params[1] = { (DEventHandler*)this };
|
||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void DEventHandler::MapUnloading()
|
||||
{
|
||||
IFVIRTUAL(DEventHandler, MapUnloading)
|
||||
{
|
||||
// Without the type cast this picks the 'void *' assignment...
|
||||
VMValue params[1] = { (DEventHandler*)this };
|
||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void DEventHandler::RenderFrame()
|
||||
{
|
||||
IFVIRTUAL(DEventHandler, RenderFrame)
|
||||
{
|
||||
// Without the type cast this picks the 'void *' assignment...
|
||||
VMValue params[1] = { (DEventHandler*)this };
|
||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void DEventHandler::RenderCamera()
|
||||
{
|
||||
IFVIRTUAL(DEventHandler, RenderCamera)
|
||||
{
|
||||
// Without the type cast this picks the 'void *' assignment...
|
||||
VMValue params[1] = { (DEventHandler*)this };
|
||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void DRenderEventHandler::Setup()
|
||||
{
|
||||
ViewPos = ::ViewPos;
|
||||
|
|
Loading…
Reference in a new issue