CClientEntityList reversal

Slightly reversed CClientEntityList while looking around its singleton.
This commit is contained in:
Kawe Mazidjatari 2023-01-20 00:28:49 +01:00
parent 82c914c2fd
commit dcf05a0adf
13 changed files with 110 additions and 10 deletions

View File

@ -62,9 +62,6 @@ inline auto CHLClient_GetAllClasses = p_CHLClient_GetAllClasses.RCast<ClientClas
inline CHLClient** gHLClient = nullptr;
inline CHLClient** g_pHLClient = nullptr;
#ifndef DEDICATED
inline IClientEntityList* g_pClientEntityList = nullptr;
#endif // !DEDICATED
///////////////////////////////////////////////////////////////////////////////
void CHLClient_Attach();

View File

@ -42,10 +42,4 @@ class C_Player : public C_BaseCombatCharacter, public C_BaseAnimatingOverlay
};
void F()
{
sizeof(C_Player);
}
#endif // C_BASEPLAYER_H

View File

@ -0,0 +1,55 @@
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//===========================================================================//
#if !defined( CLIENTENTITYLIST_H )
#define CLIENTENTITYLIST_H
#ifdef _WIN32
#pragma once
#endif
#include "public/icliententitylist.h"
#include "tier1/utlvector.h"
#include "c_baseplayer.h"
// Implement this class and register with entlist to receive entity create/delete notification
class IClientEntityListener
{
public:
virtual void OnEntityCreated(C_BaseEntity* pEntity) {};
virtual void OnEntityDeleted(C_BaseEntity* pEntity) {};
};
class CClientEntityList : public IClientEntityList
{
class CPVSNotifyInfo // !TODO: confirm this!!
{
public:
//IPVSNotify* m_pNotify;
IClientRenderable* m_pRenderable;
unsigned char m_InPVSStatus; // Combination of the INPVS_ flags.
unsigned short m_PVSNotifiersLink; // Into m_PVSNotifyInfos.
};
CUtlVector<IClientEntityListener*> m_entityListeners;
int m_iNumServerEnts; // Current count
int m_iMaxServerEnts; // Max allowed
int m_iNumClientNonNetworkable; // Non networkable count
int m_iMaxUsedServerIndex; // Current last used slot
// !TODO:
/*
// This holds fast lookups for special edicts.
EntityCacheInfo_t m_EntityCacheInfo[NUM_ENT_ENTRIES];
// For fast iteration.
CUtlLinkedList<C_BaseEntity*, unsigned short> m_BaseEntities;*/
};
inline CClientEntityList* g_pClientEntityList = nullptr;
#endif // CLIENTENTITYLIST_H

View File

@ -0,0 +1,20 @@
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
//===========================================================================//
#include "core/stdafx.h"
#include "util_shared.h"
#ifndef CLIENT_DLL
#include "game/server/player.h"
#include "game/server/gameinterface.h"
#endif // !CLIENT_DLL
#ifndef CLIENT_DLL
CPlayer* UTIL_PlayerByIndex(int nIndex)
{
}
#endif // CLIENT_DLL

View File

View File

@ -27,6 +27,7 @@
#include "game/server/gameinterface.h"
#endif // !CLIENT_DLL
#ifndef DEDICATED
#include "game/client/cliententitylist.h"
#include "gameui/IConsole.h"
#endif // !DEDICATED
@ -82,7 +83,7 @@ bool CModAppSystemGroup::Create(CModAppSystemGroup* pModAppSystemGroup)
#endif // !CLIENT_DLL
#ifndef DEDICATED
g_pClientEntityList = g_pFactory->GetFactoryPtr(VCLIENTENTITYLIST_INTERFACE_VERSION, false).RCast<IClientEntityList*>();
g_pClientEntityList = g_pFactory->GetFactoryPtr(VCLIENTENTITYLIST_INTERFACE_VERSION, false).RCast<CClientEntityList*>();
g_pEngineTrace = g_pFactory->GetFactoryPtr(INTERFACEVERSION_ENGINETRACE_CLIENT, false).RCast<CEngineTrace*>();
g_pImGuiConfig->Load(); // Load ImGui configs.

View File

@ -66,6 +66,7 @@
<ClCompile Include="..\game\shared\animation.cpp" />
<ClCompile Include="..\game\shared\collisionproperty.cpp" />
<ClCompile Include="..\game\shared\entitylist_base.cpp" />
<ClCompile Include="..\game\shared\util_shared.cpp" />
<ClCompile Include="..\inputsystem\inputsystem.cpp" />
<ClCompile Include="..\launcher\IApplication.cpp" />
<ClCompile Include="..\launcher\launcher.cpp" />
@ -228,6 +229,7 @@
<ClInclude Include="..\filesystem\filesystem.h" />
<ClInclude Include="..\gameui\IConsole.h" />
<ClInclude Include="..\gameui\IBrowser.h" />
<ClInclude Include="..\game\client\cliententitylist.h" />
<ClInclude Include="..\game\client\c_baseentity.h" />
<ClInclude Include="..\game\client\c_baseplayer.h" />
<ClInclude Include="..\game\client\enginesprite.h" />
@ -245,6 +247,7 @@
<ClInclude Include="..\game\shared\shared_classnames.h" />
<ClInclude Include="..\game\shared\takedamageinfo.h" />
<ClInclude Include="..\game\shared\usercmd.h" />
<ClInclude Include="..\game\shared\util_shared.h" />
<ClInclude Include="..\inputsystem\ButtonCode.h" />
<ClInclude Include="..\inputsystem\inputsystem.h" />
<ClInclude Include="..\launcher\IApplication.h" />

View File

@ -663,6 +663,9 @@
<ClCompile Include="..\game\client\movehelper_client.cpp">
<Filter>sdk\game\client</Filter>
</ClCompile>
<ClCompile Include="..\game\shared\util_shared.cpp">
<Filter>sdk\game\shared</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\client\cdll_engine_int.h">
@ -1943,6 +1946,12 @@
<ClInclude Include="..\game\client\movehelper_client.h">
<Filter>sdk\game\client</Filter>
</ClInclude>
<ClInclude Include="..\game\shared\util_shared.h">
<Filter>sdk\game\shared</Filter>
</ClInclude>
<ClInclude Include="..\game\client\cliententitylist.h">
<Filter>sdk\game\client</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\resource\lockedserver.png">

View File

@ -201,6 +201,7 @@
<ClInclude Include="..\game\shared\shared_classnames.h" />
<ClInclude Include="..\game\shared\takedamageinfo.h" />
<ClInclude Include="..\game\shared\usercmd.h" />
<ClInclude Include="..\game\shared\util_shared.h" />
<ClInclude Include="..\launcher\IApplication.h" />
<ClInclude Include="..\launcher\launcher.h" />
<ClInclude Include="..\launcher\prx.h" />
@ -562,6 +563,7 @@
<ClCompile Include="..\game\shared\animation.cpp" />
<ClCompile Include="..\game\shared\collisionproperty.cpp" />
<ClCompile Include="..\game\shared\entitylist_base.cpp" />
<ClCompile Include="..\game\shared\util_shared.cpp" />
<ClCompile Include="..\launcher\IApplication.cpp" />
<ClCompile Include="..\launcher\launcher.cpp" />
<ClCompile Include="..\launcher\prx.cpp" />

View File

@ -1374,6 +1374,9 @@
<ClInclude Include="..\game\server\physics_main.h">
<Filter>sdk\game\server</Filter>
</ClInclude>
<ClInclude Include="..\game\shared\util_shared.h">
<Filter>sdk\game\shared</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\common\opcodes.cpp">
@ -1736,6 +1739,9 @@
<ClCompile Include="..\game\server\physics_main.cpp">
<Filter>sdk\game\server</Filter>
</ClCompile>
<ClCompile Include="..\game\shared\util_shared.cpp">
<Filter>sdk\game\shared</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\Dedicated.def" />

View File

@ -78,6 +78,7 @@
<ClCompile Include="..\game\shared\animation.cpp" />
<ClCompile Include="..\game\shared\collisionproperty.cpp" />
<ClCompile Include="..\game\shared\entitylist_base.cpp" />
<ClCompile Include="..\game\shared\util_shared.cpp" />
<ClCompile Include="..\inputsystem\inputsystem.cpp" />
<ClCompile Include="..\launcher\IApplication.cpp" />
<ClCompile Include="..\launcher\launcher.cpp" />
@ -248,6 +249,7 @@
<ClInclude Include="..\filesystem\filesystem.h" />
<ClInclude Include="..\gameui\IConsole.h" />
<ClInclude Include="..\gameui\IBrowser.h" />
<ClInclude Include="..\game\client\cliententitylist.h" />
<ClInclude Include="..\game\client\c_baseentity.h" />
<ClInclude Include="..\game\client\c_baseplayer.h" />
<ClInclude Include="..\game\client\enginesprite.h" />
@ -281,6 +283,7 @@
<ClInclude Include="..\game\shared\shared_classnames.h" />
<ClInclude Include="..\game\shared\takedamageinfo.h" />
<ClInclude Include="..\game\shared\usercmd.h" />
<ClInclude Include="..\game\shared\util_shared.h" />
<ClInclude Include="..\inputsystem\ButtonCode.h" />
<ClInclude Include="..\inputsystem\inputsystem.h" />
<ClInclude Include="..\launcher\IApplication.h" />

View File

@ -720,6 +720,9 @@
<ClCompile Include="..\game\server\physics_main.cpp">
<Filter>sdk\game\server</Filter>
</ClCompile>
<ClCompile Include="..\game\shared\util_shared.cpp">
<Filter>sdk\game\shared</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\client\cdll_engine_int.h">
@ -2099,6 +2102,12 @@
<ClInclude Include="..\game\server\physics_main.h">
<Filter>sdk\game\server</Filter>
</ClInclude>
<ClInclude Include="..\game\shared\util_shared.h">
<Filter>sdk\game\shared</Filter>
</ClInclude>
<ClInclude Include="..\game\client\cliententitylist.h">
<Filter>sdk\game\client</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\resource\lockedserver.png">

View File

@ -54,6 +54,7 @@
#include "game/server/gameinterface.h"
#endif // !CLIENT_DLL
#ifndef DEDICATED
#include "game/client/cliententitylist.h"
#include "game/client/viewrender.h"
#endif // !DEDICATED