mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
Added SendNetworkEvent static method to EventHandler; Fixed qualified static method call from own class (previously was 'shadowed' by qualified virtual method call)
This commit is contained in:
parent
c9a994a885
commit
3338fb7f33
4 changed files with 34 additions and 5 deletions
|
@ -117,6 +117,21 @@ bool E_UnregisterHandler(DStaticEventHandler* handler)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3)
|
||||
{
|
||||
if (gamestate != GS_LEVEL)
|
||||
return false;
|
||||
|
||||
Net_WriteByte(DEM_NETEVENT);
|
||||
Net_WriteString(name);
|
||||
Net_WriteByte(3);
|
||||
Net_WriteLong(arg1);
|
||||
Net_WriteLong(arg2);
|
||||
Net_WriteLong(arg3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool E_CheckHandler(DStaticEventHandler* handler)
|
||||
{
|
||||
for (DStaticEventHandler* lhandler = E_FirstEventHandler; lhandler; lhandler = lhandler->next)
|
||||
|
@ -521,6 +536,18 @@ DEFINE_ACTION_FUNCTION(DStaticEventHandler, SetOrder)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DEventHandler, SendNetworkEvent)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_STRING(name);
|
||||
PARAM_INT(arg1);
|
||||
PARAM_INT(arg2);
|
||||
PARAM_INT(arg3);
|
||||
//
|
||||
|
||||
ACTION_RETURN_BOOL(E_SendNetworkEvent(name, arg1, arg2, arg3));
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DEventHandler, Create)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
|
@ -1160,10 +1187,6 @@ CCMD(netevent)
|
|||
for (int i = 0; i < argn; i++)
|
||||
arg[i] = atoi(argv[2 + i]);
|
||||
// call networked
|
||||
Net_WriteByte(DEM_NETEVENT);
|
||||
Net_WriteString(argv[1]);
|
||||
Net_WriteByte(argn);
|
||||
for (int i = 0; i < 3; i++)
|
||||
Net_WriteLong(arg[i]);
|
||||
E_SendNetworkEvent(argv[1], arg[0], arg[1], arg[2]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,9 @@ bool E_Responder(event_t* ev); // splits events into InputProcess and UiProcess
|
|||
// this executes on console/net events.
|
||||
void E_Console(int player, FString name, int arg1, int arg2, int arg3);
|
||||
|
||||
// send networked event. unified function.
|
||||
bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3);
|
||||
|
||||
// check if there is anything that should receive GUI events
|
||||
bool E_CheckUiProcessors();
|
||||
// check if we need native mouse due to UiProcessors
|
||||
|
|
|
@ -7859,6 +7859,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx)
|
|||
Self = new FxSelf(ScriptPosition);
|
||||
Self->ValueType = NewPointer(cls);
|
||||
}
|
||||
else novirtual = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -343,4 +343,6 @@ class EventHandler : StaticEventHandler native
|
|||
|
||||
static native bool Register(StaticEventHandler handler);
|
||||
static native bool Unregister(StaticEventHandler handler);
|
||||
|
||||
clearscope static native void SendNetworkEvent(String name, int arg1 = 0, int arg2 = 0, int arg3 = 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue