mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Client: reverse client entity list class
Fully reversed.
This commit is contained in:
parent
759a41bb69
commit
e41366f065
@ -104,7 +104,7 @@ bool CModAppSystemGroup::StaticCreate(CModAppSystemGroup* pModAppSystemGroup)
|
|||||||
|
|
||||||
#endif // !CLIENT_DLL
|
#endif // !CLIENT_DLL
|
||||||
#ifndef DEDICATED
|
#ifndef DEDICATED
|
||||||
g_pClientEntityList = (CClientEntityList*)g_FactorySystem.GetFactory(VCLIENTENTITYLIST_INTERFACE_VERSION);
|
g_pClientEntityList = (IClientEntityList*)g_FactorySystem.GetFactory(VCLIENTENTITYLIST_INTERFACE_VERSION);
|
||||||
g_pEngineTraceClient = (CEngineTraceClient*)g_FactorySystem.GetFactory(INTERFACEVERSION_ENGINETRACE_CLIENT);
|
g_pEngineTraceClient = (CEngineTraceClient*)g_FactorySystem.GetFactory(INTERFACEVERSION_ENGINETRACE_CLIENT);
|
||||||
|
|
||||||
g_ImGuiConfig.Load(); // Load ImGui configs.
|
g_ImGuiConfig.Load(); // Load ImGui configs.
|
||||||
|
@ -207,7 +207,10 @@ add_sources( SOURCE_GROUP "Entity"
|
|||||||
"client/c_baseanimating.h"
|
"client/c_baseanimating.h"
|
||||||
"client/c_baseanimatingoverlay.h"
|
"client/c_baseanimatingoverlay.h"
|
||||||
"client/c_basecombatcharacter.h"
|
"client/c_basecombatcharacter.h"
|
||||||
|
"client/cliententitylist.cpp"
|
||||||
"client/cliententitylist.h"
|
"client/cliententitylist.h"
|
||||||
|
"client/entitylist_clientbase.h"
|
||||||
|
"client/icliententityinternal.h"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_sources( SOURCE_GROUP "Player"
|
add_sources( SOURCE_GROUP "Player"
|
||||||
|
7
src/game/client/cliententitylist.cpp
Normal file
7
src/game/client/cliententitylist.cpp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include "cliententitylist.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: a global list of all the entities in the game. All iteration through
|
||||||
|
// entities is done through this object.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
CClientEntityList* g_clientEntityList = nullptr; // todo(amos): obtain game object.
|
@ -11,8 +11,14 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
#include "public/icliententitylist.h"
|
|
||||||
#include "tier1/utlvector.h"
|
#include "tier1/utlvector.h"
|
||||||
|
#include "tier1/utllinkedlist.h"
|
||||||
|
|
||||||
|
#include "public/icliententitylist.h"
|
||||||
|
|
||||||
|
#include "entitylist_clientbase.h"
|
||||||
|
#include "icliententityinternal.h"
|
||||||
|
#include "entitylist_clientbase.h"
|
||||||
#include "c_baseplayer.h"
|
#include "c_baseplayer.h"
|
||||||
|
|
||||||
// Implement this class and register with entlist to receive entity create/delete notification
|
// Implement this class and register with entlist to receive entity create/delete notification
|
||||||
@ -23,17 +29,21 @@ public:
|
|||||||
virtual void OnEntityDeleted(C_BaseEntity* pEntity) {};
|
virtual void OnEntityDeleted(C_BaseEntity* pEntity) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class CClientEntityList : public IClientEntityList
|
class CClientEntityList : public C_BaseEntityList, public IClientEntityList
|
||||||
{
|
{
|
||||||
class CPVSNotifyInfo // !TODO: confirm this!!
|
protected:
|
||||||
|
// Cached info for networked entities.
|
||||||
|
struct EntityCacheInfo_t
|
||||||
{
|
{
|
||||||
public:
|
// Cached off because GetClientNetworkable is called a *lot*
|
||||||
//IPVSNotify* m_pNotify;
|
IClientNetworkable* m_pNetworkable;
|
||||||
IClientRenderable* m_pRenderable;
|
unsigned short m_BaseEntitiesIndex; // Index into m_BaseEntities (or m_BaseEntities.InvalidIndex() if none).
|
||||||
unsigned char m_InPVSStatus; // Combination of the INPVS_ flags.
|
unsigned short m_bDormant; // cached dormant state - this is only a bit
|
||||||
unsigned short m_PVSNotifiersLink; // Into m_PVSNotifyInfos.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual EntityCacheInfo_t *GetClientNetworkableArray() = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
CUtlVector<IClientEntityListener*> m_entityListeners;
|
CUtlVector<IClientEntityListener*> m_entityListeners;
|
||||||
|
|
||||||
int m_iNumServerEnts; // Current count
|
int m_iNumServerEnts; // Current count
|
||||||
@ -41,15 +51,15 @@ class CClientEntityList : public IClientEntityList
|
|||||||
int m_iNumClientNonNetworkable; // Non networkable count
|
int m_iNumClientNonNetworkable; // Non networkable count
|
||||||
int m_iMaxUsedServerIndex; // Current last used slot
|
int m_iMaxUsedServerIndex; // Current last used slot
|
||||||
|
|
||||||
// !TODO:
|
|
||||||
/*
|
|
||||||
// This holds fast lookups for special edicts.
|
// This holds fast lookups for special edicts.
|
||||||
EntityCacheInfo_t m_EntityCacheInfo[NUM_ENT_ENTRIES];
|
EntityCacheInfo_t m_EntityCacheInfo[NUM_ENT_ENTRIES];
|
||||||
|
|
||||||
// For fast iteration.
|
// For fast iteration.
|
||||||
CUtlLinkedList<C_BaseEntity*, unsigned short> m_BaseEntities;*/
|
CUtlLinkedList<C_BaseEntity*, unsigned short> m_BaseEntities;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline CClientEntityList* g_pClientEntityList = nullptr;
|
COMPILE_TIME_ASSERT(sizeof(CClientEntityList) == 0x3800C0);
|
||||||
|
|
||||||
|
inline IClientEntityList* g_pClientEntityList = nullptr;
|
||||||
|
|
||||||
#endif // CLIENTENTITYLIST_H
|
#endif // CLIENTENTITYLIST_H
|
||||||
|
34
src/game/client/entitylist_clientbase.h
Normal file
34
src/game/client/entitylist_clientbase.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef ENTITYLIST_CLIENTBASE_H
|
||||||
|
#define ENTITYLIST_CLIENTBASE_H
|
||||||
|
|
||||||
|
#include <tier0/threadtools.h>
|
||||||
|
#include <game/shared/ehandle.h>
|
||||||
|
#include <game/shared/entitylist_base.h>
|
||||||
|
|
||||||
|
class C_BaseEntityList
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Overridables.
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// These are notifications to the derived class. It can cache info here if it wants.
|
||||||
|
virtual void OnAddEntity(IHandleEntity* pEnt, const CBaseHandle& handle) = 0; // NOTE: implemented in engine!
|
||||||
|
|
||||||
|
// It is safe to delete the entity here. We won't be accessing the pointer after
|
||||||
|
// calling OnRemoveEntity.
|
||||||
|
virtual void OnRemoveEntity(IHandleEntity* pEnt, const CBaseHandle& handle) = 0; // NOTE: implemented in engine!
|
||||||
|
|
||||||
|
private:
|
||||||
|
// The first MAX_EDICTS entities are networkable. The rest are client-only or server-only.
|
||||||
|
CEntInfo m_EntPtrArray[NUM_ENT_ENTRIES];
|
||||||
|
CEntInfoList m_activeList;
|
||||||
|
CEntInfoList m_freeNonNetworkableList;
|
||||||
|
|
||||||
|
// Client Sound (Miles) entities.
|
||||||
|
CThreadMutex m_clientSoundEntsMutex;
|
||||||
|
IHandleEntity* m_pClientSoundEnts[NUM_ENT_ENTRIES];
|
||||||
|
ssize_t m_clientSoundEntCount;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ENTITYLIST_CLIENTBASE_H
|
32
src/game/client/icliententityinternal.h
Normal file
32
src/game/client/icliententityinternal.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======//
|
||||||
|
//
|
||||||
|
// Purpose:
|
||||||
|
//
|
||||||
|
// $NoKeywords: $
|
||||||
|
//=============================================================================//
|
||||||
|
#ifndef ICLIENTENTITYINTERNAL_H
|
||||||
|
#define ICLIENTENTITYINTERNAL_H
|
||||||
|
#ifdef _WIN32
|
||||||
|
#pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "icliententity.h"
|
||||||
|
//#include "clientleafsystem.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Forward declarations
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class ClientClass;
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// represents a handle used only by the client DLL
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
typedef CBaseHandle ClientEntityHandle_t;
|
||||||
|
typedef unsigned short SpatialPartitionHandle_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // ICLIENTENTITYINTERNAL_H
|
@ -26,5 +26,26 @@ public:
|
|||||||
void ClearLinks();
|
void ClearLinks();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CEntInfoList
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CEntInfoList();
|
||||||
|
|
||||||
#endif // ENTITYLIST_BASE_H
|
const CEntInfo *Head() const { return m_pHead; }
|
||||||
|
const CEntInfo *Tail() const { return m_pTail; }
|
||||||
|
CEntInfo *Head() { return m_pHead; }
|
||||||
|
CEntInfo *Tail() { return m_pTail; }
|
||||||
|
//void AddToHead( CEntInfo *pElement ) { LinkAfter( NULL, pElement ); }
|
||||||
|
//void AddToTail( CEntInfo *pElement ) { LinkBefore( NULL, pElement ); }
|
||||||
|
|
||||||
|
//void LinkBefore( CEntInfo *pBefore, CEntInfo *pElement );
|
||||||
|
//void LinkAfter( CEntInfo *pBefore, CEntInfo *pElement );
|
||||||
|
//void Unlink( CEntInfo *pElement );
|
||||||
|
//bool IsInList( CEntInfo *pElement );
|
||||||
|
|
||||||
|
private:
|
||||||
|
CEntInfo *m_pHead;
|
||||||
|
CEntInfo *m_pTail;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ENTITYLIST_BASE_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user