forked from nillerusr/source-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLocalNetworkBackdoor.h
111 lines (85 loc) · 2.76 KB
/
LocalNetworkBackdoor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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