Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

113 lines
2.9 KiB

//========= Copyright © 1996-2005, 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();
// Used by Foundry when it changes an entity (and possibly its class) but preserves its serial number.
void ForceFlushEntity( int iEntity );
// 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