From dcf05a0adfa61fba1426510e8f2310753a47acc1 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Fri, 20 Jan 2023 00:28:49 +0100 Subject: [PATCH] CClientEntityList reversal Slightly reversed CClientEntityList while looking around its singleton. --- r5dev/client/cdll_engine_int.h | 3 -- r5dev/game/client/c_baseplayer.h | 6 --- r5dev/game/client/cliententitylist.h | 55 +++++++++++++++++++++++++++ r5dev/game/shared/util_shared.cpp | 20 ++++++++++ r5dev/game/shared/util_shared.h | 0 r5dev/launcher/IApplication.cpp | 3 +- r5dev/vproj/clientsdk.vcxproj | 3 ++ r5dev/vproj/clientsdk.vcxproj.filters | 9 +++++ r5dev/vproj/dedicated.vcxproj | 2 + r5dev/vproj/dedicated.vcxproj.filters | 6 +++ r5dev/vproj/gamesdk.vcxproj | 3 ++ r5dev/vproj/gamesdk.vcxproj.filters | 9 +++++ r5dev/vstdlib/callback.cpp | 1 + 13 files changed, 110 insertions(+), 10 deletions(-) create mode 100644 r5dev/game/client/cliententitylist.h create mode 100644 r5dev/game/shared/util_shared.cpp create mode 100644 r5dev/game/shared/util_shared.h diff --git a/r5dev/client/cdll_engine_int.h b/r5dev/client/cdll_engine_int.h index 8cf47f02..b109597a 100644 --- a/r5dev/client/cdll_engine_int.h +++ b/r5dev/client/cdll_engine_int.h @@ -62,9 +62,6 @@ inline auto CHLClient_GetAllClasses = p_CHLClient_GetAllClasses.RCast 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 m_BaseEntities;*/ +}; + +inline CClientEntityList* g_pClientEntityList = nullptr; + +#endif // CLIENTENTITYLIST_H diff --git a/r5dev/game/shared/util_shared.cpp b/r5dev/game/shared/util_shared.cpp new file mode 100644 index 00000000..3370bda8 --- /dev/null +++ b/r5dev/game/shared/util_shared.cpp @@ -0,0 +1,20 @@ +//===== Copyright � 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 diff --git a/r5dev/game/shared/util_shared.h b/r5dev/game/shared/util_shared.h new file mode 100644 index 00000000..e69de29b diff --git a/r5dev/launcher/IApplication.cpp b/r5dev/launcher/IApplication.cpp index ea87cbfb..2d978cac 100644 --- a/r5dev/launcher/IApplication.cpp +++ b/r5dev/launcher/IApplication.cpp @@ -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(); + g_pClientEntityList = g_pFactory->GetFactoryPtr(VCLIENTENTITYLIST_INTERFACE_VERSION, false).RCast(); g_pEngineTrace = g_pFactory->GetFactoryPtr(INTERFACEVERSION_ENGINETRACE_CLIENT, false).RCast(); g_pImGuiConfig->Load(); // Load ImGui configs. diff --git a/r5dev/vproj/clientsdk.vcxproj b/r5dev/vproj/clientsdk.vcxproj index 6ca5c352..2967f138 100644 --- a/r5dev/vproj/clientsdk.vcxproj +++ b/r5dev/vproj/clientsdk.vcxproj @@ -66,6 +66,7 @@ + @@ -228,6 +229,7 @@ + @@ -245,6 +247,7 @@ + diff --git a/r5dev/vproj/clientsdk.vcxproj.filters b/r5dev/vproj/clientsdk.vcxproj.filters index cae54511..de89d058 100644 --- a/r5dev/vproj/clientsdk.vcxproj.filters +++ b/r5dev/vproj/clientsdk.vcxproj.filters @@ -663,6 +663,9 @@ sdk\game\client + + sdk\game\shared + @@ -1943,6 +1946,12 @@ sdk\game\client + + sdk\game\shared + + + sdk\game\client + diff --git a/r5dev/vproj/dedicated.vcxproj b/r5dev/vproj/dedicated.vcxproj index 80690828..052adea5 100644 --- a/r5dev/vproj/dedicated.vcxproj +++ b/r5dev/vproj/dedicated.vcxproj @@ -201,6 +201,7 @@ + @@ -562,6 +563,7 @@ + diff --git a/r5dev/vproj/dedicated.vcxproj.filters b/r5dev/vproj/dedicated.vcxproj.filters index de3c3e52..1246239a 100644 --- a/r5dev/vproj/dedicated.vcxproj.filters +++ b/r5dev/vproj/dedicated.vcxproj.filters @@ -1374,6 +1374,9 @@ sdk\game\server + + sdk\game\shared + @@ -1736,6 +1739,9 @@ sdk\game\server + + sdk\game\shared + diff --git a/r5dev/vproj/gamesdk.vcxproj b/r5dev/vproj/gamesdk.vcxproj index 9dd720ef..acbb15a0 100644 --- a/r5dev/vproj/gamesdk.vcxproj +++ b/r5dev/vproj/gamesdk.vcxproj @@ -78,6 +78,7 @@ + @@ -248,6 +249,7 @@ + @@ -281,6 +283,7 @@ + diff --git a/r5dev/vproj/gamesdk.vcxproj.filters b/r5dev/vproj/gamesdk.vcxproj.filters index e2ae0704..45225760 100644 --- a/r5dev/vproj/gamesdk.vcxproj.filters +++ b/r5dev/vproj/gamesdk.vcxproj.filters @@ -720,6 +720,9 @@ sdk\game\server + + sdk\game\shared + @@ -2099,6 +2102,12 @@ sdk\game\server + + sdk\game\shared + + + sdk\game\client + diff --git a/r5dev/vstdlib/callback.cpp b/r5dev/vstdlib/callback.cpp index ba9ee0c2..68e9fc71 100644 --- a/r5dev/vstdlib/callback.cpp +++ b/r5dev/vstdlib/callback.cpp @@ -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