From 2ae117cccae0edd73f42bccfccd366f351f8d3ca Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Sun, 27 Sep 2015 17:05:29 -0400 Subject: [PATCH] Add IGameEventSystem. --- public/eiface.h | 22 +++++++++--- public/engine/igameeventsystem.h | 60 ++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 public/engine/igameeventsystem.h diff --git a/public/eiface.h b/public/eiface.h index 5a7f66fd..cf681039 100644 --- a/public/eiface.h +++ b/public/eiface.h @@ -88,9 +88,6 @@ namespace google typedef uint32 SpawnGroupHandle_t; typedef uint32 SwapChainHandle_t; -// This is really an enum included in a proto-generated header. Not sure if we want to include that here. -typedef int ENetworkDisconnectionReason; - //----------------------------------------------------------------------------- // defines //----------------------------------------------------------------------------- @@ -140,6 +137,21 @@ struct CEntityIndex int _index; }; +struct CSplitScreenSlot +{ + CSplitScreenSlot( int index ) + { + _index = index; + } + + int Get() const + { + return _index; + } + + int _index; +}; + //----------------------------------------------------------------------------- // Purpose: Interface the engine exposes to the game DLL and client DLL //----------------------------------------------------------------------------- @@ -562,8 +574,8 @@ public: virtual void ClientFullyConnect( CEntityIndex index, CPlayerSlot slot ) = 0; // Client is disconnecting from server - virtual void ClientDisconnect( CEntityIndex index, int userId, ENetworkDisconnectionReason reason, const char *pszName, - uint64 xuid, const char *pszNetworkID ) = 0; + virtual void ClientDisconnect( CEntityIndex index, int userId, /* ENetworkDisconnectionReason */ int reason, + const char *pszName, uint64 xuid, const char *pszNetworkID ) = 0; // Sets the client index for the client who typed the command into his/her console virtual void SetCommandClient( CPlayerSlot slot) = 0; diff --git a/public/engine/igameeventsystem.h b/public/engine/igameeventsystem.h new file mode 100644 index 00000000..5552c03b --- /dev/null +++ b/public/engine/igameeventsystem.h @@ -0,0 +1,60 @@ +#ifndef GAMEEVENTSYSTEM_H +#define GAMEEVENTSYSTEM_H + +#ifdef _WIN32 +#pragma once +#endif + +#include + +#include + +class IRecipientFilter; +class CUtlSlot; + +namespace google { + namespace protobuf { + class Message; + } +} + +enum NetChannelBufType_t +{ +}; + +struct GameEventHandle_t__ +{ + void *m_pUnknown; + const char* m_szMessageType; + int m_iUnknown2; + void *m_pUnknown3; + void *m_pUnknown4; + void *m_pUnknown5; + unsigned short m_MessageID; +}; + +#define GAMEEVENTSYSTEM_INTERFACE_VERSION "GameEventSystemServerV001" + +abstract_class IGameEventSystem : public IAppSystem +{ +public: + virtual void RegisterGameEvent( GameEventHandle_t__ *pEvent ) = 0; + virtual void RegisterGameEventHandlerAbstract( CUtlSlot *slot, const CUtlAbstractDelegate &delegate, + GameEventHandle_t__ *pEvent, int ) = 0; + virtual void UnregisterGameEventHandlerAbstract( CUtlSlot *slot, const CUtlAbstractDelegate &delegate, + GameEventHandle_t__ *pEvent ) = 0; + virtual void PostEventAbstract_Local( CSplitScreenSlot slot, GameEventHandle_t__ *, const void *pData, + unsigned long nSize ) = 0; + virtual void PostEventAbstract( CSplitScreenSlot slot, bool bLocalOnly, int nClientCount, const unsigned char *clients, + GameEventHandle_t__ *pEvent, const void *pData, unsigned long nSize, NetChannelBufType_t bufType ) = 0; + virtual void PostEventAbstract( CSplitScreenSlot slot, bool bLocalOnly, IRecipientFilter *pFilter, + GameEventHandle_t__ *pEvent, const void *pData, unsigned long nSize ) = 0; + virtual void PostEntityEventAbstract( const CBaseHandle &hndl, GameEventHandle_t__ *pEvent, const void *pData, + unsigned long nSize, NetChannelBufType_t bufType ) = 0; + virtual void ProcessQueuedEvents( void ) = 0; + virtual int GetEventSource( void ) const = 0; + virtual void PurgeQueuedEvents( void ) = 0; +}; + + +#endif // GAMEEVENTSYSTEM_H \ No newline at end of file