mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-01 00:21:35 +00:00
Add NewGame to EventHandler
https://forum.zdoom.org/viewtopic.php?t=61908
This commit is contained in:
parent
7d1af25b46
commit
7885a22cad
4 changed files with 35 additions and 0 deletions
|
@ -515,6 +515,14 @@ bool E_CheckReplacement( PClassActor *replacee, PClassActor **replacement )
|
|||
return final;
|
||||
}
|
||||
|
||||
void E_NewGame()
|
||||
{
|
||||
for (DStaticEventHandler* handler = E_FirstEventHandler; handler; handler = handler->next)
|
||||
{
|
||||
handler->NewGame();
|
||||
}
|
||||
}
|
||||
|
||||
// normal event loopers (non-special, argument-less)
|
||||
DEFINE_EVENT_LOOPER(RenderFrame)
|
||||
DEFINE_EVENT_LOOPER(WorldLightning)
|
||||
|
@ -668,6 +676,8 @@ DEFINE_EMPTY_HANDLER(DStaticEventHandler, NetworkProcess);
|
|||
|
||||
DEFINE_EMPTY_HANDLER(DStaticEventHandler, CheckReplacement);
|
||||
|
||||
DEFINE_EMPTY_HANDLER(DStaticEventHandler, NewGame)
|
||||
|
||||
// ===========================================
|
||||
//
|
||||
// Event handlers
|
||||
|
@ -1154,6 +1164,18 @@ void DStaticEventHandler::CheckReplacement( PClassActor *replacee, PClassActor *
|
|||
}
|
||||
}
|
||||
|
||||
void DStaticEventHandler::NewGame()
|
||||
{
|
||||
IFVIRTUAL(DStaticEventHandler, NewGame)
|
||||
{
|
||||
// don't create excessive DObjects if not going to be processed anyway
|
||||
if (func == DStaticEventHandler_NewGame_VMPtr)
|
||||
return;
|
||||
VMValue params[1] = { (DStaticEventHandler*)this };
|
||||
VMCall(func, params, 1, nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
void DStaticEventHandler::OnDestroy()
|
||||
{
|
||||
|
|
|
@ -72,6 +72,9 @@ void E_Console(int player, FString name, int arg1, int arg2, int arg3, bool manu
|
|||
// called when looking up the replacement for an actor class
|
||||
bool E_CheckReplacement(PClassActor* replacee, PClassActor** replacement);
|
||||
|
||||
// called on new game
|
||||
void E_NewGame();
|
||||
|
||||
// send networked event. unified function.
|
||||
bool E_SendNetworkEvent(FString name, int arg1, int arg2, int arg3, bool manual);
|
||||
|
||||
|
@ -172,6 +175,9 @@ public:
|
|||
|
||||
//
|
||||
void CheckReplacement(PClassActor* replacee, PClassActor** replacement, bool* final);
|
||||
|
||||
//
|
||||
void NewGame();
|
||||
};
|
||||
class DEventHandler : public DStaticEventHandler
|
||||
{
|
||||
|
|
|
@ -527,6 +527,10 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
|
|||
gamestate = GS_LEVEL;
|
||||
}
|
||||
G_DoLoadLevel (0, false);
|
||||
if(!savegamerestore)
|
||||
{
|
||||
E_NewGame();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -339,6 +339,9 @@ class StaticEventHandler : Object native play version("2.4")
|
|||
//
|
||||
virtual native void CheckReplacement(ReplaceEvent e);
|
||||
|
||||
//
|
||||
virtual native void NewGame();
|
||||
|
||||
// this value will be queried on Register() to decide the relative order of this handler to every other.
|
||||
// this is most useful in UI systems.
|
||||
// default is 0.
|
||||
|
|
Loading…
Reference in a new issue