Permalink
Browse files

Remove CGameEntityXRefManager code

  • Loading branch information...
codenulls committed Nov 14, 2018
1 parent d43cd09 commit fcf3d627af6b19a5b169c31943d699591699e66c
@@ -150,7 +150,6 @@
#include "CEvents.h"
#include "HeapTrace.h"
#include "logic/CClientGame.h"
#include "logic/CGameEntityXRefManager.h"
#include "logic/CClientModelCacheManager.h"
#include "logic/CClientPerfStatManager.h"
#include "logic/CDeathmatchVehicle.h"
@@ -55,8 +55,6 @@ CClientEntity::CClientEntity(ElementID ID) : ClassInit(this)
m_pElementGroup = NULL;
m_pModelInfo = NULL;

g_pClientGame->GetGameEntityXRefManager()->OnClientEntityCreate(this);

m_bWorldIgnored = false;
g_pCore->UpdateDummyProgress();
}
@@ -160,7 +158,6 @@ CClientEntity::~CClientEntity(void)
if (!g_pClientGame->IsBeingDeleted())
CClientEntityRefManager::OnEntityDelete(this);

g_pClientGame->GetGameEntityXRefManager()->OnClientEntityDelete(this);
SAFE_RELEASE(m_pChildrenListSnapshot);
g_pCore->GetGraphics()->GetRenderItemManager()->RemoveClientEntityRefs(this);
g_pCore->UpdateDummyProgress();
@@ -158,7 +158,6 @@ CClientGame::CClientGame(bool bLocalPlay)
CClientEntity::StartupEntitiesFromRoot();

// Startup game entity tracking manager
m_pGameEntityXRefManager = NewGameEntityXRefManager();
m_pModelCacheManager = NewClientModelCacheManager();

// Initialize our root entity with an invalid id, we dont know the true id until map-start
@@ -489,7 +488,7 @@ CClientGame::~CClientGame(void)
SAFE_DELETE(m_pRootEntity);

SAFE_DELETE(m_pModelCacheManager);
SAFE_DELETE(m_pGameEntityXRefManager);
//SAFE_DELETE(m_pGameEntityXRefManager);
SAFE_DELETE(m_pZoneNames);
SAFE_DELETE(m_pScriptKeyBinds);

@@ -3766,7 +3765,6 @@ void CClientGame::StaticGameEntityRenderHandler(CEntitySAInterface* pGameEntity)
CPools* pPools = g_pGame->GetPools();
// Map to client entity and pass to the texture replacer
CClientEntity* pClientEntity = pPools->GetClientEntity((DWORD*)pGameEntity);
//CClientEntity* pClientEntity = g_pClientGame->GetGameEntityXRefManager()->FindClientEntity(pGameEntity);
if (pClientEntity)
{
int iTypeMask;
@@ -3828,7 +3826,9 @@ void CClientGame::DrawRadarAreasHandler(void)

bool CClientGame::BreakTowLinkHandler(CVehicle* pTowedVehicle)
{
CClientVehicle* pVehicle = m_pVehicleManager->Get(pTowedVehicle, false);
CPools* pPools = g_pGame->GetPools();
SClientEntity<CVehicleSA>* pVehicleClientEntity = pPools->GetVehicle((DWORD*)pTowedVehicle->GetInterface());
CClientVehicle* pVehicle = reinterpret_cast<CClientVehicle*>(pVehicleClientEntity->pClientEntity);
if (pVehicle)
{
// Check if this is a legal break
@@ -4848,17 +4848,17 @@ bool CClientGame::VehicleFellThroughMapHandler(CVehicleSAInterface* pVehicleInte
// Validate known objects
void CClientGame::GameObjectDestructHandler(CEntitySAInterface* pObject)
{
m_pGameEntityXRefManager->OnGameEntityDestruct(pObject);
//m_pGameEntityXRefManager->OnGameEntityDestruct(pObject);
}

void CClientGame::GameVehicleDestructHandler(CEntitySAInterface* pVehicle)
{
m_pGameEntityXRefManager->OnGameEntityDestruct(pVehicle);
//m_pGameEntityXRefManager->OnGameEntityDestruct(pVehicle);
}

void CClientGame::GamePlayerDestructHandler(CEntitySAInterface* pPlayer)
{
m_pGameEntityXRefManager->OnGameEntityDestruct(pPlayer);
//m_pGameEntityXRefManager->OnGameEntityDestruct(pPlayer);
}

void CClientGame::GameProjectileDestructHandler(CEntitySAInterface* pProjectile)
@@ -4874,7 +4874,7 @@ void CClientGame::GameProjectileDestructHandler(CEntitySAInterface* pProjectile)

void CClientGame::GameModelRemoveHandler(ushort usModelId)
{
m_pGameEntityXRefManager->OnGameModelRemove(usModelId);
//m_pGameEntityXRefManager->OnGameModelRemove(usModelId);
}

void CClientGame::TaskSimpleBeHitHandler(CPedSAInterface* pPedAttacker, ePedPieceTypes hitBodyPart, int hitBodySide, int weaponId)
@@ -6480,7 +6480,6 @@ bool CClientGame::WorldSoundHandler(const SWorldSoundEvent& event)
{
CPools* pPools = g_pGame->GetPools();
CClientEntity* pEntity = pPools->GetClientEntity((DWORD*)event.pGameEntity);
//CClientEntity* pEntity = g_pClientGame->GetGameEntityXRefManager()->FindClientEntity(event.pGameEntity);
if (pEntity)
{
CLuaArguments Arguments;
@@ -49,7 +49,6 @@
#define MIN_PUSH_ANTISPAM_RATE 1500
#define INVALID_DOWNLOAD_PRIORITY_GROUP (INT_MIN)

class CGameEntityXRefManager;
class CClientModelCacheManager;
class CDebugHookManager;
class CResourceFileDownloadManager;
@@ -292,7 +291,6 @@ class CClientGame
CObjectSync* GetObjectSync(void) { return m_pObjectSync; }
#endif
CLatentTransferManager* GetLatentTransferManager(void) { return m_pLatentTransferManager; }
CGameEntityXRefManager* GetGameEntityXRefManager(void) { return m_pGameEntityXRefManager; }
CClientModelCacheManager* GetModelCacheManager(void) { return m_pModelCacheManager; }
CDebugHookManager* GetDebugHookManager(void) { return m_pDebugHookManager; }

@@ -675,7 +673,6 @@ class CClientGame
bool m_bInitiallyFadedOut;
bool m_bHudAreaNameDisabled;
CSingularFileDownloadManager* m_pSingularFileDownloadManager;
CGameEntityXRefManager* m_pGameEntityXRefManager;
CClientModelCacheManager* m_pModelCacheManager;
CDebugHookManager* m_pDebugHookManager;
CRemoteCalls* m_pRemoteCalls;
@@ -270,16 +270,6 @@ void CClientManager::UnreferenceEntity(CClientEntity* pEntity)
}
}

CClientEntity* CClientManager::FindEntity(CEntity* pGameEntity, bool bValidatePointer)
{
return g_pClientGame->GetGameEntityXRefManager()->FindClientEntity(pGameEntity);
}

CClientEntity* CClientManager::FindEntitySafe(CEntity* pGameEntity)
{
return g_pClientGame->GetGameEntityXRefManager()->FindClientEntity(pGameEntity);
}

void CClientManager::OnUpdateStreamPosition(CClientStreamElement* pElement)
{
if (m_pColManager && m_pColManager->Count() > 0)
@@ -102,8 +102,6 @@ class CClientManager
void InvalidateEntity(CClientEntity* pEntity);
void RestoreEntity(CClientEntity* pEntity);
void UnreferenceEntity(CClientEntity* pEntity);
CClientEntity* FindEntity(CEntity* pGameEntity, bool bValidatePointer = false);
CClientEntity* FindEntitySafe(CEntity* pGameEntity);

void OnUpdateStreamPosition(CClientStreamElement* pElement);
void OnLowLODElementCreated(void);
@@ -506,9 +506,6 @@ void CClientObject::Create(void)
// Put our pointer in its stored pointer
m_pObject->SetStoredPointer(this);

// Add XRef
g_pClientGame->GetGameEntityXRefManager()->AddEntityXRef(this, m_pObject);

// Apply our data to the object
m_pObject->Teleport(m_vecPosition.fX, m_vecPosition.fY, m_vecPosition.fZ);
m_pObject->SetOrientation(m_vecRotation.fX, m_vecRotation.fY, m_vecRotation.fZ);
@@ -573,9 +570,6 @@ void CClientObject::Destroy(void)
// Invalidate
m_pManager->InvalidateEntity(this);

// Remove XRef
g_pClientGame->GetGameEntityXRefManager()->RemoveEntityXRef(this, m_pObject);

// Destroy the object
g_pGame->GetPools()->RemoveObject(m_pObject);
m_pObject = NULL;
@@ -127,6 +127,7 @@ void CClientObjectManager::DeleteAll(void)
m_bCanRemoveFromList = true;
}


CClientObject* CClientObjectManager::Get(ElementID ID)
{
// Grab the element with the given id. Check its type.
@@ -139,16 +140,6 @@ CClientObject* CClientObjectManager::Get(ElementID ID)
return NULL;
}

CClientObject* CClientObjectManager::Get(CObject* pObject, bool bValidatePointer)
{
return g_pClientGame->GetGameEntityXRefManager()->FindClientObject(pObject);
}

CClientObject* CClientObjectManager::GetSafe(CEntity* pEntity)
{
return g_pClientGame->GetGameEntityXRefManager()->FindClientObject(pEntity);
}

bool CClientObjectManager::IsValidModel(unsigned long ulObjectModel)
{
bool bIsValid = false;
@@ -28,8 +28,6 @@ class CClientObjectManager
unsigned int Count(void) { return static_cast<unsigned int>(m_Objects.size()); };
unsigned int CountCreatedObjects(void) { return static_cast<unsigned int>(g_pGame->GetPools()->GetObjectCount()); };
static CClientObject* Get(ElementID ID);
CClientObject* Get(CObject* pObject, bool bValidatePointer);
CClientObject* GetSafe(CEntity* pEntity);

static bool IsValidModel(unsigned long ulObjectModel);
static bool IsBreakableModel(unsigned long ulObjectModel);
@@ -3575,9 +3575,6 @@ void CClientPed::_CreateModel(void)
// Put our pointer in the stored data and update the remote data with the new model pointer
m_pPlayerPed->SetStoredPointer(this);

// Add XRef
g_pClientGame->GetGameEntityXRefManager()->AddEntityXRef(this, m_pPlayerPed);

g_pMultiplayer->AddRemoteDataStorage(m_pPlayerPed, m_remoteDataStorage);

// Grab the task manager
@@ -3704,9 +3701,6 @@ void CClientPed::_CreateLocalModel(void)
// Put our pointer in its stored pointer
m_pPlayerPed->SetStoredPointer(this);

// Add XRef
g_pClientGame->GetGameEntityXRefManager()->AddEntityXRef(this, m_pPlayerPed);

// Add a reference to the model we're using
m_pLoadedModelInfo = m_pModelInfo;
m_pLoadedModelInfo->ModelAddRef(BLOCKING, "CClientPed::_CreateLocalModel");
@@ -3794,9 +3788,6 @@ void CClientPed::_DestroyModel()
// Invalidate
m_pManager->InvalidateEntity(this);

// Remove XRef
g_pClientGame->GetGameEntityXRefManager()->RemoveEntityXRef(this, m_pPlayerPed);

// Remove the ped from the world
g_pGame->GetPools()->RemovePed(m_pPlayerPed);
m_pPlayerPed = NULL;
@@ -3839,9 +3830,6 @@ void CClientPed::_DestroyLocalModel()
// Invalidate
m_pManager->InvalidateEntity(this);

// Remove XRef
g_pClientGame->GetGameEntityXRefManager()->RemoveEntityXRef(this, m_pPlayerPed);

g_pGame->GetPools()->InvalidateLocalPlayerClientEntity();

// Make sure we are CJ again
@@ -51,6 +51,7 @@ void CClientPedManager::DoPulse(bool bDoStandardPulses)
}
}


CClientPed* CClientPedManager::Get(ElementID ID, bool bCheckPlayers)
{
// Grab the element with the given id. Check its type.
@@ -63,16 +64,6 @@ CClientPed* CClientPedManager::Get(ElementID ID, bool bCheckPlayers)
return NULL;
}

CClientPed* CClientPedManager::Get(CPlayerPed* pPlayer, bool bValidatePointer, bool bCheckPlayers)
{
return g_pClientGame->GetGameEntityXRefManager()->FindClientPed(pPlayer);
}

CClientPed* CClientPedManager::GetSafe(CEntity* pEntity, bool bCheckPlayers)
{
return g_pClientGame->GetGameEntityXRefManager()->FindClientPed(pEntity);
}

bool CClientPedManager::Exists(CClientPed* pPed)
{
// Is it in our list?
@@ -27,8 +27,6 @@ class CClientPedManager

void DoPulse(bool bDoStandardPulses);
CClientPed* Get(ElementID ID, bool bCheckPlayers = false);
CClientPed* Get(CPlayerPed* pPlayer, bool bValidatePointer, bool bCheckPlayers);
CClientPed* GetSafe(CEntity* pEntity, bool bCheckPlayers);

bool Exists(CClientPed* pPed);

@@ -1922,9 +1922,15 @@ CClientVehicle* CClientVehicle::GetPreviousTrainCarriage(void)
if (IsDerailed())
return NULL;

if (m_pVehicle && m_pVehicle->GetPreviousTrainCarriage())
if (m_pVehicle)
{
return m_pVehicleManager->Get(m_pVehicle->GetPreviousTrainCarriage(), false);
CVehicle* pPreviousTrainCarriage = m_pVehicle->GetPreviousTrainCarriage();
if (pPreviousTrainCarriage)
{
CPools* pPools = g_pGame->GetPools();
CEntitySAInterface * pInterface = pPreviousTrainCarriage->GetInterface();
return reinterpret_cast<CClientVehicle*>(pPools->GetVehicle((DWORD*)pInterface)->pClientEntity);
}
}
return m_pPreviousLink;
}
@@ -1934,9 +1940,15 @@ CClientVehicle* CClientVehicle::GetNextTrainCarriage(void)
if (IsDerailed())
return NULL;

if (m_pVehicle && m_pVehicle->GetNextTrainCarriage())
if (m_pVehicle)
{
return m_pVehicleManager->Get(m_pVehicle->GetNextTrainCarriage(), false);
CVehicle* pNextTrainCarriage = m_pVehicle->GetNextTrainCarriage();
if (pNextTrainCarriage)
{
CPools* pPools = g_pGame->GetPools();
CEntitySAInterface * pInterface = pNextTrainCarriage->GetInterface();
return reinterpret_cast<CClientVehicle*>(pPools->GetVehicle((DWORD*)pInterface)->pClientEntity);
}
}
return m_pNextLink;
}
@@ -2545,9 +2557,6 @@ void CClientVehicle::Create(void)
// Put our pointer in its custom data
m_pVehicle->SetStoredPointer(this);

// Add XRef
g_pClientGame->GetGameEntityXRefManager()->AddEntityXRef(this, m_pVehicle);

/*if ( DoesNeedToWaitForGroundToLoad() )
{
// waiting for ground to load
@@ -2985,9 +2994,6 @@ void CClientVehicle::Destroy(void)
m_pPreviousLink->GetGameVehicle()->SetNextTrainCarriage(NULL);
}

// Remove XRef
g_pClientGame->GetGameEntityXRefManager()->RemoveEntityXRef(this, m_pVehicle);

// Destroy the vehicle
g_pGame->GetPools()->RemoveVehicle(m_pVehicle);
m_pVehicle = NULL;
@@ -393,18 +393,6 @@ CClientVehicle* CClientVehicleManager::Get(ElementID ID)
return NULL;
}

CClientVehicle* CClientVehicleManager::Get(CVehicle* pVehicle, bool bValidatePointer)
{
auto pXrefManager = g_pClientGame->GetGameEntityXRefManager();
CClientVehicle * pReturnEntity = pXrefManager->FindClientVehicle(pVehicle);
return pReturnEntity;
}

CClientVehicle* CClientVehicleManager::GetSafe(CEntity* pEntity)
{
return g_pClientGame->GetGameEntityXRefManager()->FindClientVehicle(pEntity);
}

CClientVehicle* CClientVehicleManager::GetClosest(CVector& vecPosition, float fRadius)
{
float fClosestDistance = 0.0f;
@@ -28,8 +28,6 @@ class CClientVehicleManager

unsigned int Count(void) { return static_cast<unsigned int>(m_List.size()); };
static CClientVehicle* Get(ElementID ID);
CClientVehicle* Get(CVehicle* pVehicle, bool bValidatePointer);
CClientVehicle* GetSafe(CEntity* pEntity);
CClientVehicle* GetClosest(CVector& vecPosition, float fRadius);

void DoPulse(void);
Oops, something went wrong.

0 comments on commit fcf3d62

Please sign in to comment.