diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /engine/LocalNetworkBackdoor.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'engine/LocalNetworkBackdoor.h')
| -rw-r--r-- | engine/LocalNetworkBackdoor.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/engine/LocalNetworkBackdoor.h b/engine/LocalNetworkBackdoor.h new file mode 100644 index 0000000..13bbf45 --- /dev/null +++ b/engine/LocalNetworkBackdoor.h @@ -0,0 +1,111 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#ifndef LOCALNETWORKBACKDOOR_H +#define LOCALNETWORKBACKDOOR_H +#ifdef _WIN32 +#pragma once +#endif + +#include "quakedef.h" +#include "cl_localnetworkbackdoor.h" +#include "icliententitylist.h" +#include "LocalNetworkBackdoor.h" +#include "iclientnetworkable.h" +#include "basehandle.h" +#include "client_class.h" +#include "dt_localtransfer.h" +#include "client.h" +#include "cdll_engine_int.h" +#include "datacache/imdlcache.h" +#include "sys_dll.h" +#include "utllinkedlist.h" +#include "edict.h" +#include "server.h" + + +class SendTable; + +class CLocalNetworkBackdoor +{ +public: + + void StartEntityStateUpdate(); + void EndEntityStateUpdate(); + + void EntityDormant( int iEnt, int iSerialNum ); + void AddToPendingDormantEntityList( unsigned short iEdict ); + void ProcessDormantEntities(); + + void NotifyEdictFlagsChange( int iEdict ) + { + // If they newly added the dontsend flag, then we need to run it through EntityDormant. + if ( sv.edicts[iEdict].m_fStateFlags & FL_EDICT_DONTSEND ) + AddToPendingDormantEntityList( iEdict ); + } + + + void EntState( + int iEnt, + int iSerialNum, + int iClass, + const SendTable *pSendTable, + const void *pSourceEnt, + bool bChanged, + bool bShouldTransmit ); + + void ClearState(); + void StartBackdoorMode(); + void StopBackdoorMode(); + + + // This is called when the client DLL is loaded to precalculate data to let it copy data faster. + static void InitFastCopy(); + + +private: + // Temporarily built up while processing a frame. + CBitVec<MAX_EDICTS> m_EntsAlive; + + // This should correspond to which m_CachedEntState entries have a non-null m_pNetworkable pointer. + CBitVec<MAX_EDICTS> m_PrevEntsAlive; + + // Entities that get created during a frame are remembered here. + unsigned short m_EntsCreatedIndices[MAX_EDICTS]; + int m_nEntsCreated; + + // Entities that changed but weren't created go here. + unsigned short m_EntsChangedIndices[MAX_EDICTS]; + int m_nEntsChanged; + + // Tell the client DLL about entities that need to be notified about being dormant. + // Anything that EntityDormant() would care about needs to get added to this list. + CUtlLinkedList<unsigned short,unsigned short> m_PendingDormantEntities; + + // This data is cached in here so we don't have to call a lot of virtuals to get it from the client DLL. + class CCachedEntState + { + public: + CCachedEntState() + { + m_iSerialNumber = -1; + } + + bool m_bDormant; + int m_iSerialNumber; + void *m_pDataPointer; + IClientNetworkable *m_pNetworkable; + }; + + CCachedEntState m_CachedEntState[MAX_EDICTS]; +}; + + +// The client will set this if it decides to use the fast path. +extern CLocalNetworkBackdoor *g_pLocalNetworkBackdoor; + + +#endif // LOCALNETWORKBACKDOOR_H |